/* Account pages. Colors and fonts are the website's (flowstatefoundry.com, src/styles/global.css):
   dark by default, sepia as the light theme. theme.js sets [data-theme] before paint. Fonts are
   self-hosted here too; nothing loads from another origin. */
@font-face {
  font-family: 'Crimson Pro Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url('/fonts/crimson-pro-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
}

:root,
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f0f0f;
  --surface: #141416;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e0e0e0;
  --text-2: #b2b2b2;
  --muted: #888888;
  --accent: #4a9eff;
  --accent-ink: #0a0a0a;
  --danger: #ff6b6b;
  --ok: #51cf66;
  --serif: 'Crimson Pro Variable', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
:root[data-theme='sepia'] {
  color-scheme: light;
  --bg: #f4ead5;
  --surface: #faf6eb;
  --border: rgba(59, 47, 30, 0.14);
  --border-strong: rgba(59, 47, 30, 0.26);
  --text: #3b2f1e;
  --text-2: #554938;
  --muted: #6b604e;
  --accent: #b8621b;
  --accent-ink: #fdf6ec;
  --danger: #c92a2a;
  --ok: #2f9e44;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  padding-inline: 20px;
}

.top, .page, .foot { width: 100%; max-width: 40rem; margin-inline: auto; }
.top { display: flex; justify-content: space-between; align-items: center; padding-block: 1.5rem; }
.brand { font: 600 1.25rem var(--serif); color: var(--text); text-decoration: none; }
.top-actions { display: flex; align-items: center; gap: 1rem; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; color: var(--text-2);
  border: 1px solid var(--border); border-radius: 6px;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle .ico { width: 18px; height: 18px; display: none; }
:root[data-theme='dark'] .theme-toggle .ico--sun,
:root[data-theme='sepia'] .theme-toggle .ico--moon { display: block; }
.page { flex: 1; padding-block: 2rem 3rem; }
.foot { padding-block: 2rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
.foot a { color: var(--text-2); }

h1 { font: 600 clamp(2rem, 6vw, 2.6rem)/1.15 var(--serif); margin: 0 0 0.75rem; }
h2 { font: 600 1.4rem var(--serif); margin: 0; }
h3 { font-size: 0.95rem; font-weight: 600; margin: 1.5rem 0 0.25rem; }
.lede { color: var(--text-2); margin: 0 0 1.5rem; }
.meta { color: var(--muted); font-size: 0.875rem; margin: 0; }
.hint { color: var(--muted); font-size: 0.875rem; margin: 0 0 1rem; }
.status { color: var(--muted); }
.error { color: var(--danger); margin-top: 1rem; }

form { display: grid; gap: 0.6rem; max-width: 24rem; }
label { font-size: 0.875rem; color: var(--text-2); }
input {
  font: inherit;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
input#code { font-size: 1.4rem; letter-spacing: 0.35em; max-width: 12rem; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button { font: inherit; cursor: pointer; border-radius: 8px; }
button:disabled { opacity: 0.6; cursor: progress; }
.primary { border: 0; padding: 0.65rem 1.1rem; background: var(--accent); color: var(--accent-ink); font-weight: 600; justify-self: start; }
.secondary { border: 1px solid var(--border); padding: 0.4rem 0.8rem; background: transparent; color: var(--text); }
.danger { border: 0; padding: 0.4rem 0.8rem; background: var(--danger); color: var(--accent-ink); font-weight: 600; }
.link { border: 0; padding: 0.25rem 0; background: none; color: var(--text-2); text-decoration: underline; justify-self: start; }

.licence { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 1.25rem 1.25rem 0.5rem; margin-bottom: 1.25rem; }
.licence header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.badge { font-size: 0.8rem; padding: 0.15rem 0.6rem; border-radius: 999px; border: 1px solid currentColor; }
.badge.active { color: var(--ok); }
.badge.inactive { color: var(--danger); }

.devices { list-style: none; padding: 0; margin: 0; }
.device { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding-block: 0.85rem; border-top: 1px solid var(--border); }
.device-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.device-actions .confirm { display: inline-flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.9rem; }
.devices .empty { color: var(--muted); padding-block: 0.85rem; border-top: 1px solid var(--border); }
