/* ===================================================================
   panteleev.art — командный центр. Дизайн-система.
   =================================================================== */
:root {
  --c-alexey: #3b82f6;
  --c-roman: #8b5cf6;
  --c-zarina: #f59e0b;
  --prio-high: #ef4444;
  --prio-med: #f59e0b;
  --prio-low: #10b981;
  --pos: #22c55e;
  --neg: #f43f5e;
  --radius: 16px;
  --radius-sm: 11px;
  --gap: 16px;
  --maxw: 1320px;
  --ff: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
}

html[data-theme="dark"] {
  --bg: #0a0c12;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent),
             radial-gradient(900px 500px at -10% 10%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent);
  --bg-2: #11141c;
  --surface: #161b26;
  --surface-2: #1e2533;
  --glass: color-mix(in srgb, #161b26 72%, transparent);
  --border: #262f3e;
  --border-2: #313c4e;
  --text: #e8eef6;
  --text-dim: #97a4b6;
  --text-faint: #66718200;
  --text-faint: #677182;
  --shadow: 0 10px 40px rgba(0,0,0,.5);
  --shadow-sm: 0 4px 16px rgba(0,0,0,.35);
}
html[data-theme="light"] {
  --bg: #eef1f7;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent),
             radial-gradient(900px 500px at -10% 10%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent);
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f4fa;
  --glass: color-mix(in srgb, #ffffff 75%, transparent);
  --border: #e1e7f0;
  --border-2: #d2dae6;
  --text: #161e29;
  --text-dim: #57647a;
  --text-faint: #8a96a8;
  --shadow: 0 10px 40px rgba(40,55,80,.16);
  --shadow-sm: 0 4px 16px rgba(40,55,80,.10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ff);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px; line-height: 1.45;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.content::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .palette-list::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }

/* ===== Topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--glass); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; letter-spacing: .2px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%;
  background: conic-gradient(var(--accent), var(--accent-2), var(--c-zarina), var(--accent));
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent); }
.brand-accent { color: var(--accent); }
.topbar-spacer { flex: 1; }
.menu-btn { display: none; }

.search-pill {
  display: inline-flex; align-items: center; gap: 10px; margin-left: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 500; min-width: 230px;
  transition: border-color .15s, background .15s;
}
.search-pill:hover { border-color: var(--accent); }
.search-pill kbd { margin-left: auto; font-family: var(--mono); font-size: 11px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; background: transparent;
  border: 1px solid transparent; cursor: pointer; font-size: 17px;
  transition: background .15s, border-color .15s, transform .1s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.icon-btn:active { transform: scale(.92); }

/* ===== Layout ===== */
.layout { display: flex; max-width: var(--maxw); margin: 0 auto; }
.sidebar {
  width: 236px; flex: none; position: sticky; top: 59px;
  height: calc(100vh - 59px); overflow-y: auto;
  padding: 14px 12px; display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--border);
}
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-faint);
  font-weight: 700; padding: 14px 13px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: 11px;
  background: transparent; border: none; cursor: pointer; color: var(--text-dim);
  text-align: left; font-weight: 600; width: 100%; transition: background .15s, color .15s;
}
.nav-item .ni { font-size: 16px; width: 20px; text-align: center; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--prio-high); color: #fff; font-size: 12px; font-weight: 700;
  display: none; align-items: center; justify-content: center; }
.badge.show { display: inline-flex; }
.nav-item.active .badge { background: rgba(255,255,255,.25); }
.badge.muted { background: var(--text-faint); }
.sidebar-foot { margin-top: auto; padding: 12px 8px 4px; color: var(--text-faint); }
.sidebar-foot small { font-size: 11.5px; line-height: 1.5; }
.content { flex: 1; min-width: 0; padding: 24px 26px 130px; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.scrim { display: none; }

/* ===== View headers ===== */
.view-head { display: flex; align-items: center; gap: 12px; margin: 2px 0 20px; flex-wrap: wrap; }
.view-head h1 { font-size: 25px; margin: 0; font-weight: 800; letter-spacing: -.4px; }
.view-head .sub { color: var(--text-dim); font-size: 14px; }
.view-head .grow { flex: 1; }

/* ===== Sections ===== */
.section { margin-bottom: 26px; }
.section-title { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-size: 13px;
  text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); font-weight: 700; }
.section-title .count { color: var(--text-faint); font-weight: 600; }
.section-title .dot { width: 9px; height: 9px; border-radius: 50%; }
.grid { display: grid; gap: 12px; }
.empty { padding: 30px; text-align: center; color: var(--text-faint);
  border: 1px dashed var(--border-2); border-radius: var(--radius); background: var(--bg-2); }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); }
.card.glass { background: var(--glass); backdrop-filter: blur(10px); }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h3 { margin: 0; font-size: 16px; font-weight: 700; }
.card-h .grow { flex: 1; }

/* ===== Task card ===== */
.task { position: relative; display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; cursor: pointer; border-left: 4px solid var(--cl, var(--border));
  transition: transform .08s, border-color .15s, background .15s, box-shadow .15s; }
.task:hover { background: var(--surface-2); box-shadow: var(--shadow-sm); }
.task:active { transform: scale(.995); }
.task.is-done { opacity: .55; }
.task.is-done .task-title { text-decoration: line-through; }
.task-check { flex: none; width: 21px; height: 21px; border-radius: 7px; border: 2px solid var(--text-faint);
  background: transparent; cursor: pointer; margin-top: 1px; display: grid; place-items: center;
  color: #fff; font-size: 13px; line-height: 1; transition: background .15s, border-color .15s, transform .1s; }
.task-check:active { transform: scale(.85); }
.task-check.done { background: var(--prio-low); border-color: var(--prio-low); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 650; word-break: break-word; }
.task-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; align-items: center; }
.task-note { color: var(--text-dim); font-size: 13.5px; margin-top: 6px; white-space: pre-wrap; word-break: break-word; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }
.chip .cdot { width: 8px; height: 8px; border-radius: 50%; }
.chip.prio-high { background: color-mix(in srgb, var(--prio-high) 16%, transparent); color: var(--prio-high); border-color: transparent; }
.chip.prio-med  { background: color-mix(in srgb, var(--prio-med) 18%, transparent); color: var(--prio-med); border-color: transparent; }
.chip.prio-low  { background: color-mix(in srgb, var(--prio-low) 16%, transparent); color: var(--prio-low); border-color: transparent; }
.chip.due-over  { background: color-mix(in srgb, var(--prio-high) 18%, transparent); color: var(--prio-high); border-color: transparent; }
.chip.due-today { background: color-mix(in srgb, var(--prio-med) 20%, transparent); color: var(--prio-med); border-color: transparent; }
.chip.status-doing { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); border-color: transparent; }
.chip.recurring { background: color-mix(in srgb, var(--c-roman) 16%, transparent); color: var(--c-roman); border-color: transparent; }

/* ===== Board ===== */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.board-col { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; }
.board-col-head { display: flex; align-items: center; gap: 9px; padding: 12px 13px 10px; font-weight: 700;
  border-bottom: 1px solid var(--border); position: sticky; top: 59px; background: var(--bg-2);
  border-radius: var(--radius) var(--radius) 0 0; z-index: 1; }
.board-col-head .cdot { width: 11px; height: 11px; border-radius: 50%; }
.board-col-head .col-count { margin-left: auto; color: var(--text-faint); font-size: 13px; font-weight: 600; }
.board-col-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.board .task { border-radius: var(--radius-sm); padding: 11px 12px; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-weight: 650; transition: filter .15s, background .15s, transform .1s; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--prio-high); border-color: color-mix(in srgb, var(--prio-high) 40%, var(--border)); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.pos { background: var(--pos); border-color: transparent; color: #06270f; }

/* ===== FAB ===== */
.fab { position: fixed; right: 24px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 35;
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 30px; line-height: 1;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 45%, transparent); transition: transform .12s; }
.fab:hover { transform: translateY(-2px) scale(1.04); }
.fab:active { transform: scale(.92); }

/* ===== Stats / KPI ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat .v { font-size: 27px; font-weight: 800; letter-spacing: -.6px; }
.stat .l { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.stat .ic { position: absolute; right: 12px; top: 12px; font-size: 20px; opacity: .5; }
.stat.accent .v { color: var(--accent); }
.stat.warn .v { color: var(--prio-med); }
.stat.danger .v { color: var(--prio-high); }
.stat.pos .v { color: var(--pos); }
.stat.neg .v { color: var(--neg); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: 0; background: var(--kpi-grad, none); opacity: .10; pointer-events: none; }
.kpi .l { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.kpi .v { font-size: 30px; font-weight: 820; letter-spacing: -.8px; margin-top: 6px; }
.kpi .delta { font-size: 12.5px; font-weight: 700; margin-top: 6px; display: inline-flex; gap: 4px; align-items: center; }
.delta.up { color: var(--pos); } .delta.down { color: var(--neg); } .delta.flat { color: var(--text-faint); }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
input[type=text], input[type=date], input[type=number], select, textarea {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  outline: none; width: 100%; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type=color] { padding: 4px; height: 42px; cursor: pointer; }
textarea { resize: vertical; }
.check-inline { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--accent); }
.check-tall { justify-content: flex-end; }
.check-tall .check-inline { padding: 10px 0; }

/* ===== Filter / segmented ===== */
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.filterbar select, .filterbar input[type=text] { width: auto; min-width: 130px; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-dim); font-weight: 600; transition: background .15s, color .15s; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-kind button.active[data-kind=expense] { color: var(--neg); }
.seg-kind button.active[data-kind=income] { color: var(--pos); }

/* ===== Modal ===== */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(5,8,14,.55);
  display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(3px); }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--bg-2); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0;
  border: 1px solid var(--border); box-shadow: var(--shadow); max-height: 92vh; display: flex;
  flex-direction: column; animation: slideUp .22s ease; }
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.modal-foot .spacer { flex: 1; }

/* ===== Command palette ===== */
.palette-backdrop { align-items: flex-start; padding-top: 12vh; }
.palette { background: var(--bg-2); width: 100%; max-width: 600px; border-radius: 16px; border: 1px solid var(--border-2);
  box-shadow: var(--shadow); overflow: hidden; animation: slideDown .18s ease; }
@keyframes slideDown { from { transform: translateY(-12px); opacity: .5; } to { transform: none; opacity: 1; } }
#paletteInput { border: none; border-bottom: 1px solid var(--border); border-radius: 0; padding: 16px 18px; font-size: 16px; box-shadow: none; }
#paletteInput:focus { box-shadow: none; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 10px; cursor: pointer; }
.palette-item .pi-ic { font-size: 18px; width: 24px; text-align: center; }
.palette-item .pi-sub { margin-left: auto; color: var(--text-faint); font-size: 12px; }
.palette-item.sel, .palette-item:hover { background: var(--surface-2); }
.palette-group { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint);
  font-weight: 700; padding: 10px 13px 4px; }

/* ===== Factory / visits ===== */
.visit { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px; cursor: pointer; border-left: 4px solid var(--c-zarina); }
.visit:hover { background: var(--surface-2); }
.visit.past { opacity: .7; border-left-color: var(--text-faint); }
.visit-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown { background: linear-gradient(135deg, color-mix(in srgb, var(--c-zarina) 22%, var(--bg-2)), var(--bg-2));
  border: 1px solid color-mix(in srgb, var(--c-zarina) 35%, var(--border)); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 18px; }
.countdown .big { font-size: 30px; font-weight: 800; }
.countdown .lbl { color: var(--text-dim); }

/* ===== Monitoring ===== */
.mon-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.mon-card h3 { margin: 0 0 4px; font-size: 16px; }
.mon-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mon-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 11px; }
.mon-item .name { font-weight: 600; flex: 1; min-width: 0; word-break: break-word; }
.mon-item .last { color: var(--text-faint); font-size: 12.5px; white-space: nowrap; }
.mon-item.checked-today { border-color: color-mix(in srgb, var(--prio-low) 45%, var(--border)); }
.mon-add { display: flex; gap: 8px; margin-top: 12px; }
.mon-add input { flex: 1; }
.link-x { color: var(--text-faint); cursor: pointer; padding: 4px 7px; border-radius: 7px; }
.link-x:hover { color: var(--prio-high); background: var(--surface-2); }

/* ===== Finance ===== */
.acct-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 8px; }
.acct { border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; cursor: pointer;
  background: var(--surface); border-top: 3px solid var(--ac, var(--accent)); box-shadow: var(--shadow-sm); transition: transform .1s; }
.acct:hover { transform: translateY(-2px); }
.acct .an { font-weight: 600; color: var(--text-dim); font-size: 13px; }
.acct .ab { font-size: 22px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.acct.add { display: grid; place-items: center; border-style: dashed; color: var(--text-faint); border-top-color: var(--border); }

.txn { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.txn:hover { background: var(--surface-2); }
.txn .tic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex: none;
  background: var(--tcl, var(--surface-2)); }
.txn .tmain { flex: 1; min-width: 0; }
.txn .tt { font-weight: 600; }
.txn .tsub { color: var(--text-faint); font-size: 12.5px; margin-top: 2px; }
.txn .tamt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.txn .tamt.income { color: var(--pos); } .txn .tamt.expense { color: var(--text); }
.day-sep { display: flex; align-items: center; gap: 10px; margin: 16px 2px 8px; color: var(--text-faint);
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.day-sep .ds-sum { margin-left: auto; font-variant-numeric: tabular-nums; }

/* budget bars */
.budget { margin-bottom: 12px; }
.budget .bh { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.budget .bh .bn { font-weight: 600; }
.budget .bh .bv { margin-left: auto; color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.bar { height: 9px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 6px; transition: width .5s ease; }
.bar.over > span { background: var(--neg) !important; }

/* ===== Charts ===== */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chart-wrap { width: 100%; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; }
.legend .li { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); }
.legend .li .lc { width: 11px; height: 11px; border-radius: 3px; }
.legend .li b { color: var(--text); font-variant-numeric: tabular-nums; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-row .brn { width: 110px; flex: none; color: var(--text-dim); font-size: 13px; text-align: right; }
.bar-row .brt { flex: 1; height: 22px; border-radius: 7px; background: var(--surface-2); overflow: hidden; }
.bar-row .brt > span { display: flex; align-items: center; height: 100%; padding: 0 8px; color: #fff;
  font-size: 12px; font-weight: 700; border-radius: 7px; white-space: nowrap; transition: width .6s ease; }
.spark { display: block; width: 100%; height: 40px; }

/* ===== Calendar ===== */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .cdow { text-align: center; font-size: 12px; color: var(--text-faint); font-weight: 700; padding: 4px 0; text-transform: uppercase; }
.cal .cell { min-height: 92px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 7px; cursor: pointer; transition: border-color .15s; }
.cal .cell:hover { border-color: var(--accent); }
.cal .cell.other { opacity: .4; }
.cal .cell.today { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.cal .cn { font-weight: 700; font-size: 13px; }
.cal .cdot-row { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.cal .ce { font-size: 10.5px; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); color: var(--text-dim);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Notes ===== */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.note textarea { background: transparent; border: none; resize: none; padding: 0; min-height: 80px; }
.note textarea:focus { box-shadow: none; }
.note .nf { display: flex; align-items: center; gap: 8px; color: var(--text-faint); font-size: 12px; }
.note .nf .grow { flex: 1; }
.note.pinned { border-color: color-mix(in srgb, var(--c-zarina) 45%, var(--border)); }

/* ===== Reports ===== */
.report { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.rtable { width: 100%; border-collapse: collapse; margin-top: 8px; }
.rtable th, .rtable td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.rtable th { color: var(--text-dim); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
.rtable td.num, .rtable th.num { text-align: right; }
.rtable tr:last-child td { border-bottom: none; }
.rtable .total td { font-weight: 800; border-top: 2px solid var(--border-2); }

/* ===== Focus timer ===== */
.focus-widget { position: fixed; right: 24px; bottom: calc(94px + env(safe-area-inset-bottom)); z-index: 36;
  background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--border-2); border-radius: 16px;
  padding: 14px 16px; box-shadow: var(--shadow); text-align: center; min-width: 170px; }
.focus-time { font-size: 34px; font-weight: 820; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.focus-label { color: var(--text-dim); font-size: 12px; margin-top: -2px; }
.focus-controls { display: flex; gap: 6px; margin-top: 10px; align-items: center; justify-content: center; }
.focus-widget.run .focus-time { color: var(--accent); }

/* ===== Settings ===== */
.set-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.set-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: none; }
.set-row .sl { flex: 1; } .set-row .sl b { display: block; } .set-row .sl small { color: var(--text-faint); }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.swatch.sel { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-2) inset; }

/* ===== Links / связи ===== */
.links-box { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 2px; }
.links-box .lb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.links-box .lb-head b { font-size: 13px; color: var(--text-dim); font-weight: 700; flex: 1; }
.link-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.link-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; cursor: pointer; max-width: 100%; }
.link-chip:hover { border-color: var(--accent); }
.link-chip .lc-ic { font-size: 13px; }
.link-chip .lc-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.link-chip .lc-x { color: var(--text-faint); padding: 0 2px; border-radius: 5px; }
.link-chip .lc-x:hover { color: var(--neg); }

.link-pick-list { max-height: 52vh; overflow-y: auto; margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.link-pick { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); }
.link-pick:hover { background: var(--surface-2); border-color: var(--accent); }
.link-pick .lp-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; flex: none; background: var(--surface-2); }
.link-pick .lp-main { flex: 1; min-width: 0; }
.link-pick .lp-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-pick .lp-s { color: var(--text-faint); font-size: 12px; }
.link-pick .lp-type { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.link-pick-group { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); font-weight: 700; padding: 8px 4px 2px; }

/* ===== Detail / карточка объекта ===== */
.trail { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; }
.trail .tr-item { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--border); cursor: pointer; max-width: 240px; }
.trail .tr-item.cur { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.trail .tr-item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trail .tr-sep { color: var(--text-faint); }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); border-top: 4px solid var(--dc, var(--accent)); margin-bottom: 18px; }
.detail-card .dc-h { display: flex; align-items: flex-start; gap: 14px; }
.detail-card .dc-ic { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; font-size: 24px; flex: none; background: var(--surface-2); }
.detail-card .dc-title { font-size: 20px; font-weight: 800; }
.detail-card .dc-sub { color: var(--text-dim); margin-top: 3px; }
.detail-card .dc-body { margin-top: 14px; white-space: pre-wrap; color: var(--text-dim); line-height: 1.55; }
.detail-card .dc-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ===== Documents ===== */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer;
  box-shadow: var(--shadow-sm); border-left: 4px solid var(--dcl, var(--accent)); transition: transform .1s, border-color .15s; }
.doc:hover { transform: translateY(-2px); }
.doc .d-type { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); font-weight: 700; }
.doc .d-title { font-weight: 700; margin: 4px 0 6px; }
.doc .d-prev { color: var(--text-dim); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.doc .d-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--text-faint); font-size: 12px; }
.doc .lk { margin-left: auto; }

/* ===== Activity log / журнал ===== */
.log-list { display: flex; flex-direction: column; gap: 2px; }
.log-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 12px; border-radius: 10px; }
.log-row:hover { background: var(--surface-2); }
.log-row .lg-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; flex: none; background: var(--surface-2); }
.log-row .lg-main { flex: 1; min-width: 0; }
.log-row .lg-t { font-weight: 600; }
.log-row .lg-time { color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.log-row.clickable { cursor: pointer; }

/* ===== Sync indicator ===== */
.sync { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--text-faint); border: 1px solid var(--border); display: none; }
.sync.show { display: inline-flex; align-items: center; gap: 5px; }
.sync.saving { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.sync.saved { color: var(--pos); border-color: color-mix(in srgb, var(--pos) 35%, var(--border)); }
.sync.offline { color: var(--prio-med); border-color: color-mix(in srgb, var(--prio-med) 40%, var(--border)); }

/* ===== Login ===== */
.login-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: var(--bg); background-image: var(--bg-grad); }
.login-card { background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--border-2);
  border-radius: 20px; box-shadow: var(--shadow); padding: 34px 30px; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 14px; text-align: center; animation: slideUp .25s ease; }
.login-logo { font-size: 44px; }
.login-title { margin: 0; font-size: 24px; font-weight: 800; }
.login-sub { margin: 0 0 8px; color: var(--text-dim); }
.login-card input { text-align: center; font-size: 16px; padding: 12px; }
.login-err { color: var(--neg); font-size: 13px; font-weight: 600; }
.login-card .btn { padding: 12px; font-size: 15px; }

/* ===== Confetti & toast ===== */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--surface);
  border: 1px solid var(--border-2); color: var(--text); padding: 11px 18px; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 95; font-weight: 600; animation: toastIn .2s ease; }
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ===== Responsive ===== */
@media (min-width: 720px) { .modal-backdrop { align-items: center; padding: 20px; } .modal { border-radius: 20px; } }
@media (max-width: 980px) { .board { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }
  .search-pill { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; z-index: 55; transform: translateX(-100%);
    transition: transform .22s ease; background: var(--bg-2); width: 270px; padding-top: calc(16px + env(safe-area-inset-top)); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); }
  .content { padding: 16px 14px 130px; }
  .field-row { flex-direction: column; gap: 14px; }
  .view-head h1 { font-size: 21px; }
  .cal .cell { min-height: 62px; } .cal .ce { display: none; }
  .cal .cdot-row { gap: 4px; } .cal .cell .mini-dot { width: 6px; height: 6px; border-radius: 50%; }
}

/* ===== Print (reports) ===== */
@media print {
  .topbar, .sidebar, .fab, .focus-widget, .scrim, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .content { padding: 0; } .report { border: none; box-shadow: none; }
}
