/* Reyakopele ICT Help Desk — UI shell.
   Brand colours arrive from /brand.css as --brand-* custom properties. */

:root {
  --brand-primary: #1d4ed8;
  --brand-accent: #0f766e;
  --brand-sidebar: #0f172a;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --border-strong: #cfd4da;
  --text: #16191d;
  --text-muted: #667085;
  --text-invert: #f8fafc;

  --green: #157347; --green-bg: #e7f5ed;
  --amber: #a15c07; --amber-bg: #fdf3e0;
  --rose:  #b42318; --rose-bg:  #fdecea;
  --blue:  #1d4ed8; --blue-bg:  #e8edfd;
  --indigo:#4338ca; --indigo-bg:#eceafc;
  --violet:#6d28d9; --violet-bg:#f0e9fd;
  --slate: #475467; --slate-bg: #eef0f3;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 8px 24px rgba(16,24,40,.10);
  --sidebar-w: 254px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .86em; background: var(--slate-bg);
  padding: .1em .38em; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; font-weight: 620; letter-spacing: -.01em; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.block { display: block; }
.inline { display: inline; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--brand-sidebar);
  color: var(--text-invert);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.sidebar__mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 9px;
  background: rgba(255,255,255,.12); color: #fff; flex: none;
}
.sidebar__logo { max-width: 150px; max-height: 40px; }
.sidebar__name { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar__name strong { font-size: 15px; }
.sidebar__name small { font-size: 11.5px; color: rgba(255,255,255,.62); letter-spacing: .04em;
  text-transform: uppercase; }

.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav__label {
  margin: 14px 10px 6px; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: rgba(255,255,255,.42);
}
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.80); font-size: 14px; text-decoration: none;
}
.nav__item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav__item.is-active { background: rgba(255,255,255,.14); color: #fff; font-weight: 560; }
.nav__item.is-soon { color: rgba(255,255,255,.36); cursor: default; }
.nav__item.is-soon:hover { background: none; color: rgba(255,255,255,.36); }
.nav__icon { display: inline-flex; flex: none; opacity: .9; }
.nav__soon {
  margin-left: auto; font-style: normal; font-size: 10px; letter-spacing: .05em;
  text-transform: uppercase; color: rgba(255,255,255,.34);
  border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 1px 6px;
}
.sidebar__foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.10); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-size: 17px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar__user { display: flex; align-items: center; gap: 9px; color: var(--text); }
.topbar__user:hover { text-decoration: none; }
.topbar__meta { display: flex; flex-direction: column; line-height: 1.15; }
.topbar__meta strong { font-size: 13.5px; font-weight: 560; }
.topbar__meta small { font-size: 11.5px; color: var(--text-muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-primary); color: #fff; font-weight: 600; font-size: 14px;
}
.topbar__burger { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.topbar__burger span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; }

.content { flex: 1; padding: 22px; max-width: 1320px; width: 100%; }
.footer {
  padding: 14px 22px 26px; color: var(--text-muted); font-size: 12.5px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.footer__dot { opacity: .5; }

/* ---------- page intro ---------- */
.page-intro {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-intro__title { font-size: 20px; }
.page-intro__sub { margin: 5px 0 0; color: var(--text-muted); max-width: 74ch; font-size: 14px; }
.page-intro > .btn, .page-intro > .chip { margin-left: auto; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.card--narrow { max-width: 560px; }
.card__head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.card__title { font-size: 14.5px; }
.card__head .chip { margin-left: auto; }
.card__body { padding: 16px; }
.prose p { margin: 0 0 10px; font-size: 14px; color: var(--text-muted); }
.prose strong { color: var(--text); }
.stack > .card:last-child { margin-bottom: 0; }

.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(390px, 1fr)); }

/* ---------- stat cards ---------- */
.stat-grid {
  display: grid; gap: 14px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text);
}
.stat:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.stat__label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat__value { font-size: 26px; font-weight: 640; letter-spacing: -.02em; }
.stat__foot { font-size: 12px; color: var(--text-muted); }

/* ---------- tiles ---------- */
.tile-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 5px;
  padding: 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text);
}
.tile:hover { text-decoration: none; border-color: var(--brand-primary); box-shadow: var(--shadow-lg); }
.tile__icon { color: var(--brand-primary); display: inline-flex; }
.tile span:last-child { font-size: 13px; color: var(--text-muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table-wrap--scroll { max-height: 420px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table thead th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600; background: #fbfbfc;
  position: sticky; top: 0;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfc; }
.table--compact th, .table--compact td { padding: 7px 12px; font-size: 13.5px; }
.table--matrix th:first-child { width: 200px; }
.table .empty { text-align: center; color: var(--text-muted); padding: 26px; }
.table .detail { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-family: var(--mono); }
.arrow { color: var(--text-muted); width: 28px; }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 560; letter-spacing: .01em; text-transform: capitalize;
}
.badge--green  { background: var(--green-bg);  color: var(--green); }
.badge--amber  { background: var(--amber-bg);  color: var(--amber); }
.badge--rose   { background: var(--rose-bg);   color: var(--rose); }
.badge--blue   { background: var(--blue-bg);   color: var(--blue); }
.badge--indigo { background: var(--indigo-bg); color: var(--indigo); }
.badge--violet { background: var(--violet-bg); color: var(--violet); }
.badge--slate  { background: var(--slate-bg);  color: var(--slate); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
}
.chip--muted { background: var(--slate-bg); border-color: transparent; }
.chip--accent { background: var(--blue-bg); color: var(--blue); border-color: transparent; }

/* ---------- forms ---------- */
.form__actions { display: flex; gap: 10px; align-items: center; padding-top: 6px; }
.form__actions--sticky {
  position: sticky; bottom: 0; background: var(--bg);
  padding: 14px 0; border-top: 1px solid var(--border); margin-top: 4px;
}
.field { display: block; margin-bottom: 14px; }
.field__label {
  display: block; font-size: 12.5px; font-weight: 560; color: var(--text);
  margin-bottom: 5px;
}
.field__hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 180px; }
.field--inline { display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
.field--inline .field__label { margin-bottom: 0; white-space: nowrap; }

.input {
  width: 100%; padding: 8px 11px; font: inherit; font-size: 14px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.input:focus {
  outline: none; border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.14);
}
.input:disabled { background: #f4f5f7; color: var(--text-muted); }
.input--short { max-width: 150px; }
.input--sm { padding: 5px 8px; font-size: 13px; }
.input--time { max-width: 120px; }
.input--colour { padding: 3px; height: 38px; max-width: 90px; }
textarea.input { resize: vertical; }

.filters {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  padding: 13px 16px; border-bottom: 1px solid var(--border); background: #fbfbfc;
}
.card__body .filters { border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 12px; }

/* ---------- switches ---------- */
.switch-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.switch-row:last-of-type { border-bottom: 0; }
.switch-row--bare { padding: 0; border: 0; }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
  flex: none; width: 38px; height: 22px; border-radius: 999px;
  background: var(--border-strong); position: relative; transition: background .15s ease;
  margin-top: 1px;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .15s ease; box-shadow: var(--shadow);
}
.switch-row input:checked + .switch { background: var(--brand-primary); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch { box-shadow: 0 0 0 3px rgba(29,78,216,.22); }
.switch--sm { width: 32px; height: 19px; }
.switch--sm::after { width: 13px; height: 13px; }
.switch-row input:checked + .switch--sm::after { transform: translateX(13px); }
.switch-row__text { display: flex; flex-direction: column; gap: 2px; }
.switch-row__text strong { font-size: 14px; font-weight: 560; }
.switch-row__text small { font-size: 12.5px; color: var(--text-muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 8px 15px; font: inherit; font-size: 14px; font-weight: 540;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn.is-busy { opacity: .62; cursor: progress; }
.btn--primary { background: var(--brand-primary); color: #fff; }
.btn--primary:hover { filter: brightness(.94); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: #f4f5f7; }
.btn--warn { background: var(--amber-bg); color: var(--amber); border-color: #f0dcb4; }
.btn--warn:hover { filter: brightness(.97); }
.btn--sm { padding: 5px 11px; font-size: 13px; }
.btn--block { width: 100%; }
.btn__icon { display: inline-flex; }

/* ---------- checklist ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist__item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.checklist__item:last-child { border-bottom: 0; }
.checklist__box {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--border-strong); display: grid; place-items: center;
  color: transparent;
}
.checklist__item.is-done .checklist__box {
  background: var(--green-bg); border-color: transparent; color: var(--green);
}
.checklist__item.is-done span:last-child, .checklist__item.is-done a { color: var(--text-muted); }

/* ---------- flash ---------- */
.flash-stack { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); font-size: 14px;
  margin-bottom: 14px;
}
.flash-stack .flash { margin-bottom: 0; }
.flash--success { background: var(--green-bg); border-color: #c7e6d5; color: var(--green); }
.flash--error   { background: var(--rose-bg);  border-color: #f5c9c4; color: var(--rose); }
.flash--warn    { background: var(--amber-bg); border-color: #f0dcb4; color: var(--amber); }
.flash--info    { background: var(--blue-bg);  border-color: #c9d6f8; color: var(--blue); }
.flash__text { flex: 1; }
.flash__close {
  background: none; border: 0; font-size: 19px; line-height: 1; cursor: pointer;
  color: inherit; opacity: .55; padding: 0 2px;
}
.flash__close:hover { opacity: 1; }

/* ---------- auth & error ---------- */
.app--bare { background: var(--brand-sidebar); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth__panel {
  width: 100%; max-width: 400px; background: var(--surface);
  border-radius: 14px; padding: 30px 28px; box-shadow: var(--shadow-lg);
}
.auth__panel--error { max-width: 460px; text-align: center; }
.auth__brand { text-align: center; margin-bottom: 22px; }
.auth__mark {
  display: inline-grid; place-items: center; width: 50px; height: 50px;
  border-radius: 13px; background: var(--brand-primary); color: #fff; margin-bottom: 12px;
}
.auth__brand h1 { font-size: 19px; }
.auth__brand p {
  margin: 2px 0 0; font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted);
}
.auth__note { margin: 18px 0 0; font-size: 12.5px; color: var(--text-muted); text-align: center; }
.error__code { font-size: 40px; font-weight: 680; color: var(--border-strong); margin: 0; }
.error__title { font-size: 19px; margin-bottom: 8px; }
.error__message { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 40; transform: translateX(-100%);
    transition: transform .18s ease;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .topbar__burger { display: block; }
  .content { padding: 16px; }
  .grid--2 { grid-template-columns: 1fr; }
  .topbar__meta { display: none; }
}

@media print {
  .sidebar, .topbar, .footer, .filters, .form__actions { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; }
}
