/* 372 12th board tracker.
   Accessibility notes:
   - Base font 16px, body text never below 14px.
   - Every text and background pair below meets WCAG AA (4.5:1), and the
     status colors meet it against their own tinted backgrounds.
   - Interactive controls are at least 44px tall.
   - Focus is always visible, with a 3px ring.
   - Color is never the only signal: status is always spelled out in words. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #cfd8e3;
  --border-strong: #9fb0c4;

  --text: #16202b;        /* 15.8:1 on white */
  --text-soft: #47576a;   /* 7.6:1 on white  */

  --primary: #1d4ed8;     /* 6.3:1 on white  */
  --primary-dark: #16389f;
  --primary-soft: #e8eefc;

  --red: #b3261e;
  --red-soft: #fdeceb;
  --amber: #8a4b08;
  --amber-soft: #fdf1e1;
  --green: #15662f;
  --green-soft: #e6f4ea;
  --purple: #5b2ec4;
  --purple-soft: #f0eafc;
  --slate: #3f5060;
  --slate-soft: #eceff3;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .10);
  --focus: 0 0 0 3px #ffffff, 0 0 0 6px var(--primary);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--primary); color: #fff; padding: 12px 18px; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- password gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 500; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px 30px;
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 16px;
}
.gate-card h1 { margin: 0; font-size: 24px; text-align: center; }
.gate-sub { margin: 0; color: var(--text-soft); text-align: center; }
.gate-err {
  margin: 0; color: var(--red); font-weight: 600;
  background: var(--red-soft); border: 1px solid #f0c3c0;
  border-radius: 8px; padding: 10px 12px;
}
body.locked > .topbar, body.locked > .container, body.locked > .demo-banner { display: none; }

.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text-soft); }
.checkbox-row input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }

/* ---------- banner and topbar ---------- */
.demo-banner {
  background: #fdf1e1;
  border-bottom: 2px solid #e0b678;
  color: #6b3d0a;
  padding: 12px 20px;
  text-align: center;
}
.demo-banner code { background: #f8e2bf; padding: 2px 6px; border-radius: 4px; }

.topbar { background: var(--surface); border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { font-weight: 700; font-size: 20px; white-space: nowrap; }

.tabs { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.tab {
  border: 2px solid transparent;
  background: none;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 600;
}
.tab:hover { background: var(--surface-alt); color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }

/* ---------- mobile menu ---------- */
/* The hamburger and sidebar exist only on narrow screens. On wider screens
   the tabs sit in the top bar as normal. */
.menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border: 2px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  border-radius: 8px; cursor: pointer; flex: 0 0 auto;
}
.menu-btn:hover { background: var(--surface-alt); }

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 200; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: min(310px, 84vw);
  background: var(--surface);
  border-right: 2px solid var(--border);
  box-shadow: 4px 0 24px rgba(15, 23, 42, .22);
  z-index: 201;
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .22s ease;
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; border-bottom: 2px solid var(--border);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.sidebar-nav .tab { width: 100%; text-align: left; font-size: 17px; padding: 14px 16px; min-height: 52px; }
.sidebar-actions { padding: 0 16px 20px; margin-top: auto; }

/* ---------- layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 28px 20px 90px; }
.view > * + * { margin-top: 22px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.section-desc { color: var(--text-soft); margin: 0; max-width: 68ch; }
.empty-note { color: var(--text-soft); text-align: center; padding: 40px 0; }
.group-heading {
  font-size: 15px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-soft); margin: 26px 0 12px;
  border-bottom: 2px solid var(--border); padding-bottom: 8px;
}
.inline-note {
  margin: 0; background: var(--surface-alt); border-left: 4px solid var(--border-strong);
  padding: 12px 14px; color: var(--text-soft); font-size: 15px; border-radius: 0 8px 8px 0;
}

/* ---------- buttons and inputs ---------- */
.btn {
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 10px 18px;
  min-height: 44px;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-alt); border-color: var(--text-soft); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--red); border-color: #d9928d; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-block { width: 100%; justify-content: center; }
.btn-close {
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 14px; min-height: 40px;
  font-size: 15px; font-family: inherit; font-weight: 600; cursor: pointer;
}
.btn-close:hover { background: var(--surface-alt); }

.input {
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
  font-size: 16px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.input:hover { border-color: var(--text-soft); }
textarea.input { min-height: 80px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--slate);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat .num { font-size: 30px; font-weight: 700; line-height: 1.15; }
.stat .lbl { color: var(--text-soft); font-size: 15px; margin-top: 4px; }
.stat-red { border-left-color: var(--red); }
.stat-red .num { color: var(--red); }
.stat-amber { border-left-color: var(--amber); }
.stat-amber .num { color: var(--amber); }
.stat-blue { border-left-color: var(--primary); }
.stat-blue .num { color: var(--primary); }
.stat-green { border-left-color: var(--green); }
.stat-green .num { color: var(--green); }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: start; }
.dash-section + .dash-section { margin-top: 28px; }
.dash-section h2 { margin: 0 0 12px; font-size: 16px; }
.status-key {
  display: inline-block; border-radius: 6px; padding: 5px 12px;
  font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.status-key-overdue  { background: var(--red-soft);    color: var(--red);     border: 1px solid #e8b4b0; }
.status-key-soon     { background: var(--amber-soft);  color: var(--amber);   border: 1px solid #e0bd8c; }
.status-key-later    { background: var(--primary-soft);color: var(--primary-dark); border: 1px solid #b7c9f2; }
.status-key-progress { background: var(--purple-soft); color: var(--purple);  border: 1px solid #cbb6f0; }
.status-key-done     { background: var(--green-soft);  color: var(--green);   border: 1px solid #a9d5b7; }
.status-key-nodate   { background: var(--slate-soft);  color: var(--slate);   border: 1px solid var(--border-strong); }

.card-list { display: flex; flex-direction: column; gap: 12px; }
.card-list .none { color: var(--text-soft); padding: 4px 2px; }

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  width: 100%; text-align: left; font-family: inherit; font-size: 16px; color: var(--text);
}
.task-card:hover { background: var(--surface-alt); border-color: var(--border-strong); }
.task-card.is-overdue { border-left-color: var(--red); }
.task-card.is-soon    { border-left-color: var(--amber); }
.task-card.is-done    { border-left-color: var(--green); }
.task-card .row1 { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.task-card .title { font-weight: 700; }
.task-card .due { font-size: 14px; color: var(--text-soft); white-space: nowrap; }
.task-card .due.overdue { color: var(--red); font-weight: 700; }
.task-card .due.soon { color: var(--amber); font-weight: 700; }
.task-card .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--text-soft); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; font-size: 13px; font-weight: 700;
  border-radius: 6px; padding: 3px 10px; white-space: nowrap; border: 1px solid transparent;
}
.badge-cat { background: var(--slate-soft); color: var(--slate); border-color: var(--border); }
.badge-open { background: var(--primary-soft); color: var(--primary-dark); border-color: #b7c9f2; }
.badge-in_progress { background: var(--purple-soft); color: var(--purple); border-color: #cbb6f0; }
.badge-done { background: var(--green-soft); color: var(--green); border-color: #a9d5b7; }
.badge-high { background: var(--red-soft); color: var(--red); border-color: #e8b4b0; }
.badge-cost { background: var(--surface-alt); color: var(--text-soft); border-color: var(--border); }

.assignee-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-soft); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; border: 1px solid #b7c9f2;
}
.avatar-none { background: var(--slate-soft); color: var(--slate); border-color: var(--border); }

/* ---------- filters and table ---------- */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar .field { flex: 0 0 auto; min-width: 170px; }
.filter-bar .search-field { flex: 1 1 260px; }

.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; min-width: 940px; }
.table th {
  text-align: left; font-size: 14px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-soft); padding: 14px; border-bottom: 2px solid var(--border); background: var(--surface-alt);
}
.table .col-title { width: 32%; }
.table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-alt); }
.table tbody tr.row-overdue { border-left: 6px solid var(--red); }
.table tbody tr.row-soon { border-left: 6px solid var(--amber); }
.table tbody tr.row-plain { border-left: 6px solid transparent; }
.table .t-title { font-weight: 700; }
.table .t-desc { color: var(--text-soft); font-size: 14px; margin-top: 4px; max-width: 46ch; }
.table .due-overdue { color: var(--red); font-weight: 700; }
.table .due-soon { color: var(--amber); font-weight: 700; }
.table td.t-actions { text-align: right; }

.link-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.link-chip {
  font-size: 14px; color: var(--primary-dark); background: var(--primary-soft);
  border: 1px solid #b7c9f2; border-radius: 6px; padding: 4px 10px;
  text-decoration: underline; display: inline-block;
}
.link-chip:hover { background: #d9e4fa; }

.btn-done {
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 8px; font-size: 15px; font-weight: 600; padding: 8px 14px;
  min-height: 40px; cursor: pointer; font-family: inherit;
}
.btn-done:hover { background: var(--green-soft); color: var(--green); border-color: var(--green); }

/* ---------- cards for vendors, accounts, members ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  cursor: pointer; text-align: left; font-family: inherit; font-size: 16px;
  color: var(--text); width: 100%; display: block;
}
.info-card:hover { background: var(--surface-alt); border-color: var(--border-strong); }
.info-card h3 { margin: 0 0 4px; font-size: 18px; }
.info-card .sub { color: var(--text-soft); font-size: 15px; margin-bottom: 10px; }
.contact-line { font-size: 15px; color: var(--text-soft); margin-top: 6px; }
.contact-line .lbl { font-weight: 600; color: var(--text); }
.contact-line a { color: var(--primary-dark); }
.info-card .notes { font-size: 14px; color: var(--text-soft); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ---------- modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto;
}
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 680px; box-shadow: 0 20px 50px rgba(15,23,42,.3); }
.modal-sm { max-width: 480px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 2px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.field > span { font-size: 15px; font-weight: 600; color: var(--text); }
.field .req, .field .hint { font-weight: 400; color: var(--text-soft); font-size: 14px; }
.field-row { display: flex; gap: 16px; }

.links-fieldset { border: 2px solid var(--border); border-radius: 10px; padding: 16px; margin: 0; }
.links-fieldset legend { font-size: 15px; font-weight: 700; padding: 0 8px; }
.link-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; font-size: 15px; }
.link-row + .link-row { border-top: 1px solid var(--border); }
.link-row a { color: var(--primary-dark); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row .kind {
  font-size: 12px; color: var(--slate); background: var(--slate-soft);
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
}
.link-row .rm {
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 14px; font-weight: 600; padding: 6px 12px;
  min-height: 40px; border-radius: 8px; font-family: inherit;
}
.link-row .rm:hover { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.link-add { display: grid; grid-template-columns: 1.1fr 1.5fr .9fr auto; gap: 10px; margin-top: 14px; align-items: end; }
.link-none { color: var(--text-soft); font-size: 15px; }

.modal-actions { display: flex; gap: 12px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.modal-actions .spacer { flex: 1; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 14px 22px; border-radius: 10px;
  font-size: 16px; font-weight: 600; z-index: 200; box-shadow: 0 8px 24px rgba(15,23,42,.35);
  max-width: calc(100vw - 40px);
}
.toast.err { background: var(--red); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  /* Below this width the tabs would wrap onto a second line, so they move
     into the slide out menu instead. */
  .menu-btn { display: inline-flex; }
  .topbar .tabs { display: none; }
  .topbar-add { display: none; }
  .topbar-inner { gap: 14px; }
  .brand { flex: 1; }
}

@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; gap: 16px; }
  .link-add { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: stretch; }
  .section-head .btn { width: 100%; }
  .container { padding: 20px 16px 80px; }
  .modal-backdrop { padding: 16px 10px; }
}

@media (prefers-contrast: more) {
  :root { --border: #6b7c8f; --border-strong: #47576a; --text-soft: #32404f; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
