@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url(/static/fonts/Poppins-Regular.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url(/static/fonts/Poppins-Medium.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url(/static/fonts/Poppins-SemiBold.woff2) format("woff2"); }

:root {
  --ink: #0d0d0d; --text: #4e4e4e; --muted: #798490; --line: #cacaca;
  --bg: #f4f4f1; --panel: #ffffff; --accent: #990000;
  --ok: #008b27; --warn: #ffb514; --info: #00abc8; --info-bg: #e0f7fb;
}

* { box-sizing: border-box; border-radius: 0; box-shadow: none; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 Poppins, system-ui, sans-serif; }
h1, h2 { color: var(--ink); font-weight: 600; margin: 0 0 12px; line-height: 1.3; }
h1 { font-size: 20px; }
h2 { font-size: 14px; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--ink); color: #fff; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.muted { color: var(--text); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar img { display: block; }
.usermenu { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--ink); font-weight: 500; }
.crumbs { padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 13px; font-weight: 500; }
.crumbs:empty { display: none; }
.crumbs a { color: var(--text); font-weight: 400; text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

.layout { display: flex; align-items: flex-start; }
.sidebar { width: 220px; flex: none; margin: 16px 0 16px 16px; background: var(--panel); border: 1px solid var(--line); }
main { flex: 1; min-width: 0; padding: 16px; }

.nav-item { display: block; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.sidebar .nav-item:last-child { border-bottom: 0; }
a.nav-item:hover { background: var(--bg); }
.nav-item:focus-visible { outline-offset: -4px; }
.nav-item.is-active { background: var(--ink); color: #fff; font-weight: 600; }
.nav-item.is-active:focus-visible { outline-color: #fff; }
.nav-item.is-locked { color: var(--muted); opacity: 0.7; cursor: not-allowed; }
.nav-item.is-soon { color: var(--text); }
.nav-item small { font-size: 11px; }

.pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pagehead h1 { margin: 0; }
.tabs { display: flex; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 6px 16px; margin-bottom: -1px; border: 1px solid transparent; color: var(--text); text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { border-color: var(--line); border-bottom-color: var(--bg); color: var(--ink); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 16px; }
main > .panel + .panel { margin-top: 16px; }
.panel-narrow { max-width: 480px; }
.login { max-width: 360px; margin: 48px auto; }
.login .btn { width: 100%; }
.flash { background: var(--info-bg); border: 1px solid var(--info); color: var(--ink); padding: 8px 12px; margin-bottom: 16px; }
[role="alert"] { margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--accent); color: var(--accent); background: var(--panel); }
.badge { display: inline-block; padding: 0 8px; border: 1px solid var(--line); color: var(--text); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge-ok { border-color: var(--ok); color: var(--ok); }

.btn { display: inline-block; padding: 6px 16px; border: 1px solid var(--ink); font: 600 14px/1.5 Poppins, sans-serif; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--text); border-color: var(--text); }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: #fff; }

form label { display: block; margin-bottom: 12px; color: var(--ink); font-weight: 500; }
.field { display: block; width: 100%; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line); background: var(--panel); font: 400 14px/1.5 Poppins, sans-serif; color: var(--ink); }
.field:hover { border-color: var(--muted); }
.field:focus-visible { outline-offset: 0; border-color: var(--ink); }
fieldset { margin: 0 0 12px; padding: 8px 12px 12px; border: 1px solid var(--line); }
legend { padding: 0 4px; color: var(--ink); font-weight: 500; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 16px; }
.checks label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.checks input { accent-color: var(--ink); }
.perm-row { display: grid; grid-template-columns: 1fr 160px; align-items: center; gap: 12px; margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line); }
.perm-row .field { margin-top: 0; }
.perm-row:last-child { border-bottom: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--panel); }
.table { width: 100%; border-collapse: collapse; background: var(--panel); }
.table th, .table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg); }
.table th { color: var(--ink); font-size: 13px; font-weight: 600; }
.table-dense th, .table-dense td { padding: 6px; font-size: 13px; }
.table-dense th { font-size: 12px; white-space: normal; vertical-align: bottom; }
.table-dense td:first-child { white-space: normal; }
.actions { display: flex; align-items: center; gap: 12px; }
.actions form { margin: 0; }
.actions .btn { padding: 2px 10px; font-size: 13px; }

@media (max-width: 767px) {
  .layout { flex-direction: column; align-items: stretch; }
  .sidebar { width: auto; align-self: stretch; margin: 0; border-width: 0 0 1px; display: flex; overflow-x: auto; }
  .nav-item { white-space: nowrap; padding: 11px 12px; border-bottom: 0; border-right: 1px solid var(--line); }
  .sidebar .nav-item:last-child { border-right: 0; }
  .login { margin-top: 16px; }
}
