/* -------------------------------------------------------------------------
   JIS INTERNAL TOOL THEME

   Deliberately mirrors Keskuskuvaskanneri and AIpistelaskenta: same colour
   tokens, header silhouette, brand lockup, theme toggle and panel chrome, so
   the three internal tools read as one family. Trimmed to what this small
   self-service page needs, plus a loading spinner for the Admin API wait.
   ------------------------------------------------------------------------- */

:root,
:root[data-theme="dark"] {
  --bg: #0d0e0f;
  --bg-elevated: #111315;
  --panel: #16181a;
  --panel-raised: #1c1f21;
  --panel-hover: #24282b;
  --border: #34383b;
  --border-soft: #292d30;
  --text: #f5f3f0;
  --muted: #989b9e;
  --muted-strong: #c4c5c4;
  --accent: #ff8247;
  --accent-hover: #ff996b;
  --accent-ink: #21140e;
  --accent-soft: rgba(255, 130, 71, 0.13);
  --accent-border: rgba(255, 130, 71, 0.45);
  --success: #63c991;
  --success-bg: rgba(99, 201, 145, 0.13);
  --success-border: rgba(99, 201, 145, 0.5);
  --warning: #e8b85b;
  --warning-bg: rgba(232, 184, 91, 0.12);
  --warning-border: rgba(232, 184, 91, 0.45);
  --danger: #e76f72;
  --danger-strong: #ff9ca4;
  --error-bg: rgba(231, 111, 114, 0.08);
  --error-border: rgba(231, 111, 114, 0.28);
  --shadow: 0 22px 58px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.23);
  --radius: 14px;
  --radius-sm: 8px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f0ea;
  --bg-elevated: #ece8e1;
  --panel: #fffdf9;
  --panel-raised: #f8f5ef;
  --panel-hover: #f0ebe3;
  --border: #d3cec5;
  --border-soft: #e4dfd7;
  --text: #202224;
  --muted: #6d706f;
  --muted-strong: #484b4d;
  --accent: #ff8247;
  --accent-hover: #ee733a;
  --accent-ink: #21140e;
  --accent-soft: rgba(224, 92, 34, 0.105);
  --accent-border: rgba(211, 78, 22, 0.42);
  --success: #32835a;
  --success-bg: rgba(50, 131, 90, 0.1);
  --success-border: rgba(50, 131, 90, 0.4);
  --warning: #9a6b12;
  --warning-bg: rgba(154, 107, 18, 0.1);
  --warning-border: rgba(154, 107, 18, 0.38);
  --danger: #b84449;
  --danger-strong: #b84449;
  --error-bg: rgba(184, 68, 73, 0.07);
  --error-border: rgba(184, 68, 73, 0.25);
  --shadow: 0 22px 58px rgba(50, 39, 29, 0.12), 0 3px 12px rgba(50, 39, 29, 0.07);
  --shadow-sm: 0 12px 34px rgba(50, 39, 29, 0.095);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 130, 71, 0.105), transparent 28rem),
    linear-gradient(180deg, #111315 0%, var(--bg) 28rem, #0a0b0c 100%);
  -webkit-font-smoothing: antialiased;
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 130, 71, 0.16), transparent 28rem),
    linear-gradient(180deg, #fbfaf7 0%, var(--bg) 28rem, #eeebe5 100%);
}

/* Restrained angular JIS line motif; it stays behind the work surface. */
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 4.6rem 0 auto auto;
  width: min(42vw, 44rem);
  height: min(42vw, 44rem);
  pointer-events: none;
  opacity: 0.24;
  background:
    linear-gradient(30deg, transparent 48.8%, rgba(255, 130, 71, 0.28) 49.1%, rgba(255, 130, 71, 0.28) 50.2%, transparent 50.5%) 0 0 / 96px 56px,
    linear-gradient(150deg, transparent 48.8%, rgba(255, 130, 71, 0.18) 49.1%, rgba(255, 130, 71, 0.18) 50.2%, transparent 50.5%) 0 0 / 96px 56px;
  mask-image: radial-gradient(circle at 80% 15%, black 0, transparent 72%);
}

html[data-theme="light"] body::before { opacity: 0.13; }

/* The browser scripts toggle the `hidden` attribute; !important keeps it
   winning over any display rule on the same element (flex panels etc.). */
[hidden],
.hidden { display: none !important; }

/* For screen readers only (table header of the action column). */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

h1,
h2,
p { margin-top: 0; }

/* -------------------------------------------------------------------------
   Header: same silhouette and brand lockup as the sibling tools.
   ------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0;
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 14, 15, 0.92);
  backdrop-filter: blur(20px) saturate(130%);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.24);
}

html[data-theme="light"] .topbar {
  border-bottom-color: rgba(38, 32, 28, 0.12);
  background: rgba(255, 253, 249, 0.91);
  box-shadow: 0 10px 34px rgba(48, 36, 25, 0.085);
}

.header-row {
  min-height: 5.25rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.78rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.brand-emblem {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 130, 71, 0.4);
  border-radius: 10px;
  background: #17191b;
  overflow: hidden;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.brand-emblem::after {
  content: "";
  position: absolute;
  inset: auto -25% -52% 20%;
  height: 80%;
  transform: rotate(-22deg);
  background: rgba(255, 130, 71, 0.12);
}

.brand-emblem:hover {
  transform: translateY(-2px) rotate(-2deg);
  border-color: var(--accent);
  background: #1c1c1c;
}

.brand-emblem img {
  position: relative;
  z-index: 1;
  width: 2.15rem;
  height: 2.15rem;
  object-fit: contain;
}

.brand-copy { min-width: 0; }
.brand-copy p { margin: 0; }
.brand-copy > p:last-child {
  margin-top: 0.2rem;
  color: #8f9294;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

html[data-theme="light"] .brand-copy > p:last-child { color: var(--muted); }

#brand-home-link {
  color: inherit;
  text-decoration: none;
}

#brand-home-link:hover,
#brand-home-link:focus-visible { color: var(--accent); }

.brand-copy h1 {
  margin: 0;
  font-size: clamp(1.15rem, 1.7vw, 1.45rem);
  font-weight: 780;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.eyebrow {
  margin: 0 0 0.22rem;
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.135em;
  line-height: 1.3;
  text-transform: uppercase;
}

.eyebrow span {
  color: var(--muted);
  font-weight: 650;
}

.eyebrow span::before {
  content: " / ";
  color: #5f6264;
}

/* The light tint needs a deeper orange for small bold text to clear 4.5:1, as with the big accent number. */
html[data-theme="light"] .eyebrow,
html[data-theme="light"] #brand-home-link:hover,
html[data-theme="light"] #brand-home-link:focus-visible { color: #c9531c; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* The sign-out control is a POST form; display: contents lets its button
   sit in the header flex row like the links around it. */
.inline-form { display: contents; }

.header-link {
  padding: 0.42rem 0.8rem;
  color: var(--muted-strong);
  /* Also used on a <button>, which the global button rule would otherwise
     fill with the accent colour. */
  background: transparent;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 640;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.header-link:hover {
  color: var(--text);
  background: var(--panel-hover);
  border-color: var(--accent-border);
  box-shadow: none;
}

/* The toggle is intentionally the same control as in the sibling tools. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  width: auto;
  height: auto;
  min-height: 2.65rem;
  padding: 0.3rem 0.65rem 0.3rem 0.34rem;
  color: var(--muted-strong);
  background: #090a0b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.theme-toggle:hover:not(:disabled) {
  color: var(--text);
  background: #191b1d;
  border-color: var(--accent-border);
  box-shadow: none;
  transform: translateY(-1px);
}

.theme-toggle-track {
  position: relative;
  display: block;
  width: 3.5rem;
  height: 1.8rem;
  flex: 0 0 auto;
  border: 1px solid #35393c;
  border-radius: 999px;
  background: #151719;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  transition: background 220ms ease, border-color 220ms ease;
}

.theme-toggle-knob {
  position: absolute;
  z-index: 2;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: linear-gradient(145deg, #f6f3ef, #c9c9c7);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.42);
  transform: translateX(0);
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1), background 220ms ease;
}

.theme-icon {
  position: absolute;
  top: 50%;
  display: block;
  width: 0.9rem !important;
  height: 0.9rem !important;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(-50%);
}

.theme-icon-sun { right: 0.35rem; color: #767a7d; }
.theme-icon-moon { left: 0.36rem; color: var(--accent); }
.theme-toggle-label {
  min-width: 2.8rem;
  font-size: 0.74rem;
  font-weight: 730;
  text-align: left;
}

html[data-theme="light"] .theme-toggle {
  border-color: rgba(50, 42, 35, 0.12);
  background: #ebe7df;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

html[data-theme="light"] .theme-toggle:hover:not(:disabled) {
  color: var(--text);
  background: #fffdfa;
}

html[data-theme="light"] .theme-toggle-track {
  border-color: rgba(193, 85, 36, 0.42);
  background: #ffd4bf;
  box-shadow: inset 0 2px 5px rgba(127, 59, 29, 0.12);
}

html[data-theme="light"] .theme-toggle-knob {
  background: linear-gradient(145deg, #ff9a6a, var(--accent));
  box-shadow: 0 2px 7px rgba(99, 50, 28, 0.28);
  transform: translateX(1.7rem);
}

html[data-theme="light"] .theme-icon-sun { color: #a3451d; }
html[data-theme="light"] .theme-icon-moon { color: #9e918a; }

/* -------------------------------------------------------------------------
   Work surface
   ------------------------------------------------------------------------- */
main {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 2.1rem 2rem 4.5rem;
  display: grid;
  gap: 1rem;
}

body.wide main { width: min(100%, 1100px); }

.panel {
  position: relative;
  margin: 0;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid rgba(255, 255, 255, 0.095);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(25, 27, 29, 0.98), rgba(17, 19, 20, 0.985));
  box-shadow: var(--shadow-sm);
}

/* The hero panel: orange edge and the faint JIS mark, as in the sibling
   tools' upload panels. */
.create-panel {
  overflow: hidden;
  border-color: rgba(255, 130, 71, 0.34);
  background: linear-gradient(110deg, rgba(27, 29, 31, 0.99) 0%, rgba(20, 22, 23, 0.98) 64%, rgba(32, 24, 20, 0.98) 100%);
}

.create-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), rgba(255, 130, 71, 0.08));
}

.create-panel::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1.6rem;
  width: min(27vw, 20rem);
  height: min(27vw, 20rem);
  transform: translateY(-50%) rotate(-7deg);
  background: url("jis-logo.png") center / contain no-repeat;
  opacity: 0.055;
  filter: saturate(0.8);
  pointer-events: none;
}

html[data-theme="light"] .panel {
  border-color: rgba(48, 39, 32, 0.105);
  background: linear-gradient(155deg, rgba(255, 254, 251, 0.99), rgba(248, 245, 239, 0.99));
}

html[data-theme="light"] .create-panel {
  border-color: rgba(221, 91, 34, 0.28);
  background: linear-gradient(110deg, #fffdfa 0%, #f8f5ef 64%, #fff2e9 100%);
}

html[data-theme="light"] .create-panel::after { opacity: 0.035; }

/* Everything inside the hero panel sits above the logo watermark. */
.create-panel > * {
  position: relative;
  z-index: 1;
}

.section-heading { margin-bottom: 1.25rem; }
.section-heading h2 {
  margin: 0;
  font-size: clamp(1.28rem, 3vw, 1.65rem);
  font-weight: 760;
  letter-spacing: -0.035em;
}

.section-copy {
  max-width: 42rem;
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-copy:empty { display: none; }

.hint {
  max-width: 46rem;
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Stat tiles: the numbers someone came here to see. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.95rem 1.05rem;
  background: var(--panel-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.stat strong {
  color: var(--text);
  font-size: 1.65rem;
  font-weight: 720;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.stat-accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.stat-accent strong { color: var(--accent); }

html[data-theme="light"] .stat { background: rgba(255, 255, 255, 0.83); }
html[data-theme="light"] .stat-accent { background: var(--accent-soft); }
/* The light accent tint needs a deeper orange for a big number to stay
   readable, as the sibling tools do for their accent-on-tint links. */
html[data-theme="light"] .stat-accent strong { color: #c9531c; }

/* -------------------------------------------------------------------------
   Controls
   ------------------------------------------------------------------------- */
button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.58rem 1.1rem;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 720;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

button:hover:not(:disabled),
.button-link:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 5px 18px rgba(255, 130, 71, 0.2);
}

button:active:not(:disabled),
.button-link:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.primary-button {
  min-height: 3.2rem;
  padding-inline: 1.25rem;
  white-space: nowrap;
}

.button-link svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

/* Quiet secondary action (admin "Allow again"): two states, not two calls
   to action. Same restraint as the sibling tools' tab buttons. */
.secondary-button {
  color: var(--muted-strong);
  background: transparent;
  border-color: var(--border);
  font-weight: 640;
}

.secondary-button:hover:not(:disabled) {
  color: var(--text);
  background: var(--panel-hover);
  border-color: var(--accent-border);
  box-shadow: none;
}

html[data-theme="light"] .secondary-button { background: rgba(255, 255, 255, 0.83); }

.small {
  padding: 0.36rem 0.75rem;
  font-size: 0.78rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.42rem;
}

.field > span {
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 650;
}

input[type="text"],
input[type="month"] {
  width: 100%;
  min-width: 0;
  min-height: 3.2rem;
  padding: 0.68rem 0.85rem;
  color: var(--text);
  background: rgba(7, 8, 9, 0.68);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder { color: #74777a; }
input[type="text"]:hover,
input[type="month"]:hover { border-color: #4c4f51; }

html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="month"] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.83);
  border-color: #c9c3ba;
}

html[data-theme="light"] input::placeholder { color: #918d87; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* -------------------------------------------------------------------------
   Messages
   ------------------------------------------------------------------------- */
.message {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.88rem;
}

.message:empty { display: none; }
.message-ok { color: var(--success); font-weight: 600; }
.message-error { color: var(--danger-strong); font-weight: 600; }
.table-wrap ~ .message { margin-top: 0.9rem; }

/* Louder than .hint but not an error: nothing is broken, the person just
   cannot use the button right now. Accent tokens, as in the sibling tools'
   notices. */
.notice {
  max-width: 46rem;
  margin: 1rem 0 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--accent-border);
  border-left-width: 3px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--muted-strong);
  font-size: 0.84rem;
  line-height: 1.5;
}

.notice strong { color: var(--text); }

/* Read-first version above the action, as the sibling tools place their
   AI notice above the file picker. */
.notice-lead { margin: 0 0 1.25rem; }

/* -------------------------------------------------------------------------
   Loading

   The Admin API lookup behind /api/me takes a second or a few. The page
   shows a spinner panel until it answers, and the raise button shows an
   inline spinner while its request is in flight.
   ------------------------------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
  border: 2.5px solid rgba(255, 130, 71, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -0.2em;
  animation: jis-spin 0.8s linear infinite;
}

.spinner-lg {
  width: 2.6rem;
  height: 2.6rem;
  border-width: 3px;
  box-shadow: 0 0 18px rgba(255, 130, 71, 0.22);
}

.loading-panel {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  border-color: var(--accent-border);
}

.loading-panel .eyebrow { margin-bottom: 0.15rem; }
.loading-text {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}
.loading-panel .hint { margin-top: 0.2rem; }

.loading-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.9rem 0 0;
  color: var(--muted-strong);
  font-size: 0.86rem;
}

/* Spinner inside the accent-filled button: dark ink on orange. */
.button-spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  flex: none;
  border: 2px solid rgba(33, 20, 14, 0.25);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  animation: jis-spin 0.8s linear infinite;
}

/* On a quiet secondary button the spinner is orange on dark, not ink. */
.secondary-button .button-spinner {
  border-color: rgba(255, 130, 71, 0.25);
  border-top-color: var(--accent);
}

.is-busy .button-spinner { display: inline-block; }
button.is-busy:disabled { opacity: 0.85; cursor: progress; }

/* -------------------------------------------------------------------------
   Admin table
   ------------------------------------------------------------------------- */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.admin-toolbar .section-heading { margin-bottom: 0; }
.admin-toolbar .field { flex: 0 0 auto; width: 12rem; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
}

html[data-theme="light"] .table-wrap { background: rgba(255, 255, 255, 0.83); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th {
  padding: 0.6rem 0.85rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.7rem 0.85rem;
  color: var(--muted-strong);
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--panel-hover); }
td:first-child { color: var(--text); font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.when { white-space: nowrap; }
td.action { text-align: right; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-neutral { color: var(--muted); border-color: var(--border); }
.badge-ok { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.badge-warn { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.badge-danger { color: var(--danger); background: var(--error-bg); border-color: var(--error-border); }

.footer {
  padding: 0 1.5rem 3rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

@keyframes jis-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .header-row {
    padding-inline: 1rem;
    gap: 0.75rem;
    flex-wrap: wrap; /* the actions drop below the title instead of squeezing it */
  }

  .header-actions { margin-left: auto; }

  .brand-copy > p:last-child { display: none; }
  .theme-toggle-label { display: none; }
  .theme-toggle { padding-right: 0.34rem; }
  .header-actions { gap: 0.5rem; }
  main { padding: 1.25rem 1rem 3rem; }
  .create-panel::after { width: 15rem; height: 15rem; right: -3rem; }
  .admin-toolbar .field { width: 100%; }
}

@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .loading-panel { flex-direction: column; align-items: flex-start; gap: 0.9rem; }
  .actions .primary-button { width: 100%; }
}

@media (max-width: 480px) {
  .brand-emblem { width: 2.8rem; height: 2.8rem; }
  .brand-emblem img { width: 1.9rem; height: 1.9rem; }
  .brand-copy .eyebrow span { display: none; }
  .brand-copy h1 { font-size: 1.05rem; }
  .panel { padding: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* A frozen ring looks broken; a slow one still says "working". */
  .spinner,
  .button-spinner {
    animation-duration: 1.6s !important;
    animation-iteration-count: infinite !important;
  }
}
