/* Bibdify dashboard shell. Colours are tokens so the light and dark themes share every rule. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --side: #10151f;
  --side-text: #c6cedb;
  --side-active: #1e2736;
  --text: #161b26;
  --muted: #667085;
  --line: #e3e7ee;
  --accent: #2456e6;
  --accent-text: #ffffff;
  --ok-bg: #e7f6ec; --ok-text: #14693a;
  --err-bg: #fdecec; --err-text: #a12020;
  --warn-bg: #fff4dc; --warn-text: #8a5a00;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #161b24; --side: #0a0d13; --side-text: #aeb7c6; --side-active: #1b2230;
    --text: #e6e9ef; --muted: #98a2b3; --line: #262d3a; --accent: #5b86ff; --accent-text: #0b0f17;
    --ok-bg: #12301f; --ok-text: #7fdca4; --err-bg: #3a1616; --err-text: #ff9c9c; --warn-bg: #3a2c0c; --warn-text: #f2c462;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #161b24; --side: #0a0d13; --side-text: #aeb7c6; --side-active: #1b2230;
  --text: #e6e9ef; --muted: #98a2b3; --line: #262d3a; --accent: #5b86ff; --accent-text: #0b0f17;
  --ok-bg: #12301f; --ok-text: #7fdca4; --err-bg: #3a1616; --err-text: #ff9c9c; --warn-bg: #3a2c0c; --warn-text: #f2c462;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 6px; line-height: 1.25; }
h1 { font-size: 18px; } h2 { font-size: 18px; } h3 { font-size: 16px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }

/* Shell */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.brand { display: block; color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; padding: 4px 8px; letter-spacing: .2px; }
.ws-switch label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 0 8px 4px; opacity: .7; }
.ws-switch select { width: 100%; background: var(--side-active); color: #fff; border: 1px solid transparent; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; opacity: .6; padding: 14px 8px 4px; }
.nav-item { display: block; padding: 8px 10px; border-radius: 8px; color: var(--side-text); text-decoration: none; }
.nav-item:hover { background: var(--side-active); color: #fff; }
.nav-item.active { background: var(--side-active); color: #fff; font-weight: 600; }
.side-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 8px; }
.side-foot .link { background: none; border: 0; color: var(--side-text); padding: 8px 10px; cursor: pointer; font: inherit; }
.side-foot .link:hover { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.top h1 { flex: 1; margin: 0; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 16px; }
.menu-btn { display: none; }
.content { padding: 24px; max-width: 1100px; width: 100%; display: flex; flex-direction: column; gap: 16px; }

/* Blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stat .num { font-size: 28px; font-weight: 700; line-height: 1.1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.narrow { max-width: 420px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0 0; }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.facts dd { margin: 2px 0 0; font-weight: 600; }

.item { border-top: 1px solid var(--line); padding: 12px 0; }
.item:first-of-type { margin-top: 10px; }
.item summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; list-style: none; }
.item summary::-webkit-details-marker { display: none; }
.item summary::before { content: "▸"; color: var(--muted); }
.item[open] summary::before { content: "▾"; }
.item[open] summary { margin-bottom: 14px; }
.item-name { font-weight: 600; }
.item.addon { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.transfer { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); justify-content: space-between; }
.transfer > div { flex: 1; min-width: 220px; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--text); white-space: nowrap; }
.badge.active { background: var(--ok-bg); color: var(--ok-text); }
.badge.trial { background: var(--warn-bg); color: var(--warn-text); }
.badge.paused, .badge.transferred { background: var(--err-bg); color: var(--err-text); }

.flash { padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.error { background: var(--err-bg); color: var(--err-text); }

/* Forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 38px; width: 100%; }
input[type="checkbox"] { width: auto; min-height: 0; }
input[type="file"] { width: auto; flex: 1; min-width: 200px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.btn { display: inline-block; font: inherit; font-weight: 600; font-size: 14px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--err-text); }
.btn.small { padding: 4px 10px; font-size: 13px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border-top: 0; white-space: nowrap; }

/* Sign-in and other pages without the sidebar */
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.bare-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.bare-box .brand { color: var(--text); text-align: center; font-size: 22px; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .15s; z-index: 10; overflow-y: auto; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .menu-btn { display: block; }
  .top { padding: 12px 16px; }
  .content { padding: 16px; }
}

/* Shared pieces add-ons use */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters label { min-width: 140px; flex: 1; }
.filters .btn { min-height: 38px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tabs a { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 13px; }
.tabs a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; }
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; margin: 0; }
.timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.timeline > div { border-left: 2px solid var(--line); padding-left: 12px; }
td a.strong, a.strong { font-weight: 600; text-decoration: none; }
