:root {
  color-scheme: light;
  --ink: #17232c;
  --muted: #687783;
  --line: #dfe6e8;
  --surface: #ffffff;
  --canvas: #f4f7f7;
  --accent: #0f766e;
  --accent-dark: #0b5e58;
  --accent-soft: #e1f2ef;
  --danger: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.site-header { background: var(--ink); color: #fff; }
.header-inner, .page-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 32px; padding: 30px 0; }
.eyebrow { margin: 0 0 12px; color: #72c8bc; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 42px); line-height: 1; letter-spacing: -0.03em; }
h2 { margin-bottom: 10px; font-size: 27px; letter-spacing: -0.02em; }
h3 { margin-bottom: 8px; font-size: 17px; }
.subtitle { margin: 0; color: #b9c9cb; font-size: 16px; }
.page-shell { padding: 32px 0 72px; }
.dashboard-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 34px; }
.sidebar { display: flex; flex-direction: column; min-height: 520px; padding: 18px 0; border-right: 1px solid var(--line); }
.sidebar-label, .section-kicker { margin-bottom: 12px; color: #829096; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 5px; padding-right: 18px; }
.sidebar-nav a, .sidebar-nav button { display: block; width: 100%; border: 0; border-radius: 5px; padding: 11px 12px; background: transparent; color: var(--muted); text-align: left; text-decoration: none; font-weight: 700; }
.sidebar-nav a.active, .sidebar-nav a:hover, .sidebar-nav button:hover { background: var(--accent-soft); color: var(--accent-dark); }
.sidebar-footer { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 14px 12px 0 0; border-top: 1px solid var(--line); color: var(--ink); font-size: 12px; }
.sidebar-footer strong, .sidebar-footer small { display: block; }
.sidebar-footer small { margin-top: 3px; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #2fa56f; box-shadow: 0 0 0 4px #e2f4ea; }
.dashboard-content { min-width: 0; }
.intro-row { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.section-kicker { margin-bottom: 8px; color: var(--accent-dark); }
.metrics-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { min-height: 94px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.metric span { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.metric strong { display: block; color: var(--ink); font-size: 20px; }
.muted { color: var(--muted); }
.status { min-height: 24px; margin: 10px 0; color: var(--accent-dark); }
.status.error { color: var(--danger); }
.script-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.script-card { display: flex; flex-direction: column; min-height: 220px; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 16px rgba(23, 35, 44, 0.04); }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.script-card h3 { margin-bottom: 6px; font-size: 19px; }
.version { flex: 0 0 auto; padding: 4px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 700; }
.card-description { flex: 1; margin: 14px 0 20px; color: var(--muted); line-height: 1.6; }
.card-date { margin-bottom: 14px; color: #8b989d; font-size: 12px; }
.install-link { display: inline-flex; justify-content: center; padding: 11px 14px; border-radius: 5px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 700; }
.install-link:hover { background: var(--accent-dark); }
.empty-state { padding: 70px 20px; border: 1px dashed #b7c5c7; text-align: center; color: var(--muted); }
.primary-button, .secondary-button, .close-button { border: 0; border-radius: 5px; padding: 10px 15px; font-weight: 700; }
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { background: #edf2f2; color: var(--ink); }
.secondary-button:hover { background: #dce7e7; }
.site-header .secondary-button { background: #fff; color: var(--ink); }
.admin-dialog { width: min(1080px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 80px rgba(0, 0, 0, .25); }
.admin-dialog::backdrop { background: rgba(23, 35, 44, .62); }
.dialog-close-form { position: absolute; top: 18px; right: 18px; }
.close-button { background: transparent; color: var(--muted); }
.dialog-content { padding: 34px; overflow: auto; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 24px; }
.security-note { color: var(--muted); font-size: 12px; }
.admin-login-view { max-width: 440px; padding: 18px 0 28px; }
.admin-login-view h3 { margin-bottom: 8px; font-size: 22px; }
.login-form { margin-top: 20px; }
.login-form .primary-button { margin-top: 16px; }
.workspace-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: #f7fbfb; }
.workspace-toolbar strong, .workspace-toolbar span { display: block; }
.workspace-toolbar span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.token-settings { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 1.3fr); gap: 18px; margin-bottom: 24px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.token-settings h3 { margin-bottom: 6px; }
.token-settings .muted { margin-bottom: 0; font-size: 12px; }
.token-settings-fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: start; }
.token-settings .editor-status { grid-column: 2 / -1; margin-top: 0; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, .6fr); gap: 28px; margin-top: 18px; }
.script-form { min-width: 0; }
.field-label { display: block; margin: 14px 0 7px; font-size: 13px; font-weight: 700; }
.text-input, .code-input { width: 100%; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); padding: 10px 12px; }
.text-input:focus, .code-input:focus { outline: 2px solid #8bd1c7; outline-offset: 1px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.script-dropzone { display: flex; flex-direction: column; align-items: center; gap: 5px; margin-bottom: 10px; padding: 18px; border: 1px dashed #9bb8b7; border-radius: 5px; background: #f4fbfa; color: var(--accent-dark); text-align: center; cursor: pointer; }
.script-dropzone span { color: var(--muted); font-size: 12px; }
.script-dropzone small { color: var(--muted); font-size: 11px; }
.dropzone-button { margin-top: 6px; padding: 6px 10px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.script-dropzone.is-dragging, .script-dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.code-input { min-height: 330px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.editor-status { min-height: 22px; margin-top: 12px; color: var(--accent-dark); font-size: 13px; }
.editor-status.error { color: var(--danger); }
.admin-list-panel { border-left: 1px solid var(--line); padding-left: 24px; }
.admin-list { display: grid; gap: 8px; }
.admin-item { padding: 12px; border: 1px solid var(--line); border-radius: 5px; }
.admin-item strong { display: block; margin-bottom: 5px; }
.admin-item small { display: block; margin-bottom: 10px; color: var(--muted); }
.admin-item-actions { display: flex; gap: 8px; }
.text-button { border: 0; padding: 0; background: transparent; color: var(--accent-dark); font-size: 13px; font-weight: 700; }
.text-button.danger { color: var(--danger); }

@media (max-width: 720px) {
  .header-inner { align-items: start; flex-direction: column; padding: 28px 0; }
  .page-shell { width: min(100% - 28px, 1120px); padding-top: 30px; }
  .dashboard-layout { grid-template-columns: 1fr; gap: 18px; }
  .sidebar { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 16px; }
  .sidebar-nav { grid-template-columns: 1fr 1fr; padding-right: 0; }
  .sidebar-footer { display: none; }
  .intro-row, .dialog-heading { align-items: start; flex-direction: column; }
  .metrics-row { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .token-settings { grid-template-columns: 1fr; }
  .token-settings-fields { grid-template-columns: 1fr; }
  .token-settings .editor-status { grid-column: auto; }
  .admin-list-panel { border-top: 1px solid var(--line); border-left: 0; padding-top: 22px; padding-left: 0; }
  .dialog-content { padding: 28px 20px; }
}
