/* DeMarket — dizayn tizimi (yashil · krem · serif) */
:root {
  --bg: #f3f2ec; --bg-side: #f6f5f0; --card: #ffffff; --soft: #efeee7; --soft2: #e8e6de; --hover: #ebeae3;
  --text: #1d231c; --text2: #5a6058; --text3: #979a8f;
  --border: #e5e3d9; --border2: #d4d1c4;
  --accent: #1f5b45; --accent-2: #2f7d5b; --accent-bg: #e3eee7; --accent-ink: #ffffff;
  --green: #2f7d5b; --green-bg: #e1efe6;
  --amber: #9a6b16; --amber-bg: #f5ead2; --amber-bar: #b7791f;
  --purple: #6b5bbf; --purple-bg: #ebe7f7;
  --red: #b8432f; --red-bg: #f8e3df;
  --blue: #3a7d9a; --blue-bg: #e1ecf2;
  --gray: #74776d; --gray-bg: #ecebe4;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --r-sm: 10px; --r: 14px; --r-lg: 18px;
  --shadow: 0 1px 2px rgba(29, 35, 28, .04), 0 2px 8px rgba(29, 35, 28, .04);
  --shadow-lg: 0 24px 60px rgba(29, 35, 28, .18);
  --side: 252px;
}
[data-theme="dark"] {
  --bg: #121512; --bg-side: #161a16; --card: #1b201b; --soft: #232923; --soft2: #2a312a; --hover: #252b25;
  --text: #e8ebe4; --text2: #a9ada3; --text3: #6f746a;
  --border: #283028; --border2: #37403a;
  --accent: #5cba8b; --accent-2: #5cba8b; --accent-bg: #1a3328; --accent-ink: #0f1a14;
  --green: #6cc79a; --green-bg: #173026;
  --amber: #e0b15a; --amber-bg: #33280f; --amber-bar: #d4a13f;
  --purple: #a99bf0; --purple-bg: #2a2545;
  --red: #ec8c7b; --red-bg: #3a1f1a;
  --blue: #7fbfd9; --blue-bg: #17303b;
  --gray: #9aa095; --gray-bg: #262b26;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; margin: 0; padding: 0 }
html { -webkit-text-size-adjust: 100% }
body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100vh }
a { color: inherit; text-decoration: none }
button, input, select, textarea { font: inherit; color: inherit }
img { max-width: 100% }
.serif { font-family: var(--serif); font-optical-sizing: auto }
.muted { color: var(--text3) }
.sub { color: var(--text2) }
.small { font-size: 12px }
.nowrap { white-space: nowrap }
.right { text-align: right }
.hide { display: none !important }
.show-sm { display: none }
.grow { flex: 1; min-width: 0 }
.row { display: flex; align-items: center; gap: 10px }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
.stack { display: flex; flex-direction: column; gap: 14px }
.link { color: var(--accent); font-weight: 600 }
.link:hover { text-decoration: underline }
.t-green { color: var(--green) } .t-red { color: var(--red) } .t-amber { color: var(--amber) }
.t-purple { color: var(--purple) }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh }
.side { position: sticky; top: 0; height: 100vh; background: var(--bg-side); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px 12px; z-index: 50 }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 4px 16px }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 18px; flex-shrink: 0 }
.brand-name { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.3px; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  display: grid; place-items: center; cursor: pointer; color: var(--text2); font-size: 17px; flex-shrink: 0;
  transition: background .15s, color .15s }
.icon-btn:hover { background: var(--hover); color: var(--text) }
.side-search { display: flex; align-items: center; gap: 8px; background: var(--soft); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 12px; color: var(--text3); cursor: text; margin-bottom: 14px }
.side-search input { border: 0; background: transparent; outline: 0; flex: 1; min-width: 0; color: var(--text) }
.kbd { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--border); background: var(--card);
  border-radius: 5px; padding: 1px 6px; color: var(--text3) }
.nav { flex: 1; overflow-y: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px }
.nav::-webkit-scrollbar { display: none }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .9px; color: var(--text3); text-transform: uppercase;
  padding: 16px 12px 6px }
.nav-label:first-child { padding-top: 4px }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; color: var(--text);
  font-size: 14.5px; margin-bottom: 2px; transition: background .12s }
.nav a:hover { background: var(--hover) }
.nav a.active { background: var(--accent-bg); color: var(--accent); font-weight: 600 }
.nav a i { font-size: 19px; color: var(--text2); width: 20px; flex-shrink: 0 }
.nav a.active i { color: var(--accent) }
.nav a .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.pill-count { background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 20px;
  min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px }
.pct-pill { font-size: 10.5px; font-weight: 700; color: #fff; border-radius: 20px; padding: 2px 7px; background: var(--c) }
.nav .proj { font-size: 14px; padding: 7px 12px }
.nav .proj .dot { width: 8px; height: 8px; margin: 0 6px 0 5px; background: var(--c) }
.nav .proj .pct { font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums }
.nav-label-row { display: flex; justify-content: space-between; align-items: center }
.nav-label-row a { font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--accent); padding: 0; margin: 0; font-weight: 600 }
.nav-label-row a:hover { background: none; text-decoration: underline }
.side-user .icon-btn.active { background: var(--accent-bg); color: var(--accent); border-color: transparent }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 6px 2px; border-top: 1px solid var(--border);
  margin-top: 8px }
.side-user .name { font-weight: 600; font-size: 14px; line-height: 1.2 }
.side-user .role { font-size: 12px; color: var(--text3) }

.main { min-width: 0; display: flex; flex-direction: column }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 16px 32px; display: flex;
  align-items: center; gap: 14px; min-height: 72px }
.topbar h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.6px; line-height: 1.1 }
.topbar .subtitle { color: var(--text2); font-size: 14.5px; padding-top: 6px }
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text2) }
.crumbs b { color: var(--text); font-weight: 600 }
.crumbs a:hover { color: var(--text) }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px }
.menu-btn { display: none }
.page { padding: 26px 32px 56px; flex: 1; max-width: 1560px; width: 100% }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-weight: 600;
  font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s }
.btn:hover { background: var(--hover) }
.btn:active { transform: scale(.98) }
.btn i { font-size: 17px }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000) }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); background: var(--card) }
.btn-danger:hover { background: var(--red-bg) }
.btn-ghost { background: transparent; border-color: transparent }
.btn-ghost:hover { background: var(--hover) }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px }
.btn-block { width: 100% }
.btn-icon { width: 42px; padding: 0 }
.btn-sm.btn-icon { width: 34px }

.inp { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--soft); color: var(--text); outline: 0; transition: border-color .15s, background .15s, box-shadow .15s }
textarea.inp { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.55 }
.inp:focus { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px var(--accent-bg) }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.inp:focus-visible { outline: 0 }
.inp::placeholder { color: var(--text3) }
select.inp { appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23979a8f' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center }
.inp-sm { height: 38px; font-size: 13px; border-radius: 10px }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0 }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text2) }
.field .help { font-size: 12px; color: var(--text3) }
.field .err { font-size: 12.5px; color: var(--red) }
.field.has-err .inp { border-color: var(--red) }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px }
.form-grid .full { grid-column: 1 / -1 }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) }
.form-grid.fg-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) }
.form-grid.fg-top, .form-grid.fg-camp { align-items: end; margin-bottom: 12px }
.form-grid.fg-top { grid-template-columns: minmax(0, 1fr) 150px 44px }
.form-grid.fg-camp { grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)) 44px }
.form-section { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 26px 0 14px;
  display: flex; align-items: center; gap: 8px }
.form-section i { color: var(--accent); font-size: 20px }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; flex-wrap: wrap }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none }
.check input, .chk-input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px }
.choice-row label { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 14px; cursor: pointer; background: var(--card); font-size: 14px; transition: .15s }
.choice-row label:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); color: var(--accent);
  font-weight: 600 }
.choice-row input { accent-color: var(--accent) }
.swatches { display: flex; gap: 10px; flex-wrap: wrap }
.swatches label { width: 34px; height: 34px; border-radius: 50%; background: var(--sw); cursor: pointer; position: relative;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px transparent; transition: box-shadow .15s }
.swatches input { position: absolute; opacity: 0; inset: 0 }
.swatches label:has(input:checked) { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--sw) }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px 24px;
  box-shadow: var(--shadow); min-width: 0 }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap }
.card-title { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.3px; flex: 1 }
.card-title.sm { font-size: 17px }
.card-link { color: var(--accent); font-weight: 600; font-size: 14px }
.card-link:hover { text-decoration: underline }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start }
.grid-side { display: grid; grid-template-columns: minmax(0, var(--side-w, 340px)) minmax(0, 1fr); gap: 20px; align-items: start }
.grid-2-eq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px }
.mt { margin-top: 20px } .mt-sm { margin-top: 12px } .mb { margin-bottom: 20px }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 18px 20px;
  box-shadow: var(--shadow); display: block; transition: border-color .15s, transform .15s }
a.stat:hover { border-color: var(--border2); transform: translateY(-2px) }
.stat .k { font-size: 13px; color: var(--text2); font-weight: 600; letter-spacing: .1px }
.stat .v { font-family: var(--serif); font-size: 34px; font-weight: 500; letter-spacing: -.8px; line-height: 1.15;
  margin: 2px 0 4px }
.stat .v small { font-size: 18px; color: var(--text2); letter-spacing: 0 }
.stat .s { font-size: 13px; color: var(--text2) }
.stat .k.alert { color: var(--red) }
.stat.tile { background: var(--soft); box-shadow: none; border-color: transparent }
.stat.pipe { padding: 14px 16px }
.stat.pipe .v { font-size: 30px }
.stat.pipe.on { border-color: var(--accent); background: var(--accent-bg) }

/* ---------- Badges & avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 4px 12px;
  border-radius: 20px; white-space: nowrap; line-height: 1.3 }
.b-gray { background: var(--gray-bg); color: var(--gray) }
.b-amber { background: var(--amber-bg); color: var(--amber) }
.b-purple { background: var(--purple-bg); color: var(--purple) }
.b-green { background: var(--green-bg); color: var(--green) }
.b-red { background: var(--red-bg); color: var(--red) }
.b-blue { background: var(--blue-bg); color: var(--blue) }
.b-accent { background: var(--accent-bg); color: var(--accent) }
.tag { display: inline-flex; font-size: 13px; padding: 4px 12px; border-radius: 20px; background: var(--soft);
  color: var(--text2); font-weight: 500 }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--c, var(--gray)) }
.dot.gray { --c: var(--gray) } .dot.amber { --c: var(--amber-bar) } .dot.purple { --c: var(--purple) }
.dot.green { --c: var(--green) } .dot.red { --c: var(--red) } .dot.blue { --c: var(--blue) }

.av { --c: #7c8a80; display: inline-grid; place-items: center; border-radius: 50%; flex-shrink: 0; font-weight: 700;
  font-family: var(--sans); letter-spacing: .2px; color: var(--c);
  background: color-mix(in srgb, var(--c) 15%, var(--card)); border: 2px solid var(--card) }
.av-sm { width: 36px; height: 36px; font-size: 10.5px }
.av-xs { width: 28px; height: 28px; font-size: 9px }
.av-md { width: 42px; height: 42px; font-size: 12px }
.av-lg { width: 64px; height: 64px; font-size: 17px }
.av-solid { background: var(--c); color: #fff }
.av-empty { color: var(--text3); background: var(--soft) }
.av-stack { display: inline-flex }
.av-stack .av + .av { margin-left: -5px }

/* ---------- Lists ---------- */
.list-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--border) }
.list-row:first-child { border-top: 0 }
.list .title { font-weight: 600; font-size: 15px; line-height: 1.3 }
.list .meta { font-size: 13px; color: var(--text2) }
.list-row .when { width: 88px; font-size: 13.5px; color: var(--text2) }
.u-late, .u-today, .late { color: var(--red) !important; font-weight: 600 }
.u-soon { color: var(--amber) !important; font-weight: 600 }
.done .title { text-decoration: line-through; color: var(--text3) }
.tick { width: 22px; height: 22px; border: 1.5px solid var(--border2); border-radius: 7px; background: var(--card);
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0; color: transparent; transition: .15s; padding: 0 }
.tick:hover { border-color: var(--accent) }
.tick.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.tick i { font-size: 14px }
.datebox { width: 46px; height: 50px; border-radius: 12px; background: var(--soft); display: flex; flex-direction: column;
  align-items: center; justify-content: center; flex-shrink: 0 }
.datebox b { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1 }
.datebox span { font-size: 10px; font-weight: 700; color: var(--text3); letter-spacing: .5px }

.bar { height: 8px; background: var(--soft2); border-radius: 8px; overflow: hidden; flex: 1 }
.bar > span { display: block; height: 100%; border-radius: 8px; background: var(--c, var(--accent)); transition: width .4s }
.bar.thin { height: 6px }
.prog-row { display: grid; grid-template-columns: minmax(0, 150px) 1fr 44px; align-items: center; gap: 16px;
  padding: 13px 0; border-top: 1px solid var(--border) }
.prog-row:first-child { border-top: 0 }
.prog-row .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.prog-row b { text-align: right; font-weight: 600 }

.pipe-dots { display: flex; gap: 4px; align-items: center }
.pipe-dots i { width: 18px; height: 6px; border-radius: 6px; background: var(--soft2); display: block }
.pipe-dots i.on { background: var(--accent) }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px }
.table { width: 100%; border-collapse: collapse; min-width: 640px }
.table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
  color: var(--text3); padding: 10px 12px 12px; border-bottom: 1px solid var(--border); white-space: nowrap }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle }
.table tr:last-child td { border-bottom: 0 }
.table tbody tr { transition: background .12s }
.table tbody tr.clickable { cursor: pointer }
.table tbody tr.clickable:hover { background: var(--soft) }
.table .strong { font-weight: 600; font-size: 15px }
.table th:first-child, .table td:first-child { padding-left: 0 }
.table th:last-child, .table td:last-child { padding-right: 0 }
.amount { font-weight: 600; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums }

/* ---------- Segmented & chips ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap }
.seg { display: inline-flex; background: var(--soft2); border-radius: 13px; padding: 4px; gap: 2px }
.seg a, .seg button { padding: 8px 18px; border-radius: 10px; font-weight: 500; color: var(--text2); border: 0;
  background: transparent; cursor: pointer; font-size: 14.5px; white-space: nowrap }
.seg a.on, .seg a.active, .seg button.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow) }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 15px; border-radius: 20px; background: var(--soft);
  color: var(--text2); font-weight: 500; font-size: 14px; border: 1px solid transparent; cursor: pointer; white-space: nowrap }
.chip:hover { background: var(--soft2) }
.chip.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; border-color: color-mix(in srgb, var(--accent) 25%, transparent) }
.filter-select { width: auto; height: 40px; border-radius: 12px; border: 1px solid var(--border); background-color: var(--card);
  padding: 0 34px 0 14px; font-size: 13.5px; font-weight: 500; min-width: 150px }
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); margin: 6px 0 22px; overflow-x: auto;
  scrollbar-width: none }
.tabs a { padding: 10px 0 13px; font-size: 16px; color: var(--text2); border-bottom: 2.5px solid transparent;
  margin-bottom: -1px; white-space: nowrap }
.tabs a:hover { color: var(--text) }
.tabs a.on { color: var(--accent); border-color: var(--accent); font-weight: 600 }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 18px; align-items: start;
  overflow-x: auto; padding-bottom: 8px }
.kcol { background: var(--soft2); border-radius: var(--r-lg); padding: 14px; min-height: 300px;
  transition: background .15s, box-shadow .15s }
.kcol.drop { background: var(--accent-bg); box-shadow: inset 0 0 0 2px var(--accent) }
.kcol-head { display: flex; align-items: center; gap: 9px; padding: 4px 4px 14px; font-weight: 600; font-size: 16px }
.kcol-head .count { background: var(--card); border-radius: 20px; font-size: 12px; min-width: 24px; height: 24px;
  display: grid; place-items: center; padding: 0 7px; color: var(--text2) }
.kcol-head .sum { margin-left: auto; font-size: 12.5px; color: var(--text2); font-weight: 500 }
.kcard { display: block; background: var(--card); border-radius: 14px; padding: 15px 16px; margin-bottom: 12px;
  box-shadow: var(--shadow); border: 1px solid transparent; cursor: grab; transition: box-shadow .15s, transform .15s, border-color .15s }
.kcard:hover { border-color: var(--border2); transform: translateY(-1px) }
.kcard.dragging { opacity: .5; transform: rotate(1.5deg) }
.kcard .title { font-weight: 600; font-size: 15.5px; line-height: 1.35; margin-bottom: 8px }
.kcard .proj { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text2); margin-bottom: 12px }
.kcard .foot { display: flex; align-items: center; gap: 8px; justify-content: space-between }
.kcard .money { font-family: var(--serif); font-size: 21px; font-weight: 600 }
.kcard .sep { border-top: 1px solid var(--border); margin: 12px -16px; }
.kadd { display: block; width: 100%; text-align: center; border: 1.5px dashed var(--border2); border-radius: 14px;
  padding: 12px; color: var(--text2); background: transparent; cursor: pointer; font-size: 14px }
.kadd:hover { background: var(--card); color: var(--accent) }
.prio-high { box-shadow: inset 3px 0 0 var(--red), var(--shadow) }

/* ---------- Projects grid ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px }
.pcard { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 18px; transition: transform .15s, border-color .15s }
.pcard:hover { transform: translateY(-2px); border-color: var(--border2) }
.p-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0;
  background: color-mix(in srgb, var(--c) 12%, var(--card)); color: var(--c); font-size: 22px }
.pcard .name { font-size: 17.5px; font-weight: 600; line-height: 1.25 }
.pcard .svc { font-size: 13.5px; color: var(--text2) }
.pcard .pline { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 14px;
  color: var(--text2) }
.pcard .pline b { font-family: var(--serif); font-size: 24px; font-weight: 500; color: var(--text) }
.pnew { border: 1.5px dashed var(--border2); border-radius: var(--r-lg); display: grid; place-items: center;
  min-height: 220px; color: var(--text2); font-size: 16px; transition: .15s }
.pnew:hover { background: var(--card); color: var(--accent) }
.phero { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.1fr) auto; gap: 26px; align-items: center }
.phero .p-ico { width: 76px; height: 76px; border-radius: 20px; font-size: 34px }
.phero h2 { font-family: var(--serif); font-size: 36px; font-weight: 600; letter-spacing: -.8px; line-height: 1.1;
  margin-bottom: 10px }
.team-label { font-size: 13px; color: var(--text2); margin-bottom: 6px; text-align: right }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border);
  font-size: 14.5px }
.kv:first-child { border-top: 0 }
.kv span { color: var(--text2) }
.kv b { font-weight: 600; text-align: right }

/* ---------- Charts ---------- */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 230px; padding: 12px 4px 0; border-bottom: 1px solid var(--border) }
.chart .col { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 100%; position: relative }
.chart .b { width: min(36px, 40%); border-radius: 7px 7px 0 0; min-height: 3px; transition: height .5s; position: relative }
.chart .b.in { background: var(--green) } .chart .b.out { background: var(--red) }
.chart .b.single { width: min(62px, 70%); background: var(--accent) }
.chart .b:hover::after { content: attr(data-v); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px);
  background: var(--text); color: var(--bg); font-size: 11.5px; padding: 3px 8px; border-radius: 6px; white-space: nowrap }
.chart-x { display: flex; gap: 14px; padding: 10px 4px 0 }
.chart-x span { flex: 1; text-align: center; font-size: 13px; color: var(--text2) }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text2); align-items: center }
.legend span { display: inline-flex; align-items: center; gap: 6px }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; background: var(--c) }
.cat-row { display: grid; grid-template-columns: 120px 1fr 48px; gap: 14px; align-items: center; padding: 9px 0; font-size: 14px }
.cat-row b { text-align: right; font-weight: 600 }

/* ---------- Calendar ---------- */
.cal { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--card) }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) }
.cal-head div { padding: 12px 14px; font-size: 13.5px; color: var(--text2); border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border); background: var(--bg-side) }
.cal-day { min-height: 128px; padding: 10px 10px 12px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 5px; min-width: 0; position: relative }
.cal-week:last-child .cal-day { border-bottom: 0 }
.cal-day:nth-child(7n), .cal-head div:nth-child(7n) { border-right: 0 }
.cal-day.other { background: var(--bg-side) }
.cal-day.other .num { color: var(--text3) }
.cal-day .num { font-size: 14px; font-weight: 500; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; margin-bottom: 2px }
.cal-day.today .num { background: var(--accent); color: var(--accent-ink); font-weight: 700 }
.cal-add { position: absolute; top: 10px; right: 10px; opacity: 0; color: var(--text3); font-size: 16px; transition: .15s }
.cal-day:hover .cal-add { opacity: 1 }
.cal-day.week-mode { min-height: 360px }
.ev { display: block; font-size: 12.5px; font-weight: 600; padding: 4px 9px; border-radius: 7px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis }
.ev.green { background: var(--green-bg); color: var(--green) } .ev.purple { background: var(--purple-bg); color: var(--purple) }
.ev.amber { background: var(--amber-bg); color: var(--amber) } .ev.red { background: var(--red-bg); color: var(--red) }
.ev.blue { background: var(--blue-bg); color: var(--blue) } .ev.gray { background: var(--gray-bg); color: var(--gray) }
.ev.done { opacity: .6; text-decoration: line-through }
.ev:hover { filter: brightness(.96) }
.month-nav { display: flex; align-items: center; gap: 14px }
.month-nav h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: -.5px; min-width: 210px; text-align: center }

/* ---------- Plan matrix ---------- */
.matrix { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: auto; background: var(--card) }
.matrix table { border-collapse: collapse; width: 100%; min-width: 980px }
.matrix th { text-align: left; padding: 14px 18px; font-size: 13.5px; font-weight: 500; color: var(--text2);
  border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); background: var(--bg-side) }
.matrix th.cur { background: var(--accent-bg); color: var(--accent); font-weight: 600 }
.matrix th span { float: right; color: var(--text3) }
.matrix td { vertical-align: top; padding: 12px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
  width: 22%; min-height: 120px }
.matrix td:first-child { width: 230px; padding: 18px }
.matrix tr:last-child td { border-bottom: 0 }
.matrix th:last-child, .matrix td:last-child { border-right: 0 }
.matrix .ev { margin-bottom: 6px }

/* ---------- Team ---------- */
.member-row.sel td { background: var(--accent-bg) }
.member-row.sel td:first-child { border-radius: 14px 0 0 14px } .member-row.sel td:last-child { border-radius: 0 14px 14px 0 }
.load { display: flex; align-items: center; gap: 12px; min-width: 190px }
.load .bar { max-width: 150px }
.profile-head { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px }
.profile-head h3 { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -.4px; line-height: 1.15 }

/* ---------- Report ---------- */
.report-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--accent) }
.report-hero h2 { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -.8px; line-height: 1.15 }
.logo-tile { width: 62px; height: 62px; border-radius: 16px; background: var(--accent-bg); color: var(--accent);
  display: grid; place-items: center; font-family: var(--serif); font-size: 26px; font-weight: 600; flex-shrink: 0 }
.rank { font-family: var(--serif); font-size: 22px; color: var(--accent); width: 28px }
.note-box { background: var(--soft); border-radius: var(--r); padding: 18px 22px; white-space: pre-line }
.note-box .label { margin-bottom: 6px; display: block }
.side-list a { display: flex; align-items: center; gap: 10px; padding: 14px 14px; border-radius: 14px; margin-bottom: 4px }
.side-list a:hover { background: var(--soft) }
.side-list a.on { background: var(--accent-bg) }
.side-list .t { font-weight: 600 } .side-list .m { font-size: 13px; color: var(--text2) }

/* ---------- Empty / misc ---------- */
.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px }
.empty .ico { width: 64px; height: 64px; border-radius: 18px; background: var(--accent-bg); color: var(--accent);
  display: grid; place-items: center; font-size: 28px; margin-bottom: 8px }
.empty h3 { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: -.3px }
.empty p { color: var(--text2); max-width: 400px }
.empty .btn { margin-top: 8px }
.empty.sm { padding: 26px 12px } .empty.sm h3 { font-size: 18px } .empty.sm .ico { width: 48px; height: 48px; font-size: 22px }
.alert-bar { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-radius: var(--r); margin-bottom: 18px;
  background: var(--red-bg); color: var(--red); font-weight: 500 }
.alert-bar.amber { background: var(--amber-bg); color: var(--amber) }
.alert-bar i { font-size: 20px } .alert-bar a, .alert-bar b { margin-left: auto; font-weight: 700; white-space: nowrap }
a.alert-bar:hover { filter: brightness(.97) }
.activity { display: flex; gap: 12px; padding: 10px 0; font-size: 13.5px; border-top: 1px solid var(--border) }
.activity:first-child { border-top: 0 }
.activity i { color: var(--accent); font-size: 17px; margin-top: 1px }
.activity .when { font-size: 12px; color: var(--text3) }
.prose { white-space: pre-line; line-height: 1.7; color: var(--text) }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px }
.info-grid .it { background: var(--soft); border-radius: 12px; padding: 12px 14px }
.info-grid .it span { display: block; font-size: 12px; color: var(--text2); margin-bottom: 3px }
.info-grid .it b { font-weight: 600 }
.stage-track { display: flex; gap: 6px; flex-wrap: wrap }
.stage-track form { display: contents }
.stage-track button { border: 1px solid var(--border); background: var(--card); border-radius: 20px; padding: 7px 14px;
  font-size: 13px; cursor: pointer; color: var(--text2); display: inline-flex; gap: 6px; align-items: center }
.stage-track button.past { background: var(--accent-bg); color: var(--accent); border-color: transparent }
.stage-track button.cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600 }
.comment { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border) }
.comment:first-child { border-top: 0 }
.comment .who { font-weight: 600; font-size: 14px } .comment .when { font-size: 12px; color: var(--text3) }

/* ---------- Dialog ---------- */
dialog.modal { border: 0; border-radius: 22px; padding: 0; width: min(620px, calc(100vw - 24px)); background: var(--card);
  color: var(--text); box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); margin: auto }
dialog.modal::backdrop { background: rgba(20, 26, 20, .45); backdrop-filter: blur(3px) }
dialog.modal[open] { animation: pop .18s ease-out }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } }
.modal-body { padding: 28px 30px 26px }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px }
.modal-head h2 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.6px }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px }
.toast { display: flex; align-items: center; gap: 12px; background: var(--text); color: var(--bg); padding: 13px 18px;
  border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: 380px; animation: pop .2s ease-out }
.toast i { font-size: 19px }
.toast.success i { color: #7fd6a7 } .toast.error i { color: #ff9e8c } .toast.warning i { color: #f3c96b }
.toast.hiding { opacity: 0; transform: translateY(8px); transition: .3s }

/* ---------- Search popup ---------- */
.search-pop { position: absolute; left: 14px; right: -300px; top: 118px; z-index: 60; background: var(--card);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; max-height: 70vh; overflow: auto }
.search-pop .grp { font-size: 11px; font-weight: 700; color: var(--text3); letter-spacing: .8px; text-transform: uppercase;
  padding: 10px 10px 4px }
.search-pop a { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px }
.search-pop a:hover, .search-pop a.kb { background: var(--soft) }
.search-pop a i { font-size: 18px; color: var(--accent) }
.search-pop .t { font-weight: 600; font-size: 14px } .search-pop .s { font-size: 12px; color: var(--text2) }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr }
.auth-art { background: var(--accent); color: #fff; padding: 48px 56px; display: flex; flex-direction: column;
  justify-content: space-between; position: relative; overflow: hidden }
.auth-art::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -200px;
  background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 70%) }
.auth-art h1 { font-family: var(--serif); font-size: 50px; font-weight: 500; letter-spacing: -1.4px; line-height: 1.05; max-width: 520px }
.auth-art p { opacity: .82; font-size: 17px; max-width: 460px; margin-top: 18px; line-height: 1.6 }
.auth-art .brand-mark { background: #fff; color: var(--accent) }
.auth-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 520px; position: relative; z-index: 1 }
.auth-feats div { background: rgba(255, 255, 255, .1); border-radius: 14px; padding: 14px 16px; font-size: 14px }
.auth-feats i { font-size: 20px; display: block; margin-bottom: 6px }
.auth-form { display: grid; place-items: center; padding: 40px 24px }
.auth-card { width: min(420px, 100%) }
.auth-card h2 { font-family: var(--serif); font-size: 36px; font-weight: 600; letter-spacing: -.8px }
.form-errors { background: var(--red-bg); color: var(--red); padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500 }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 0%, var(--accent-bg), transparent 55%), var(--bg) }
.login-card { width: min(400px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: 22px;
  padding: 40px 34px 34px; box-shadow: 0 1px 2px rgba(29, 35, 28, .04), 0 18px 48px rgba(29, 35, 28, .08);
  display: flex; flex-direction: column; gap: 18px }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 10px }
.login-mark { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--serif); font-size: 28px; font-weight: 600;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent) }
.login-brand h1 { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -.8px; line-height: 1 }
.login-btn { height: 50px; font-size: 15px; margin-top: 6px }
@media (max-width: 480px) { .login-card { padding: 32px 22px 26px; border-radius: 18px } .login-brand h1 { font-size: 30px } }

/* ---------- Mobile tabbar ---------- */
.tabbar, .fab, .scrim { display: none }

/* ---------- Print (hisobot PDF) ---------- */
@media print {
  .side, .topbar, .tabbar, .fab, .toasts, .no-print { display: none !important }
  .app { display: block } .page { padding: 0 }
  body { background: #fff } .card { box-shadow: none; border-color: #ddd; break-inside: avoid }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr }
  .phero { grid-template-columns: auto 1fr; } .phero > :nth-child(3), .phero > :nth-child(4) { grid-column: 1 / -1 }
  .team-label { text-align: left }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 290px; max-width: 86vw; z-index: 120;
    transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow-lg) }
  body.nav-open .side { transform: none }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(20, 26, 20, .4); z-index: 110; opacity: 0;
    pointer-events: none; transition: opacity .25s }
  body.nav-open .scrim { opacity: 1; pointer-events: auto }
  body.nav-open .fab { opacity: 0; pointer-events: none }
  .menu-btn { display: grid }
  .topbar { padding: 12px 16px; min-height: 64px; gap: 10px }
  .topbar h1 { font-size: 25px }
  .topbar .subtitle { display: none }
  .page { padding: 18px 16px 110px }
  .grid-2-eq, .grid-3, .grid-side { grid-template-columns: 1fr }
  .kanban { grid-template-columns: repeat(4, minmax(260px, 82vw)); scroll-snap-type: x mandatory; margin: 0 -16px;
    padding: 0 16px 8px }
  .kcol { scroll-snap-align: start; min-height: 200px }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border);
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom)) }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px;
    color: var(--text2); background: none; border: 0; cursor: pointer; padding: 4px 0 }
  .tabbar i { font-size: 23px }
  .tabbar .on { color: var(--accent); font-weight: 700 }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(82px + env(safe-area-inset-bottom));
    width: 58px; height: 58px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 28px;
    z-index: 95; box-shadow: 0 10px 24px rgba(31, 91, 69, .35); border: 0; cursor: pointer }
  .toasts { left: 16px; right: 16px; bottom: calc(150px + env(safe-area-inset-bottom)) }
  .toast { max-width: none }
  .top-actions .btn:not(.keep) { display: none }
  .search-pop { right: 14px; top: 110px }
  .auth { grid-template-columns: 1fr } .auth-art { display: none }
  .profile-head h3 { font-size: 22px }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap } .topbar .seg a { padding: 7px 12px; font-size: 13px }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px }
  .stat { padding: 14px 15px } .stat .v { font-size: 27px }
  .form-grid, .form-grid.cols-3, .form-grid.fg-camp { grid-template-columns: 1fr }
  .form-grid.fg-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .form-grid.fg-top { grid-template-columns: minmax(0, 1fr) 100px 30px }
  .form-grid.fg-camp { border-bottom: 1px dashed var(--border); padding-bottom: 14px }
  .card { padding: 18px 16px; border-radius: 16px }
  .table-wrap { margin: 0 -16px; padding: 0 16px }
  .phero h2 { font-size: 28px } .phero .p-ico { width: 58px; height: 58px; font-size: 26px }
  .modal-body { padding: 22px 18px 20px } .modal-head h2 { font-size: 25px }
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 92vh }
  .cal-day { min-height: 76px; padding: 6px 4px } .ev { font-size: 10.5px; padding: 2px 5px }
  .cal-head div { padding: 8px 4px; font-size: 11px; text-align: center }
  .cal-day .num { font-size: 12.5px; width: 24px; height: 24px }
  .month-nav h2 { font-size: 22px; min-width: 0 }
  .list-row .when { width: auto }
  .prog-row { grid-template-columns: minmax(0, 110px) 1fr 40px; gap: 10px }
  .hide-sm { display: none !important }
  .show-sm { display: inline }
  .list-row .av { display: none }
  .report-hero h2 { font-size: 26px }
  .stats.pipeline { display: flex; overflow-x: auto; gap: 8px; margin: 0 -16px 16px; padding: 0 16px 4px; scrollbar-width: none }
  .stats.pipeline::-webkit-scrollbar { display: none }
  .stats.pipeline .stat { flex: 0 0 auto; min-width: 104px; padding: 10px 13px }
  .stats.pipeline .stat .v { font-size: 22px }
  .stats.pipeline .stat .k { font-size: 11.5px; white-space: nowrap }
  .table-cards { min-width: 0 }
  .table-cards thead { display: none }
  .table-cards tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 14px 0;
    border-bottom: 1px solid var(--border) }
  .table-cards tbody tr:last-child { border-bottom: 0 }
  .table-cards td { border: 0 !important; padding: 0 !important }
  .table-cards td.cell-main { flex: 1 1 calc(100% - 60px); min-width: 0 }
  .table-cards td.cell-end { margin-left: auto }
  .table-cards .amount { text-align: left }
  .table-cards .av { display: none }
  .table-cards .pipe-dots i { width: 12px }
  body:has(.fab) .top-actions .btn-primary { display: none }
  .stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px }
  .stats.stats-3 .stat { padding: 12px 11px }
  .stats.stats-3 .v { font-size: 21px }
  .stats.stats-3 .k { font-size: 11.5px; line-height: 1.3 }
  .stats.stats-3 .s { display: none }
  .toolbar { gap: 10px; margin-bottom: 14px }
  .toolbar .row-wrap { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; margin-left: 0 !important;
    margin-right: -16px; padding-right: 16px }
  .toolbar .row-wrap::-webkit-scrollbar { display: none }
  .toolbar .row-wrap .filter-select, .toolbar > .filter-select { flex: 1 1 0; min-width: 0 }
  .chip { padding: 7px 13px; font-size: 13.5px }
}
