/* =============================================================================
 * admin.dharmoni.com — one stylesheet for the whole console
 * =============================================================================
 *
 * The palette, typography and card treatment are lifted from the D'Harmoni SSO
 * sign-in page (dharmoni_sso_auth/auth.php) so the two feel like one product:
 * the deep navy field, the royal-blue/crimson rule taken from the company mark,
 * Manrope for headings, Inter for text, JetBrains Mono for identifiers.
 *
 * Sections
 *   1. Tokens and resets
 *   2. Shared furniture (eyebrow, card rule, alerts, buttons)
 *   3. Sign-in screen
 *   4. Console chrome (masthead, panels, footer)
 *   5. Data tables and paging
 *   6. Modals and forms
 *   7. Toasts
 *   8. Responsive
 * ========================================================================== */

/* -----------------------------------------------------------------------------
 * 1. Tokens and resets
 * -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Field */
  --field-1:  #0A1230;
  --field-2:  #14204E;
  --field-3:  #1D2C63;

  /* Mark — sampled from the D'Harmoni logo */
  --royal:      #22309E;
  --royal-deep: #1A2578;
  --royal-soft: #E9EBF8;
  --crimson:    #D6252B;

  /* Paper */
  --ink:        #111A33;
  --ink-soft:   #38445F;
  --slate:      #5C6880;
  --slate-soft: #8C96AB;
  --card:       #FFFFFF;
  --wash:       #F7F8FC;
  --line:       #E3E7F0;
  --line-soft:  #EEF1F7;

  --teal:     #1C8C7C;
  --teal-bg:  #E7F4F1;
  --amber:    #B4761A;
  --amber-bg: #FDF3E3;
  --red-bg:   #FBEBE9;
  --red-ink:  #7A2A23;

  --font-display: 'Manrope', 'Segoe UI', sans-serif;
  --font-body:    'Inter', 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Consolas', monospace;

  --radius:    8px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--field-1);
  -webkit-font-smoothing: antialiased;
}

/* The console sits on paper; the sign-in screen keeps the navy field. */
body.console { background: var(--wash); }

:focus-visible { outline: 2px solid var(--royal); outline-offset: 2px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: 0.001ms !important; }
}

/* -----------------------------------------------------------------------------
 * 2. Shared furniture
 * -------------------------------------------------------------------------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate-soft);
  margin-bottom: 10px;
}
.eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* The blue-to-red rule: the two colours of the mark, in the order they
   appear in it. */
.card-rule {
  height: 4px;
  background: linear-gradient(90deg, var(--royal) 0%, var(--royal) 46%, var(--crimson) 78%, #E8544E 100%);
}

.alert {
  background: var(--red-bg);
  color: var(--red-ink);
  border: 1px solid rgba(196, 70, 59, 0.25);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 18px;
}

.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius);
  padding: 10px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.08s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--royal); color: #fff; box-shadow: 0 6px 16px -9px rgba(34, 48, 158, 0.9); }
.btn-primary:hover { background: var(--royal-deep); }
.btn-ghost { background: var(--card); color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { border-color: #C9D2E4; background: var(--wash); }
.btn-quiet { background: transparent; color: var(--slate); border-color: transparent; padding: 10px 10px; }
.btn-quiet:hover { color: var(--ink); background: var(--wash); }

/* The super-admin-only row: same shape as the ghost button, marked out with the
   royal tint so it reads as a different class of action from the staff tools. */
.btn-super {
  background: var(--royal-soft);
  color: var(--royal-deep);
  border-color: #CFD5F2;
}
.btn-super:hover { background: #DEE2F6; border-color: #B9C2EC; }

.spacer { flex: 1 1 auto; }
.muted { color: var(--slate-soft); }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.pill-teal  { background: var(--teal-bg);  color: var(--teal); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-royal { background: var(--royal-soft); color: var(--royal); }
.pill-grey  { background: var(--wash); color: var(--slate); border: 1px solid var(--line); }

/* -----------------------------------------------------------------------------
 * 3. Sign-in screen
 * -------------------------------------------------------------------------- */

.stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 48px 20px;
  overflow: hidden;
  background:
    radial-gradient(1100px 620px at 50% -10%, var(--field-3), transparent 70%),
    linear-gradient(165deg, var(--field-2) 0%, var(--field-1) 62%);
}
/* The swoosh from the mark, blown up and dimmed to almost nothing. */
.stage__swoosh { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* A faint horizon so the card has something to sit against. */
.stage::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
  pointer-events: none;
}

.login-container {
  position: relative;
  width: 100%;
  max-width: 428px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 1px rgba(6, 12, 32, 0.30), 0 28px 64px -20px rgba(6, 12, 32, 0.65);
  overflow: hidden;
  animation: rise 0.42s cubic-bezier(0.16, 0.84, 0.44, 1) both;
}

.card-head {
  padding: 30px 34px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--card);
}
.card-head img { display: block; width: 214px; max-width: 100%; height: auto; }
.card-body { padding: 26px 34px 30px; }

.login-container h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  font-size: 23px;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 6px;
}
.lede { color: var(--slate); font-size: 13.5px; margin: 0 0 20px; }

.scope-badge {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--wash);
  color: var(--slate);
  border: 1px solid var(--line);
  border-left: 3px solid var(--royal);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 22px;
}
.scope-badge svg { flex-shrink: 0; color: var(--royal); }
.scope-badge strong {
  display: block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12.5px;
  color: var(--ink);
  margin-top: 1px;
}

.form-group { margin-bottom: 15px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.form-group input[type="text"], .form-group input[type="password"] {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--wash);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.form-group input:hover { border-color: #D3D9E6; }
.form-group input:focus {
  background: var(--card);
  border-color: var(--royal);
  box-shadow: 0 0 0 3px var(--royal-soft);
  outline: none;
}
.hint { font-size: 11.5px; color: var(--slate-soft); margin: 6px 0 0; }

.login-container button[type="submit"] {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 13px 20px;
  border: none;
  border-radius: var(--radius);
  background: var(--royal);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  box-shadow: 0 6px 16px -8px rgba(34, 48, 158, 0.85);
  transition: background 0.14s ease, transform 0.08s ease, box-shadow 0.14s ease;
}
.login-container button[type="submit"]:hover { background: var(--royal-deep); box-shadow: 0 8px 20px -8px rgba(26, 37, 120, 0.9); }
.login-container button[type="submit"]:active { transform: translateY(1px); }

.secured {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate-soft);
}
.secured .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(28, 140, 124, 0.18);
}

.stage-foot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  max-width: 520px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(196, 208, 232, 0.55);
  text-align: center;
  line-height: 1.7;
}
.stage-foot .addr { text-transform: none; letter-spacing: 0.02em; font-family: var(--font-body); font-size: 11.5px; }

/* -----------------------------------------------------------------------------
 * 4. Console chrome
 * -------------------------------------------------------------------------- */

.masthead {
  position: relative;
  background:
    radial-gradient(900px 420px at 12% -40%, var(--field-3), transparent 70%),
    linear-gradient(165deg, var(--field-2) 0%, var(--field-1) 70%);
  color: #fff;
  overflow: hidden;
}
.masthead__swoosh { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.masthead__inner {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 28px 22px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand img {
  width: 186px; height: auto; flex-shrink: 0;
  /* The mark is drawn for light paper; a white plate keeps the strokes
     legible on the navy field without needing a second asset. */
  background: #fff;
  padding: 7px 11px;
  border-radius: 10px;
}
.brand__text { min-width: 0; }
.brand__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin: 0;
}
.brand__meta {
  font-size: 11.5px;
  line-height: 1.55;
  color: rgba(203, 214, 236, 0.72);
  margin: 3px 0 0;
}

.masthead__spacer { flex: 1 1 40px; }

/* "← Staff Directory" and friends, for pages that are not the main console. */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: #CBD6EC;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  padding: 9px 14px;
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.back-link:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.whoami {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  padding: 10px 14px;
}
.whoami__name { font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.whoami__role {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}
.whoami__role.super { color: #FF9E9A; }
.whoami__role.admin { color: #9FB2FF; }

.btn-logout {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  background: rgba(214, 37, 43, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  padding: 9px 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s ease;
}
.btn-logout:hover { background: var(--crimson); }

main { max-width: 1600px; margin: 0 auto; padding: 22px 28px 60px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(17, 26, 51, 0.04);
  overflow: hidden;
  margin-bottom: 18px;
}
.panel__body { padding: 18px 22px 20px; }

.panel h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0 0 3px;
}
.panel__lede { color: var(--slate); font-size: 13px; margin: 0 0 16px; }

.site-foot {
  max-width: 1600px; margin: 0 auto;
  padding: 0 28px 40px;
  font-size: 11.5px; line-height: 1.7;
  color: var(--slate-soft);
  text-align: center;
}
.site-foot strong { color: var(--slate); font-weight: 600; }

/* ---------- Controls ---------- */
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* The row of super-admin-only buttons that sits above the staff toolbar. */
.toolbar-super {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line);
}
.toolbar-super__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate-soft);
  margin-right: auto;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
}
.field input, .field select {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--wash);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
  min-width: 220px;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.field input:focus, .field select:focus {
  background: var(--card);
  border-color: var(--royal);
  box-shadow: 0 0 0 3px var(--royal-soft);
  outline: none;
}

/* -----------------------------------------------------------------------------
 * 5. Data tables and paging
 * -------------------------------------------------------------------------- */

.table-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 15px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #FCFDFF, var(--card));
}
.table-head h2 { margin: 0; }
.count-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--slate);
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

.table-scroll { overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--field-2);
  color: #E6EBFA;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  text-align: left;
  padding: 11px 12px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.data-table thead th.sortable { cursor: pointer; user-select: none; }
.data-table thead th.sortable:hover { background: var(--field-3); }
.data-table thead th .arrow { opacity: 0.35; margin-left: 5px; font-size: 10px; }
.data-table thead th.sorted .arrow { opacity: 1; color: #FF9E9A; }

.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  color: var(--ink-soft);
}
.data-table tbody tr:nth-child(even) { background: #FBFCFE; }
.data-table tbody tr:hover { background: var(--royal-soft); }
.data-table td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink); white-space: nowrap; }
.data-table td.name { font-weight: 600; color: var(--ink); min-width: 210px; }
.data-table td.num  { text-align: right; font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.data-table td.addr { min-width: 240px; max-width: 320px; font-size: 12px; color: var(--slate); }
.data-table td.nowrap { white-space: nowrap; }

.state-row td {
  text-align: center;
  padding: 40px 16px;
  color: var(--slate-soft);
  font-size: 13.5px;
}

/* Admin toggle */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 38px; height: 21px; border-radius: 999px;
  background: #CBD3E3; position: relative;
  transition: background 0.16s ease;
  flex-shrink: 0;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.28);
  transition: transform 0.16s ease;
}
.switch input:checked + .switch__track { background: var(--royal); }
.switch input:checked + .switch__track::after { transform: translateX(17px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--royal-soft); }
.switch.locked { cursor: not-allowed; opacity: 0.55; }

.btn-reset {
  background: var(--crimson); color: #fff;
  border: none; border-radius: 5px;
  padding: 5px 11px;
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  cursor: pointer;
  transition: background 0.14s ease;
}
.btn-reset:hover { background: #B31D22; }

.row-actions { display: flex; gap: 4px; }
.icon-btn {
  background: transparent; border: 1px solid transparent;
  border-radius: 5px; padding: 4px 6px;
  cursor: pointer; color: var(--slate); line-height: 0;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.icon-btn:hover { background: var(--card); border-color: var(--line); color: var(--royal); }
.icon-btn.danger:hover { color: var(--crimson); }

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: #FCFDFF;
  font-size: 12.5px;
  color: var(--slate);
}
.pager select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-size: 12.5px; color: var(--ink); }
.pager .page-btns { display: flex; gap: 5px; align-items: center; }
.pager .page-gap { color: var(--slate-soft); }
.pager .page-btn {
  min-width: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
}
.pager .page-btn:hover:not(:disabled) { border-color: var(--royal); color: var(--royal); }
.pager .page-btn:disabled { opacity: 0.4; cursor: default; }
.pager .page-btn.current { background: var(--royal); border-color: var(--royal); color: #fff; }

/* -----------------------------------------------------------------------------
 * 6. Modals and forms
 * -------------------------------------------------------------------------- */

.modal-veil {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 18, 48, 0.62);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 18px;
  overflow-y: auto;
}
.modal-veil[hidden] { display: none; }
.modal {
  width: 100%; max-width: 720px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 70px -22px rgba(6, 12, 32, 0.7);
  overflow: hidden;
  animation: rise 0.24s cubic-bezier(0.16, 0.84, 0.44, 1) both;
}
/* The company / department / family pop-ups carry far fewer fields. */
.modal--narrow { max-width: 560px; }

.modal__head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.modal__head h3 {
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  margin: 0; flex: 1; color: var(--ink);
}
.modal__close {
  background: transparent; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--slate-soft); padding: 2px 6px;
}
.modal__close:hover { color: var(--ink); }
.modal__body { padding: 20px 24px 4px; }
.modal__foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px 20px;
}

/* The "what already exists" list shown above the add form. */
.mini-head {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--slate-soft);
  margin: 0 0 8px;
}
.mini-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 240px;
  margin-bottom: 20px;
}
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table thead th {
  position: sticky; top: 0;
  background: var(--wash);
  color: var(--slate);
  text-align: left;
  font-family: var(--font-display);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.mini-table tbody td { padding: 7px 12px; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); }
.mini-table tbody tr:last-child td { border-bottom: none; }
.mini-table td.id { font-family: var(--font-mono); color: var(--ink); width: 92px; }
.mini-table .state-row td { padding: 22px 12px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.grid .full { grid-column: 1 / -1; }
.grid label {
  display: block;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--slate);
  margin-bottom: 5px;
}
.grid input, .grid select, .grid textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--wash);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
}
.grid textarea { resize: vertical; min-height: 62px; }
.grid input:focus, .grid select:focus, .grid textarea:focus {
  background: var(--card); border-color: var(--royal);
  box-shadow: 0 0 0 3px var(--royal-soft); outline: none;
}
.grid input:disabled { background: var(--line-soft); color: var(--slate); cursor: not-allowed; }
.field-note { font-size: 11px; color: var(--slate-soft); margin: 5px 0 0; }

/* -----------------------------------------------------------------------------
 * 7. Toasts
 * -------------------------------------------------------------------------- */

#toaster {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(440px, calc(100vw - 40px));
}
.toast {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--royal);
  border-radius: 10px;
  box-shadow: 0 14px 34px -14px rgba(6, 12, 32, 0.5);
  padding: 12px 15px;
  font-size: 13px;
  color: var(--ink-soft);
  animation: rise 0.2s ease both;
  white-space: pre-line;
}
.toast.ok  { border-left-color: var(--teal); }
.toast.bad { border-left-color: var(--crimson); }

/* -----------------------------------------------------------------------------
 * 8. Responsive
 * -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .masthead__inner { padding: 16px 18px; }
  main { padding: 18px 16px 50px; }
  .grid { grid-template-columns: 1fr; }
  .field input, .field select { min-width: 0; width: 100%; }
  .field { flex: 1 1 100%; }
  .toolbar-super { justify-content: stretch; }
  .toolbar-super__label { flex: 1 1 100%; margin-bottom: 4px; }
}

@media (max-width: 520px) {
  .stage { padding: 28px 14px 34px; justify-content: flex-start; }
  .login-container { max-width: 100%; border-radius: 14px; }
  .card-head { padding: 24px 22px 18px; }
  .card-head img { width: 180px; }
  .card-body { padding: 22px 22px 26px; }
  .login-container h2 { font-size: 21px; }
}
