/* Outright brand theme */
:root {
  --o-green: #39ac61; --o-red: #ec483c; --o-blue: #3976b9; --o-yellow: #fac12c; --o-ink: #111111;
  --bg: #f6f7f9; --panel: #ffffff; --text: #16181d; --muted: #6b7280; --line: #e6e8ec;
  --brand: var(--o-ink); --link: #2f66a6; --focus: #b9d0ec; --soft: #eef4fb;
  --ok: #217a45; --ok-bg: #e3f4ea; --warn: #8a5a00; --warn-bg: #fff4d6;
  --bad: #c0322a; --bad-bg: #fde8e6; --info: #2f66a6; --info-bg: #e5eef8;
  --stripe: linear-gradient(90deg, var(--o-yellow) 0 25%, var(--o-green) 25% 50%, var(--o-red) 50% 75%, var(--o-blue) 75% 100%);
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 14px; margin: 16px 0 4px; }
code { background: #f0f1f4; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.stripe { height: 4px; background: var(--stripe); }
.top-stripe { position: fixed; top: 0; left: 0; right: 0; z-index: 40; }

/* layout */
.sidebar { position: fixed; inset: 4px auto 0 0; width: 240px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20; }
.brand { padding: 20px 20px 14px; }
.brand img { display: block; width: 150px; height: auto; }
.brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-top: 8px; font-weight: 600; }
.brand.big { padding: 0 0 18px; text-align: center; }
.brand.big img { width: 210px; margin: 0 auto; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px; }
.sidebar nav a { display: block; color: #3a3f47; padding: 8px 12px; border-radius: 8px; margin: 1px 0; font-weight: 500; position: relative; }
.sidebar nav a:hover { background: #f2f4f7; text-decoration: none; color: var(--o-ink); }
.sidebar nav a.active { background: var(--soft); color: var(--o-ink); font-weight: 700; }
.sidebar nav a.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--o-blue); }
.nav-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #9aa0a9; padding: 14px 12px 4px; font-weight: 700; }
.me { padding: 14px 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.me b { color: var(--text); display: block; font-size: 13px; }
.me small { display: block; margin-bottom: 6px; }
main.with-nav { margin-left: 240px; padding: 28px 32px 48px; max-width: 1440px; }
main.bare { padding: 9vh 16px; }
.nav-btn { display: none; }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .empty { padding: 18px; }
.card.narrow { max-width: 640px; }
.card.auth { max-width: 410px; margin: 0 auto; padding: 0 30px 28px; overflow: hidden; }
.card.auth .stripe { margin: 0 -30px 28px; }
.card.auth h1 { margin-bottom: 4px; justify-content: center; }
.card.auth > p.muted { text-align: center; }
.card.highlight { background: var(--soft); border-color: #cddcef; border-left: 4px solid var(--o-blue); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid #d5d9e0; border-radius: 12px; padding: 12px 16px; color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
a.stat:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(16,24,40,.08); }
.stat small { color: var(--muted); display: block; font-weight: 600; }
.stat b { font-size: 26px; letter-spacing: -.02em; }
.stat.ok { border-top-color: var(--o-green); } .stat.info { border-top-color: var(--o-blue); }
.stat.warn { border-top-color: var(--o-yellow); } .stat.bad { border-top-color: var(--o-red); }
.stat.ink { border-top-color: var(--o-ink); }
.bar { height: 8px; background: #eef0f3; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--o-blue); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafbfc; font-weight: 700; }
tbody tr:hover { background: #fafbfd; }
tbody tr:last-child td { border-bottom: 0; }
tr.dim td { opacity: .55; }
.card:not(.flush) table th { background: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: Consolas, ui-monospace, monospace; font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.empty { color: var(--muted); margin: 0; }
.pre { white-space: pre-line; margin: 0; }
.bad-text { color: var(--bad); font-weight: 600; } .warn-text { color: var(--warn); font-weight: 600; }
dl.details { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
dl.details dt { color: var(--muted); } dl.details dd { margin: 0; }

/* badges: one brand colour per status */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f0f1f4; color: #4b5260; vertical-align: middle; white-space: nowrap; }
.badge[class*=" s-"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-available, .s-completed, .s-sent { background: var(--ok-bg); color: var(--ok); }
.s-allotted, .s-in-progress { background: var(--info-bg); color: var(--info); }
.s-in-repair, .s-open { background: var(--warn-bg); color: var(--warn); }
.s-retired, .s-cancelled { background: #eceef1; color: #565d69; }
.s-lost-stolen { background: var(--bad-bg); color: var(--bad); }

/* forms */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 18px; }
.grid-form.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.card.auth .field, .card.narrow .field { margin-bottom: 12px; }
.field.full, .full { grid-column: 1 / -1; }
.field > span { font-weight: 600; font-size: 13px; }
.field em { color: var(--o-red); font-style: normal; }
.field small { color: var(--muted); font-size: 12px; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid #d3d7de; border-radius: 8px; background: #fff; color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--o-blue); }
input[type=checkbox] { width: auto; accent-color: var(--o-blue); }
select[size] { padding: 4px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400 !important; }
.actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px; }
.filters input[name=q] { flex: 1 1 240px; width: auto; }
.filters select { width: auto; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-right: auto; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tabs a:hover { background: #f2f4f7; text-decoration: none; }
.tabs a.on { background: var(--o-ink); color: #fff; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 12px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
fieldset .check { margin: 6px 0; }
form.inline { display: inline; }
ol.steps li { margin-bottom: 6px; }
ul.errors { color: var(--bad); font-size: 13px; max-height: 260px; overflow: auto; }

/* buttons: black like the wordmark */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: 8px; border: 1px solid var(--o-ink); background: var(--o-ink); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #2b2d31; text-decoration: none; }
.btn:focus-visible { outline: 3px solid var(--focus); }
.btn.secondary { background: var(--soft); color: #1f4f86; border-color: #cddcef; }
.btn.secondary:hover { background: #e2ecf8; }
.btn.ghost { background: #fff; color: var(--text); border-color: #d3d7de; }
.btn.ghost:hover { background: #f4f5f7; }
.btn.danger { background: #fff; color: var(--bad); border-color: #f2bdb8; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
button.link { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; padding: 0 4px; }

/* flash */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; border-left-width: 4px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cc; border-left-color: var(--o-green); }
.flash.error { background: var(--bad-bg); color: var(--bad); border-color: #f5c6c1; border-left-color: var(--o-red); }
.flash.warn, .flash.message { background: var(--warn-bg); color: var(--warn); border-color: #f6e0a3; border-left-color: var(--o-yellow); }
.pager { display: flex; gap: 14px; justify-content: center; align-items: center; color: var(--muted); }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
  #nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-btn { display: block; position: fixed; top: 12px; left: 12px; z-index: 30; background: var(--o-ink); color: #fff; border-radius: 8px; padding: 5px 12px; font-size: 18px; cursor: pointer; }
  main.with-nav { margin-left: 0; padding: 64px 16px 40px; }
  .cols { grid-template-columns: 1fr; }
}
