/* =========================================================================
   Site request — interface styles
   Tokens, then layout, then components. Print rules live at the very bottom.
   ========================================================================= */

/* --accent-light, --accent-dark and --brand-font come from the admin branding
   settings, injected inline by views/partials/head.ejs. They are read through
   var() fallbacks rather than declared here — a :root declaration in this file
   would load after the inline block and silently overwrite the admin's choice. */

:root {
  color-scheme: light;

  --brand-600: var(--accent-light, #0e6f57);
  --brand-500: color-mix(in srgb, var(--brand-600) 86%, white);
  --brand-700: color-mix(in srgb, var(--brand-600) 82%, black);
  --brand-50:  color-mix(in srgb, var(--brand-600) 8%, white);
  --brand-100: color-mix(in srgb, var(--brand-600) 20%, white);

  --bg:        #f5f7f8;
  --surface:   #ffffff;
  --surface-2: #f8fafa;
  --border:    #dfe4e8;
  --border-2:  #eaeef1;

  --text:      #1a2229;
  --text-2:    #5a6672;
  --text-3:    #8a949e;

  --danger:    #b4302c;
  --danger-bg: #fcefee;
  --warn:      #8a5a1c;
  --warn-bg:   #fdf4e7;
  --info-bg:   #eef4fb;
  --info:      #2a5f9e;

  --radius:    8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 32, 0.06);
  --shadow:    0 1px 3px rgba(16, 24, 32, 0.08), 0 4px 12px rgba(16, 24, 32, 0.05);
  --shadow-lg: 0 8px 28px rgba(16, 24, 32, 0.12);

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --step: 0.25rem;
}

/* The dark palette. Applied when the OS asks for it and the user has not
   pinned light, or when the user has explicitly chosen dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --brand-600: var(--accent-dark, #35b993);
    --brand-500: color-mix(in srgb, var(--brand-600) 88%, black);
    --brand-700: color-mix(in srgb, var(--brand-600) 80%, white);
    --brand-50:  color-mix(in srgb, var(--brand-600) 14%, #0e1417);
    --brand-100: color-mix(in srgb, var(--brand-600) 26%, #0e1417);

    --bg:        #0e1417;
    --surface:   #151d21;
    --surface-2: #1a242a;
    --border:    #26333a;
    --border-2:  #1f2b31;

    --text:      #e6edf1;
    --text-2:    #9fb0bb;
    --text-3:    #72828d;

    --danger:    #f0817c;
    --danger-bg: #2a1817;
    --warn:      #e0a860;
    --warn-bg:   #2a2118;
    --info-bg:   #16232f;
    --info:      #7fb3e8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow:    0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --brand-600: var(--accent-dark, #35b993);
  --brand-500: color-mix(in srgb, var(--brand-600) 88%, black);
  --brand-700: color-mix(in srgb, var(--brand-600) 80%, white);
  --brand-50:  color-mix(in srgb, var(--brand-600) 14%, #0e1417);
  --brand-100: color-mix(in srgb, var(--brand-600) 26%, #0e1417);

  --bg:        #0e1417;
  --surface:   #151d21;
  --surface-2: #1a242a;
  --border:    #26333a;
  --border-2:  #1f2b31;

  --text:      #e6edf1;
  --text-2:    #9fb0bb;
  --text-3:    #72828d;

  --danger:    #f0817c;
  --danger-bg: #2a1817;
  --warn:      #e0a860;
  --warn-bg:   #2a2118;
  --info-bg:   #16232f;
  --info:      #7fb3e8;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:    0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); text-underline-offset: 2px; }
a:hover { color: var(--brand-700); }

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 3px;
}

.mono { font-family: var(--mono); }
.hint { color: var(--text-2); font-size: 0.85rem; }
.muted { color: var(--text-2); }

/* ------------------------------------------------------------------- nav */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: calc(var(--step) * 6);
  padding: 0 calc(var(--step) * 6);
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.masthead .brand {
  display: flex;
  align-items: center;
  gap: calc(var(--step) * 2.5);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.masthead .brand-mark {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  background: var(--brand-600);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}
.masthead .brand-logo { height: 26px; max-width: 132px; object-fit: contain; display: block; }

/* The wordmark font is an admin setting. */
.brand-name {
  font-family: var(--brand-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.masthead nav { display: flex; gap: calc(var(--step) * 1); align-items: center; }
.masthead nav a {
  padding: calc(var(--step) * 1.5) calc(var(--step) * 3);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.masthead nav a:hover { background: var(--surface-2); color: var(--text); }
.masthead nav a[aria-current="page"] { background: var(--brand-50); color: var(--brand-700); }

.masthead .right { margin-left: auto; display: flex; align-items: center; gap: calc(var(--step) * 2); }
.masthead .whoami {
  display: flex; align-items: center; gap: calc(var(--step) * 2);
  padding: calc(var(--step) * 1) calc(var(--step) * 2);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
}
.masthead .whoami:hover { background: var(--surface-2); }
.masthead .whoami .who-name { font-weight: 500; }
.masthead form { display: flex; }
.linkbtn {
  background: none; border: 0; padding: calc(var(--step) * 1.5) calc(var(--step) * 2);
  color: var(--text-2); font: inherit; font-size: 0.88rem; cursor: pointer;
  border-radius: var(--radius-sm);
}
.linkbtn:hover { background: var(--surface-2); color: var(--text); }

@media (max-width: 720px) {
  .masthead { height: auto; flex-wrap: wrap; padding: calc(var(--step) * 2) calc(var(--step) * 4); gap: calc(var(--step) * 2); }
  .masthead nav { order: 3; width: 100%; overflow-x: auto; }
  .masthead .right { margin-left: auto; }
  .masthead .whoami .who-name { display: none; }
}

/* ---------------------------------------------------------------- layout */

.wrap { max-width: 68rem; margin: 0 auto; padding: calc(var(--step) * 8) calc(var(--step) * 6) calc(var(--step) * 20); }
.wrap.narrow { max-width: 40rem; }

.page-head { margin-bottom: calc(var(--step) * 7); }
.page-head h1 {
  font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em;
  margin: 0 0 calc(var(--step) * 1.5);
}
.page-head .lede { color: var(--text-2); margin: 0; max-width: 46rem; }

h2 {
  font-size: 1.02rem; font-weight: 620; letter-spacing: -0.01em;
  margin: 0 0 calc(var(--step) * 4);
  display: flex; align-items: center; gap: calc(var(--step) * 2.5);
}
h3 { font-size: 0.92rem; font-weight: 600; margin: calc(var(--step) * 6) 0 calc(var(--step) * 3); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: calc(var(--step) * 6);
  margin-bottom: calc(var(--step) * 5);
}
.card > :last-child { margin-bottom: 0; }
.card-head { margin-bottom: calc(var(--step) * 4); }
.card-head h2 { margin-bottom: calc(var(--step) * 1); }
.card-head .hint { margin: 0; }

.count-pill {
  font-size: 0.74rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--brand-700); background: var(--brand-50);
  border-radius: 999px; padding: calc(var(--step) * 0.5) calc(var(--step) * 2);
}

/* ----------------------------------------------------------------- forms */

fieldset { border: 0; margin: 0; padding: 0; }
fieldset + fieldset { margin-top: calc(var(--step) * 7); }
legend {
  padding: 0; margin-bottom: calc(var(--step) * 4);
  font-size: 0.78rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3);
}

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: calc(var(--step) * 5); }
.field { display: flex; flex-direction: column; gap: calc(var(--step) * 1.5); min-width: 0; }
.field.wide { grid-column: 1 / -1; }
label { font-weight: 500; font-size: 0.9rem; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=file], select, textarea {
  font: inherit;
  width: 100%;
  padding: calc(var(--step) * 2.25) calc(var(--step) * 3);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:hover:not(:disabled), select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-50);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
textarea.mono { font-size: 0.86rem; }
input[type=file] { padding: calc(var(--step) * 1.75) calc(var(--step) * 2); font-size: 0.88rem; }
input[type=file]::file-selector-button {
  font: inherit; font-size: 0.85rem; font-weight: 500;
  margin-right: calc(var(--step) * 3);
  padding: calc(var(--step) * 1.25) calc(var(--step) * 3);
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer;
}
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 1.1rem center, right 0.8rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: calc(var(--step) * 8);
}

.checkline { display: flex; align-items: center; gap: calc(var(--step) * 2); font-weight: 400; font-size: 0.9rem; }
input[type=checkbox] { accent-color: var(--brand-600); width: 1rem; height: 1rem; }

/* Password reveal — always present, unlike the browser's own button. */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: calc(var(--step) * 11); }
.pw-toggle {
  position: absolute; top: 50%; right: calc(var(--step) * 1.5); transform: translateY(-50%);
  display: grid; place-items: center;
  width: 2rem; height: 2rem; padding: 0;
  background: none; border: 0; border-radius: var(--radius-sm);
  color: var(--text-3); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
input[type=password]::-ms-reveal, input[type=password]::-ms-clear { display: none; }

/* Site name + domain suffix */
.sitename { display: flex; align-items: stretch; }
.sitename input { border-radius: var(--radius) 0 0 var(--radius); position: relative; z-index: 1; }
.sitename .suffix {
  display: flex; align-items: center; white-space: nowrap;
  padding: 0 calc(var(--step) * 3.5);
  color: var(--text-2); font-size: 0.92rem;
  background: var(--surface-2);
  border: 1px solid var(--border); border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: calc(var(--step) * 2);
  font: inherit; font-size: 0.9rem; font-weight: 550;
  padding: calc(var(--step) * 2.25) calc(var(--step) * 4.5);
  border: 1px solid var(--brand-600);
  border-radius: var(--radius);
  background: var(--brand-600);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--text-3); color: var(--text); }
.btn.ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: none; color: var(--danger); border-color: var(--border); }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn.small { font-size: 0.83rem; padding: calc(var(--step) * 1.25) calc(var(--step) * 2.75); }

.actions {
  display: flex; flex-wrap: wrap; gap: calc(var(--step) * 3); align-items: center;
  margin-top: calc(var(--step) * 6);
}
.actions.tight { margin-top: calc(var(--step) * 4); }

/* --------------------------------------------------------------- notices */

.notice {
  display: flex; gap: calc(var(--step) * 3);
  padding: calc(var(--step) * 3.5) calc(var(--step) * 4);
  margin-bottom: calc(var(--step) * 5);
  background: var(--info-bg);
  border: 1px solid transparent;
  border-left: 3px solid var(--info);
  border-radius: var(--radius);
  font-size: 0.92rem;
}
.notice.error { background: var(--danger-bg); border-left-color: var(--danger); }
.notice.good { background: var(--brand-50); border-left-color: var(--brand-600); }

/* Toast — used for "status updated" and import results. */
.toast-dock {
  position: fixed;
  top: calc(56px + var(--step) * 4);
  right: calc(var(--step) * 5);
  z-index: 60;
  width: min(26rem, calc(100vw - var(--step) * 10));
  display: flex; flex-direction: column; gap: calc(var(--step) * 2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: calc(var(--step) * 3);
  padding: calc(var(--step) * 3.5) calc(var(--step) * 4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  animation: toast-in 0.22s ease-out;
}
.toast.good  { border-left-color: var(--brand-600); }
.toast.error { border-left-color: var(--danger); }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-title { font-weight: 550; }
.toast ul { margin: calc(var(--step) * 2) 0 0; padding-left: calc(var(--step) * 4); color: var(--text-2); font-size: 0.85rem; }
.toast li { margin-bottom: calc(var(--step) * 0.5); }
.toast .toast-close {
  background: none; border: 0; padding: 0 calc(var(--step) * 1);
  color: var(--text-3); font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.toast .toast-close:hover { color: var(--text); }
.toast.leaving { animation: toast-out 0.18s ease-in forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

@media (prefers-reduced-motion: reduce) {
  .toast, .toast.leaving { animation: none; }
}
@media (max-width: 720px) {
  .toast-dock { top: auto; bottom: calc(var(--step) * 4); right: calc(var(--step) * 4); left: calc(var(--step) * 4); width: auto; }
}

/* Theme switch */
.theme-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer;
}
.theme-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.theme-btn svg { width: 17px; height: 17px; }

.empty {
  padding: calc(var(--step) * 10) calc(var(--step) * 4);
  text-align: center;
  color: var(--text-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.empty p { margin: 0 0 calc(var(--step) * 4); }
.empty p:last-child { margin: 0; }

/* ---------------------------------------------------------------- tables */

.table-scroll { overflow-x: auto; margin: 0 calc(var(--step) * -1); padding: 0 calc(var(--step) * 1); }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: calc(var(--step) * 3) calc(var(--step) * 3); vertical-align: middle; }
th {
  font-size: 0.74rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border-2); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.mono, th.mono { font-family: var(--mono); font-size: 0.85rem; }
th.right, td.right { text-align: right; }
td form { display: inline-flex; }
td .stack { display: flex; gap: calc(var(--step) * 2); align-items: center; }

.rowlink { font-weight: 550; text-decoration: none; }
.rowlink:hover { text-decoration: underline; }

/* Drag-to-reorder */
.sortable tbody tr { cursor: grab; }
.sortable tbody tr.dragging { opacity: 0.45; background: var(--brand-50); }
.sortable tbody tr.drop-target { box-shadow: inset 0 2px 0 var(--brand-500); }
.grip-col { width: 2.4rem; }
.grip { color: var(--text-3); letter-spacing: 0.08em; cursor: grab; user-select: none; }
.save-flag { font-size: 0.82rem; color: var(--text-2); min-height: 1.2rem; margin: calc(var(--step) * 2) 0 0; }
.save-flag.ok { color: var(--brand-600); }
.save-flag.bad { color: var(--danger); }

/* --------------------------------------------------------------- badges */

.status {
  display: inline-flex; align-items: center; gap: calc(var(--step) * 1.5);
  font-size: 0.78rem; font-weight: 550;
  padding: calc(var(--step) * 0.75) calc(var(--step) * 2.5);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-Approved   { color: var(--info);     border-color: color-mix(in srgb, var(--info) 35%, transparent);     background: var(--info-bg); }
.status-Provisioned{ color: var(--brand-600); border-color: color-mix(in srgb, var(--brand-600) 35%, transparent); background: var(--brand-50); }
.status-Rejected   { color: var(--danger);   border-color: color-mix(in srgb, var(--danger) 35%, transparent);   background: var(--danger-bg); }

.role-tag {
  font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: calc(var(--step) * 0.5) calc(var(--step) * 1.75);
}
.role-tag.admin { color: var(--brand-700); background: var(--brand-50); border-color: var(--brand-100); }

/* --------------------------------------------------------------- avatars */

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; flex: none;
  border: 1px solid var(--border);
}
.avatar.placeholder {
  display: inline-grid; place-items: center;
  background: var(--brand-600); color: #fff;
  border-color: transparent;
  font-size: 0.78rem; font-weight: 650;
}
.avatar.lg { width: 84px; height: 84px; font-size: 2rem; }
.profile-row { display: flex; gap: calc(var(--step) * 6); align-items: flex-start; }
.profile-row .grow { flex: 1; min-width: 0; }
@media (max-width: 560px) { .profile-row { flex-direction: column; } }

.swatches { display: flex; flex-wrap: wrap; gap: calc(var(--step) * 2); }
.swatch {
  display: flex; align-items: center; gap: calc(var(--step) * 2);
  padding: calc(var(--step) * 2) calc(var(--step) * 3);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer; font-weight: 400; font-size: 0.88rem;
}
.swatch:hover { border-color: var(--text-3); }
.swatch:has(input:checked) { border-color: var(--brand-600); background: var(--brand-50); }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.swatch-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.15); }
.swatch-name { text-transform: capitalize; }

.logo-preview {
  max-width: 11rem; max-height: 3.5rem; object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: calc(var(--step) * 2);
}

/* ------------------------------------------------------------ app picker */

.applist { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: calc(var(--step) * 2); }
.appitem {
  display: flex; align-items: center; gap: calc(var(--step) * 2.5);
  padding: calc(var(--step) * 3) calc(var(--step) * 3.5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--mono); font-size: 0.86rem;
  transition: border-color 0.12s, background 0.12s;
}
.appitem:hover { border-color: var(--brand-500); }
.appitem:has(input:checked) { background: var(--brand-50); border-color: var(--brand-500); color: var(--brand-700); font-weight: 500; }
.appitem input { margin: 0; }

.picker-bar {
  display: flex; align-items: center; gap: calc(var(--step) * 3);
  margin-bottom: calc(var(--step) * 4);
}
.picker-bar .spacer { margin-left: auto; }

/* --------------------------------------------------------------- the code */

pre.cmds {
  background: #12191d; color: #dfe9ef;
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.7;
  padding: calc(var(--step) * 4) calc(var(--step) * 4.5);
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0;
}
.cmds-head { display: flex; align-items: center; gap: calc(var(--step) * 3); margin-bottom: calc(var(--step) * 3); }
.cmds-head .spacer { margin-left: auto; }

/* ------------------------------------------------------------- the report */

.report-head {
  display: flex; align-items: center; justify-content: space-between; gap: calc(var(--step) * 4);
  padding-bottom: calc(var(--step) * 4);
  margin-bottom: calc(var(--step) * 5);
  border-bottom: 1px solid var(--border);
}
.report-head .brand-block { display: flex; align-items: center; gap: calc(var(--step) * 3); min-width: 0; }
.report-head .brand-logo { max-height: 2.4rem; max-width: 12rem; object-fit: contain; }
.report-head .brand-text { font-weight: 600; font-size: 1.02rem; }
.report-head .doc-type {
  color: var(--text-3); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap;
}

.docket-head { margin-bottom: calc(var(--step) * 5); }
.docket-head .site {
  font-family: var(--mono); font-size: 1.75rem; line-height: 1.2;
  letter-spacing: -0.02em; word-break: break-all;
  margin-bottom: calc(var(--step) * 2);
}
.docket-head .ref {
  display: flex; flex-wrap: wrap; align-items: center; gap: calc(var(--step) * 2);
  color: var(--text-2); font-size: 0.88rem;
}
.docket-head .ref .mono { font-size: 0.85rem; }

.meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: calc(var(--step) * 4);
  margin: 0 0 calc(var(--step) * 6);
}
.meta div { border-left: 2px solid var(--border); padding-left: calc(var(--step) * 3); }
.meta dt { color: var(--text-3); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.meta dd { margin: calc(var(--step) * 0.5) 0 0; font-weight: 500; }

ol.applist-plain { list-style: none; margin: 0; padding: 0; columns: 3; column-gap: calc(var(--step) * 6); counter-reset: app; }
ol.applist-plain li {
  counter-increment: app; position: relative;
  padding: calc(var(--step) * 1) 0 calc(var(--step) * 1) calc(var(--step) * 7);
  break-inside: avoid;
  font-family: var(--mono); font-size: 0.86rem;
}
ol.applist-plain li::before {
  content: counter(app, decimal-leading-zero);
  position: absolute; left: 0;
  color: var(--text-3); font-size: 0.76rem;
}
@media (max-width: 680px) { ol.applist-plain { columns: 2; } }
@media (max-width: 440px) { ol.applist-plain { columns: 1; } }

.report-foot { display: none; }

/* ----------------------------------------------------------------- print */

@media print {
  @page { margin: 14mm 14mm 16mm; }

  .masthead, .noprint, .toast-dock { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .wrap { max-width: none; padding: 0; }
  a { color: #000; text-decoration: none; }
  .card { border: 0; box-shadow: none; padding: 0; margin: 0 0 12pt; background: none; }

  .report-head { border-bottom: 1.5pt solid #000; margin-bottom: 14pt; padding-bottom: 8pt; }
  .report-head .doc-type { color: #555; }

  .docket-head .site { font-size: 19pt; }
  .docket-head .ref { color: #444; }
  .status { border: 0.6pt solid #888; color: #000; background: none; }
  .status::before { display: none; }

  h2 { margin: 14pt 0 7pt; page-break-after: avoid; font-size: 11pt; }
  .count-pill { background: none; color: #555; border: 0.6pt solid #bbb; }

  .meta { gap: 8pt 14pt; margin: 12pt 0 14pt; }
  .meta div { border-left: 1pt solid #bbb; }
  .meta dt { color: #555; }

  ol.applist-plain { columns: 2; }
  ol.applist-plain li::before { color: #777; }
  li, tr { page-break-inside: avoid; }

  /* Hidden on screen, shown at the end of the printed document. */
  .report-foot {
    display: flex; align-items: center; gap: 10pt;
    margin-top: 22pt; padding-top: 7pt;
    border-top: 0.75pt solid #bbb;
    color: #555; font-size: 8.5pt;
  }
  .report-foot .foot-logo { max-height: 2rem; max-width: 9rem; object-fit: contain; }
  .report-foot .foot-text { margin-left: auto; text-align: right; }
  .report-foot .foot-ref { font-family: var(--mono); font-size: 8pt; }
}
