/* Единые шрифт и структура; цвета берутся из темы проекта ([data-theme]) */
:root {
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
  --s-new: #8a94a0; --s-work: #e0a030; --s-review: #8e6fd8; --s-done: #3fa776;
  --danger: #d9534f;
}

/* ---- темы проектов (цвета с сайтов) ---- */
[data-theme="masters"] {
  --bg: #f2e6d6; --surface: #fbf5ec; --surface2: #eadbc7; --text: #442d2a; --muted: #7a6259;
  --border: #dcc9b2; --accent: #af522a; --accent-h: #94441f; --on-accent: #fff;
  --side-bg: #442d2a; --side-text: #f2e6d6; --side-muted: #c5b4a8; --side-hover: #533935; --side-active: #5e4b43;
  color-scheme: light;
}
[data-theme="mig"] {
  --bg: #14161a; --surface: #1e2022; --surface2: #24313b; --text: #e8f0f6; --muted: #8fa3b0;
  --border: #2e3a44; --accent: #77ccf4; --accent-h: #63a8d1; --on-accent: #14161a;
  --side-bg: #181a1c; --side-text: #e8f0f6; --side-muted: #8fa3b0; --side-hover: #1e2022; --side-active: #24313b;
  color-scheme: dark;
}
[data-theme="capitalgroup"] {
  --bg: #edf1f6; --surface: #ffffff; --surface2: #e5e9ef; --text: #15181c; --muted: #6a7482;
  --border: #d2d7de; --accent: #0064d9; --accent-h: #0052b3; --on-accent: #fff;
  --side-bg: #15181c; --side-text: #ffffff; --side-muted: #7e8c9e; --side-hover: #1f242a; --side-active: #2a313a;
  color-scheme: light;
}
[data-theme="stmichael"] {
  --bg: #191b1d; --surface: #232628; --surface2: #2d3033; --text: #ffffff; --muted: #9a9ea3;
  --border: #373b3e; --accent: #ffffff; --accent-h: #d9dadb; --on-accent: #191b1d;
  --side-bg: #121314; --side-text: #ffffff; --side-muted: #9a9ea3; --side-hover: #1d1f21; --side-active: #2a2d2f;
  color-scheme: dark;
}
[data-theme="purehome"] {
  --bg: #f8f9fb; --surface: #ffffff; --surface2: #f1ece8; --text: #493a33; --muted: #8b7b72;
  --border: #e6dcd5; --accent: #a1715a; --accent-h: #956d57; --on-accent: #fff;
  --side-bg: #ffffff; --side-text: #493a33; --side-muted: #8b7b72; --side-hover: #f8f3f0; --side-active: #f1ece8;
  color-scheme: light;
}
[data-theme="neutral"] {
  --bg: #f3f4f6; --surface: #ffffff; --surface2: #e9ebee; --text: #1f2933; --muted: #6b7782;
  --border: #dfe2e6; --accent: #3f4b5b; --accent-h: #2d3744; --on-accent: #fff;
  --side-bg: #1f2933; --side-text: #f3f4f6; --side-muted: #9aa5b0; --side-hover: #2a3642; --side-active: #364352;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---- каркас ---- */
.app { display: grid; grid-template-columns: 252px 1fr; height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; padding: 22px 14px 14px; gap: 4px; overflow-y: auto;
  border-right: 1px solid var(--border); }
.brand { display: block; padding: 6px 10px 20px; min-height: 64px; }
.brand img { display: block; max-width: 100%; max-height: 52px; width: auto; height: auto; }
.brand img[src$="stmichael.svg"], .brand img[src$="capitalgroup.svg"] { width: 100%; }
.brand .mig-brand { display: flex; align-items: center; gap: 12px; }
.brand .mig-brand img { width: 46px; height: 46px; }
.brand .mig-brand b { font-size: 22px; letter-spacing: .08em; }
.brand .mig-brand small { display: block; font-size: 11px; color: var(--side-muted); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.brand .plain { font-size: 20px; font-weight: 800; letter-spacing: .02em; }
.side-sec { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); padding: 14px 12px 6px; font-weight: 700; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--side-text); font-weight: 600; }
.nav:hover { background: var(--side-hover); }
.nav.active { background: var(--side-active); }
.nav .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.nav .cnt { margin-left: auto; font-size: 12px; color: var(--side-muted); font-weight: 600; }
.dot[data-p="masters"] { background: #af522a; }
.dot[data-p="mig"] { background: #77ccf4; }
.dot[data-p="capitalgroup"] { background: #0064d9; }
.dot[data-p="stmichael"] { background: #d9dadb; box-shadow: 0 0 0 1px #6b6f73; }
.dot[data-p="purehome"] { background: #a1715a; }
.dot[data-p="my"] { background: var(--side-muted); }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--side-active); display: flex; flex-direction: column; gap: 2px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-weight: 700; }
.side-foot .nav { font-weight: 500; font-size: 13px; color: var(--side-muted); }
.side-foot .nav:hover { color: var(--side-text); }

main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.top { display: flex; align-items: center; gap: 14px; padding: 18px 28px; flex-wrap: wrap; }
.top h1 { font-size: 24px; margin: 0; font-weight: 800; letter-spacing: -.01em; margin-right: auto; }
.top h1 a { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 10px; letter-spacing: 0; }
.top h1 a:hover { color: var(--accent); }
.seg { display: inline-flex; background: var(--surface2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.input, select.input { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; outline: none; min-width: 0; }
.input:focus { border-color: var(--accent); }
select.input { padding-right: 8px; }
.btn { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 10px; padding: 9px 18px; font-weight: 700; }
.btn:hover { background: var(--accent-h); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 600; }
.btn.ghost:hover { background: var(--surface2); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--border); font-weight: 600; }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn:disabled:hover { background: var(--accent); }
.view { flex: 1; overflow: auto; padding: 4px 28px 28px; }

/* ---- доска ---- */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 16px; align-items: start; min-height: 100%; }
.col { background: var(--surface2); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; transition: outline-color .1s; outline: 2px dashed transparent; outline-offset: -4px; }
.col.over { outline-color: var(--accent); }
.col-h { display: flex; align-items: center; gap: 8px; font-weight: 800; padding: 2px 4px; }
.col-h .sd { width: 10px; height: 10px; border-radius: 50%; }
.col-h .n { color: var(--muted); font-weight: 600; }
.col-h .act { margin-left: auto; font-size: 12px; color: var(--muted); background: none; border: 0; font-weight: 600; }
.col-h .act:hover { color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.card:hover { border-color: var(--accent); }
.card.dragging { opacity: .4; }
.card .t { font-weight: 600; word-break: break-word; }
.card .lc { font-size: 12px; color: var(--muted); border-left: 2px solid var(--border); padding-left: 8px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.meta .sp { margin-left: auto; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface2); }
.chip .dot { width: 7px; height: 7px; }
.pri-2 { color: var(--danger); font-weight: 700; }
.due.late { color: var(--danger); font-weight: 700; }
.ava { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; flex: none; }
.add-quick { display: flex; gap: 6px; }
.add-quick input { flex: 1; }
.add-quick select { width: 92px; flex: none; padding-left: 8px; font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* ---- список ---- */
.list { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 11px 14px; background: var(--surface2); font-weight: 700; }
.list td { padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
.list tr.row { cursor: pointer; }
.list tr.row:hover td { background: var(--surface2); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.pill i { width: 9px; height: 9px; border-radius: 50%; }

/* ---- карточка задачи ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .15s; }
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 100vw); background: var(--surface); z-index: 21; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .2s; box-shadow: -8px 0 30px rgba(0,0,0,.25); }
.drawer.open { transform: none; }
.drawer:not(.open) { box-shadow: none; }
.dr-h { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.dr-h .x { margin-left: auto; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); }
.dr-body { flex: 1; overflow-y: auto; padding: 18px 22px 8px; display: flex; flex-direction: column; gap: 18px; }
.dr-body > * { flex-shrink: 0; }
.dr-title { font-size: 22px; line-height: 1.3; min-height: 40px; font-weight: 800; width: 100%; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 4px 8px; margin-left: -8px; outline: none; resize: none; overflow: hidden; }
.dr-title { border-color: var(--border); cursor: text; }
.dr-title:hover { background: var(--surface2); }
.dr-title:focus { border-color: var(--accent); background: transparent; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.fields .input { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--text); width: 100%; }
.sec-h { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.sec-h .btn { margin-left: auto; text-transform: none; letter-spacing: 0; }
textarea.input { width: 100%; resize: vertical; min-height: 90px; line-height: 1.5; }
.files { display: flex; flex-wrap: wrap; gap: 10px; }
.file { width: 112px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg); position: relative; font-size: 11px; }
.file .pv { height: 76px; display: grid; place-items: center; background: var(--surface2); font-weight: 800; color: var(--muted); }
.file .pv img { width: 100%; height: 100%; object-fit: cover; }
.file .nm { padding: 4px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .rm { position: absolute; top: 3px; right: 3px; border: 0; background: rgba(0,0,0,.55); color: #fff; width: 20px; height: 20px; border-radius: 50%; line-height: 1; opacity: 0; }
.file:hover .rm { opacity: 1; }
.tl { display: flex; flex-direction: column; gap: 12px; }
.ev { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.ev time { margin-left: auto; white-space: nowrap; }
.cm { display: flex; gap: 10px; }
.cm .bub { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; flex: 1; min-width: 0; }
.cm .who { font-size: 12px; font-weight: 800; display: flex; gap: 8px; align-items: baseline; }
.cm .who time { color: var(--muted); font-weight: 500; }
.cm .who .src { color: var(--muted); font-weight: 600; font-size: 11px; }
.cm .txt { white-space: pre-wrap; word-break: break-word; margin-top: 3px; }
.cm .files { margin-top: 8px; }
.composer { border-top: 1px solid var(--border); padding: 12px 22px 16px; background: var(--surface); }
.composer textarea { min-height: 64px; }
.composer .row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.composer .hint { font-size: 12px; color: var(--muted); margin-right: auto; }
.pend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pend span { background: var(--surface2); border-radius: 8px; padding: 3px 4px 3px 9px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.pend button { border: 0; background: none; color: var(--muted); }
.dr-foot { display: flex; gap: 8px; padding-top: 4px; }
.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* ---- модалки, вход ---- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 16px; }
.modal .box { background: var(--surface); border-radius: 16px; padding: 24px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.modal h3 { margin: 0; font-size: 18px; }
.modal p { margin: 0; color: var(--muted); }
.modal .code { font-size: 26px; font-weight: 800; letter-spacing: .15em; text-align: center; background: var(--surface2); border-radius: 10px; padding: 10px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; }
.err { color: var(--danger); font-size: 13px; min-height: 1em; }
.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; z-index: 60; font-weight: 600; }

.login-page { display: grid; place-items: center; min-height: 100vh; background: #1f2933; padding: 16px; }
.login-box { background: #fff; color: #1f2933; width: min(380px, 100%); border-radius: 18px; padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-box h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; }
.login-box label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; color: #6b7782; text-transform: uppercase; letter-spacing: .08em; }
.login-box input { border: 1px solid #dfe2e6; border-radius: 10px; padding: 11px 13px; font-size: 15px; outline: none; text-transform: none; letter-spacing: 0; color: #1f2933; font-weight: 500; }
.login-box input:focus { border-color: #3f4b5b; }
.login-box button { background: #1f2933; color: #fff; border: 0; border-radius: 10px; padding: 12px; font-weight: 700; font-size: 15px; }

.menu-btn { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 15; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-block; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 7px 12px; font-size: 16px; }
  .top { padding: 14px 16px; }
  .view { padding: 4px 16px 24px; }
  .board { grid-template-columns: repeat(4, 280px); }
  .fields { grid-template-columns: 1fr; }
}
