/* Plannex OS panel. Brand from plannex.org (mini app): ink navy, indigo, mint, Bowler display face.
   One loud element — the day band on the Day screen; everything else is a quiet working surface. */
@font-face {
  font-family: "Bowler"; src: url("bowler.ttf") format("truetype"); font-display: swap;
  /* Bowler has no narrow no-break space (U+202F, our thousands separator): let the system face draw it. */
  unicode-range: U+0000-202E, U+2030-FFFF;
}

:root {
  --ink: #16223d;          /* brand navy: top bar, day band, headings */
  --ink-deep: #0c1024;
  --indigo: #5b53d4;       /* actions */
  --indigo-soft: #ecebfb;
  /* Text colours are checked against WCAG AA (≥4.5:1) on white, paper and their own soft fills. */
  --mint: #0b7d50;         /* growth as text (brand #3ddc97 is too pale on paper) */
  --mint-soft: #e2f4ea;
  --mint-bright: #3ddc97;
  --amber: #8a5306;        /* unexplained change, missing report */
  --amber-soft: #fbf0dc;
  --red: #a92636;
  --red-soft: #fbe7e9;
  --paper: #f3f5fb;
  --surface: #ffffff;
  --text: #1b2236;
  --muted: #5c6582;
  --line: #e1e5f0;
  --focus: #5b53d4;
  --on-indigo: #ffffff;
  --chart-1: #5b53d4;      /* validated: dataviz validate_palette, light surface #fff */
  --chart-2: #b9740f;
  --chart-grid: #e8ebf3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #0c1024;
    --ink-deep: #070a17;
    --indigo: #8f88ff;
    --indigo-soft: #26244f;
    --mint: #3ddc97;
    --mint-soft: color-mix(in srgb, #3ddc97 14%, #1a2440);
    --amber: #f0b14f;
    --amber-soft: #3a2c12;
    --red: #ff7d8a;
    --red-soft: #3c1c22;
    --paper: #121a30;
    --surface: #1a2440;
    --text: #e9ecf6;
    --muted: #9099b8;
    --line: #2a3557;
    --focus: #8f88ff;
    --on-indigo: #0e1230;    /* white on #8f88ff is 2.9:1; dark ink is 6.2:1 */
    --chart-1: #857dff;    /* validated against dark surface #1a2440 */
    --chart-2: #b97c25;
    --chart-grid: #26304f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Bowler is caps-only: dates and big figures only, never running headings. */
h1, .display { font-family: Bowler, system-ui, sans-serif; font-weight: 400; letter-spacing: .01em; }
h1 { font-size: 26px; line-height: 1.15; margin: 0; color: var(--ink); }
@media (prefers-color-scheme: dark) { h1 { color: var(--text); } }
.band h1 { color: #fff; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; color: var(--ink); }
@media (prefers-color-scheme: dark) { h2 { color: var(--text); } }
p { margin: 0 0 10px; max-width: 72ch; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--mint); }
.neg { color: var(--red); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--ink); color: #fff;
  position: sticky; top: 0; z-index: 3;
}
.brand { display: flex; align-items: center; gap: 10px; font: 18px Bowler, system-ui, sans-serif; color: #fff; text-decoration: none; }
.brand img { height: 26px; width: auto; }
nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
nav a {
  color: rgb(255 255 255 / .62); text-decoration: none; padding: 7px 12px; border-radius: 8px;
}
nav a:hover { color: #fff; background: rgb(255 255 255 / .06); }
nav a.active { color: #fff; background: rgb(144 172 249 / .16); }
.who { display: flex; align-items: center; gap: 12px; color: rgb(255 255 255 / .7); font-size: 13px; }
.who button.link { color: #fff; }
@media (max-width: 680px) {
  .top { gap: 6px 16px; padding: 10px 16px 4px; }
  .who { margin-left: auto; }
  nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 10px 4px; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav a { white-space: nowrap; }
}

main { max-width: 1240px; margin: 0 auto; padding: 24px 24px 72px; }
@media (max-width: 680px) { main { padding: 16px 16px 56px; } }

/* ---------- page heads ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head p { margin: 6px 0 0; }

/* Employee portal: one personal view, the team schedule and a draft-only assistant. */
.employee-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.employee-metrics .sheet { margin-bottom: 20px; }
.employee-metrics .value { overflow-wrap: anywhere; }
.employee-metrics p { margin: 8px 0 0; font-size: 13px; }
.assistant-title { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.assistant-conversation { display: flex; flex-direction: column; gap: 10px; max-height: 450px; overflow: auto; padding: 15px; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.assistant-conversation > p { margin: 0; }
.assistant-question, .assistant-answer { max-width: min(85%, 640px); padding: 11px 14px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-question { align-self: flex-end; color: var(--on-indigo); background: var(--indigo); }
.assistant-answer { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.assistant-answer p { margin: 7px 0; }
.assistant-status { font-weight: 650; color: var(--mint); }
.assistant-card .stack textarea { width: 100%; }
@media (max-width: 720px) { .employee-metrics { grid-template-columns: 1fr; gap: 0; } }

/* ---------- day band: the one loud element ---------- */
.band {
  background: linear-gradient(100deg, var(--ink) 0%, #252f6e 62%, var(--indigo) 140%);
  color: #fff; border-radius: 18px; padding: 22px 26px; margin-bottom: 20px;
  display: grid; grid-template-columns: 1fr auto; gap: 18px 28px; align-items: end;
}
.band .date-nav { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; flex-wrap: wrap; }
.band .date-nav h1 { font-size: 34px; margin-right: 6px; }
.band .date-nav button, .band .date-nav input {
  background: rgb(255 255 255 / .08); color: #fff; border-color: rgb(255 255 255 / .18);
}
.band .date-nav input { color-scheme: dark; }
.band .state { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: rgb(255 255 255 / .12); }
.band .state.closed { background: rgb(61 220 151 / .2); color: var(--mint-bright); }
.band .state.reopened { background: rgb(240 177 79 / .2); color: #ffd28a; }
.figure .value { font: 44px/1 Bowler, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
/* Bowler's own space is a quarter of a digit wide: widen the thousands gap in big figures. */
.figure .value, .stat .value { word-spacing: .18em; }
.figure .value small { font-size: 20px; opacity: .7; margin-left: 6px; }
.figure .caption { color: rgb(255 255 255 / .66); font-size: 13px; margin-top: 6px; }
.tally { min-width: 240px; }
.tally .caption { color: rgb(255 255 255 / .66); font-size: 13px; margin-bottom: 8px; }
.segments { display: flex; gap: 4px; }
.segments span { flex: 1; height: 10px; border-radius: 3px; background: rgb(255 255 255 / .16); min-width: 14px; }
.segments .done { background: var(--mint-bright); }
.segments .off { background: rgb(255 255 255 / .45); }
.segments .rejected { background: #ff7d8a; }
@media (max-width: 680px) {
  .band { grid-template-columns: 1fr; padding: 18px; border-radius: 14px; }
  .band .date-nav h1 { font-size: 26px; width: 100%; }
  .figure .value { font-size: 36px; }
}

/* ---------- working surface ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: minmax(0, 1fr); } }  /* minmax: a wide table scrolls inside, the page does not */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 20px; }
.slip { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; position: sticky; top: 76px; }
.slip section + section { border-top: 1px dashed var(--line); margin-top: 16px; padding-top: 16px; }
@media (max-width: 980px) { .slip { position: static; } }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-weight: 500; color: var(--muted); font-size: 13px; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: none; }
tfoot td { font-weight: 600; border-top: 1px solid var(--text); border-bottom: none; }
td .sub { display: block; color: var(--muted); font-size: 13px; }
tbody td:first-child { white-space: nowrap; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; white-space: nowrap; background: var(--paper); color: var(--muted); }
.tag.ok { background: var(--mint-soft); color: var(--mint); }
.tag.warn { background: var(--amber-soft); color: var(--amber); }
.tag.bad { background: var(--red-soft); color: var(--red); }

/* ---------- controls ---------- */
form.inline, .row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
input.amount { width: 140px; text-align: right; font-variant-numeric: tabular-nums; }
button {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 7px 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); white-space: nowrap;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--indigo); color: var(--on-indigo); border-color: var(--indigo); }
button.primary:hover { filter: brightness(1.08); }
button.big { width: 100%; padding: 11px 16px; font-size: 16px; }
button.danger { color: var(--red); }
button.link { border: none; background: none; color: var(--indigo); padding: 0; }
button:disabled { opacity: .45; cursor: default; filter: none; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- figures in sheets ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 24px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font: 24px/1.2 Bowler, system-ui, sans-serif; font-variant-numeric: tabular-nums; margin-top: 2px; }
.slip .stats { grid-template-columns: 1fr 1fr; gap: 14px; }
.slip .stat .value { font-size: 20px; }

/* ---------- login ---------- */
.login {
  max-width: 400px; margin: 12vh auto; padding: 26px; border-radius: 18px;
  background: linear-gradient(160deg, var(--ink) 0%, #252f6e 100%); color: #fff;
}
.login .brand { font-size: 24px; margin-bottom: 14px; }
.login .brand img { height: 34px; }
.login p { color: rgb(255 255 255 / .72); }
.login label { color: rgb(255 255 255 / .72); }
.login input { width: 100%; background: rgb(255 255 255 / .08); color: #fff; border-color: rgb(255 255 255 / .2); }
.login .neg { color: #ff9aa5; }
.login button { width: 100%; margin-top: 14px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 5; max-width: min(440px, calc(100vw - 32px)); }
.toast { padding: 11px 15px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgb(12 16 36 / .25); }
.toast.bad { background: #a92636; }  /* fixed: white on the dark theme's light red would be 2.6:1 */
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(6px); opacity: 0; } }
}

/* ---------- identity ---------- */
.who-link { color: #fff; text-decoration: none; border-bottom: 1px solid rgb(255 255 255 / .3); }
.who-link:hover { border-bottom-color: #fff; }
.login button.link.on-dark { color: rgb(255 255 255 / .75); width: auto; margin: 0; font-size: 14px; }
.login button.link.on-dark:hover { color: #fff; }

/* ---------- charts ---------- */
.chart { position: relative; margin: 4px 0 8px; }
.chart svg { display: block; overflow: visible; }
.chart .axis text, .chart .axis-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1; }
.chart .bar { fill: var(--chart-1); }
.chart .bar.neg { fill: var(--chart-1); opacity: .55; }
.chart .hover-band { fill: var(--muted); opacity: .08; }
.chart .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line.actual { stroke: var(--chart-1); }
.chart .line.forecast { stroke: var(--chart-2); stroke-dasharray: 5 4; }
.chart .band { fill: var(--chart-2); opacity: .16; }
.chart .dot.actual { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.chart .direct { fill: var(--text); font-size: 12px; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 13px;
  padding: 7px 10px; border-radius: 8px; white-space: nowrap; box-shadow: 0 6px 18px rgb(12 16 36 / .25); z-index: 2;
}
.legend { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.legend .key { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--chart-1); margin-right: 6px; vertical-align: middle; }
.legend .key.forecast { border-top: 2px dashed var(--chart-2); margin-left: 10px; }
details summary { cursor: pointer; margin-top: 8px; }

/* ---------- browser surfaces, touch, busy ---------- */
::selection { background: var(--indigo-soft); color: var(--text); }
:root { accent-color: var(--indigo); caret-color: var(--indigo); scrollbar-color: var(--line) transparent; }
@media (pointer: coarse) {
  button, input, select { min-height: 44px; }
  nav a { padding: 11px 12px; }
}
/* A form or button stays disabled while its request runs: no double expenses, no double close. */
button[aria-busy="true"] { cursor: progress; opacity: .6; }
.icon { width: 16px; height: 16px; display: block; }

/* ---------- outreach ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.chip { border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.on .muted { color: rgb(255 255 255 / .7); }
.chip.attention:not(.on) { border-color: var(--amber); color: var(--amber); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack input, .stack select, .stack textarea { width: 100%; }
textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.found { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.found .sub, .timeline .sub { display: block; color: var(--muted); font-size: 13px; }
.timeline { list-style: none; padding: 0; margin: 12px 0 0; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--line); }
.timeline li .muted { display: block; font-size: 12px; }
details summary { cursor: pointer; }

/* «Мой доход» → ежемесячные платежи: cards instead of a table, so the buttons stay in place in the narrow column */
.pay-total { padding: 12px 14px; margin: 0 0 12px; border-radius: 12px; background: var(--paper, rgba(127,127,127,.08)); }
.pay-total .value { font-size: 24px; font-weight: 700; margin: 2px 0; }
.pay-list { display: flex; flex-direction: column; gap: 8px; }
.pay-item { padding: 10px 12px; border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: 10px; }
.pay-item.paid { opacity: .65; }
.pay-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pay-head strong { overflow-wrap: anywhere; }
.pay-head .num { white-space: nowrap; font-weight: 600; }
.pay-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.ok-text { color: var(--mint); }

/* «Письма Harvey» */
.harvey-draft { margin-bottom: 14px; }
.harvey-to { display: flex; flex-direction: column; gap: 2px; }
.harvey-draft textarea { font: inherit; line-height: 1.5; }
