:root {
  --bg: #f3f7fb;
  --surface: #f7fafc;
  --card: #ffffff;
  --text: #2c333a;
  --muted: #5c6b7a;
  --accent: #718cb1;
  --accent-soft: #8eafdd;
  --err: #c44b4b;
  --border: #d5dee8;
  --bar: #464645;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  object-position: left center;
}
.logo-login {
  height: 42px;
  max-width: 200px;
  margin: 0 auto;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.brand { display: flex; align-items: center; }
nav { display: flex; gap: 1.1rem; align-items: center; }
nav a { color: var(--muted); font-weight: 500; text-decoration: none; }
nav a:hover { color: var(--text); }

main {
  flex: 1;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 2.5rem;
}
h1 { font-size: 1.35rem; margin: 0 0 .35rem; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 2rem 0 .75rem; font-weight: 600; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; font-weight: 600; }
.muted { color: var(--muted); }
.err { color: var(--err); margin: 0; }
.meta { color: var(--muted); font-size: .9rem; margin: 0 0 1.25rem; }
.meta code {
  font-size: .8em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .1rem .35rem;
  border-radius: 4px;
}

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .65rem; }
.cards a {
  display: flex; flex-direction: column; gap: .2rem;
  padding: .9rem 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  color: inherit; text-decoration: none;
  transition: border-color 160ms ease-out;
}
.cards a:hover { border-color: var(--accent); text-decoration: none; }
.cards span { color: var(--muted); font-size: .88rem; }

.stack { display: flex; flex-direction: column; gap: .7rem; max-width: 26rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
input, select, button {
  font: inherit; padding: .5rem .65rem; border-radius: 6px; border: 1px solid var(--border);
  background: var(--card); color: var(--text);
}
input:focus, select:focus, button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
}
button, .btn {
  background: var(--accent); color: #f7fafc; border: none; font-weight: 600; cursor: pointer;
  width: fit-content; text-decoration: none;
}
button:hover, .btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn-quiet {
  background: transparent; color: var(--muted); border: 1px solid var(--border); font-weight: 500;
}
.btn-quiet:hover { color: var(--text); background: var(--surface); filter: none; }
.btn-ghost {
  background: transparent; color: var(--muted); border: none; font-weight: 500; padding: .25rem .4rem;
  font-size: .8rem;
}
.btn-ghost:hover { color: var(--err); background: color-mix(in srgb, var(--err) 8%, transparent); filter: none; }
.inline { display: inline-flex; gap: .4rem; align-items: center; margin: 0; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface); font-weight: 600; }
tr:last-child td { border-bottom: none; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.15rem;
  margin: 0 0 1rem;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin-bottom: .85rem; padding-bottom: .65rem; border-bottom: 1px solid var(--border);
}
.panel-head h3 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.badge {
  font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent); padding: .2rem .45rem; border-radius: 4px;
}
.badge-ro { background: #eef1f4; color: var(--muted); }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .65rem; min-height: 1.75rem; }
.chip {
  display: inline-flex; align-items: center; gap: .25rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: .2rem .35rem .2rem .55rem;
  font-size: .82rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.chip form { display: inline; margin: 0; }
.chip .btn-ghost { padding: .05rem .35rem; border-radius: 999px; }
.sublabel { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin: 0 0 .35rem; }
.add-row {
  display: flex; gap: .4rem; flex-wrap: wrap; align-items: center;
  padding-top: .55rem; border-top: 1px dashed var(--border); margin-top: .35rem;
}
.add-row input, .add-row select { flex: 1; min-width: 10rem; }

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1000px 480px at 50% -10%, color-mix(in srgb, var(--accent-soft) 28%, transparent), transparent),
    var(--bg);
}
.login-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
}
.login-card {
  width: min(360px, 92vw);
  margin: 0;
  display: flex; flex-direction: column; gap: .85rem;
  padding: 1.75rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px color-mix(in srgb, var(--bar) 6%, transparent);
}
.login-tagline {
  margin: -.25rem 0 .25rem;
  text-align: center;
  color: var(--muted);
  font-size: .92rem;
}
.login-card button { width: 100%; margin-top: .25rem; }

.site-footer {
  margin-top: auto;
  background: var(--bar);
  color: #d7dde4;
  padding: 1.5rem 1.25rem 1.75rem;
  font-size: .82rem;
}
.footer-grid {
  width: min(960px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.footer-title {
  margin: 0 0 .5rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #a8b3c0;
  font-weight: 600;
}
.footer-legal { margin: 0; line-height: 1.5; color: #c5ced8; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.footer-links a { color: #e4eaf0; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-powered { margin: 1rem 0 0; color: #a8b3c0; }
.footer-powered a { color: #e4eaf0; }
.footer-powered strong { color: #fff; font-weight: 600; }

.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
}
.empty { color: var(--muted); font-size: .9rem; margin: .25rem 0 .5rem; }
