/* ============================================================================
   Hydro Plant Control — Design System & Reusable Component Styles
   Palette: 4. Deep Forest & Warm Stone (#147A54 + #F5F7F3)
   Font: Chiron GoRound TC
   ============================================================================ */
:root {
  --font: "Chiron GoRound TC", "Segoe UI", Arial, sans-serif;
  --ink: #14241d;
  --ink-soft: #2e4239;
  --muted: #64756c;
  --green: #147a54;
  --green-hover: #0f6343;
  --green-soft: #eaf6ed;
  --green-border: #bfe3ca;
  --line: #dce4dc;
  --line-strong: #c5d2c6;
  --paper: #f5f7f3;
  --surface-subtle: #fafbf9;
  --white: #ffffff;
  --orange: #a86414;
  --orange-soft: #fff8eb;
  --orange-border: #f1ddB6;
  --danger: #a93b30;
  --danger-soft: #fff1ee;
  --danger-border: #f3cfc8;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(20, 36, 29, 0.04);
  --shadow-sm: 0 4px 14px -2px rgba(20, 36, 29, 0.06), 0 2px 5px -2px rgba(20, 36, 29, 0.04);
  --shadow-md: 0 12px 28px -6px rgba(20, 36, 29, 0.1), 0 4px 10px -3px rgba(20, 36, 29, 0.05);
  --shadow-lg: 0 22px 48px -12px rgba(20, 44, 32, 0.14);
  --ring: 0 0 0 3.5px rgba(20, 122, 84, 0.22);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: var(--font);
  font-size: 18px;
  color: var(--ink);
  background: radial-gradient(circle at 50% 0%, #ffffff 0%, var(--paper) 65%);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; transition: color 0.18s var(--ease); }
a:hover { color: var(--green); }
button, input, select, textarea, code { font: inherit; }

.ui-icon {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  vertical-align: middle;
}

/* --- Buttons & Interactive Controls --- */
button, .button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 17px;
  transition: transform 0.16s var(--ease), box-shadow 0.2s var(--ease), background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
button:disabled { opacity: 0.44; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
button:hover:enabled, .button:hover { transform: translateY(-1px); }
button:active:enabled, .button:active { transform: translateY(0); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.primary {
  background: linear-gradient(180deg, #18895f 0%, var(--green) 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(20, 122, 84, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.primary:hover:enabled, a.primary:hover {
  background: linear-gradient(180deg, var(--green) 0%, var(--green-hover) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(20, 122, 84, 0.3);
}
.secondary {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green-border);
}
.secondary:hover:enabled {
  background: #dff1e4;
  border-color: #9fd4b0;
}
.quiet {
  background: var(--white);
  color: var(--ink-soft);
}
.quiet:hover:enabled {
  background: var(--surface-subtle);
  color: var(--ink);
}
.bordered {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.bordered:hover:enabled {
  border-color: var(--line-strong);
}
.text-button {
  background: none;
  color: var(--green);
  padding: 4px 2px;
  border: 0;
  box-shadow: none;
}
.text-button:hover:enabled {
  color: var(--green-hover);
  text-decoration: underline;
  transform: none;
}
.danger-button {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}
.danger-button:hover:enabled {
  background: #ffe5e0;
  border-color: #eab3a9;
}

.copy-chip {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  margin-left: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--muted);
  border: 1px solid var(--line);
}
.copy-chip:hover:enabled {
  color: var(--green);
  border-color: var(--green-border);
  background: var(--green-soft);
}
.copy-chip.copied {
  color: var(--green);
  border-color: var(--green-border);
  background: var(--green-soft);
}

/* --- Topbar & Navigation --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 86px;
  border-bottom: 1px solid rgba(220, 228, 220, 0.85);
  padding: 0 max(36px, calc((100vw - 1240px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-weight: 800;
  font-size: 21px;
  letter-spacing: 2px;
}
.brand:hover .brand-mark {
  transform: scale(1.04) rotate(-2deg);
  box-shadow: 0 6px 16px rgba(20, 122, 84, 0.28);
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1a9265 0%, var(--green) 100%);
  color: #fff;
  border-radius: 13px;
  font-size: 26px;
  letter-spacing: -2px;
  box-shadow: 0 3px 10px rgba(20, 122, 84, 0.22);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.brand-mark span { font-size: 17px; align-self: flex-start; margin-top: 6px; }
.brand small { display: block; font-size: 13px; letter-spacing: 2.5px; color: var(--muted); margin-top: 3px; }
/* Text wordmark (CONTROL_BRAND_SHORT) in the mark box; full name beside it. */
.brand-mark--text {
  width: auto;
  min-width: 44px;
  padding: 0 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.brand-mark--text span { font-size: 12px; margin-top: 4px; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: 0.2px; line-height: 1.25; }
.brand-full { font-weight: 700; letter-spacing: 0.2px; margin: 18px 0 8px; }
.account { display: flex; align-items: center; gap: 18px; font-size: 17px; }
.account-name {
  border-right: 1px solid var(--line);
  padding-right: 18px;
  font-weight: 600;
  color: var(--ink-soft);
}
.top-label { font-size: 16px; color: var(--muted); }

main { max-width: 1240px; margin: 0 auto; padding: 42px 0 64px; min-height: calc(100vh - 166px); }

/* --- App shell: sidebar + workspace (authenticated pages) --- */
.topbar-tools { display: flex; align-items: center; gap: 18px; }
.shell-search input { width: 300px; padding: 9px 13px; font-size: 15px; border-radius: var(--radius-pill); }
.shell {
  display: flex;
  align-items: flex-start;
  max-width: 1560px;
  margin: 0 auto;
}
.shell main { flex: 1 1 auto; min-width: 0; margin: 0; padding: 42px 36px 64px; }
.sidebar {
  flex: 0 0 284px;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 86px);
  overflow-y: auto;
  padding: 30px 18px 30px 26px;
  border-right: 1px solid var(--line);
}
.sidebar-heading {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: var(--muted);
  margin: 22px 0 10px;
}
.sidebar-nav .sidebar-heading { margin-top: 0; }
.sidebar-nav a {
  display: block;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-weight: 650;
  font-size: 16px;
}
.sidebar-nav a:hover { background: var(--green-soft); }
.sidebar-group { margin-bottom: 12px; }
.sidebar-company-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-company { font-weight: 750; font-size: 15.5px; padding: 5px 10px; }
.sidebar-toggle {
  padding: 2px 8px;
  font-size: 14px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.sidebar-plants { list-style: none; margin: 4px 0 0; padding: 0 0 0 10px; }
.sidebar-group.is-closed .sidebar-plants { display: none; }
.sidebar-plants a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.sidebar-plants a:hover { background: var(--green-soft); }
.sidebar-code { color: var(--muted); font-size: 13px; }
.sidebar-empty { color: var(--muted); font-size: 14px; padding: 4px 10px; }
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 9px;
  background: #c3cec4;
}
.status-dot.is-online { background: var(--green); box-shadow: 0 0 0 3px rgba(20, 122, 84, 0.16); }
.status-dot.is-offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(169, 59, 48, 0.12); }
.live-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.htmx-indicator { display: none; }
/* Dashboard stage-3 pieces: attention center, company groups, filters. */
.filter-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin: 6px 0 18px; }
.filter-bar label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.filter-bar select, .filter-bar input { min-width: 190px; }
.attention-panel {
  border: 1px solid var(--danger-border);
  background: var(--danger-soft);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 10px 0 22px;
}
.attention-list { margin: 4px 0 6px; padding-left: 6px; list-style: none; }
.attention-list li { padding: 4px 0; }
.attention-list a { font-weight: 700; }
.dash-group { margin: 10px 0 26px; }
.dash-group > summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 19px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
}
.dash-group .station-grid { margin-top: 16px; }
.plants-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius-md); overflow: hidden; }
.plants-table th, .plants-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.plants-table th { font-size: 13px; letter-spacing: 1px; color: var(--muted); background: var(--surface-subtle); }
.tab-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; border-bottom: 2px solid var(--line); }
.tab-nav a { padding: 10px 14px; font-weight: 650; border-radius: var(--radius-sm) var(--radius-sm) 0 0; color: var(--ink-soft); }
.tab-nav a:hover { background: var(--green-soft); }
.tab-nav a.is-active { background: var(--green); color: #fff; }
.config-block { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px 18px; margin: 14px 0; background: var(--white); }
.config-block table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.config-block th, .config-block td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 15px; vertical-align: top; }
.config-diff { color: var(--danger); font-weight: 700; }
.pager { display: flex; gap: 14px; align-items: center; margin: 16px 0; }
footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 0;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 1.4px;
}
footer b { margin: 0 12px; color: #becbc1; }

/* --- Typography & Section Headers --- */
.eyebrow {
  font-size: 14px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--green);
  margin: 0 0 10px;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(20, 122, 84, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(20, 122, 84, 0); }
}
.tiny-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 7px;
  animation: pulse-dot 2.4s infinite;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 37px; letter-spacing: -1.2px; line-height: 1.2; margin-bottom: 10px; font-weight: 700; }
h2 { font-size: 21px; font-weight: 650; letter-spacing: -0.3px; }
.heading-dot { color: var(--green); }
.muted { color: var(--muted); font-size: 17px; line-height: 1.65; }
.page-heading { display: flex; justify-content: space-between; align-items: center; margin: 0 0 32px; gap: 20px; }
.page-heading p:last-child { margin-bottom: 0; }
.refresh-note {
  display: inline-flex;
  align-items: center;
  font-size: 15px;
  color: var(--ink-soft);
  background: var(--white);
  border: 1px solid var(--line);
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}

/* --- Metrics Strip Component --- */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-lg);
  margin-bottom: 38px;
  padding: 26px 0;
  box-shadow: var(--shadow-sm);
}
.metrics > div { padding: 0 32px; border-right: 1px solid var(--line); }
.metrics > div:last-child { border: 0; }
.metrics span { font-size: 13px; color: var(--muted); letter-spacing: 1.5px; font-weight: 700; }
.metrics strong { display: block; font-size: 36px; margin-top: 12px; font-weight: 650; }
.metrics small { font-size: 15px; font-weight: 400; color: var(--muted); margin-left: 14px; letter-spacing: 0; }
.green { color: var(--green) !important; }

.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 20px; }
.section-heading h2 { margin: 0; font-size: 21px; }
.section-heading > span {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 1.5px;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  padding: 4px 11px;
  border-radius: var(--radius-pill);
}

/* --- Station Cards & Badges --- */
.station-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.station-card {
  padding: 25px 26px 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease), border-color 0.24s var(--ease);
}
.station-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--green-border);
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.station-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
  font-size: 22px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.online { color: var(--green); background: var(--green-soft); border-color: var(--green-border); }
.online i { animation: pulse-dot 2.4s infinite; }
.offline { color: #866e4a; background: #f8f3ea; border-color: #eadcc5; }

.station-card h2 { margin-bottom: 6px; font-size: 25px; overflow-wrap: anywhere; }
.host { font-size: 15px; color: var(--muted); margin-bottom: 22px; overflow-wrap: anywhere; }
.station-meta { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; font-size: 15px; }
.station-meta span { font-size: 13px; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
.station-meta strong { font-weight: 600; color: var(--ink-soft); }

.mini-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  margin-bottom: 18px;
}
.mini-modules div { width: 33.333%; min-width: 100px; border-right: 1px solid var(--line); padding-left: 20px; }
.mini-modules div:first-child { padding-left: 0; }
.mini-modules div:last-child { border: 0; }
.mini-modules b { display: block; font-size: 14px; letter-spacing: 1px; margin-bottom: 5px; }
.mini-modules span { font-size: 15px; color: var(--muted); }

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-subtle);
  margin: 0 -26px;
  padding: 15px 26px;
  gap: 10px;
}
.card-bottom span { font-size: 13px; color: var(--muted); }
.card-bottom a { font-size: 15px; font-weight: 700; color: var(--green); white-space: nowrap; }
.card-bottom a:hover { color: var(--green-hover); }

/* --- Register Panel & Empty States --- */
.register-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--green-border);
  border-radius: var(--radius-lg);
  padding: 26px 30px;
  gap: 24px;
  margin-top: 32px;
  background: linear-gradient(135deg, #eff7f1 0%, #e7f2e9 100%);
  box-shadow: var(--shadow-xs);
}
.register-panel h2 { margin-bottom: 6px; }
.register-panel p:last-child { margin: 0; font-size: 15px; }
.register-panel form { display: flex; gap: 10px; min-width: 46%; }
.register-panel input { min-width: 0; flex: 1; }
.register-panel .eyebrow { font-size: 13px; }

.empty {
  text-align: center;
  padding: 52px 25px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  grid-column: 1 / -1;
  background: var(--white);
  box-shadow: var(--shadow-xs);
}
.empty > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 28px;
}
.empty h2 { margin-top: 16px; }
.empty p { color: var(--muted); font-size: 17px; margin-bottom: 0; }
.compact { border: 0; box-shadow: none; padding: 36px 20px; }
.compact h3 { font-size: 18px; margin-bottom: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

/* --- Form Fields (Input, Select, Textarea, Checkbox) --- */
input, .operation-form textarea, .operation-form select {
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font-size: 17px;
  width: 100%;
  box-shadow: inset 0 1px 2px rgba(20, 36, 29, 0.03);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
input:hover, .operation-form textarea:hover, .operation-form select:hover {
  border-color: #9eb4a3;
}
input:focus, .operation-form textarea:focus, .operation-form select:focus {
  border-color: var(--green);
  box-shadow: var(--ring);
  outline: none;
}
label { font-size: 16px; font-weight: 600; display: block; color: var(--ink-soft); }
label input { margin-top: 8px; }

.stack { display: flex; flex-direction: column; gap: 22px; }
.stack .primary { justify-content: space-between; margin-top: 4px; padding: 14px 18px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
fieldset legend { font-size: 15px; font-weight: 700; color: var(--ink-soft); padding: 0 6px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-top: 8px; }
.checkbox-row input { width: auto; margin-top: 0; }

/* --- Login View --- */
.login-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 90px;
  max-width: 1060px;
  margin: 45px auto 20px;
  align-items: center;
}
.login-intro { position: relative; min-height: 490px; padding-top: 10px; }
.login-intro h1 { font-size: 61px; line-height: 1.08; font-weight: 700; letter-spacing: -2.2px; margin: 28px 0 22px; }
.lede { max-width: 370px; color: var(--muted); font-size: 18px; line-height: 1.75; }
.module-pills { display: flex; gap: 10px; margin-top: 30px; }
.module-pills span {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 1.5px;
  border: 1px solid var(--green-border);
  background: var(--green-soft);
  color: var(--green);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
}
.login-panel {
  padding: 40px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.login-panel h2 { font-size: 28px; margin: 12px 0 8px; }
.login-panel > .muted { margin-bottom: 28px; }
.login-note {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin: 25px 0 0;
  line-height: 1.7;
}
.signal-art { position: absolute; width: 150px; height: 150px; bottom: 0; left: 270px; opacity: 0.8; }
.signal-art i { position: absolute; border: 1px solid #bdd9c4; border-radius: 100%; inset: 0; }
.signal-art i:nth-child(2) { inset: 23px; }
.signal-art i:nth-child(3) { inset: 46px; }
.signal-art span { position: absolute; inset: 50px; display: grid; place-items: center; font-size: 37px; color: var(--green); }

/* --- Alerts & Banners --- */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 16px;
  line-height: 1.65;
  background: var(--orange-soft);
  color: #825318;
  border: 1px solid var(--orange-border);
  margin-bottom: 22px;
  box-shadow: var(--shadow-xs);
}
.alert strong { font-weight: 700; }
.observe {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green-border);
}
.observe strong { white-space: nowrap; }
.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

.back-link {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}
.back-link:hover {
  background: var(--white);
  border-color: var(--green-border);
  color: var(--green);
}

/* --- Module Cards --- */
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.module-card {
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}
.module-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.module-card-heading h2 { font-size: 24px; margin: 0; letter-spacing: 0.2px; }
.module-card > .muted { font-size: 15px; }
.module-detail { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; background: var(--surface-subtle); padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.module-facts { padding-top: 8px; display: grid; grid-template-columns: 1fr; gap: 4px; margin-bottom: 20px; }
.module-facts dt { font-size: 14px; color: var(--muted); margin-top: 9px; }
.module-facts dd { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.command-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 18px; }
.command-buttons button { width: 100%; font-size: 15px; padding: 10px 8px; white-space: nowrap; }
.autostart-form { margin-top: 14px; }
.autostart-form button { font-size: 15px; }

/* --- Command History & Terminal Logs --- */
.history-heading { margin-top: 40px; margin-bottom: 10px; }
.history-note { font-size: 15px; }
.history {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.history-item {
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
  transition: background-color 0.16s var(--ease);
}
.history-item:hover { background: var(--surface-subtle); }
.history-item:last-child { border: 0; }
.history-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.history-row > div { display: flex; gap: 16px; align-items: center; }
.history-row b {
  font-size: 15px;
  letter-spacing: 1px;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
  padding: 5px 10px;
  border-radius: 7px;
}
.history-row span { font-size: 16px; font-weight: 600; }
.history-row small { font-size: 14px; color: var(--muted); }
.command-status {
  font-size: 14px !important;
  font-weight: 650;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  border: 1px solid transparent;
}
.succeeded { color: var(--green); background: var(--green-soft); border-color: var(--green-border); }
.failed { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.queued, .delivered { background: var(--orange-soft); color: var(--orange); border-color: var(--orange-border); }
.expired { color: var(--muted); background: #f0f2ef; border-color: var(--line); }
.result-message { font-size: 16px; margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.command-id { font-size: 13px; color: #94a198; margin: 10px 0 0; font-family: var(--font); }

details { margin-top: 14px; }
summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--green);
  line-height: 1.7;
  transition: color 0.16s var(--ease);
}
summary:hover { color: var(--green-hover); }
pre {
  background: #12221b;
  color: #d6ebe0;
  font-size: 15px;
  line-height: 1.75;
  font-family: var(--font);
  padding: 18px 20px;
  max-height: 400px;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid #243d32;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 0;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
}

.station-settings { padding: 22px 0; }
.station-settings summary { color: var(--muted); }
.station-settings p { font-size: 16px; }
.station-settings p:first-of-type { margin-top: 18px; }

/* --- Token Panel --- */
.token-panel {
  max-width: 780px;
  margin: 25px auto;
  padding: 38px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.token-panel h1 { font-size: 32px; overflow-wrap: anywhere; }
.token-panel p { font-size: 17px; line-height: 1.75; }
.token-panel dt { font-size: 15px; font-weight: 650; color: var(--muted); margin: 25px 0 10px; display: flex; align-items: center; }
.token-panel dd {
  margin: 0;
  background: var(--surface-subtle);
  padding: 15px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}
.token-panel code { font-size: 17px; line-height: 1.75; font-family: var(--font); font-weight: 600; color: var(--ink); }
.token-panel .primary { margin-top: 16px; }

/* --- Workspace Panels & Operations Accordion --- */
.workspace-panel {
  margin-top: 30px;
  padding: 28px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.workspace-panel > details {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.workspace-panel > details > summary {
  font-size: 17px;
  font-weight: 650;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}
.workspace-panel > details > summary::-webkit-details-marker { display: none; }
.workspace-panel > details > summary::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease);
}
.workspace-panel > details[open] > summary { color: var(--green); }
.workspace-panel > details[open] > summary::after {
  content: "−";
  background: var(--green);
  color: var(--white);
}

.operation-form { display: grid; gap: 16px; max-width: 780px; margin: 20px 0; }
.operation-form label { line-height: 1.65; }
.operation-form textarea, .operation-form select {
  display: block;
  margin-top: 8px;
  line-height: 1.6;
  font-family: var(--font);
}
.operation-form textarea { resize: vertical; }
.operation-form > button { justify-self: start; }

/* --- Custom Select Dropdown Component (ui.select_dropdown) --- */
.ui-select-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.ui-select-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.5;
}
.ui-select-req {
  color: var(--danger);
  text-decoration: none;
  margin-left: 4px;
}
.ui-select {
  position: relative;
  width: 100%;
}
.ui-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.ui-select-trigger {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font-size: 17px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  box-shadow: inset 0 1px 2px rgba(20, 36, 29, 0.03), var(--shadow-xs);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s var(--ease);
}
.ui-select--sm .ui-select-trigger { min-height: 40px; padding: 7px 12px; font-size: 15px; }
.ui-select--lg .ui-select-trigger { min-height: 54px; padding: 13px 16px; font-size: 18px; }
.ui-select-trigger:hover:enabled {
  border-color: #9eb4a3;
  transform: none;
}
.ui-select.is-open .ui-select-trigger,
.ui-select-trigger:focus-visible {
  border-color: var(--green);
  box-shadow: var(--ring);
}
.ui-select-field.has-error .ui-select-trigger {
  border-color: var(--danger);
}
.ui-select-trigger-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
}
.ui-select-prefix-icon {
  display: inline-flex;
  align-items: center;
  color: var(--green);
  flex-shrink: 0;
}
.ui-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.ui-select.is-multiple .ui-select-value {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  white-space: normal;
}
.ui-select-value.is-placeholder {
  color: var(--muted);
  font-weight: 400;
}
.ui-select-trigger-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ui-select-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--muted);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.ui-select-clear:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.ui-select-chevron {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  transition: transform 0.22s var(--ease), color 0.18s var(--ease);
}
.ui-select.is-open .ui-select-chevron {
  transform: rotate(180deg);
  color: var(--green);
}

/* Badges inside Trigger & Options */
.ui-select-trigger-badge,
.ui-select-option-badge {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.6px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--ink-soft);
  white-space: nowrap;
  flex-shrink: 0;
}
.tone-online {
  color: var(--green);
  background: var(--green-soft);
  border-color: var(--green-border);
}
.tone-offline {
  color: #866e4a;
  background: #f8f3ea;
  border-color: #eadcc5;
}
.tone-warning {
  color: var(--orange);
  background: var(--orange-soft);
  border-color: var(--orange-border);
}
.tone-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

/* Multi-select Tag Chips */
.ui-select-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
}

/* Popover Menu */
@keyframes select-popover-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ui-select-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 45;
  background: var(--white);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: select-popover-in 0.16s var(--ease);
}
.ui-select-header {
  padding: 10px 12px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui-select-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.ui-select-search-icon {
  position: absolute;
  left: 11px;
  color: var(--muted);
  display: inline-flex;
  pointer-events: none;
  font-size: 15px;
}
.ui-select-search-input {
  width: 100%;
  padding: 8px 34px 8px 34px !important;
  font-size: 15px !important;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--white);
}
.ui-select-search-clear {
  position: absolute;
  right: 6px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
}
.ui-select-search-clear:hover:enabled {
  color: var(--danger);
  background: var(--danger-soft);
  transform: none;
}
.ui-select-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  padding: 0 2px;
}
.ui-select-count {
  font-weight: 600;
  letter-spacing: 0.4px;
}
.ui-select-bulk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ui-select-bulk .text-button {
  font-size: 13px;
  padding: 0;
}

/* Options List */
.ui-select-list {
  max-height: 270px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ui-select-group-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 4px;
}
.ui-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}
.ui-select-option:hover:not(.is-disabled),
.ui-select-option.is-focused:not(.is-disabled) {
  background: var(--surface-subtle);
}
.ui-select-option.is-selected {
  background: var(--green-soft);
  color: var(--green);
}
.ui-select-option.is-selected:hover:not(.is-disabled) {
  background: #dff1e4;
}
.ui-select-option.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.ui-select-option--empty {
  color: var(--muted);
  font-style: italic;
}
.ui-select-option-icon {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  flex-shrink: 0;
}
.ui-select-option.is-selected .ui-select-option-icon {
  color: var(--green);
}
.ui-select-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.ui-select-option-label {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.ui-select-option-sublabel {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
}
.ui-select-option-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ui-select-option-check {
  display: inline-flex;
  align-items: center;
  color: var(--green);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}
.ui-select-option.is-selected .ui-select-option-check {
  opacity: 1;
  transform: scale(1);
}

/* Empty Search State & Quick Create Bar */
.ui-select-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}
.ui-select-empty p {
  margin: 0 0 10px;
}
.ui-select-quick-from-search {
  font-size: 14px;
  padding: 7px 14px;
  gap: 6px;
}
.ui-select-create {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}
.ui-select-create-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px !important;
  font-size: 15px !important;
}
.ui-select-create-btn {
  padding: 8px 14px;
  font-size: 14px;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ui-select-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  font-size: 14px;
  display: flex;
  justify-content: flex-end;
}
.ui-select-footer a {
  color: var(--green);
  font-weight: 650;
  text-decoration: none;
}
.ui-select-footer a:hover {
  color: var(--green-hover);
  text-decoration: underline;
}
.ui-select-feedback {
  font-size: 14px;
  color: var(--muted);
}
.ui-select-feedback.is-error {
  color: var(--danger);
}

.check-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-weight: 500;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  cursor: pointer;
}
.check-label input {
  width: 18px;
  height: 18px;
  margin: 5px 0 0;
  flex-shrink: 0;
  accent-color: var(--green);
}

.sql-plan {
  margin-top: 20px;
  padding: 22px;
  border: 1px solid var(--orange-border);
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
}
.sql-plan code, .release-row code { overflow-wrap: anywhere; }
.release-row { display: grid; gap: 8px; padding: 18px 0; border-top: 1px solid var(--line); font-size: 16px; }
.release-row span, .release-row small { color: var(--muted); }
.workspace-panel a { color: var(--green); text-decoration: underline; font-weight: 600; }

/* --- Custom Confirmation Modal (<dialog>) --- */
.confirm-modal {
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  max-width: 480px;
  width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg);
}
.confirm-modal::backdrop {
  background: rgba(16, 30, 24, 0.45);
  backdrop-filter: blur(4px);
}
.confirm-modal-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.confirm-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.confirm-modal-head h2 { margin: 0; font-size: 22px; }
.confirm-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--orange-soft);
  color: var(--orange);
  border: 1px solid var(--orange-border);
}
.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* --- Responsive Breakpoints --- */
@media (max-width: 1320px) {
  main, footer { margin-left: 36px; margin-right: 36px; }
  .topbar { padding: 0 36px; }
  .login-layout { gap: 60px; }
}
@media (max-width: 1000px) {
  .shell { flex-direction: column; }
  .shell main { padding: 30px 20px 40px; width: 100%; }
  .sidebar {
    position: static;
    flex: none;
    width: 100%;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px 20px;
  }
  .shell-search { display: none; }
  .module-grid { grid-template-columns: 1fr; }
  .module-card { display: block; }
  .module-facts { grid-template-columns: 1fr 1fr; }
  .module-facts dt { margin-top: 0; }
  .module-facts dd { margin-bottom: 8px; }
  .command-buttons { grid-template-columns: repeat(4, 1fr); }
  .register-panel { align-items: flex-start; flex-direction: column; }
  .register-panel form { width: 100%; }
  .metrics small { display: block; margin: 4px 0 0; }
  .login-layout { gap: 35px; }
  .login-intro h1 { font-size: 47px; }
  .signal-art { left: 160px; }
  .login-panel { padding: 28px; }
}
@media (max-width: 700px) {
  .topbar { height: 76px; padding: 0 20px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .brand-mark--text { width: auto; min-width: 36px; font-size: 14px; }
  /* The full product name is long; narrow screens keep only the wordmark. */
  .brand-name { display: none; }
  .account-name, .top-label { display: none; }
  .account { gap: 0; }
  .account button { font-size: 15px; padding: 8px 12px; }
  main { padding: 30px 0 40px; margin: 0 20px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 17px; }
  h1 { font-size: 31px; }
  .refresh-note { padding: 7px 12px; font-size: 14px; }
  .metrics { padding: 20px 0; margin-bottom: 28px; }
  .metrics > div { padding: 0 14px; }
  .metrics span { font-size: 13px; letter-spacing: 0.7px; }
  .metrics strong { font-size: 31px; }
  .metrics small { font-size: 13px; line-height: 1.6; }
  .station-grid { grid-template-columns: 1fr; }
  .station-card { padding: 20px 20px 0; }
  .card-bottom { margin: 0 -20px; padding: 15px 20px; }
  .section-heading h2 { font-size: 21px; }
  .register-panel { padding: 22px; }
  .register-panel form { flex-direction: column; }
  .register-panel button { justify-content: space-between; }
  .login-layout { display: block; margin: 0 auto; }
  .login-intro { min-height: 0; padding: 10px 5px 25px; }
  .login-intro h1 { font-size: 45px; margin: 20px 0; }
  .login-intro .lede { font-size: 17px; }
  .module-pills, .signal-art { display: none; }
  .login-panel { padding: 26px; }
  .login-panel h2 { font-size: 25px; }
  .login-note { font-size: 13px; }
  .observe { flex-direction: column; align-items: flex-start; gap: 6px; }
  .module-grid { gap: 16px; }
  .module-card { padding: 20px; }
  .command-buttons { grid-template-columns: repeat(2, 1fr); }
  .history-row > div { flex-wrap: wrap; gap: 8px 12px; }
  .history-row small { width: 100%; }
  .history-row { align-items: flex-start; gap: 10px; }
  .history-item { padding: 16px; }
  .command-status { font-size: 13px !important; padding: 5px 8px; }
  .history-heading { margin-top: 28px; }
  .token-panel { padding: 25px 20px; margin-top: 5px; }
  .token-panel code { font-size: 15px; }
  footer { margin: 0 20px; padding: 22px 0; font-size: 13px; letter-spacing: 0.5px; gap: 15px; }
  footer span:last-child { text-align: right; }
}

/* --- Review pass: consistent native selects, shell navigation, live module state --- */
select {
  appearance: none;
  -webkit-appearance: none;
  padding: 11px 40px 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6f63' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 13px center;
  color: var(--ink);
  font-size: 16px;
  width: 100%;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(20, 36, 29, 0.03);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
select:hover { border-color: #9eb4a3; }
select:focus { border-color: var(--green); box-shadow: var(--ring); outline: none; }
label select { margin-top: 8px; }
.filter-bar { align-items: flex-end; gap: 16px; margin: 0 0 26px; }
.filter-bar label { gap: 0; font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0.3px; }
.filter-bar select, .filter-bar input { min-width: 210px; padding-top: 10px; padding-bottom: 10px; font-size: 16px; }
.filter-bar button { padding: 11px 22px; }

.metrics--four { grid-template-columns: repeat(4, 1fr); }
.metrics--four > div { padding: 0 26px; }
.metrics--four strong { font-size: 34px; }
.metrics--four small { display: block; margin: 6px 0 0; }

.sidebar-nav a { display: flex; align-items: center; gap: 11px; color: var(--ink-soft); }
.sidebar-nav a .ui-icon { width: 18px; height: 18px; flex: 0 0 18px; color: var(--muted); }
.sidebar-nav a.is-active { background: var(--green-soft); color: var(--green); font-weight: 750; }
.sidebar-nav a.is-active .ui-icon { color: var(--green); }
.shell-search { position: relative; display: block; }
.shell-search .ui-icon { position: absolute; left: 14px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.shell-search input { padding-left: 38px; margin-top: 0; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 22px; font-size: 15px; color: var(--muted); }
.breadcrumb a { color: var(--ink-soft); font-weight: 600; }
.breadcrumb a:hover { color: var(--green); }
.breadcrumb b { color: var(--ink); font-weight: 700; }
.plant-head-live { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; font-size: 14px; white-space: nowrap; }

.tab-nav { flex-wrap: nowrap; overflow-x: auto; gap: 4px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tab-nav a { white-space: nowrap; padding: 11px 16px; font-size: 16px; border-radius: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab-nav a:hover { background: transparent; color: var(--green); }
.tab-nav a.is-active { background: transparent; color: var(--green); border-bottom-color: var(--green); font-weight: 750; }

.module-notes { list-style: none; margin: 10px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.module-notes li { font-size: 14px; font-weight: 600; padding: 6px 10px; border-radius: var(--radius-sm); background: #fff7e6; color: #8a5a00; border: 1px solid #f1dcae; }
.module-notes li.is-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.module-card-heading h2 { font-size: 20px; line-height: 1.3; }
.module-card-heading { align-items: flex-start; }

.attention-panel .section-heading { margin-top: 4px; }
.attention-list { display: grid; gap: 4px; padding-left: 0; }
.attention-list li { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; border-top: 1px solid var(--danger-border); }
.attention-list li:first-child { border-top: 0; }
.attention-list .status-dot { margin-top: 8px; }
.attention-list small { color: var(--muted); font-size: 14px; margin-left: 6px; }
.dash-group > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; list-style: none; }
.dash-group > summary::-webkit-details-marker { display: none; }
.dash-group > summary > span:first-child::before { content: "▸"; display: inline-block; margin-right: 10px; color: var(--green); transition: transform 0.15s var(--ease); }
.dash-group[open] > summary > span:first-child::before { transform: rotate(90deg); }
.dash-group-count { font-size: 14px; font-weight: 600; color: var(--muted); }
.station-card h2 .sidebar-code { font-size: 14px; font-weight: 600; }

.error-panel { max-width: 640px; margin: 40px auto; padding: 34px 36px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.error-panel h1 { font-size: 28px; margin: 6px 0 12px; }
.error-panel .actions { display: flex; gap: 12px; margin-top: 24px; }

@media (max-width: 1100px) {
  .metrics--four { grid-template-columns: repeat(2, 1fr); row-gap: 22px; }
  .metrics--four > div:nth-child(2n) { border-right: 0; }
  .plant-head-live { align-items: flex-start; }
}

/* Wide forms inside a register panel stack under its intro instead of squeezing beside it. */
.register-panel:has(.operation-form) { display: block; }
.register-panel:has(.operation-form) form { display: grid; min-width: 0; }
.register-panel:has(.operation-form) > div { margin-bottom: 18px; }
.register-panel:has(.operation-form) .operation-form { max-width: none; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.register-panel:has(.operation-form) .operation-form textarea,
.register-panel:has(.operation-form) .operation-form button,
.register-panel:has(.operation-form) .operation-form .check-label { grid-column: 1 / -1; }
.register-panel:has(.operation-form) .operation-form button { justify-self: start; }
.operation-form .check-label { display: flex; align-items: center; gap: 10px; }
.operation-form .check-label input { width: auto; margin: 0; flex: 0 0 auto; }

@media (max-width: 1000px) {
  .shell-search { display: none; }
  .topbar-tools { gap: 10px; }
  .sidebar { padding: 10px 14px; }
  .sidebar-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
  .sidebar-nav .sidebar-heading, .sidebar-tree { display: none; }
  .sidebar-nav a { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; font-size: 15px; }
  .metrics--four { grid-template-columns: repeat(2, 1fr); }
  .filter-bar select, .filter-bar input { min-width: 0; width: 100%; }
  .filter-bar label { flex: 1 1 100%; }
  .plants-table { display: block; overflow-x: auto; }
  .plant-head-live { align-items: flex-start; white-space: normal; }
}

/* Filter bars use the custom dropdown component like the rest of the admin. */
.filter-bar .ui-select-field { min-width: 210px; flex: 0 1 240px; }
.filter-bar .ui-select-field .ui-select-label { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0.3px; }
@media (max-width: 1000px) { .filter-bar .ui-select-field { flex: 1 1 100%; } }
.filter-bar .ui-select-popover { min-width: max(100%, 320px); }
