:root {
  /* Warm Starlight Stone Canvas + Frosted Porcelain Glass */
  --bg-top: #f5f3ef;
  --bg-bottom: #ece9e2;
  --glass: rgba(255, 254, 251, 0.76);
  --glass-strong: rgba(255, 254, 252, 0.9);
  --glass-border: rgba(42, 36, 28, 0.085);
  --glass-border-strong: rgba(42, 36, 28, 0.145);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.94);

  /* Ink — Warm Charcoal */
  --ink: #1c1b19;
  --ink-2: #3d3b37;
  --muted: #6e6a63;

  /* Brand Accent — Muted Nordic Slate Blue (low-saturation, architectural) */
  --accent: #2e5073;
  --accent-hover: #23405e;
  --accent-soft: rgba(46, 80, 115, 0.095);
  --accent-border: rgba(46, 80, 115, 0.2);
  --accent-ring: rgba(46, 80, 115, 0.18);

  /* Desaturated Semantic Tones */
  --ok-ink: #2b644d;
  --ok-dot: #3a8566;
  --ok-bg: rgba(43, 100, 77, 0.095);
  --amber: #8f5716;
  --amber-bg: rgba(168, 106, 28, 0.1);
  --amber-line: rgba(168, 106, 28, 0.24);
  --red: #ad3931;
  --red-bg: rgba(173, 57, 49, 0.09);
  --red-line: rgba(173, 57, 49, 0.23);

  /* Soft Warm-Tinted Elevation */
  --shadow-xs: 0 1px 2px rgba(34, 28, 20, 0.045);
  --shadow-glass: 0 8px 26px rgba(34, 28, 20, 0.05), 0 1px 2px rgba(34, 28, 20, 0.035);
  --shadow-float: 0 16px 40px rgba(34, 28, 20, 0.075), 0 2px 6px rgba(34, 28, 20, 0.04);
  --shadow-dialog: 0 28px 72px rgba(24, 20, 15, 0.22), 0 4px 16px rgba(24, 20, 15, 0.08);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

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

/* Shell Layout */
.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

/* Floating Liquid Glass Sidebar */
aside {
  position: sticky;
  top: 14px;
  height: calc(100vh - 28px);
  margin: 14px 0 14px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  box-shadow: var(--shadow-float), 0 0 0 1px var(--glass-border), var(--glass-highlight);
  padding: 20px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

aside header {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 6px 18px;
}

aside header img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(34, 58, 84, 0.22);
}

aside header strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
}

aside header small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.overline {
  padding: 2px 12px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

nav {
  display: grid;
  gap: 3px;
}

nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 12px;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 13.5px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

nav button:hover:not(:disabled) {
  background: rgba(42, 36, 28, 0.045);
  border-color: transparent;
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

nav button[aria-current] {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 620;
  box-shadow: 0 2px 8px rgba(34, 28, 20, 0.055), var(--glass-highlight);
}

.nav-ic {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.68;
}

nav button[aria-current] .nav-ic {
  opacity: 1;
  color: var(--accent);
}

aside footer {
  border-top: 1px solid var(--glass-border);
  margin-top: auto;
  padding: 12px 10px 2px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

aside footer small {
  margin-left: auto;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 1px 8px;
}

i {
  width: 6.5px;
  height: 6.5px;
  border-radius: 999px;
  display: inline-block;
  background: var(--ok-dot);
  box-shadow: 0 0 0 3px rgba(58, 133, 102, 0.16);
  flex-shrink: 0;
}

i.live {
  animation: pulse-dot 3s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(58, 133, 102, 0.16);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(58, 133, 102, 0.05);
  }
}

/* Top bar */
.top {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 34px 10px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.crumbs .crumb-root {
  padding: 0;
  color: var(--muted);
}

.crumbs span {
  padding: 0 7px;
  color: rgba(42, 36, 28, 0.24);
}

.crumbs b {
  color: var(--ink);
  font-weight: 600;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

select.lang-select {
  width: auto;
  height: 28px;
  padding: 0 26px 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background-color: var(--glass-strong);
  background-position: right 9px center;
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--glass-border), var(--glass-highlight);
  font-size: 11.5px;
  line-height: 1;
  color: var(--ink-2);
}

.tag {
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: var(--glass-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--glass-border), var(--glass-highlight);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  font-size: 11.5px;
  line-height: 1;
  font-family: var(--mono);
  color: var(--ink-2);
  white-space: nowrap;
}

/* Main content */
#content {
  padding: 14px 34px 64px;
  max-width: 1200px;
  margin: auto;
}

/* Buttons — Porcelain Glass & Nordic Slate Primary Pills */
button {
  cursor: pointer;
  color: var(--ink);
  border: 1px solid var(--glass-border-strong);
  border-radius: 999px;
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 7px 15px;
  font-weight: 560;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: var(--shadow-xs), var(--glass-highlight);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

button:hover:not(:disabled) {
  background: #ffffff;
  border-color: rgba(42, 36, 28, 0.22);
  box-shadow: 0 3px 10px rgba(34, 28, 20, 0.065), var(--glass-highlight);
}

button:active:not(:disabled) {
  transform: scale(0.985);
}

button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.primary {
  color: #fdfbf7;
  background: linear-gradient(180deg, #3a6189 0%, var(--accent) 100%);
  border-color: rgba(28, 52, 78, 0.72);
  box-shadow: 0 4px 14px rgba(46, 80, 115, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #32567b 0%, var(--accent-hover) 100%);
  border-color: rgba(22, 42, 64, 0.85);
  box-shadow: 0 6px 18px rgba(46, 80, 115, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.danger {
  color: var(--red);
  border-color: var(--red-line);
  background: rgba(255, 254, 252, 0.85);
}

.danger:hover:not(:disabled) {
  background: var(--red-bg);
  border-color: rgba(173, 57, 49, 0.36);
}

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  border-radius: 999px;
  color: var(--muted);
}

/* Hero */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.hero h1 {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: -0.032em;
  line-height: 1.15;
  margin: 4px 0 6px;
  color: var(--ink);
}

.hero p,
p.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.kicker {
  color: var(--accent);
  font: 600 11px var(--mono);
  letter-spacing: 0.1em;
  opacity: 0.9;
}

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass), 0 0 0 1px var(--glass-border), var(--glass-highlight);
  overflow: hidden;
}

.metric {
  padding: 15px 18px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.metric:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-float), var(--glass-highlight);
}

.metric:first-child {
  background: linear-gradient(135deg, rgba(46, 80, 115, 0.08) 0%, rgba(255, 254, 251, 0.88) 100%);
  border-color: var(--accent-border);
}

.metric b {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font: 700 29px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.metric:first-child b {
  color: var(--accent);
}

/* Panel & rows */
.panel h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.panel-head {
  padding: 13px 18px;
  background: rgba(255, 254, 252, 0.52);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.panel-head .sub {
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

.row {
  padding: 15px 18px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  transition: background-color 0.14s ease;
}

.row:hover {
  background: rgba(255, 255, 255, 0.58);
}

.row:last-child {
  border-bottom: 0;
}

.row-main {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
}

.symbol {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 11px;
  color: var(--accent);
  font-size: 15px;
  flex-shrink: 0;
}

.row h3 {
  font-size: 14.5px;
  font-weight: 640;
  margin: 0 0 2px;
}

.row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.mono,
pre,
code {
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.sub {
  color: var(--muted);
  font-size: 12px;
}

/* Pills & badges */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(42, 36, 28, 0.055);
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.35;
  font-weight: 560;
  white-space: nowrap;
}

.pill.ok {
  background: var(--ok-bg);
  border-color: rgba(43, 100, 77, 0.18);
  color: var(--ok-ink);
}

.pill.warn {
  background: var(--amber-bg);
  border-color: var(--amber-line);
  color: var(--amber);
}

.pill.bad,
.err,
#error {
  color: var(--red);
}

.pill.bad {
  background: var(--red-bg);
  border-color: var(--red-line);
}

.warn-note {
  margin-top: 8px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--amber-line);
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 12px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.mini {
  font-size: 12px;
  padding: 5px 12px;
}

/* Empty state */
.blank {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.blank b {
  display: block;
  color: var(--ink);
  font-size: 15.5px;
  margin-bottom: 5px;
}

.blank button {
  margin-top: 14px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 14px 4px;
}

/* Filters bar */
.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.filters input:first-child {
  flex: 1;
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='7.25' cy='7.25' r='4.75' stroke='%236e6a63' stroke-width='1.5'/%3E%3Cpath d='M10.8 10.8L13.75 13.75' stroke='%236e6a63' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 14px 14px;
}

.filters select {
  max-width: 196px;
}

.filters .check {
  height: 38px;
  padding: 0 9px 0 6px;
  border-radius: 10px;
  transition: background-color 0.14s ease;
}

.filters .check:hover {
  background: rgba(42, 36, 28, 0.045);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
}

.check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border-radius: 5px;
  border: 1px solid var(--glass-border-strong);
  background-color: rgba(255, 254, 252, 0.92);
  box-shadow: inset 0 1px 2px rgba(34, 28, 20, 0.04);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.check input[type="checkbox"]:hover {
  border-color: rgba(42, 36, 28, 0.28);
}

.check input[type="checkbox"]:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none'%3E%3Cpath d='M2 5.2L4.1 7.3L8.2 2.8' stroke='%23fdfbf7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: 0 1px 3px rgba(46, 80, 115, 0.28);
}

/* Tool cards */
.tool {
  padding: 16px 18px;
  border-bottom: 1px solid var(--glass-border);
  transition: background-color 0.14s ease;
}

.tool:hover {
  background: rgba(255, 255, 255, 0.52);
}

.tool:last-child {
  border: 0;
}

.tool-top {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.tool-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.tool-title h2 {
  font-size: 14px;
  font-weight: 650;
  margin: 0;
  color: var(--ink);
}

.badge {
  display: inline-flex;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(42, 36, 28, 0.045);
  border: 1px solid var(--glass-border);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 560;
}

.badge.warn {
  background: var(--amber-bg);
  border-color: var(--amber-line);
  color: var(--amber);
}

.tool p {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tool details {
  margin-top: 6px;
}

.tool summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 3px 12px;
  cursor: pointer;
  font-weight: 560;
  font-size: 12px;
  list-style: none;
  user-select: none;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.tool summary::-webkit-details-marker {
  display: none;
}

.tool summary::before {
  content: "▸";
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  transform-origin: 45% 50%;
  transition: transform 0.16s ease;
}

.tool details[open] > summary::before {
  transform: rotate(90deg);
}

.tool summary:hover {
  background: rgba(46, 80, 115, 0.15);
}

.tool details > p.sub {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.tool details label {
  display: block;
  margin: 12px 0 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}

/* Playground box */
.try-box {
  margin-top: 14px;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 254, 251, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.try-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.try-result {
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 11px;
  background: rgba(43, 100, 77, 0.065);
  border: 1px solid rgba(43, 100, 77, 0.18);
  font-size: 12px;
  color: var(--ink);
}

.try-result strong {
  color: var(--ok-ink);
}

.try-result.err {
  background: var(--red-bg);
  border-color: var(--red-line);
  color: var(--red);
}

.try-result.err strong {
  color: var(--red);
}

.try-result pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  max-height: 260px;
  overflow: auto;
  line-height: 1.5;
}

/* Activity logs */
.log-row {
  padding: 13px 18px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background-color 0.12s ease;
}

.log-row-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.log-details {
  margin-top: 2px;
}

.log-details summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 560;
  color: var(--accent);
}

.settings-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass), 0 0 0 1px var(--glass-border), var(--glass-highlight);
  margin-bottom: 14px;
}

.settings-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}

select.auto-select {
  width: auto;
  height: 32px;
  padding: 0 28px 0 10px;
  background-position: right 9px center;
  font-size: 12.5px;
}

/* Segmented controls (macOS 26 style) */
.seg-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.seg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.seg-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 64px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(42, 36, 28, 0.055);
  border: 1px solid var(--glass-border);
}

.segmented button {
  border: 1px solid transparent;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  border-radius: 9px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 540;
  color: var(--ink-2);
}

.segmented button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.55);
  border-color: transparent;
  box-shadow: none;
  color: var(--ink);
}

.segmented button[aria-selected="true"] {
  background: #ffffff;
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 620;
  box-shadow: 0 1px 4px rgba(34, 28, 20, 0.08), var(--glass-highlight);
}

.snippet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.snippet-bar p {
  margin: 0;
}

.token-controls {
  margin-top: 12px;
}

.tool-icon {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  object-fit: contain;
  flex-shrink: 0;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.template-card {
  padding: 12px 13px;
  border: 1px solid var(--glass-border);
  border-radius: 13px;
  background: rgba(255, 254, 251, 0.8);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.template-card p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  flex: 1;
}

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 254, 251, 0.72);
}

@media (max-width: 610px) {
  .template-grid {
    grid-template-columns: 1fr;
  }
}

.log-row:hover {
  background: rgba(255, 255, 255, 0.56);
}

.log-row:last-child {
  border-bottom: 0;
}

.log-main {
  min-width: 0;
}

.log-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.log-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Import preview */
.import-list {
  display: grid;
  gap: 8px;
}

.import-item {
  padding: 11px 13px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 254, 251, 0.78);
  font-size: 12px;
}

.import-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

/* Stacks & snippets */
.stack {
  display: grid;
  gap: 14px;
}

.inside {
  padding: 16px 18px;
}

.snippet {
  padding: 13px 15px;
  background: #f3f1ec;
  border: 1px solid var(--glass-border);
  color: #27333f;
  border-radius: 12px;
  white-space: pre-wrap;
  margin: 8px 0 11px;
  font-size: 12px;
  line-height: 1.55;
}

.inside p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

/* Form controls */
input:not([type="checkbox"]),
textarea,
select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--glass-border-strong);
  border-radius: 11px;
  background-color: rgba(255, 254, 252, 0.9);
  padding: 8px 11px;
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(34, 28, 20, 0.025);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input:not([type="checkbox"]),
select {
  height: 38px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%236e6a63' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 12px;
}

input:not([type="checkbox"]):hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled) {
  border-color: rgba(42, 36, 28, 0.24);
  background-color: #ffffff;
}

input:not([type="checkbox"]):focus,
textarea:focus,
select:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

::placeholder {
  color: var(--muted);
  opacity: 0.72;
}

input[readonly] {
  background-color: rgba(42, 36, 28, 0.045);
  color: var(--muted);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

label {
  font-weight: 580;
  font-size: 13px;
}

label input:not([type="checkbox"]),
label textarea,
label select {
  display: block;
  margin-top: 5px;
  font-weight: 400;
}

.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Dialogs — macOS Sheet / Warm Liquid Glass Window */
dialog {
  width: min(650px, calc(100% - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: rgba(252, 250, 246, 0.94);
  backdrop-filter: blur(32px) saturate(140%);
  -webkit-backdrop-filter: blur(32px) saturate(140%);
  box-shadow: var(--shadow-dialog), var(--glass-highlight);
}

dialog[open] {
  animation: dialog-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

dialog::backdrop {
  background: rgba(28, 25, 20, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

dialog header,
dialog footer {
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

dialog header {
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 254, 252, 0.55);
}

dialog footer {
  border-top: 1px solid var(--glass-border);
  background: rgba(255, 254, 252, 0.55);
  justify-content: flex-end;
}

dialog h2 {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

dialog header small {
  color: var(--accent);
  font: 600 10.5px var(--mono);
  letter-spacing: 0.1em;
}

.form-inner {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  max-height: 65vh;
  overflow: auto;
}

.form-inner > div:not(.cols):not([hidden]) {
  display: grid;
  gap: 10px;
}

.tip {
  margin: 0;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: rgba(42, 36, 28, 0.038);
  font-size: 12px;
  color: var(--muted);
}

#error,
#import-error {
  margin: 0;
  font-size: 12.5px;
}

/* Toast — Warm Obsidian HUD Pill */
#toast {
  position: fixed;
  z-index: 10;
  bottom: 20px;
  right: 20px;
  max-width: min(440px, calc(100% - 40px));
  padding: 10px 18px;
  background: rgba(30, 36, 44, 0.9);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fdfbf7;
  font-size: 13px;
  font-weight: 540;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(24, 20, 15, 0.22);
  animation: toast-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#toast.err {
  background: rgba(173, 57, 49, 0.92);
}

/* Login card (remote mode) */
.login-wrap {
  display: flex;
  justify-content: center;
  padding: 48px 0;
}

.login-card {
  width: min(420px, 100%);
  padding: 26px 24px;
  display: grid;
  gap: 12px;
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float), var(--glass-highlight);
}

.login-card h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.login-card p {
  margin: 0;
}

/* Responsive */
@media (max-width: 830px) {
  .shell {
    grid-template-columns: 204px minmax(0, 1fr);
  }
  #content,
  .top {
    padding-left: 20px;
    padding-right: 20px;
  }
  .row,
  .log-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 610px) {
  .shell {
    display: block;
  }
  aside {
    position: static;
    height: auto;
    margin: 10px 10px 0;
    border-radius: 16px;
    gap: 8px;
    padding: 10px 10px;
  }
  aside header {
    margin: 0 2px;
  }
  aside header img {
    width: 30px;
    height: 30px;
  }
  aside footer,
  .overline {
    display: none;
  }
  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
  }
  nav button {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    text-align: center;
    padding: 6px 2px;
    font-size: 10px;
    border-radius: 10px;
    overflow: hidden;
  }
  nav button span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-ic {
    width: 14px;
    height: 14px;
  }
  .top {
    min-height: 42px;
    padding: 10px 14px 4px;
  }
  #content {
    padding: 12px 12px 44px;
  }
  .hero {
    align-items: start;
  }
  .hero p {
    font-size: 12px;
  }
  .hero button {
    font-size: 11.5px;
    padding: 6px 11px;
  }
  .metrics {
    gap: 8px;
  }
  .metric {
    padding: 10px 11px;
    font-size: 10.5px;
  }
  .metric b {
    font-size: 21px;
  }
  .cols {
    grid-template-columns: 1fr;
  }
  .filters {
    flex-wrap: wrap;
  }
  .filters input {
    flex-basis: 50%;
  }
  .filters select {
    max-width: 130px;
  }
  .tool-top {
    flex-wrap: wrap;
  }
}
