:root {
  --bg: #0b0f14;
  --surface: #121821;
  --surface-2: #18212e;
  --border: #243041;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-2: #34d399;
  --danger: #f87171;
  --code-bg: #0a0e14;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.5; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: rgba(11, 15, 20, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.2px; }
.subtitle { margin: 0; font-size: 12px; color: var(--muted); }

.search-wrap { position: relative; flex: 1 1 260px; max-width: 420px; }
.search-wrap input {
  width: 100%; padding: 8px 72px 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13px; outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }
.match-count { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.sidebar {
  border-right: 1px solid var(--border); padding: 16px 12px; background: #0e131b;
  position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto;
}
.nav-group { margin-bottom: 18px; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 10px 6px; }
.nav-btn {
  display: block; width: 100%; text-align: left; padding: 7px 10px; margin-bottom: 2px;
  border: none; border-radius: 7px; background: transparent; color: var(--text);
  cursor: pointer; font-size: 13px;
}
.nav-btn:hover { background: var(--surface-2); }
.nav-btn.active { background: rgba(96, 165, 250, 0.16); color: var(--accent); font-weight: 600; }

.content { padding: 20px 24px 40px; max-width: 1320px; width: 100%; }
.zone { margin-bottom: 28px; }
.zone-heading { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--accent-2); border: 1px solid var(--border); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; color: #f8fafc; }
.tag { font-size: 11px; color: var(--muted); background: var(--surface-2); padding: 2px 7px; border-radius: 6px; }

.tool-row { display: flex; gap: 8px; }
.tool-row input, .tool-row select {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--code-bg); color: var(--text);
  font-family: var(--mono); font-size: 12.5px; outline: none;
}
.tool-row input:focus, .tool-row select:focus { border-color: var(--accent); }
.btn {
  padding: 7px 12px; border-radius: 7px; border: 1px solid var(--accent);
  background: rgba(96, 165, 250, 0.14); color: var(--accent); font-weight: 600; font-size: 12.5px; cursor: pointer;
}
.btn:hover { background: rgba(96, 165, 250, 0.25); }

.preset-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-family: var(--mono); cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--accent); }

.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.kv { background: var(--code-bg); border: 1px solid #1b2432; border-radius: 7px; padding: 6px 8px; }
.kv-k { font-size: 11px; color: var(--muted); }
.kv-v { font-family: var(--mono); font-size: 12px; color: var(--text); word-break: break-all; cursor: pointer; }
.kv-v:hover { color: var(--accent); }
.kv-err { grid-column: 1 / -1; color: var(--danger); font-size: 12.5px; }

.cron-desc { font-size: 12.5px; color: var(--accent-2); min-height: 18px; }
.run-list { margin: 0; padding-left: 18px; font-family: var(--mono); font-size: 12px; color: var(--text); display: grid; gap: 3px; }

.item-list { display: flex; flex-direction: column; gap: 7px; }
.item { display: flex; flex-direction: column; gap: 3px; padding-bottom: 7px; border-bottom: 1px solid #1a2330; }
.item:last-child { border-bottom: none; padding-bottom: 0; }
.item-code {
  font-family: var(--mono); font-size: 12px; color: #93c5fd; background: var(--code-bg);
  padding: 5px 8px; border-radius: 6px; border: 1px solid #1b2432; cursor: pointer; overflow-x: auto; white-space: pre;
}
.item-code:hover { border-color: var(--accent); color: #bfdbfe; }
.item-note { font-size: 12px; color: var(--muted); }

.footer { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.toast {
  position: fixed; right: 20px; bottom: 20px; padding: 8px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--accent-2); color: var(--text);
  font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
}
.toast.show { opacity: 1; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 10px; }
  .nav-group { margin-bottom: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
  .nav-title { width: 100%; padding-bottom: 2px; }
  .nav-btn { width: auto; }
  .content { padding: 14px; }
  .kv-grid { grid-template-columns: 1fr; }
}
