:root {
  --ink: #1c2430;
  --ink-2: #4a5566;
  --muted: #7a8494;
  --line: #e4e1da;
  --bg: #f6f4ef;
  --card: #ffffff;
  --side: #17202b;
  --side-ink: #c9d1dc;
  --accent: #0f6e66;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ef;
  --red: #b4372c;
  --red-soft: #fbe9e6;
  --amber: #9a6200;
  --amber-soft: #fdf1d8;
  --green: #2f7a3e;
  --green-soft: #e5f3e7;
  --blue: #2a5ea8;
  --blue-soft: #e6eefa;
  --radius: 10px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .2rem; letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 0 0 .9rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: #f0eee8; padding: .1em .35em; border-radius: 4px; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); padding: 1.2rem .9rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 0 .4rem 1.2rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.brand-name { font-weight: 650; color: #fff; }
.brand.big { justify-content: center; padding-bottom: 1rem; }
.brand.big .brand-name { color: var(--ink); font-size: 1.1rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a, .nav-soon { color: var(--side-ink); padding: .5rem .65rem; border-radius: 7px; font-size: .95rem; }
.sidebar nav a:hover { background: #222d3a; text-decoration: none; color: #fff; }
.sidebar nav a.on { background: #263443; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-soon { color: #6b7686; cursor: default; }
.nav-soon em { font-style: normal; font-size: .7rem; border: 1px solid #3a4655; border-radius: 99px; padding: 0 .4rem; margin-left: .3rem; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7686; margin: 1rem .65rem .3rem; }
.me { border-top: 1px solid #2a3542; padding: .9rem .4rem 0; display: flex; flex-direction: column; gap: .1rem; }
.me-name { color: #fff; font-weight: 600; }
.me-role { font-size: .8rem; color: #8994a3; }
.me .link { color: #8994a3; padding: 0; margin-top: .3rem; }
.main { padding: 1.8rem 2.2rem 3rem; max-width: 1240px; width: 100%; }
.solo { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.head-actions form { margin: 0; }
.crumb { margin: 0 0 .2rem; font-size: .85rem; }
.intro { color: var(--ink-2); max-width: 70ch; margin: -.4rem 0 1.2rem; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.1rem; }
.card.flush { padding: 0; overflow-x: auto; }
.card.narrow { max-width: 560px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
.two-col > .card { margin-bottom: 0; }
.two-col + .two-col, .two-col + .card, .card + .two-col { margin-top: 1.1rem; }
.alert-card { border-color: #e8b4ac; background: #fffaf9; }
.empty { padding: 2.2rem; text-align: center; color: var(--ink-2); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; display: flex; flex-direction: column; color: var(--ink); }
.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat-num { font-size: 1.7rem; font-weight: 650; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .85rem; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.table td { padding: .7rem .9rem; border-bottom: 1px solid #f0ede7; vertical-align: top; }
.card:not(.flush) .table th, .card:not(.flush) .table td { padding-left: 0; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink-2); }
.row-alert { background: var(--red-soft); }
.row-muted td { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

dl.grid-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1.4rem; margin: 0; }
dl.grid-dl .wide { grid-column: 1 / -1; }
dl.grid-dl dt { font-size: .78rem; color: var(--muted); margin-bottom: .15rem; }
dl.grid-dl dd { margin: 0; }
.pre { white-space: pre-wrap; }

/* forms */
input, select, textarea { font: inherit; color: inherit; border: 1px solid #d6d2c9; border-radius: 7px; padding: .5rem .65rem; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: auto; margin-right: .35rem; }
input[type=file] { border: 0; padding: .3rem 0; }
label { display: block; font-size: .88rem; color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.stack label input, .stack label select { margin-top: .25rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem 1.1rem; margin-bottom: .6rem; }
.field label { margin-bottom: .25rem; }
.field.wide { grid-column: 1 / -1; }
.field.check { align-self: end; }
.field.check label { color: var(--ink); display: flex; align-items: center; padding: .5rem 0; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.req { color: var(--red); }
.help { font-size: .8rem; color: var(--muted); margin: .25rem 0 0; }
.error-text { font-size: .8rem; color: var(--red); margin: .25rem 0 0; }
.actions { display: flex; gap: .6rem; margin-top: .4rem; }
.filters { display: flex; gap: .5rem; margin-bottom: 1rem; max-width: 720px; }
.filters input { flex: 2; } .filters select { flex: 1; width: auto; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .9rem; }
.inline-form select, .inline-form input:not([type=file]) { width: auto; }
form.inline { display: inline-flex; gap: .6rem; align-items: center; margin: 0; }
.add-box { margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: .9rem; }
.add-box summary { cursor: pointer; color: var(--accent); font-weight: 550; margin-bottom: .8rem; }
.offboard { margin-top: 1rem; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.code-input { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-family: ui-monospace, monospace; }
.code-input.small { font-size: 1.1rem; width: 9rem !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 550; font-size: .9rem; padding: .5rem .95rem; border-radius: 7px; border: 1px solid #d0ccc2; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #0b5a53; }
.btn.danger { color: var(--red); border-color: #e3b5ae; }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.full { width: 100%; }
button.link { background: none; border: 0; font: inherit; color: var(--accent); cursor: pointer; padding: 0; }
button.link.danger { color: var(--red); }

/* badges */
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .12rem .5rem; border-radius: 99px; white-space: nowrap; vertical-align: middle; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.grey { background: #efede8; color: var(--ink-2); }
h1 .badge { font-size: .75rem; }
.chip { display: inline-block; background: #f0eee8; border-radius: 6px; padding: .1rem .45rem; margin: 0 .25rem .25rem 0; font-size: .85rem; }
.chip-gone { background: var(--red-soft); color: var(--red); text-decoration: line-through; }
.red-text { color: var(--red); }

/* flashes */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: var(--green-soft); color: #1f5a2b; border-color: #c4e2c9; }
.flash-error { background: var(--red-soft); color: #8a2a21; border-color: #efc5bf; }
.flash-warning { background: var(--amber-soft); color: #74490a; border-color: #f1d9a6; }
.flash-info { background: var(--blue-soft); color: #234d88; border-color: #c9d9f2; }

/* misc */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.strong { font-weight: 600; }
.center { text-align: center; }
.list { margin: 0; padding-left: 1.1rem; }
.list li { margin-bottom: .4rem; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: .45rem 0; border-bottom: 1px solid #f0ede7; font-size: .9rem; }
.activity li:last-child { border-bottom: 0; }
.steps { padding-left: 1.2rem; margin: 0; }
.steps li { margin-bottom: 1rem; }
.qr { width: 190px; margin: .6rem 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.qr svg { width: 100%; height: auto; display: block; }
.key { word-break: break-all; }
.temp-pass code { font-size: 1.4rem; padding: .5rem .8rem; display: inline-block; letter-spacing: .04em; }
.vault { border-left: 4px solid var(--accent); }
.vault-ref { font-size: 1.05rem; font-weight: 550; margin: 0 0 .4rem; }

/* sign-in */
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; width: 100%; max-width: 400px; box-shadow: 0 10px 30px rgba(28, 36, 48, .06); }
.auth-card h1 { font-size: 1.3rem; justify-content: center; margin-bottom: 1rem; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label, .nav-soon { display: none; }
  .main { padding: 1.2rem; }
  .two-col, .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .two-col, .stats { grid-template-columns: 1fr; }
  .filters { flex-direction: column; }
}
.inline-form input[type=file] { width: auto; flex: 1 1 220px; }
.check-line { display: flex; align-items: center; color: var(--ink); }
