:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --text: #1d1c1a;
  --muted: #6b6862;
  --border: #e3e0da;
  --accent: #e8492f;
  --accent-hover: #cf3b23;
  --accent-text: #ffffff;
  --ok-bg: #e7f4ea; --ok-text: #1f6b35;
  --err-bg: #fbe9e6; --err-text: #9b2a17;
  --shadow: 0 1px 2px rgba(20, 18, 15, .06), 0 4px 16px rgba(20, 18, 15, .05);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161514; --surface: #201f1d; --text: #ecebe8; --muted: #9c9891;
    --border: #34322f; --accent: #f05a40; --accent-hover: #ff7258;
    --ok-bg: #1b3022; --ok-text: #8fd3a0; --err-bg: #3a1f1a; --err-text: #f3a493;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161514; --surface: #201f1d; --text: #ecebe8; --muted: #9c9891;
  --border: #34322f; --accent: #f05a40; --accent-hover: #ff7258;
  --ok-bg: #1b3022; --ok-text: #8fd3a0; --err-bg: #3a1f1a; --err-text: #f3a493;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 2px; letter-spacing: -.01em; }
h2.section { font-size: 17px; margin: 40px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
p { margin: 0 0 8px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--accent); font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right form { margin: 0; }
.who { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }

.container { max-width: 960px; margin: 0 auto; padding: 28px 16px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: background-color .12s, border-color .12s;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--border); }
.btn-block { width: 100%; }
.link { font-size: 14px; }

.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.alert-error { background: var(--err-bg); color: var(--err-text); }
.alert-success, .alert-info { background: var(--ok-bg); color: var(--ok-text); }

.bases { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.base { display: flex; align-items: center; gap: 16px; padding: 16px; }
.base-icon {
  flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 700;
}
.base-main { flex: 1; min-width: 0; }
.base-title { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.base-actions { display: flex; gap: 8px; flex: none; }
.hint { margin-top: 14px; }
.empty { padding: 28px; text-align: center; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tr.dim td { opacity: .55; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 99px; }
.tag-red { background: var(--err-bg); color: var(--err-text); }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px 24px; display: grid; gap: 14px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.auth-title { font-size: 20px; }
.auth-title b { color: var(--accent); }
.field { display: grid; gap: 5px; font-size: 14px; }
.field span { color: var(--muted); }
.field input {
  height: 42px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}

@media (max-width: 600px) {
  .base { flex-wrap: wrap; }
  .base-actions { width: 100%; }
  .base-actions .btn-primary { flex: 1; }
  h1 { font-size: 22px; }
}
