:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #172033;
  background: #f4f6f8;
  --ink: #172033;
  --muted: #5c6a80;
  --line: #d9e0ea;
  --panel: #ffffff;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --nav: #182234;
  --nav-soft: #263348;
  --warning-bg: #fff7ed;
  --warning-line: #fed7aa;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
.hidden { display: none !important; }

.home {
  background:
    radial-gradient(circle at 85% 12%, rgba(15, 118, 110, .14), transparent 32%),
    linear-gradient(135deg, #f7fafc 0%, #edf2f6 58%, #e6f1ee 100%);
}

.home-nav {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.home-nav strong { font-size: 18px; }
.home-nav nav { display: flex; gap: 8px; align-items: center; }
.home-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  padding: 9px 12px;
  border-radius: 6px;
}
.home-nav .nav-primary { background: var(--ink); color: white; }

.home-shell { max-width: 1180px; margin: 0 auto; padding: 28px 24px 54px; }
.home-hero {
  min-height: 58vh;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 360px;
  gap: 36px;
  align-items: center;
}
.hero-copy { min-width: 0; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .08em;
}
.home h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(42px, 6vw, 68px);
  line-height: 1.02;
}
.lead {
  max-width: 720px;
  font-size: 20px;
  line-height: 1.55;
  color: #40506a;
}
.home-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.button-link, button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--brand);
  color: white;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  min-height: 38px;
}
.button-link:hover, button:hover { background: var(--brand-dark); }
.button-link.secondary, .ghost { background: #334155; }

.status-panel, .home-grid article, .panel, .login-card, .metrics article {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 22px 54px rgba(23,32,51,.08);
}
.status-panel { display: grid; gap: 10px; }
.status-panel span, .home-grid span { color: var(--muted); }
.status-panel strong { font-size: 28px; }
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.home-grid article { display: grid; gap: 8px; min-height: 128px; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 18%, rgba(15, 118, 110, .24), transparent 28%),
    linear-gradient(135deg, #172033, #263348 58%, #0f766e);
}
.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 14px;
}
.login-card h1 { margin: 0; font-size: 30px; }
.login-card p { margin-bottom: 4px; color: var(--muted); }
.login-card small { color: #b91c1c; min-height: 18px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}
aside {
  background: var(--nav);
  color: #f8fafc;
  padding: 24px 18px;
  display: grid;
  align-content: start;
  gap: 18px;
}
.brand { display: grid; gap: 4px; }
.brand strong { font-size: 18px; }
.brand span, .session-box span { color: #a8b3c7; font-size: 13px; }
.session-box {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 4px;
}
.session-box strong { font-size: 14px; overflow-wrap: anywhere; }
nav { display: grid; gap: 8px; }
nav button {
  text-align: left;
  background: transparent;
  color: #dbe3ee;
  width: 100%;
}
nav button.active, nav button:hover { background: var(--nav-soft); }

main { padding: 28px; min-width: 0; }
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 28px; }
h2 { font-size: 18px; }
p { color: var(--muted); line-height: 1.5; }
.view { display: none; }
.view.active { display: grid; gap: 18px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 14px;
}
.metrics article { display: grid; gap: 8px; box-shadow: none; }
.metrics span { color: var(--muted); }
.metrics strong { font-size: 30px; }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.panel { overflow-x: auto; }
.panel-wide { max-width: 760px; }
.readonly { color: #7c2d12; background: var(--warning-bg); border-color: var(--warning-line); }
.toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar.split { justify-content: space-between; align-items: center; }
.toolbar-group { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input {
  max-width: 360px;
}
.compact-list {
  display: grid;
  gap: 10px;
}
.compact-item {
  display: grid;
  gap: 5px;
  padding: 10px 0;
  border-top: 1px solid #e4e8ef;
}
.compact-item:first-child { border-top: 0; padding-top: 0; }
.compact-item strong { color: var(--ink); font-size: 14px; }
.compact-item span { color: var(--muted); font-size: 13px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.status-badge.online { color: #065f46; background: #d1fae5; }
.status-badge.recent { color: #075985; background: #e0f2fe; }
.status-badge.offline { color: #991b1b; background: #fee2e2; }
.status-badge.unknown { color: #475569; background: #e2e8f0; }
.status-badge.archived { color: #4c1d95; background: #ede9fe; }
.usage { display: grid; gap: 6px; min-width: 130px; }
.usage > span { color: #334155; font-weight: 700; font-size: 13px; }
.usage-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}
.usage-bar i {
  display: block;
  height: 100%;
  background: var(--brand);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}
label { display: grid; gap: 6px; color: #40506a; font-weight: 700; }
.wide { grid-column: span 2; }
input, select, textarea {
  width: 100%;
  border: 1px solid #bfcad8;
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: white;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(15, 118, 110, .18);
  border-color: var(--brand);
}
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td {
  padding: 10px 8px;
  border-bottom: 1px solid #e4e8ef;
  text-align: left;
  vertical-align: top;
}
th { color: #53627a; font-size: 13px; }
small { color: var(--muted); }
.assign { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) auto; gap: 8px; min-width: 420px; margin-bottom: 8px; }
.table-actions, td:last-child {
  min-width: 190px;
}
td:last-child button {
  margin: 0 6px 6px 0;
  padding: 8px 10px;
  min-height: 32px;
}
.config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, .85fr);
  gap: 16px;
  align-items: start;
}
.config-editor { display: grid; gap: 12px; position: sticky; top: 18px; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.section-head h2 { margin-bottom: 4px; }
.section-head p { margin-bottom: 0; }
.section-head input { max-width: 280px; }
textarea {
  min-height: 420px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
button.danger, .danger {
  background: #b91c1c;
  color: white;
}
button.danger:hover, .danger:hover { background: #991b1b; }
button.ghost {
  background: #334155;
}

@media (max-width: 920px) {
  .home-nav { width: min(100% - 28px, 1180px); }
  .home-hero, .home-grid, .dashboard-grid, .app-shell, .config-grid { grid-template-columns: 1fr; }
  aside { position: static; }
  nav { grid-template-columns: repeat(2, 1fr); }
  .metrics, .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  header { display: grid; }
  .config-editor { position: static; }
  .section-head { display: grid; }
}

@media (max-width: 540px) {
  .home-nav { align-items: flex-start; display: grid; }
  .home-nav nav { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .home-nav a, .button-link { text-align: center; }
  .home-actions { display: grid; }
  nav { grid-template-columns: 1fr; }
  main { padding: 20px 14px; }
}
