/* Nusite house style.
 *
 * The colours, radii and status tones are NitHost's design tokens
 * (nithost/frontend/src/index.css), so the whole suite looks like one product.
 * NitHost is a React app that switches theme with a class and JavaScript;
 * these pages have no JavaScript, so the same tokens follow the device's own
 * light or dark setting instead.
 *
 * This file is the single source: tools/brand/apply.sh copies it into each
 * service. Edit it here, never in a copy.
 */

:root {
  /* Light, from NitHost's .light */
  --nh-bg: #f0f4f8;
  --nh-surface: #ffffff;
  --nh-surface-raised: #f8fafc;
  --nh-surface-overlay: #f1f5f9;
  --nh-border: #e2e8f0;
  --nh-border-strong: #cbd5e1;
  --nh-text: #0f172a;
  --nh-text-muted: #475569;
  --nh-text-subtle: #94a3b8;
  --nh-accent: #4f46e5;
  --nh-accent-hover: #4338ca;
  --nh-accent-contrast: #ffffff;
  --nh-success: #059669;
  --nh-success-muted: rgba(5, 150, 105, 0.1);
  --nh-warning: #b45309;
  --nh-warning-muted: rgba(217, 119, 6, 0.12);
  --nh-danger: #dc2626;
  --nh-danger-muted: rgba(220, 38, 38, 0.1);
  --nh-input-bg: #ffffff;
  --nh-input-border: #e2e8f0;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark, from NitHost's :root/.dark */
    --nh-bg: #0a0e1a;
    --nh-surface: #111827;
    --nh-surface-raised: #1a2235;
    --nh-surface-overlay: #1f2937;
    --nh-border: #1f2937;
    --nh-border-strong: #374151;
    --nh-text: #f9fafb;
    --nh-text-muted: #9ca3af;
    --nh-text-subtle: #6b7280;
    /* One step lighter than NitHost's #6366f1: these pages put links on the
       page background, where the darker indigo is hard to read. */
    --nh-accent: #818cf8;
    --nh-accent-hover: #a5b4fc;
    --nh-accent-contrast: #0a0e1a;
    --nh-success: #10b981;
    --nh-success-muted: rgba(16, 185, 129, 0.15);
    --nh-warning: #f59e0b;
    --nh-warning-muted: rgba(245, 158, 11, 0.15);
    --nh-danger: #ef4444;
    --nh-danger-muted: rgba(239, 68, 68, 0.15);
    --nh-input-bg: #1a2235;
    --nh-input-border: #2d3748;
  }
}

:root {
  /* What the pages actually use. */
  --bg: var(--nh-bg);
  --surface: var(--nh-surface);
  --surface-raised: var(--nh-surface-raised);
  --text: var(--nh-text);
  --muted: var(--nh-text-muted);
  --subtle: var(--nh-text-subtle);
  --line: var(--nh-border);
  --line-strong: var(--nh-border-strong);
  --accent: var(--nh-accent);
  --accent-hover: var(--nh-accent-hover);
  --accent-contrast: var(--nh-accent-contrast);
  --good: var(--nh-success);
  --good-bg: var(--nh-success-muted);
  --warn: var(--nh-warning);
  --warn-bg: var(--nh-warning-muted);
  --bad: var(--nh-danger);
  --bad-bg: var(--nh-danger-muted);
  --neutral-bg: var(--nh-surface-overlay);
  --accent-soft: color-mix(in srgb, var(--nh-accent) 12%, transparent);
  --accent-line: color-mix(in srgb, var(--nh-accent) 28%, transparent);
  --input-bg: var(--nh-input-bg);
  --input-border: var(--nh-input-border);

  --radius-card: 0.75rem;   /* NitHost .card */
  --radius-control: 0.5rem;
  --font-sans: "Inter var", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ── Shell ────────────────────────────────────────────────────────────────
   NitHost's layout: a sidebar of icon links on the left, the page beside it.
   No JavaScript, so on a narrow screen the sidebar becomes a row along the
   top that scrolls sideways, rather than a drawer that needs a button.
   ─────────────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; }
.sidebar .brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; padding: 4px 8px 16px; }
.sidebar .brand img { width: 26px; height: 26px; }
.sidebar-section { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); padding: 16px 10px 6px; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-control); color: var(--muted); text-decoration: none; font-weight: 500; }
.sidebar a:hover { background: var(--neutral-bg); color: var(--text); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); font-weight: 600; }
.sidebar .spacer { flex: 1; }
.sidebar .me { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 12px 8px 4px; margin-top: 8px; }
.sidebar .me .who-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.sidebar .me .who-role { color: var(--subtle); font-size: 12px; }
.sidebar .me form { margin-left: auto; margin-bottom: 0; }
.sidebar .me button { border: 0; background: none; padding: 6px; color: var(--muted); border-radius: var(--radius-control); }
.sidebar .me button:hover { background: var(--neutral-bg); color: var(--text); }
.icon { flex: none; }

.content { min-width: 0; }
.page-head { display: flex; align-items: flex-start; gap: 12px; padding: 4px 0 20px; }
.page-head .page-icon { color: var(--accent); margin-top: 2px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Cards carry a title and one line saying what they are for, as NitHost's do. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 16px 20px 20px; margin: 0 0 16px; }
.card > h2, .card > h3 { margin: 0; font-size: 16px; }
.card > .sub { color: var(--muted); margin: 4px 0 14px; font-size: 14px; }
.card > .sub:last-child { margin-bottom: 0; }

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; gap: 4px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .sidebar .brand { padding: 4px 8px; }
  .sidebar-section, .sidebar .me .who-role { display: none; }
  .sidebar a { white-space: nowrap; }
  .sidebar .me { border-top: 0; border-left: 1px solid var(--line); margin: 0 0 0 4px; padding: 0 0 0 10px; }
}
