/* ReMac iCloud Check — v2 theme
 * Sidebar app shell. Verdant editorial × refined utility.
 * Type: Bricolage Grotesque (display/UI) + Geist (body) + Instrument Serif (big numbers) + Geist Mono (data).
 */

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ─── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bone: #F6F5EE;
  --paper: #FFFFFF;
  --paper-2: #FBFAF4;
  --paper-3: #EEEDE3;
  --hairline: #E2E0D2;
  --hairline-soft: #ECEAE0;

  /* Brand */
  --forest: #0B2415;
  --forest-2: #173E26;
  --moss: #4F7A57;
  --moss-2: #6E9C76;
  --mint: #50C878;
  --mint-bright: #6DE08F;
  --mint-deep: #2EAB59;
  --mint-soft: #DCEFE2;
  --leaf-pale: #ECF6EF;
  --citrine: #E8DA7C;
  --sun: #F2C94C;

  /* Text */
  --ink: #0B2415;
  --ink-soft: #2D3A30;
  --muted: #6B6F65;
  --hush: #9DA193;
  --whisper: #C2C5B7;

  /* Status */
  --warm-red: #C2543D;
  --warm-amber: #D4A017;
  --warm-good: #2EAB59;

  /* Effects */
  --shadow-sm: 0 1px 0 rgba(11, 36, 21, 0.04), 0 6px 18px -6px rgba(11, 36, 21, 0.10);
  --shadow-md: 0 1px 0 rgba(11, 36, 21, 0.05), 0 18px 40px -12px rgba(11, 36, 21, 0.15);
  --shadow-lift: 0 2px 0 rgba(11, 36, 21, 0.06), 0 32px 60px -18px rgba(11, 36, 21, 0.20);

  /* Type */
  --display: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, ui-sans-serif, sans-serif;
  --serif: 'Instrument Serif', 'Cormorant Garamond', Georgia, serif;
  --body: 'Geist', -apple-system, BlinkMacSystemFont, ui-sans-serif, sans-serif;
  --mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Radii */
  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-xl: 36px;

  /* Geometry */
  --sidebar-w: 280px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-weight: 400;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bone);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Prevent any child from forcing horizontal scroll */
  max-width: 100vw;
}

/* ─── Ambient background ─────────────────────────────────────── */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
}
.orb-1 {
  width: 880px; height: 880px;
  top: -260px; left: -200px;
  background: radial-gradient(circle, rgba(80, 200, 120, 0.30) 0%, transparent 70%);
  animation: float-1 22s ease-in-out infinite;
}
.orb-2 {
  width: 720px; height: 720px;
  bottom: -240px; right: -200px;
  background: radial-gradient(circle, rgba(110, 156, 118, 0.22) 0%, transparent 70%);
  animation: float-2 28s ease-in-out infinite;
}
.orb-3 {
  width: 560px; height: 560px;
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(232, 218, 124, 0.10) 0%, transparent 70%);
  animation: float-3 32s ease-in-out infinite;
}
@keyframes float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 80px) scale(1.08); }
}
@keyframes float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-80px, -60px) scale(1.05); }
}
@keyframes float-3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-45%, -55%) scale(1.12); }
}
.grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  opacity: 0.045;
  mix-blend-mode: multiply;
}

/* ─── Type helpers ───────────────────────────────────────────── */
.display {
  font-family: var(--display);
  font-weight: 500;
  font-variation-settings: "opsz" 96, "wght" 500;
  letter-spacing: -0.028em;
  line-height: 1.02;
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  color: var(--ink);
}
.display em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--moss);
  font-size: 1.02em;
  letter-spacing: -0.01em;
}
.kicker {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 0.8rem;
}
.lede {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 560px;
  margin-top: 1rem;
}
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-feature-settings: 'tnum' 1; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  font-family: var(--body);
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: -0.005em;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.18s var(--ease),
              box-shadow 0.18s var(--ease),
              background 0.18s var(--ease),
              color 0.18s var(--ease);
  white-space: nowrap;
  background: transparent;
}
.btn-full { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-primary {
  background: var(--forest);
  color: var(--bone);
  box-shadow: 0 6px 18px -8px rgba(11, 36, 21, 0.4);
}
.btn-primary:hover {
  background: var(--forest-2);
  transform: translateY(-1px);
  box-shadow: 0 16px 32px -12px rgba(11, 36, 21, 0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  border-color: var(--hairline);
  color: var(--ink-soft);
  background: var(--paper);
}
.btn-ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
  transform: translateY(-1px);
}
.btn-add-funds {
  width: 100%;
  background: var(--mint);
  color: var(--forest);
  font-weight: 600;
  padding: 10px 16px;
  margin-top: 0.8rem;
}
.btn-add-funds svg { width: 16px; height: 16px; }
.btn-add-funds:hover {
  background: var(--mint-bright);
  transform: translateY(-1px);
}
.btn-arrow {
  font-family: var(--serif);
  font-size: 1.2em;
  line-height: 0.5;
  font-style: italic;
}
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn[aria-busy="true"] {
  opacity: 0.7;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-link {
  background: transparent;
  border: 0;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  font-size: 13px;
  width: 100%;
  justify-content: flex-start;
  transition: color 0.16s var(--ease);
}
.btn-link:hover { color: var(--ink); }
.btn-link svg { width: 15px; height: 15px; }

/* ─── Login view ─────────────────────────────────────────────── */
.view-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2rem);
  padding-top: calc(clamp(1rem, 4vw, 2rem) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(clamp(1rem, 4vw, 2rem) + env(safe-area-inset-bottom, 0px));
}
.login-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 0;
  width: 100%;
  max-width: 1080px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  animation: rise 0.6s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-side {
  background:
    radial-gradient(circle at 80% 0%, rgba(80, 200, 120, 0.25) 0%, transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(11, 36, 21, 0.10) 0%, transparent 50%),
    linear-gradient(180deg, var(--leaf-pale) 0%, var(--paper-2) 100%);
  padding: clamp(2.5rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 540px;
}
.login-logo {
  width: 220px; max-width: 80%; height: auto;
  margin-bottom: 2rem;
  animation: pop 0.7s var(--ease-bounce) 0.2s both;
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.login-display {
  font-family: var(--display);
  font-variation-settings: "opsz" 96, "wght" 500;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: var(--forest);
  margin-bottom: 1.2rem;
}
.login-display em {
  font-family: var(--serif);
  font-style: italic;
  color: var(--moss);
  font-weight: 400;
}
.login-blurb {
  color: var(--ink-soft);
  font-size: 16px;
  max-width: 380px;
  margin-bottom: 2rem;
}
.login-feature-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.login-feature-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--ink-soft);
}
.login-feature-list .dot {
  width: 7px; height: 7px;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(80, 200, 120, 0.15);
}
.login-card {
  padding: clamp(2.5rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-card .display { font-size: clamp(2rem, 4vw, 2.4rem); margin-bottom: 2rem; }

@media (max-width: 720px) {
  .login-shell { grid-template-columns: 1fr; max-width: 480px; }
  .login-side { min-height: auto; padding: 2rem; }
  .login-logo { width: 160px; margin-bottom: 1rem; }
}

/* ─── Form fields ────────────────────────────────────────────── */
.field {
  display: block;
  margin-bottom: 1rem;
}
.field > span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 0.4rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 16px;
  font: inherit;
  font-family: var(--body);
  /* 16px minimum prevents iOS Safari from auto-zooming on focus */
  font-size: 16px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  transition: border-color 0.15s var(--ease),
              background 0.15s var(--ease),
              box-shadow 0.15s var(--ease);
}
/* Same protection on the standalone search input in History */
.search-box input { font-size: 16px; }
.field input:hover,
.field select:hover { background: var(--paper); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--forest);
  background: var(--paper);
  box-shadow: 0 0 0 4px rgba(80, 200, 120, 0.18);
}
.form-error {
  margin-top: 1rem;
  padding: 10px 14px;
  background: rgba(194, 84, 61, 0.08);
  border: 1px solid rgba(194, 84, 61, 0.25);
  color: var(--warm-red);
  border-radius: var(--r-sm);
  font-size: 13.5px;
}

/* ─── App shell layout ──────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
}
.sidebar-brand {
  padding: 0.4rem 0.6rem 1.6rem;
  border-bottom: 1px solid var(--hairline-soft);
  margin-bottom: 1rem;
}
.sidebar-logo {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
}
.sidebar-tagline {
  font-family: var(--serif);
  font-style: italic;
  color: var(--moss);
  font-size: 14px;
  margin-top: 0.25rem;
  padding-left: 0.2rem;
}

.sidenav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 14.5px;
  cursor: pointer;
  position: relative;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--paper-2); color: var(--ink); }
.nav-item.is-active {
  background: var(--forest);
  color: var(--paper);
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -1.2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 26px;
  background: var(--mint);
  border-radius: 0 4px 4px 0;
}
.nav-spacer { flex: 1; }

/* Sidebar foot — balance card */
.sidebar-foot {
  margin-top: 1.2rem;
}
.balance-card {
  background:
    radial-gradient(circle at 100% 0%, rgba(80, 200, 120, 0.4) 0%, transparent 60%),
    linear-gradient(180deg, var(--forest) 0%, var(--forest-2) 100%);
  border-radius: var(--r-md);
  padding: 1rem 1.2rem 1.2rem;
  color: var(--bone);
  position: relative;
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.balance-card::after {
  content: "";
  position: absolute;
  bottom: -40%;
  left: -20%;
  width: 140%;
  height: 90%;
  background: radial-gradient(circle, rgba(232, 218, 124, 0.18) 0%, transparent 60%);
  pointer-events: none;
}
.balance-card > * { position: relative; }
.balance-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mint-bright);
  opacity: 0.95;
  margin-bottom: 0.2rem;
}
.balance-value {
  font-family: var(--serif);
  font-style: normal;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--bone);
}
.balance-meta {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.2rem;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: calc(0.7rem + env(safe-area-inset-top, 0px));
  left: calc(0.7rem + env(safe-area-inset-left, 0px));
  width: 46px; height: 46px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  z-index: 40;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  box-shadow: var(--shadow-md);
}
.sidebar-toggle svg { width: 22px; height: 22px; }

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    /* Allow the main pane to fill the viewport when the sidebar is hidden */
  }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: min(86vw, 320px);
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    box-shadow: var(--shadow-lift);
    padding-top: calc(1.4rem + env(safe-area-inset-top, 0px));
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }

  /* Backdrop behind the open sidebar */
  .sidebar.is-open::after {
    content: "";
    position: fixed;
    top: 0; right: 0; bottom: 0;
    left: min(86vw, 320px);
    background: rgba(11, 36, 21, 0.32);
    backdrop-filter: blur(2px);
    z-index: -1;
  }

  /* Push main content down so it never sits under the toggle / status bar */
  .app-main {
    padding-top: calc(4.2rem + env(safe-area-inset-top, 0px));
  }
  /* Smaller display font on phones so headlines don't wrap weirdly */
  .display { font-size: clamp(1.7rem, 7.5vw, 2.4rem); }
  .page-head { margin-bottom: 1.4rem; }
  .stat-card .stat-value { font-size: 2.1rem; }
  .run-stat .stat-value { font-size: 1.5rem; }
  .dash-grid { gap: 0.7rem; }
  .dash-row { gap: 0.7rem; }
}

@media (max-width: 520px) {
  .stat-card { padding: 1rem 1.1rem; }
  .card { padding: 1.2rem; }
  .single-card, .batch-card, .history-card, .account-card {
    padding: 1.2rem;
  }
  .single-result-card { padding: 1.3rem; }
  .login-shell { border-radius: 22px; }
  .login-side, .login-card { padding: 1.6rem; }
  .login-display { font-size: 2rem; }
}

/* ─── Main content ───────────────────────────────────────────── */
.app-main {
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 4vw, 3rem);
  max-width: 1280px;
  width: 100%;
}
.page-head {
  margin-bottom: 2rem;
}
.page-head .display { max-width: 720px; }
.page-head + .dash-grid { margin-top: 1rem; }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.card-head h3 {
  font-family: var(--display);
  font-variation-settings: "opsz" 96, "wght" 500;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.card-meta {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
}
.card-link {
  font-size: 13px;
  color: var(--moss);
  font-weight: 500;
  cursor: pointer;
}
.card-link:hover { color: var(--forest); }

/* ─── Dashboard grid ─────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.stat-card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 1.3rem 1.4rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 0.4rem;
}
.stat-card .stat-value {
  font-family: var(--serif);
  font-style: normal;
  font-size: 2.6rem;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--ink);
}
.stat-card .stat-value .prefix {
  font-family: var(--display);
  font-variation-settings: "opsz" 24, "wght" 500;
  font-size: 0.6em;
  color: var(--moss);
  vertical-align: 0.18em;
  margin-right: 2px;
}
.stat-card .stat-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 0.4rem;
}
.stat-card .stat-action {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--mint-soft);
  color: var(--forest);
  border: 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  transition: all 0.16s var(--ease);
}
.stat-card .stat-action:hover {
  background: var(--mint);
}
.stat-card.stat-balance {
  background:
    radial-gradient(circle at 100% 0%, rgba(80, 200, 120, 0.16) 0%, transparent 50%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  border-color: rgba(80, 200, 120, 0.3);
}
.stat-card.stat-balance .stat-value { color: var(--forest); }
.stat-card.stat-balance .stat-value .prefix { color: var(--mint-deep); }

/* Dashboard row layout */
.dash-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
@media (max-width: 900px) {
  .dash-row { grid-template-columns: 1fr; }
}

/* Bar chart */
.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  height: 160px;
  align-items: end;
  padding-top: 16px;
}
.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}
.bar-col-bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--mint) 0%, var(--mint-deep) 100%);
  min-height: 4px;
  transition: height 0.6s var(--ease);
  position: relative;
}
.bar-col-bar::after {
  content: attr(data-count);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--moss);
  font-family: var(--mono);
}
.bar-col-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Services list (dashboard) */
.service-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.service-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 10px 12px;
  background: var(--paper-2);
  border-radius: 12px;
  align-items: center;
}
.service-list .svc-name {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.service-list .svc-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.service-list .svc-bar {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--paper-3);
  border-radius: 2px;
  overflow: hidden;
}
.service-list .svc-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--mint) 0%, var(--mint-deep) 100%);
  border-radius: 2px;
  transition: width 0.7s var(--ease);
}
.service-empty {
  text-align: center;
  padding: 1.8rem 1rem;
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
  background: transparent;
}

/* Recent / history table */
.recent-table-wrap {
  overflow-x: auto;
  margin: -0.4rem -0.4rem 0;
}
.recent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.recent-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moss);
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline-soft);
}
.recent-table thead th.num { text-align: right; }
.recent-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--ink-soft);
  vertical-align: middle;
}
.recent-table tbody tr:last-child td { border-bottom: 0; }
.recent-table tbody tr {
  transition: background 0.12s var(--ease);
}
.recent-table tbody tr:hover { background: var(--paper-2); }
.recent-table td.num { text-align: right; font-family: var(--mono); }
.recent-table td.serial,
.recent-table td.result-val { font-family: var(--mono); font-size: 13.5px; }
.empty-row td {
  text-align: center !important;
  padding: 2rem !important;
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
}

/* Result pills inside table */
.result-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.result-pill.is-off {
  background: var(--mint-soft);
  color: var(--mint-deep);
}
.result-pill.is-on {
  background: rgba(194, 84, 61, 0.12);
  color: var(--warm-red);
}
.result-pill.is-err {
  background: rgba(212, 160, 23, 0.15);
  color: var(--warm-amber);
}
.result-pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Quick check CTA */
.quick-cta {
  display: block;
  padding: 1.4rem 1.6rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(80, 200, 120, 0.18) 0%, transparent 60%),
    var(--paper-2);
  border: 1px dashed var(--moss-2);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease);
  cursor: pointer;
}
.quick-cta:hover {
  transform: translateY(-2px);
  border-color: var(--moss);
  border-style: solid;
}
.quick-cta-label {
  display: block;
  font-family: var(--display);
  font-size: 1.5rem;
  font-variation-settings: "opsz" 96, "wght" 500;
  letter-spacing: -0.02em;
  color: var(--forest);
  margin-bottom: 0.3rem;
}
.quick-cta-sub {
  display: block;
  font-size: 14px;
  color: var(--muted);
}

/* ─── Single check view ──────────────────────────────────────── */
.single-card { padding: clamp(1.6rem, 4vw, 2.4rem); }
.single-form {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.single-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.field-single-serial { flex: 1 1 100%; }
.field-single-service { flex: 1 1 300px; }
.field-single-serial input {
  font-family: var(--mono);
  font-size: 17px;
  padding: 16px 18px;
  letter-spacing: 0.01em;
}
.single-price {
  padding: 13px 18px;
  font-family: var(--mono);
  font-weight: 600;
  background: var(--mint-soft);
  color: var(--forest-2);
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.single-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.single-hint {
  font-style: italic;
  font-family: var(--serif);
  color: var(--muted);
  font-size: 14px;
}

.single-result { margin-top: 1.4rem; }
.single-result-card {
  padding: clamp(1.6rem, 4vw, 2.4rem);
  background:
    radial-gradient(circle at 100% 0%, rgba(80, 200, 120, 0.10) 0%, transparent 60%),
    var(--paper);
}
.single-result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--hairline-soft);
}
.single-result-sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: 0.4rem;
  word-break: break-all;
}
.single-result-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 22px;
  font-family: var(--display);
  font-variation-settings: "opsz" 96, "wght" 600;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint-deep);
  border: 1px solid rgba(46, 171, 89, 0.3);
}
.single-result-badge.is-on {
  background: rgba(194, 84, 61, 0.1);
  color: var(--warm-red);
  border-color: rgba(194, 84, 61, 0.3);
}
.single-result-badge.is-err {
  background: rgba(212, 160, 23, 0.12);
  color: var(--warm-amber);
  border-color: rgba(212, 160, 23, 0.3);
}
.single-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem 1.6rem;
}
.detail-cell {
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.detail-cell .k {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 0.2rem;
}
.detail-cell .v {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--ink);
  word-break: break-word;
}

/* ─── Batch check ────────────────────────────────────────────── */
.batch-card { padding: clamp(1.6rem, 4vw, 2.4rem); }
.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.field-select { flex: 1 1 300px; }
.service-meta {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 13px;
}
.price-tag, .output-col {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 999px;
}
.price-tag {
  background: var(--mint-soft);
  color: var(--forest-2);
  font-family: var(--mono);
}
.output-col {
  background: var(--paper-2);
  color: var(--ink-soft);
  border: 1px solid var(--hairline);
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed var(--hairline);
  border-radius: var(--r-md);
  background: var(--paper-2);
  padding: clamp(2rem, 5vw, 3rem) 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.dropzone:hover,
.dropzone:focus,
.dropzone.is-drag {
  border-color: var(--mint-deep);
  background: var(--leaf-pale);
  transform: translateY(-1px);
}
.dropzone-icon {
  width: 40px; height: 40px;
  color: var(--moss);
  margin-bottom: 0.8rem;
  transition: transform 0.2s var(--ease-bounce);
}
.dropzone:hover .dropzone-icon { transform: translateY(-3px) scale(1.05); }
.dropzone-title {
  font-family: var(--display);
  font-variation-settings: "opsz" 96, "wght" 500;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.dropzone-or {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.dropzone-hint {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

/* Preview block */
.preview {
  margin-top: 1.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--hairline);
  animation: fade-up 0.4s var(--ease) both;
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.2rem 2rem;
  margin-bottom: 1.4rem;
}
.preview-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 0.3rem;
}
.preview-value {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
}
.preview-value.cost {
  font-family: var(--serif);
  font-size: 1.7rem;
  color: var(--forest-2);
}
.preview-sample {
  margin: 1rem 0 1.4rem;
  padding: 1rem 1.2rem;
  background: var(--paper-2);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.preview-sample summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--moss);
}
.preview-sample ul { list-style: none; padding: 0; margin-top: 0.6rem; }
.preview-sample li { padding: 4px 0; font-size: 13px; color: var(--ink-soft); }
.preview-actions {
  display: flex; gap: 0.8rem; justify-content: flex-end; flex-wrap: wrap;
}

/* Run pane */
.run-pane { margin-top: 1.4rem; }
.run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.run-stat {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 1.2rem 1.4rem;
}
.run-stat .stat-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 0.4rem;
}
.run-stat .stat-value {
  font-family: var(--serif);
  font-size: 1.9rem;
  line-height: 1;
  color: var(--ink);
}
.run-stat .stat-value.cost { color: var(--forest-2); }
.stat-divider { color: var(--hush); font-style: italic; padding: 0 0.2em; }
.run-stat .stat-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 0.4rem;
}
.progress-track {
  height: 8px;
  background: var(--paper-3);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.6rem;
  position: relative;
}
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--mint) 0%, var(--mint-bright) 100%);
  border-radius: 999px;
  transition: width 0.5s var(--ease);
  position: relative;
  box-shadow: 0 0 24px rgba(80, 200, 120, 0.5);
}
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,0.4), transparent 70%);
  animation: sheen 1.6s infinite linear;
}
@keyframes sheen {
  0% { transform: translateX(-30%); }
  100% { transform: translateX(130%); }
}
.run-banner {
  margin-bottom: 1.4rem;
  padding: 14px 18px;
  background: rgba(194, 84, 61, 0.08);
  border: 1px solid rgba(194, 84, 61, 0.25);
  border-radius: var(--r-md);
  color: var(--warm-red);
  font-size: 14px;
}
.run-banner.is-success {
  background: var(--leaf-pale);
  border-color: rgba(80, 200, 120, 0.4);
  color: var(--forest-2);
}
.run-actions {
  display: flex; gap: 0.8rem; margin-bottom: 1.4rem; flex-wrap: wrap;
}
/* Live results — streaming table during batch run */
.live-results {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 1.2rem 1.4rem;
  margin-top: 1rem;
  animation: fade-up 0.3s var(--ease) both;
}
.live-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.live-results-head h3 {
  font-family: var(--display);
  font-variation-settings: "opsz" 96, "wght" 500;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.live-results-filter {
  display: flex;
  gap: 4px;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  padding: 4px;
  border-radius: 999px;
}
.live-table tbody tr {
  animation: live-row-in 0.32s var(--ease) both;
}
.live-table td.row-num { font-family: var(--mono); color: var(--muted); width: 70px; }
.live-table td.row-serial { font-family: var(--mono); }
.live-results-note {
  margin-top: 0.8rem;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
}
.live-table tr.is-hidden { display: none; }
@keyframes live-row-in {
  from { opacity: 0; transform: translateY(-6px); background: var(--leaf-pale); }
  to { opacity: 1; transform: translateY(0); background: transparent; }
}

/* ─── History view ──────────────────────────────────────────── */
.history-card { padding: clamp(1.4rem, 3vw, 2rem); }
.history-toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.search-box {
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.search-box:focus-within {
  border-color: var(--forest);
  background: var(--paper);
  box-shadow: 0 0 0 4px rgba(80, 200, 120, 0.18);
}
.search-box svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.search-box input {
  border: 0;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 14.5px;
  flex: 1;
  color: var(--ink);
}
.history-filter {
  display: flex;
  gap: 4px;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  padding: 4px;
  border-radius: 999px;
}
.filter-pill {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.filter-pill:hover { color: var(--ink); }
.filter-pill.is-active {
  background: var(--forest);
  color: var(--paper);
}
.history-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline-soft);
  font-size: 13px;
  color: var(--muted);
}
.history-paging { display: flex; gap: 0.6rem; }

/* ─── Account ────────────────────────────────────────────────── */
.account-card {
  margin-bottom: 1rem;
  padding: clamp(1.4rem, 3vw, 1.8rem) clamp(1.6rem, 4vw, 2.2rem);
}
.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.account-user, .account-balance {
  margin-top: 0.2rem;
}
.account-balance-sub {
  margin-top: 0.2rem;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
}
.account-version {
  margin-top: 0.2rem;
  font-size: 13.5px;
  color: var(--muted);
}
.account-help {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline-soft);
  font-size: 13px;
  color: var(--muted);
}

/* ─── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--forest);
  color: var(--bone);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lift);
  z-index: 100;
  animation: toast-in 0.25s var(--ease) both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in {
  animation: fade-up 0.55s var(--ease) both;
  animation-delay: var(--delay, 0ms);
}

/* iOS PWA safe area */
@supports (padding: env(safe-area-inset-top)) {
  .app-main { padding-top: calc(2rem + env(safe-area-inset-top)); }
  .sidebar { padding-top: calc(1.6rem + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .progress-fill::after, .orb { display: none; animation: none; }
}
