:root {
  --red: #C8202A;
  --red-dark: #A3161F;
  --navy: #14213D;
  --sky: #DCE9F1;
  --sky-light: #EEF4F8;
  --sky-faint: #F4F8FA;
  --line: #C9D8E3;
  --line-strong: #8A9BAD;
  --muted: #4A5A6C;
  --white: #FFFFFF;
  --radius: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Archivo', system-ui, -apple-system, sans-serif;
  color: var(--navy);
  background: var(--white);
  font-size: 16px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, label:focus-within {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 40px; font-size: 18px; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar {
  flex: 1 1 240px; max-width: 280px;
  background: var(--sky-light); border-right: 1px solid var(--line);
  padding: 28px 22px; display: flex; flex-direction: column; gap: 28px;
}
.brand { display: flex; flex-direction: column; gap: 4px; }
.brand-mark { font-weight: 900; font-size: 52px; line-height: 0.9; letter-spacing: -0.02em; color: var(--red); }
.brand-name { font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .nav span.nav-soon {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px;
  border-radius: var(--radius); font-weight: 700; font-size: 16px;
}
.nav a:hover { background: var(--sky); }
.nav a.active { background: var(--red); color: var(--white); font-weight: 800; }
.nav .nav-soon { color: var(--muted); cursor: default; }
.nav .soon-tag { margin-left: auto; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); }
.nav svg { flex: 0 0 20px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-label { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.team { display: flex; flex-direction: column; gap: 8px; }
.team-row { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.signed { padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.signed strong { color: var(--navy); }
.signed-links { display: flex; gap: 16px; }
.link-btn { background: none; border: 0; padding: 0; min-height: 44px; font-weight: 800; color: var(--red); text-decoration: underline; cursor: pointer; display: inline-flex; align-items: center; }

.main { flex: 999 1 560px; min-width: 0; padding: 36px 32px 60px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.page-title { margin: 0; font-size: 52px; line-height: 1; font-weight: 900; letter-spacing: -0.02em; text-transform: uppercase; }
.page-sub { margin: 6px 0 0; font-size: 17px; color: var(--muted); }
.project-title { font-size: 46px; overflow-wrap: break-word; hyphens: auto; }
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 800; font-size: 15px; color: var(--red); align-self: flex-start; }

/* ---------- Avatars ---------- */
.avatar {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}
.avatar.lg { width: 38px; height: 38px; font-size: 15px; }
.avatar.red { background: var(--red); color: var(--white); }
.avatar.navy { background: var(--navy); color: var(--white); }
.avatar.sky { background: var(--sky); color: var(--navy); border: 1px solid var(--line-strong); }
.avatar.none { background: var(--white); color: var(--muted); border: 1px dashed var(--line-strong); }

/* ---------- Buttons and inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--radius);
  font-weight: 800; font-size: 15px; cursor: pointer; border: 1px solid transparent;
  background: var(--white); color: var(--navy); white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover:not(:disabled) { background: var(--red-dark); }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-outline { border-color: var(--navy); }
.btn-quiet { border-color: var(--line-strong); }
.btn-small { min-height: 44px; padding: 0 14px; font-size: 14px; }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: var(--radius); background: transparent;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 44px;
}
.icon-btn:hover { background: var(--sky-light); color: var(--navy); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label, legend.label { font-size: 15px; font-weight: 800; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); font-size: 17px; background: var(--white); color: var(--navy);
}
textarea.input { padding: 12px 14px; line-height: 1.45; resize: vertical; min-height: 110px; }
.input:focus { border-color: var(--navy); }
.row { display: flex; flex-wrap: wrap; gap: 18px; }
.row > * { flex: 1 1 200px; }
.add-row { display: flex; flex-wrap: wrap; gap: 10px; }
.add-row .input { flex: 1 1 240px; width: auto; }
.check { display: flex; align-items: center; gap: 12px; min-height: 46px; font-size: 17px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--red); flex: 0 0 22px; cursor: pointer; margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  min-height: 46px; min-width: 92px; padding: 0 18px; border-radius: var(--radius);
  font-weight: 800; font-size: 15px; cursor: pointer; background: var(--white); color: var(--navy);
  border: 2px solid var(--line-strong);
}
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--white); border-color: var(--navy); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill {
  min-height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; font-size: 15px; cursor: pointer;
  background: var(--white); color: var(--navy); border: 1px solid var(--line-strong);
}
.pill[aria-pressed="true"] { background: var(--navy); color: var(--white); border-color: var(--navy); }
.toggle-group { display: inline-flex; padding: 4px; gap: 4px; border: 1px solid var(--line-strong); border-radius: 12px; }
.toggle-group button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 8px; font-weight: 800; font-size: 15px; cursor: pointer; background: transparent; }
.toggle-group button[aria-pressed="true"] { background: var(--navy); color: var(--white); }

.search { position: relative; display: flex; align-items: center; flex: 1 1 240px; max-width: 360px; }
.search svg { position: absolute; left: 14px; pointer-events: none; }
.search .input { padding-left: 44px; min-height: 46px; font-size: 16px; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; border: 1px solid transparent; }
.chip.high { background: var(--red); color: var(--white); }
.chip.medium { background: var(--white); color: var(--navy); border-color: var(--navy); }
.chip.low { background: var(--sky); color: var(--navy); }
.chip.stage { background: var(--navy); color: var(--white); font-size: 13px; padding: 5px 12px; }
.chip.archived { background: var(--sky); color: var(--navy); font-size: 13px; padding: 5px 12px; }
.chip.overdue { background: var(--white); color: var(--red); border-color: var(--red); }

/* ---------- Cards and sections ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 16px; background: var(--white); }
.card.tint { background: var(--sky-light); }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-title { margin: 0; font-size: 22px; font-weight: 900; text-transform: uppercase; letter-spacing: -0.01em; }
.card-meta { font-size: 14px; font-weight: 700; color: var(--muted); }
.empty { margin: 0; padding: 14px 0; color: var(--muted); font-size: 16px; }
.empty-big { padding: 36px; border: 1px dashed var(--line-strong); border-radius: 12px; text-align: center; color: var(--muted); font-size: 17px; }

/* ---------- Pipeline ---------- */
.pipeline-wrap { overflow-x: auto; padding-bottom: 8px; }
.pipeline { min-width: 1040px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; align-items: start; }
.column { display: flex; flex-direction: column; gap: 12px; background: var(--sky-light); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; min-height: 440px; transition: background 0.15s; }
.column.drop { background: var(--sky); border-color: var(--navy); }
.column-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; border-bottom: 2px solid var(--navy); }
.column-head h2 { margin: 0; font-size: 16px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em; }
.count { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; background: var(--navy); color: var(--white); font-size: 14px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.pcard { display: flex; flex-direction: column; gap: 10px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: grab; }
.pcard:hover { border-color: var(--navy); }
.pcard.dragging { opacity: 0.45; }
.pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard h3 { margin: 0; font-size: 17px; line-height: 1.2; font-weight: 800; }
.pcard h3 a:hover { text-decoration: underline; }
.pcard-meta { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--muted); }
.pcard-meta strong { color: var(--navy); }
.pcard-foot { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.hint { font-size: 14px; color: var(--muted); margin: 0; }

/* ---------- Table list ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.table { width: 100%; min-width: 780px; border-collapse: collapse; }
.table th { text-align: left; padding: 14px 18px; background: var(--sky-light); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.table td { padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table a.title-link { font-size: 17px; font-weight: 800; }
.table a.title-link:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
.form { max-width: 920px; display: flex; flex-direction: column; gap: 28px; }
.form .card { gap: 20px; padding: 28px; }
.list-rows { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--sky-light); min-height: 50px; }
.list-row .grow { flex: 1; min-width: 0; padding: 10px 0; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }

/* ---------- Project page ---------- */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.stepper button { width: 100%; display: flex; flex-direction: column; gap: 8px; background: none; border: 0; padding: 0 0 6px; text-align: left; cursor: pointer; min-height: 44px; }
.stepper .bar { height: 8px; border-radius: 4px; background: var(--sky); }
.stepper .done .bar { background: var(--red); }
.stepper .now .bar { background: var(--navy); }
.stepper .lbl { font-size: 14px; font-weight: 700; color: var(--muted); }
.stepper .now .lbl { font-weight: 900; color: var(--navy); }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split-main { flex: 2 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.split-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.deliv { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; border-bottom: 1px solid var(--sky-light); padding: 4px 0; }
.deliv .check { flex: 1 1 220px; min-width: 0; }
.deliv .check span { overflow-wrap: anywhere; }
.struck { text-decoration: line-through; color: var(--muted); }
.file-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 6px; font-size: 14px; font-weight: 800; color: var(--red); text-decoration: underline; max-width: 260px; }
.file-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { flex: 1 1 100%; height: 8px; border-radius: 4px; background: var(--sky); overflow: hidden; }
.progress > div { height: 100%; background: var(--red); width: 0; transition: width 0.2s; }
.progress-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.note { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--navy); background: var(--white); }
.note.done { border-color: var(--line); background: var(--sky-faint); }
.note input[type=checkbox] { width: 24px; height: 24px; margin-top: 6px; accent-color: var(--red); flex: 0 0 24px; cursor: pointer; }
.note-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.note-who { font-size: 14px; font-weight: 800; }
.note-who time { font-weight: 500; color: var(--muted); margin-left: 4px; }
.note-text { font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-done-by { font-size: 13px; font-weight: 700; color: var(--muted); }
.details { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 16px; }
.details dt { font-weight: 700; color: var(--muted); }
.details dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.details dd a { color: var(--red); text-decoration: underline; }
.mini-activity { display: flex; flex-direction: column; gap: 12px; }
.mini-activity li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.mini-activity ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mini-activity time { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Activity page ---------- */
.feed { max-width: 860px; display: flex; flex-direction: column; gap: 28px; }
.feed h2 { margin: 0 0 8px; font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.feed-items { display: flex; flex-direction: column; gap: 6px; }
.feed-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; }
.feed-item .txt { flex: 1; min-width: 0; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.feed-item time { display: block; font-size: 14px; color: var(--muted); }
.feed-item a.view { min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; font-weight: 800; color: var(--red); text-decoration: underline; }

/* ---------- Login ---------- */
.login { display: flex; flex-wrap: wrap; min-height: 100vh; }
.login-art { flex: 1 1 460px; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 18px; background: linear-gradient(180deg, var(--sky) 0%, var(--sky-light) 100%); }
.login-art .brand-mark { font-size: 140px; }
.login-art .brand-name { font-size: 22px; }
.login-form-wrap { flex: 1 1 420px; padding: 56px 32px; display: flex; align-items: center; justify-content: center; }
.login-form { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; }
.who { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.who button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border: 2px solid var(--line-strong); border-radius: 12px; background: var(--white); cursor: pointer; font-weight: 800; font-size: 16px; }
.who button[aria-pressed="true"] { border-color: var(--red); background: var(--sky-light); }
.error { color: var(--red); font-weight: 700; margin: 0; }

/* ---------- Toast and modal ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: var(--white); padding: 14px 20px; border-radius: 12px; font-weight: 700; font-size: 15px; box-shadow: 0 8px 24px rgba(20, 33, 61, 0.25); max-width: 90vw; }
.toast.err { background: var(--red); }
.modal-back { position: fixed; inset: 0; background: rgba(20, 33, 61, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.modal { background: var(--white); border-radius: var(--radius-lg); padding: 28px; max-width: 460px; width: 100%; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { margin: 0; font-size: 24px; font-weight: 900; }
.modal p { margin: 0; font-size: 16px; color: var(--muted); }
.modal .actions { justify-content: flex-end; }

@media (max-width: 700px) {
  .sidebar { max-width: none; flex-basis: 100%; padding: 18px 16px; gap: 16px; }
  .side-foot .team { display: none; }
  .main { padding: 24px 16px 48px; }
  .page-title { font-size: 38px; }
  .project-title { font-size: 30px; }
  .login-art { padding: 32px 16px; }
  .login-art .brand-mark { font-size: 88px; }
  .login-form-wrap { padding: 32px 16px; }
}
