/* The sign-in pages, outside the shell. Colors, font and sizes follow the shell's MUI theme, so signing in and
   moving on to the panel looks like one application. data-theme is set from the shell's own setting. */

:root {
  --font: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --sidebar-width: 248px;
  --radius: 6px;

  --bg: #f5f5f5;
  --sidebar: #fafafa;
  --surface: #fff;
  --header: #fff;
  --nav-icon: #aaa;
  --hover: rgba(0, 0, 0, .04);
  --selected: rgba(25, 118, 210, .08);
  --selected-hover: rgba(25, 118, 210, .12);
  --input: #f5f5f5;
  --line: #e0e0e0;
  --line-strong: #d4d4d4;
  --fg: rgba(0, 0, 0, .87);
  --muted: rgba(0, 0, 0, .6);
  --faint: #9e9e9e;
  --accent: #1976d2;
  --on-accent: #fff;
  --accent-soft: rgba(25, 118, 210, .08);
  --danger: #d32f2f;
  --danger-soft: rgba(211, 47, 47, .08);
  --ok: #2e7d32;
  --ok-soft: rgba(46, 125, 50, .08);
  --warn: #ed6c02;
  --warn-soft: rgba(237, 108, 2, .08);
  --backdrop: rgba(0, 0, 0, .4);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1a1a1a;
  --sidebar: #222;
  --surface: #222;
  --header: #1e1e1e;
  --nav-icon: #666;
  --hover: rgba(255, 255, 255, .08);
  --selected: rgba(144, 202, 249, .16);
  --selected-hover: rgba(144, 202, 249, .24);
  --input: #2a2a2a;
  --line: #2e2e2e;
  --line-strong: #3a3a3a;
  --fg: #fff;
  --muted: rgba(255, 255, 255, .7);
  --faint: #666;
  --accent: #90caf9;
  --on-accent: #0b1a2b;
  --accent-soft: rgba(144, 202, 249, .1);
  --danger: #f48b85;
  --danger-soft: rgba(244, 67, 54, .12);
  --ok: #81c784;
  --ok-soft: rgba(102, 187, 106, .12);
  --warn: #ffb74d;
  --warn-soft: rgba(255, 167, 38, .12);
  --backdrop: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: var(--font); font-size: .95em; }

svg.icon { width: 16px; height: 16px; flex-shrink: 0; fill: currentColor; }

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

.brand { font-weight: 700; line-height: 1.2; letter-spacing: .05em; color: var(--fg); }
.lead { margin: 0; color: var(--muted); max-width: 70ch; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── Buttons ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: .78rem;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }
.btn .icon { width: 14px; height: 14px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { color: var(--on-accent); filter: brightness(1.08); }

.btn-block { width: 100%; padding: 9px 12px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 5px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--accent); background: var(--hover); }

/* ── Alerts ────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: .8rem;
}
.alert .icon { margin-top: 2px; color: var(--accent); }
.alert > div { flex: 1; min-width: 0; }
.alert p { margin: 0; }
.alert p + p { margin-top: 4px; }
.alert-ok { border-left-color: var(--ok); background: var(--ok-soft); }
.alert-ok .icon { color: var(--ok); }
.alert-error { border-left-color: var(--danger); background: var(--danger-soft); }
.alert-error .icon { color: var(--danger); }
.alert-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.alert-warn .icon { color: var(--warn); }

/* ── Forms ─────────────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: .75rem; color: var(--muted); }
.field .hint { font-size: .72rem; color: var(--faint); }

input[type=text], input[type=password], input[type=date], select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--fg);
  font: inherit;
  font-size: .82rem;
  transition: border-color .15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── Sign-in page ──────────────────────────────────────────────── */

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: min(380px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.auth-card .brand { display: block; margin-bottom: 4px; font-size: 1.1rem; }
.auth-card .lead { margin-bottom: 22px; font-size: .8rem; }
.auth-card .theme-toggle { float: right; margin: -6px -8px 0 0; }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font-size: .72rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.auth-card .alert { margin-bottom: 16px; }
.demo-credentials { margin: 10px 0 0; font-size: .72rem; color: var(--faint); }
.spaced { margin-top: 14px; }
.field .field-label { font-size: .75rem; color: var(--muted); }
.narrow { max-width: 360px; }
