/* Reply24 Pilot workspace — internal tool for two users (Маркетинг / Техник).
   Same visual language as the printed pack (pilot/assets/pilot.css) so the
   screen and the paper feel like one product. */

:root {
  --blue: #335BFF;
  --blue-dim: #2447D6;
  --blue-tint: #EAEFFF;
  --ink: #0E121B;
  --ink-2: #5B6272;
  --ink-3: #6E727E;
  --line: #E7E9EE;
  --line-soft: #F0F1F4;
  --bg: #F7F8FA;
  --surface: #ffffff;
  --green: #177F4F;
  --green-tint: #E3F3EB;
  --red: #D02E3C;
  --red-tint: #FBE6E8;
  --amber: #B4540C;
  --amber-tint: #FBEFE2;
  --sans: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r: 12px;
  --side-w: 236px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* THE sign-in bug: `.app { display: flex }` and `[hidden]`'s own `display:none`
   have equal specificity, so the later rule won and the whole 860px app kept
   rendering underneath the login card — swallowing clicks meant for the key
   field, which then stayed empty and made the button look dead. Anything
   marked hidden must actually be gone. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: var(--blue); }

/* ── Gate ── */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; padding: 20px; }
.gate__card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.gate__card input[type=password] { padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.gate__card input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.gate__remember { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.gate__err { color: var(--red); font-size: 13px; }

/* ── Shell ── */
.app { display: flex; min-height: 100%; }
.side {
  width: var(--side-w); flex: none; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side__head { padding: 18px 18px 10px; display: flex; align-items: center; justify-content: space-between; }
.side__close { display: none; background: none; border: 0; font-size: 17px; cursor: pointer; color: var(--ink-3); }
.logo { font-weight: 800; letter-spacing: -0.02em; font-size: 16px; }
.logo b { color: var(--blue); }
.logo--lg { font-size: 21px; }
.logo__tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-left: 3px; }

.side__nav { flex: 1; overflow-y: auto; padding: 6px 10px 14px; }
.side__group { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 14px 8px 6px; }
.nav {
  display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 9px;
  color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 500; margin-bottom: 1px;
}
.nav:hover { background: var(--bg); }
.nav.is-active { background: var(--blue); color: #fff; font-weight: 600; }
.nav__i { width: 18px; text-align: center; font-size: 13px; }
.nav__count { margin-left: auto; font-family: var(--mono); font-size: 11px; background: var(--blue-tint); color: var(--blue-dim); border-radius: 99px; padding: 1px 7px; }
.nav.is-active .nav__count { background: rgba(255,255,255,.25); color: #fff; }

.side__foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.linklike { background: none; border: 0; color: var(--ink-3); cursor: pointer; font: inherit; text-decoration: underline; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: rgba(247,248,250,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 14px 24px; display: flex; align-items: baseline; gap: 12px;
}
.topbar h1 { font-size: 19px; font-weight: 750; letter-spacing: -0.02em; }
.topbar__sub { font-size: 12.5px; color: var(--ink-3); }
.burger { display: none; background: none; border: 0; font-size: 19px; cursor: pointer; }
.body { padding: 22px 24px 60px; max-width: 1000px; }

/* ── Building blocks ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.card + .card { margin-top: 12px; }
.grid { display: grid; gap: 12px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; color: var(--ink-3); }
h2 { font-size: 16px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.01em; }
h3 { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
p + p, p + .grid, h2 + p { margin-top: 6px; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-dim); border-color: var(--blue-dim); }
.btn--ghost { border-style: dashed; }
.btn--danger { color: var(--red); border-color: var(--red-tint); }
.btn--sm { padding: 5px 10px; font-size: 12px; }

/* ── Material cards ── */
.mat { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; }
.mat + .mat { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.mat__ico { width: 40px; height: 40px; border-radius: 10px; background: var(--blue-tint); color: var(--blue-dim); display: grid; place-items: center; font-size: 17px; }
.mat__t { font-weight: 650; }
.mat__d { font-size: 12.5px; color: var(--ink-2); }
.mat__acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--bg); color: var(--ink-2); }
.pill--blue { background: var(--blue-tint); color: var(--blue-dim); }
.pill--green { background: var(--green-tint); color: var(--green); }
.pill--amber { background: var(--amber-tint); color: var(--amber); }
.pill--red { background: var(--red-tint); color: var(--red); }

/* ── Forms ── */
.form { display: grid; gap: 12px; }
.row { display: grid; gap: 10px; }
.row--2 { grid-template-columns: 1fr 1fr; }
.row--3 { grid-template-columns: 1fr 1fr 1fr; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-size: 13px; background: var(--surface); color: var(--ink);
}
textarea { min-height: 66px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 99px; font-weight: 500; font-size: 12.5px;
  color: var(--ink); cursor: pointer; background: var(--surface);
}
.checks label:has(input:checked) { border-color: var(--blue); background: var(--blue-tint); color: var(--blue-dim); }
.checks input { accent-color: var(--blue); }

/* ── Table ── */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 8px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover { background: var(--bg); }

/* ── Notes ── */
.note { border-left: 3px solid var(--line); padding-left: 12px; }
.note.is-pinned { border-left-color: var(--blue); }
.note__h { display: flex; align-items: baseline; gap: 8px; }
.note__t { font-weight: 650; }
.note__b { white-space: pre-wrap; color: var(--ink-2); font-size: 13px; margin-top: 3px; }
.note + .note { margin-top: 14px; }

/* ── Preview frame ── */
.viewer { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }

.empty { text-align: center; color: var(--ink-3); padding: 34px 10px; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px;
  font-size: 13px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

@media (max-width: 860px) {
  .side {
    position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.18);
  }
  .side.is-open { transform: none; }
  .side__close { display: block; }
  .burger { display: block; }
  .body { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .grid--2, .grid--3, .row--2, .row--3 { grid-template-columns: 1fr; }
  .mat { grid-template-columns: 34px 1fr; }
  .mat__acts { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ── Two users ─────────────────────────────────────────────────────────────
   Marketing and Tech share this workspace, so every note and every contractor
   row carries a coloured chip saying who created it. Colour, not just text:
   in a long list the eye finds the colour first. */
.who {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 2px 9px; border-radius: 99px; background: var(--bg); white-space: nowrap;
}
.who__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.who--mkt  { color: var(--blue-dim); background: var(--blue-tint); }
.who--tech { color: var(--green);    background: var(--green-tint); }
.who--chip { font-size: 11px; padding: 1px 8px; }
.who--side { font-size: 11.5px; }
.topbar .who { margin-left: auto; }

/* My own notes get a tinted card, so "mine vs theirs" reads without counting. */
.note.is-mine { background: linear-gradient(90deg, var(--bg), transparent 40%); }
.note__h { flex-wrap: wrap; row-gap: 4px; }

/* Segmented filter (all / marketing / tech) */
.segs { display: inline-flex; gap: 3px; padding: 3px; background: var(--bg); border-radius: 99px; }
.seg {
  border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--ink-2); padding: 4px 12px; border-radius: 99px; cursor: pointer;
}
.seg:hover { color: var(--ink); }
.seg.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* The sign-in button must never look dead: disabled state is visible. */
.btn:disabled { opacity: .6; cursor: default; }
