/* Operanet Control — product UI (light default).
   Calm plant-ops tone: ink + teal, Instrument Sans + Fraunces. */

:root,
[data-theme="light"] {
  --bg: #e9eee9;
  --bg-accent: #dfe8e2;
  --surface: #f7faf7;
  --surface-raised: #ffffff;
  --text: #122018;
  --muted: #5a6b62;
  --border: #c9d5cd;
  --accent: #0f6b5c;
  --accent-hover: #0a5247;
  --accent-soft: #d8eee8;
  --success: #1b6b45;
  --success-soft: #e4f3eb;
  --warn: #9a6700;
  --warn-soft: #f8efd6;
  --danger: #a33a32;
  --danger-soft: #fce8e6;
  --row-hover: #eef4f0;
  --chip: #e4ebe5;
  --ink: #0c1612;
  --brand: #0f6b5c;
  --shadow: none;
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --content-max: 1120px;
  --radius: 8px;
  --font: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Fraunces", "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --card: var(--surface-raised);
  --ok: var(--success);
  --bad: var(--danger);
}

[data-theme="dark"] {
  --bg: #0c1411;
  --bg-accent: #121c18;
  --surface: #15201b;
  --surface-raised: #1a2822;
  --text: #e6efe9;
  --muted: #93a59b;
  --border: #2a3b33;
  --accent: #3dbaa3;
  --accent-hover: #5ecfb8;
  --accent-soft: #16352e;
  --success: #3ecf8e;
  --success-soft: #143528;
  --warn: #e0b44a;
  --warn-soft: #332a12;
  --danger: #f07167;
  --danger-soft: #3a1a18;
  --row-hover: #1c2a24;
  --chip: #24332c;
  --ink: #e6efe9;
  --brand: #3dbaa3;
  --shadow: none;
  --card: var(--surface-raised);
  --ok: var(--success);
  --bad: var(--danger);
}

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

html, body { height: 100%; }

html { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.35), transparent 220px),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 11px,
      rgba(18, 32, 24, 0.025) 11px,
      rgba(18, 32, 24, 0.025) 12px
    );
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.skip-link:focus { left: 8px; }

/* ——— App chrome ——— */

.app {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .mark {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.15;
}
.sidebar-brand .sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.portal-pill {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
}
.portal-pill-inline {
  margin-top: 0;
  margin-left: 10px;
  vertical-align: middle;
}

.sidebar-nav {
  padding: 8px 0 20px;
  flex: 1;
}

.nav-group + .nav-group { margin-top: 6px; }

.nav-group-label {
  padding: 12px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.sidebar-nav a {
  display: block;
  margin: 1px 12px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  transition: background 120ms ease, color 120ms ease;
}
.sidebar-nav a:hover {
  background: var(--row-hover);
  text-decoration: none;
  color: var(--text);
}
.sidebar-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px 0 26px;
  background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand .mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.app-body {
  flex: 1;
  padding: 28px 28px 48px;
}

.content {
  max-width: var(--content-max);
  animation: content-in 280ms ease both;
}

@keyframes content-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  line-height: 1.2;
  color: var(--ink);
}

h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 22px 0 8px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.app-frame {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-brand .control-name {
  font-size: 13px;
  color: var(--muted);
  padding-left: 10px;
  border-left: 1px solid var(--border);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  margin: 0 !important;
}
.topbar-search input[type="search"] {
  flex: 1;
  min-width: 0;
}

.topbar-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.org-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--chip);
  color: var(--text);
}

.user-menu {
  position: relative;
}
.user-menu > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid transparent;
  user-select: none;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover,
.user-menu[open] > summary {
  background: var(--row-hover);
  border-color: var(--border);
}
.user-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: none;
}
.user-name {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  padding: 6px;
  z-index: 40;
}
.user-menu-panel a {
  display: block;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
}
.user-menu-panel a:hover {
  background: var(--row-hover);
  text-decoration: none;
}

.breadcrumb {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 16px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 6px; color: var(--muted); }
.breadcrumb .current { color: var(--text); font-weight: 500; }

h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 8px;
}

p { margin: 0 0 12px; }

.muted { color: var(--muted); }
.meta { font-size: 12.5px; color: var(--muted); }
.bang { color: var(--danger); font-weight: 700; }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

/* ——— Page header ——— */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-header h1 { margin: 0 0 4px; }
.page-header .muted,
.page-header .meta { margin: 0; max-width: 640px; }
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.attention { margin: 0 0 16px; }

/* ——— KPI / cards ——— */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.cards-kpi {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: border-color 140ms ease, background 140ms ease;
}
a.card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.card .label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
}
.card .value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-top: 8px;
  line-height: 1.1;
  color: var(--ink);
}

/* ——— Tables ——— */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

th, td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  background: var(--surface);
  letter-spacing: 0.02em;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: inset 0 -1px 0 var(--border);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--row-hover); }

/* key/value tables (settings lease) */
table tbody th {
  width: 180px;
  background: var(--row-hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* ——— Badges (quiet) ——— */

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  background: var(--chip);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge.ad,
.badge.entra {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #C5D9EE;
}
.badge.manual {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: #F3E0C0;
}
.badge.priv {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #F4C7C3;
}
.badge.ok {
  background: var(--success-soft);
  color: var(--success);
  border-color: #BFE3D0;
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: #F3E0C0;
}
.badge.bad {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #F4C7C3;
}

/* ——— Buttons ——— */

button,
.btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.3;
  display: inline-block;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
button:hover,
.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}
button:active,
.btn:active {
  transform: translateY(1px);
}

.btn.secondary,
button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover,
button.secondary:hover {
  background: var(--row-hover);
  color: var(--text);
  border-color: var(--border);
}

.btn.danger,
button.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn.danger:hover,
button.danger:hover {
  background: #8F1C14;
  border-color: #8F1C14;
  color: #fff;
}

/* ——— Forms ——— */

form.search,
form.grid {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

form.grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  min-width: 180px;
  flex: 1;
}

input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 9px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 13px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
  outline-offset: 0;
}
textarea { min-height: 72px; resize: vertical; }

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0 16px;
}

/* ——— Bars ——— */

.bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  max-width: 120px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.bar > span { display: block; height: 100%; background: var(--success); }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--danger); }

/* ——— Person identity header ——— */

.person-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.person-hero h1 { margin: 0 0 8px; }
.person-header-meta { font-size: 13px; color: var(--text); }

.person-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.person-identity { flex: 1; min-width: 0; }

.person-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 0;
}
.person-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 88px;
}
.person-meta dt {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin: 0;
}
.person-meta dd {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.person-hero .row-actions {
  margin: 0;
  justify-content: flex-end;
  align-self: flex-start;
}

/* leftover role-banner if any template still emits it */
.role-banner { display: none; }

/* ——— Responsive ——— */

@media (max-width: 1100px) {
  .cards-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app { display: block; }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    padding: 8px 8px 12px;
  }
  .nav-group { display: contents; }
  .nav-group-label { display: none; }
  .sidebar-nav a { margin: 2px; }
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--topbar-h); padding: 8px 16px; }
  .topbar-search { max-width: none; order: 5; flex-basis: 100%; }
  .person-hero { flex-wrap: wrap; }
  .person-hero .row-actions { width: 100%; justify-content: flex-start; }
  .page-header { flex-direction: column; }
}

@media (max-width: 640px) {
  .cards, .cards-kpi { grid-template-columns: 1fr; }
  .app-body { padding: 16px; }
}

/* ——— Empty state ——— */

.empty-state {
  text-align: left;
  padding: 1.75rem 1.5rem;
  background: var(--surface-raised);
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin: 8px 0 20px;
  max-width: 40rem;
  box-shadow: none;
}
.empty-state h2,
.empty-state .empty-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  color: var(--ink);
}
.empty-state p,
.empty-state .empty-body {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 36rem;
}
.empty-state .btn { margin-top: 2px; }

/* ——— Flash / toast ——— */

.flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin: 0 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}
.flash-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 28%, var(--border));
}
.flash-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 28%, var(--border));
}
.flash-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, var(--border));
}
.flash-dismiss {
  background: transparent !important;
  border: none !important;
  color: inherit !important;
  padding: 0 4px !important;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  font-weight: 400;
}
.flash-dismiss:hover { opacity: 1; }

/* ——— Command palette ——— */

.palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.palette[hidden] { display: none !important; }
.palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
[data-theme="dark"] .palette-backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.palette-panel {
  position: relative;
  width: min(480px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  z-index: 1;
}
.palette-input {
  width: 100%;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  padding: 14px 16px !important;
  font-size: 15px !important;
  outline: none !important;
  background: var(--surface) !important;
}
.palette-input:focus {
  outline: none !important;
  box-shadow: none !important;
  border-color: var(--border) !important;
}
.palette-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.palette-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.palette-list li.selected,
.palette-list li:hover {
  background: var(--accent-soft);
}
.palette-list li.selected .palette-label {
  color: var(--accent);
  font-weight: 600;
}
.palette-group {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.palette-empty {
  padding: 16px 10px;
  color: var(--muted);
  font-size: 13px;
  cursor: default;
}

/* ——— Clickable KPI cards ——— */

a.card {
  display: block;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  color: inherit;
}
a.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow);
  text-decoration: none;
  color: inherit;
}
a.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ——— Dark-theme badge text ——— */

[data-theme="dark"] .badge {
  color: var(--text);
  background: var(--chip);
}
[data-theme="dark"] .badge.ad,
[data-theme="dark"] .badge.entra {
  color: var(--accent);
  border-color: #2A4060;
}
[data-theme="dark"] .badge.manual,
[data-theme="dark"] .badge.warn {
  color: var(--warn);
  border-color: #5A4820;
}
[data-theme="dark"] .badge.priv,
[data-theme="dark"] .badge.bad {
  color: var(--danger);
  border-color: #5A2030;
}
[data-theme="dark"] .badge.ok {
  color: var(--success);
  border-color: #1E4A38;
}

/* ——— User menu action button ——— */

.user-menu-panel .user-menu-action,
.user-menu-panel button.user-menu-action {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 450;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.user-menu-panel .user-menu-action:hover {
  background: var(--row-hover);
  color: var(--text);
}

/* ——— Roles matrix / create / home commands ——— */

.create-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  max-width: 560px;
  margin: 0 0 20px;
}
.create-panel h2 { margin-bottom: 4px; }

.role-matrix-wrap { overflow-x: auto; margin-bottom: 16px; }
.role-matrix td {
  font-size: 13px;
  color: var(--text);
  white-space: normal;
  min-width: 7.5rem;
  line-height: 1.35;
}
.role-matrix th:first-child,
.role-matrix td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  min-width: 11rem;
  z-index: 1;
}
.role-matrix td.matrix-empty {
  color: var(--muted);
  text-align: center;
  min-width: 3rem;
}

.people-pick { align-items: flex-end; }
.people-pick-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.people-pick input[type="search"] { min-width: 220px; }

.commands-line {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 16px;
}
.commands-line a { font-weight: 600; }

/* ——— Auth (login / password) ——— */

.auth-body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(15, 107, 92, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(18, 32, 24, 0.08), transparent 50%),
    var(--bg);
  background-attachment: fixed;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  min-height: 100vh;
}

.auth-brand {
  display: flex;
  align-items: center;
  padding: clamp(2rem, 6vw, 4.5rem);
  color: #eef6f2;
  background:
    linear-gradient(165deg, #0c1612 0%, #143028 48%, #0f6b5c 140%);
  position: relative;
  overflow: hidden;
}

.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 22px,
      rgba(255,255,255,0.03) 22px,
      rgba(255,255,255,0.03) 23px
    );
  pointer-events: none;
}

.auth-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  animation: content-in 420ms ease both;
}

.auth-mark {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0 0 1.25rem;
  line-height: 1;
  color: #fff;
}

.auth-headline {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 1rem;
  color: #e8f4ef;
}

.auth-lede {
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(232, 244, 239, 0.82);
  margin: 0 0 1.5rem;
  max-width: 32rem;
}

.auth-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.auth-points li {
  font-size: 0.92rem;
  color: rgba(232, 244, 239, 0.9);
  padding-left: 1.1rem;
  position: relative;
}
.auth-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 1px;
  background: #7dd3c0;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.auth-panel-inner {
  width: 100%;
  max-width: 24rem;
  animation: content-in 360ms ease 80ms both;
}

.auth-form-block .auth-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.auth-form-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
  color: var(--ink);
}

.auth-form-sub {
  color: var(--muted);
  margin: 0 0 1.35rem;
  font-size: 0.95rem;
}

.auth-form {
  display: grid;
  gap: 0.9rem;
  margin: 0;
}
.auth-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 0;
}
.auth-form input {
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  border-radius: 7px;
  background: var(--surface-raised);
}
.auth-submit {
  margin-top: 0.35rem;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
}

.auth-lab {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.auth-lab summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}
.auth-foot {
  margin-top: 1.25rem;
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: auto; padding: 2rem 1.5rem 1.75rem; }
  .auth-mark { font-size: 2rem; margin-bottom: 0.75rem; }
  .auth-headline { font-size: 1.25rem; }
  .auth-points { display: none; }
}

/* ——— Setup wizard ——— */

.setup-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.setup-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem;
}
.setup-progress {
  margin-bottom: 1.25rem;
}
.setup-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.45rem;
}
.setup-progress-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 400ms ease;
}

.setup-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.5rem;
}
.setup-rail-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease;
}
.setup-rail-item:hover {
  border-color: var(--accent);
  text-decoration: none;
  color: var(--text);
}
.setup-rail-item.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.setup-rail-item.is-done .setup-rail-num {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.setup-rail-num {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--chip);
}
.setup-stage {
  max-width: 40rem;
}
.setup-panel {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.35rem 1.4rem 1.5rem;
}
.setup-panel h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-top: 0;
}
.setup-form {
  display: grid;
  gap: 0.85rem;
}
.setup-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.setup-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem !important;
  color: var(--text) !important;
  font-weight: 500 !important;
}
.setup-fields {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.flash {
  border-radius: 8px;
}
