/* Booklet admin panel. The colour tokens are reference.html's `night` theme
   verbatim (design/reference.html); the panel takes night and stops. Fonts are
   served from the binary at /admin/assets/fonts, with system fallbacks. */

@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/EBGaramond.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("/assets/fonts/AlegreyaSans-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg:          #171512;
  --sidebar:     #161514;
  --sidebar-line:#26241F;
  --page:        #221F1A;
  --page-line:   #35302A;
  --panel:       #191714;
  --code-bg:     #10150F;
  --edit-bg:     #1C1916;
  --text:        #E6DDC9;
  --text-bright: #F0E8D2;
  --text-soft:   #9C9280;
  --text-dim:    #615B4E;
  --accent:      #C2A45C;   /* brass */
  --accent-deep: #A8842C;
  --link:        #C4695A;   /* ember */
  --active-pill: #2A2721;

  --f-display: "EB Garamond", Georgia, serif;
  --f-ui: "Alegreya Sans", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- top bar and nav --- */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  height: 52px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--sidebar-line);
}
.wordmark {
  font-family: var(--f-display);
  font-size: 20px;
  color: var(--text-bright);
  letter-spacing: 0.3px;
}
.topbar nav { display: flex; gap: 6px; margin-right: auto; }
.topbar nav a {
  color: var(--text-soft);
  padding: 5px 11px;
  border-radius: 6px;
}
.topbar nav a:hover { color: var(--text-bright); text-decoration: none; }
.topbar nav a.active { color: var(--text-bright); background: var(--active-pill); }

.signout { display: flex; align-items: center; gap: 10px; }
.signout .who { color: var(--text-soft); }

/* --- layout --- */

main { max-width: 960px; margin: 0 auto; padding: 28px 24px 64px; }
.head h1 { font-family: var(--f-display); color: var(--text-bright); font-weight: 500; margin: 0; }
.head .sub { color: var(--text-soft); margin: 4px 0 0; }
section { margin-top: 32px; }
section h2 {
  font-family: var(--f-display);
  font-weight: 500;
  color: var(--text-bright);
  font-size: 18px;
  margin: 0 0 12px;
}

/* --- overview cards --- */

.cards { display: flex; gap: 16px; }
.card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--page-line);
  border-radius: 10px;
}
.card .value { font-family: var(--f-display); font-size: 30px; color: var(--text-bright); }
.card .label { color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.6px; font-size: 12px; }
.card .note { color: var(--text-dim); font-size: 13px; }

/* --- tables --- */

table { width: 100%; border-collapse: collapse; }
table.grid { width: auto; }
th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--page-line);
}
td { padding: 9px 14px 9px 0; border-bottom: 1px solid var(--sidebar-line); }
th.num, td.num { text-align: right; }
td.mono, .mono { font-family: var(--f-mono); font-size: 13px; color: var(--text-soft); }
tbody tr:hover td { background: var(--edit-bg); }
table.grid th { border: none; padding-right: 32px; }
table.grid td { border: none; font-variant-numeric: tabular-nums; }

.dim { color: var(--text-dim); }
.empty { color: var(--text-dim); font-style: italic; }

/* --- tags --- */

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--active-pill);
  color: var(--accent);
}
.tag.warn { color: var(--link); }
.tag.ok { color: var(--text-soft); }

/* --- forms and buttons --- */

button, .link {
  font-family: var(--f-ui);
  font-size: 14px;
  cursor: pointer;
}
button {
  background: var(--accent);
  color: #1b1712;
  border: none;
  border-radius: 7px;
  padding: 7px 15px;
  font-weight: 500;
}
button:hover { background: var(--accent-deep); }
button.link {
  background: none;
  color: var(--link);
  padding: 0;
  border: none;
}
button.link:hover { text-decoration: underline; }
button.danger, .danger { background: var(--link); color: #1b1712; }
a.danger { color: var(--link); background: none; }

form.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], input[type="url"] {
  font-family: var(--f-ui);
  font-size: 14px;
  background: var(--edit-bg);
  border: 1px solid var(--page-line);
  border-radius: 7px;
  color: var(--text-bright);
  padding: 7px 11px;
}
input:focus { outline: none; border-color: var(--accent); }

section.actions { display: flex; gap: 18px; align-items: center; }
.actions { display: flex; gap: 16px; align-items: center; margin-top: 16px; }

label { display: block; color: var(--text-soft); margin: 14px 0 6px; }
label input { display: block; margin-top: 6px; width: 320px; max-width: 100%; }

.error { color: var(--link); }
.warn-box {
  background: var(--edit-bg);
  border: 1px solid var(--accent-deep);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text);
}

/* --- auth dialogs (sign-in, sign-up, forgot/reset) --- */
/* Scoped to body.login so the overview's stat `.card`s are untouched; covers both
   the form cards and the div result cards. */

body.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
body.login .card {
  /* Reset the overview stat-card rule (`.card { flex: 1; display: flex }`), which
     otherwise stretches this dialog to full width. */
  flex: none;
  display: block;
  width: 360px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--page-line);
  border-radius: 12px;
  padding: 28px 26px 30px;
}
body.login .card h1 {
  font-family: var(--f-display);
  font-weight: 500;
  color: var(--text-bright);
  text-align: center;
  margin: 0 0 18px;
}
body.login .card label { margin-top: 16px; }
body.login .card label:first-of-type { margin-top: 0; }
body.login .card label input { width: 100%; }
body.login .card button { width: 100%; margin-top: 22px; padding: 9px; }
body.login .card p { color: var(--text-soft); text-align: center; }
body.login .card .aside { margin: 16px 0 0; font-size: 13px; }
.aside { color: var(--text-soft); }

/* --- light theme (reference.html's light ground; night stays the default) --- */

html[data-theme="light"] {
  --bg:          #EAE3D3;
  --sidebar:     #E2DAC7;
  --sidebar-line:#CDC2A8;
  --page:        #F7F2E6;
  --page-line:   #D8CDB2;
  --panel:       #E7E0CF;
  --code-bg:     #EAE2CD;
  --edit-bg:     #EFE8D7;
  --text:        #2E2820;
  --text-bright: #1E1913;
  --text-soft:   #6E6350;
  --text-dim:    #9C8F76;
  --accent:      #8A6D28;
  --accent-deep: #6F571F;
  --link:        #8C3A2F;
  --active-pill: #DCD2BB;
}

/* --- theme toggle --- */

.themetoggle {
  color: var(--text-soft);
  font-size: 15px;
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: none;
}
.themetoggle:hover { color: var(--text-bright); background: var(--active-pill); text-decoration: none; }

/* --- storage meter --- */

.meter {
  height: 10px;
  background: var(--edit-bg);
  border: 1px solid var(--page-line);
  border-radius: 6px;
  overflow: hidden;
  max-width: 420px;
}
.meter .fill { height: 100%; background: var(--accent); }

/* --- inline forms with labelled fields --- */

.inline-label { display: inline-flex; flex-direction: column; margin: 0; gap: 4px; color: var(--text-soft); font-size: 13px; }
.inline-label input, select {
  font-family: var(--f-ui);
  font-size: 14px;
  background: var(--edit-bg);
  border: 1px solid var(--page-line);
  border-radius: 7px;
  color: var(--text-bright);
  padding: 6px 10px;
}
form.inline { flex-wrap: wrap; }

/* --- charts --- */

.chartbox { color: var(--accent); }
svg.chart { display: block; width: 100%; height: 120px; }
svg.chart rect { fill: currentColor; opacity: 0.85; }
.chartcaption { display: flex; justify-content: space-between; margin: 6px 0 0; color: var(--text-soft); font-size: 12px; }

/* --- public site (landing, pricing, account) --- */

a.wordmark, a.wordmark:hover { text-decoration: none; }

a.button, .button {
  display: inline-block;
  background: var(--accent);
  color: #1b1712;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
}
a.button:hover { background: var(--accent-deep); text-decoration: none; }
a.ghost {
  display: inline-block;
  padding: 9px 18px;
  border: 1px solid var(--page-line);
  border-radius: 8px;
  color: var(--text-bright);
  text-decoration: none;
}
a.ghost:hover { border-color: var(--accent); text-decoration: none; }

.hero { text-align: center; padding: 60px 0 24px; }
.hero h1 { font-family: var(--f-display); font-size: 44px; color: var(--text-bright); font-weight: 500; margin: 0 0 16px; line-height: 1.12; }
.hero .lead { max-width: 620px; margin: 0 auto 28px; color: var(--text-soft); font-size: 18px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.feature { background: var(--panel); border: 1px solid var(--page-line); border-radius: 10px; padding: 18px 20px; }
.feature h3 { font-family: var(--f-display); color: var(--text-bright); font-weight: 500; margin: 0 0 8px; font-size: 18px; }
.feature p { color: var(--text-soft); margin: 0; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 8px; }
.plan { background: var(--panel); border: 1px solid var(--page-line); border-radius: 12px; padding: 22px 22px 24px; text-align: center; }
.plan h3 { font-family: var(--f-display); text-transform: capitalize; color: var(--text-bright); margin: 0 0 6px; font-size: 22px; font-weight: 500; }
.plan .price { font-family: var(--f-display); font-size: 30px; color: var(--text-bright); margin: 0; }
.plan .price .per { font-family: var(--f-ui); font-size: 14px; color: var(--text-soft); }
.plan .quota { color: var(--accent); margin: 8px 0 2px; }
.plan .desc { color: var(--text-soft); margin: 4px 0 14px; min-height: 1.2em; }
.plan .cta { margin-top: 12px; }
