/* Valihonovs Production — dark UI. Chart tokens follow the validated dark-surface palette. */
:root {
  --plane: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #211f1e;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --good: #0ca30c;
  --warning: #fab219;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(57, 135, 229, 0.18), transparent 70%),
    var(--plane);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.login-card label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }

input[type="password"], input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  font-size: 15px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

.btn {
  width: 100%;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}
.btn:hover { filter: brightness(1.08); }
.error { margin-top: 12px; color: #e66767; font-size: 14px; min-height: 20px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.shell > * { min-width: 0; }

.side {
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand { padding: 0 10px 22px; }
.brand b { display: block; font-size: 16px; letter-spacing: -0.01em; }
.brand span { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-size: 14.5px;
}
.nav-item:hover { background: var(--surface); color: var(--ink); }
.nav-item.on { background: var(--surface); color: var(--ink); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }
.side .spacer { flex: 1; }
.side .logout { color: var(--muted); font-size: 13px; background: none; border: 0; text-align: left; padding: 10px 12px; }

main { padding: 32px 36px 72px; max-width: 1180px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
h1.title { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.sub { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* ---------- cards & tiles ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h2 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.ic { margin-right: 7px; }
.card .hint { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.tile .k { font-size: 12.5px; color: var(--muted); letter-spacing: .01em; }
.tile .v { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; white-space: nowrap; }
.tile .v small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.tile.accent { box-shadow: inset 3px 0 0 var(--accent); }
.tile.warn .v { color: var(--warning); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; align-items: start; }
.stack { display: grid; gap: 16px; margin-bottom: 22px; }
@media (max-width: 1000px) { .row2 { grid-template-columns: 1fr; } }

/* ---------- project cards ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.proj {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: block; transition: border-color .15s, transform .15s;
}
.proj:hover { border-color: rgba(57, 135, 229, .55); transform: translateY(-2px); }
.proj .name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.proj .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.proj .money { font-size: 21px; font-weight: 600; margin-top: 14px; }
.proj .bar { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 14px; overflow: hidden; }
.proj .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.proj .foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }

/* ---------- tables ---------- */
.tbl { overflow-x: auto; }
.tbl table { min-width: 620px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; padding: 0 12px 10px 0; border-bottom: 1px solid var(--grid);
}
td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--grid); color: var(--ink-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; padding-left: 18px; }
td b { color: var(--ink); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.chip.paid { color: var(--good); }
.chip.due { color: var(--warning); }
.people { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* ---------- charts ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart .bar-mark { fill: var(--accent); }
.chart .bar-hit { fill: transparent; }
.chart g.b:hover .bar-mark { filter: brightness(1.25); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart text.val { fill: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }

#tip {
  position: fixed; z-index: 50; pointer-events: none; opacity: 0;
  background: #24231f; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 11px; font-size: 12.5px; color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55); transition: opacity .1s; visibility: hidden;
  max-width: 260px;
}
#tip.on { opacity: 1; visibility: visible; }
#tip b { font-variant-numeric: tabular-nums; }
#tip .t { color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-head .mname { font-size: 16px; font-weight: 600; min-width: 150px; }
.navbtn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2);
  width: 32px; height: 32px; border-radius: 8px; line-height: 1;
}
.navbtn:hover { color: var(--ink); border-color: var(--accent); }
.cal-head select { width: auto; min-width: 190px; padding: 8px 12px; font-size: 13.5px; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-bottom: 4px; text-align: center; }
.cal .day {
  min-height: 92px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid transparent; padding: 7px 8px; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
}
.cal .day.empty { background: transparent; }
.cal .day.today { border-color: var(--accent); }
.cal .day.has { color: var(--ink); cursor: default; }
.cal .day.has .amt { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal .day .cnt { font-size: 10.5px; opacity: .85; }
@media (max-width: 720px) { .cal .day { min-height: 62px; padding: 5px; } .cal .day .amt { font-size: 10.5px; } }

/* ---------- misc ---------- */
.back { color: var(--muted); font-size: 13.5px; }
.back:hover { color: var(--ink); }
.empty-note { color: var(--muted); font-size: 14px; padding: 8px 0; }
.legendless { color: var(--muted); font-size: 12px; }
.bars-h { display: grid; gap: 10px; }
.bars-h .r { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: center; font-size: 13.5px; }
.bars-h .track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bars-h .track i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.bars-h .v { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.bars-h .track i.warn { background: var(--warning); }
.bars-h .track i.bad { background: #e66767; }
.marks { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.mark-title { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; display: flex; gap: 8px; align-items: baseline; }
.miss-n { color: #e66767; }
@media (max-width: 900px) { .marks { grid-template-columns: 1fr; gap: 20px; } }
.bars-h .r.claim { grid-template-columns: 140px 1fr auto; color: var(--ink-2); }
.late-days { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 4px 132px; }
.late-days .chip { font-size: 11.5px; padding: 2px 7px; }
.late-n { color: var(--warning); }
@media (max-width: 720px) { .late-days { margin-left: 0; } .bars-h .r, .bars-h .r.claim { grid-template-columns: 90px 1fr auto; } }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: static; height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; gap: 6px;
  }
  .brand { padding: 0 12px 0 0; }
  .side .spacer { display: none; }
  .brand span { display: none; }
  .nav-item { white-space: nowrap; }
  main { padding: 20px 16px 60px; }
}
