/* IGO shared theme — one design system for every portal page.
   Base: the dark-green V3 Combined Tool theme (DM Sans / IBM Plex Mono). */
:root {
  /* V3 core tokens */
  --bg: #0f1412; --bg-elev: #171e1b; --bg-soft: #1e2823; --bg-deep: #0c100e;
  --line: #2d3a33; --line-strong: #456153;
  --text: #e8efe9; --muted: #93a399;
  --accent: #2f9e77; --accent-hover: #37b187; --accent-2: #d4a017;
  --danger: #d96b5c; --ok: #3cb371; --pending: #d4a017;
  --shadow: 0 18px 50px rgba(0,0,0,.35); --shadow-sm: 0 6px 18px rgba(0,0,0,.25);
  --radius: 14px; --radius-sm: 10px; --radius-pill: 999px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --font: "DM Sans", system-ui, sans-serif; --mono: "IBM Plex Mono", ui-monospace, monospace;
  /* Portal aliases mapped onto the same tokens */
  --bg-2: var(--bg-elev); --ink: var(--text); --card: var(--bg-elev);
  --surface: var(--bg-elev); --surface-2: var(--bg-soft); --surface-glass: rgba(23,30,27,.86);
  --forest: var(--accent); --forest-2: #268a67; --gold: var(--accent-2);
  --display: var(--font);
  color-scheme: dark;
}
html, body { background-color: var(--bg-deep); }
body {
  font-family: var(--font); color: var(--text);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(47,158,119,.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(212,160,23,.12), transparent 50%),
    linear-gradient(160deg, #101614 0%, #0c100e 45%, #121916 100%) !important;
  background-attachment: fixed;
}
h1, h2, h3 { font-family: var(--font); color: var(--text); letter-spacing: -0.02em; }
a { color: #6fd0aa; }
.muted { color: var(--muted); }

/* Buttons */
.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--bg-soft); border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--line-strong); background: #243029; }
.btn-gold { background: var(--accent-2); color: #1a1408; }

/* Inputs */
input, select, textarea { color: var(--text); }
.field input, .field select, .field textarea, .auth-card input, .license-box input,
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
  background: var(--bg-deep); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm);
}
.field span, label > span { color: var(--muted); }

/* Cards / panels */
.panel, .auth-card, .metric, .plan-card, .pack-card, .product-card { background: var(--bg-elev); border-color: var(--line); color: var(--text); box-shadow: var(--shadow-sm); }

/* Badges & pills */
.badge-ready, .step-pill.done { background: rgba(60,179,113,.15); color: #9fd4b5; }
.badge-locked { background: rgba(212,160,23,.15); color: #f0d48a; }
.badge-pending { background: var(--bg-soft); color: var(--muted); }
.stat-pill, .step-pill { background: var(--bg-soft); border-color: var(--line); color: var(--muted); }
.step-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Alerts */
.alert-error { background: rgba(217,107,92,.12); color: #f0b4ac; border: 1px solid rgba(217,107,92,.35); }
.alert-ok { background: rgba(60,179,113,.12); color: #b7ebc9; border: 1px solid rgba(60,179,113,.35); }
.alert-info { background: rgba(47,158,119,.10); color: var(--text); border: 1px solid var(--line); }

/* Tables */
table { color: var(--text); }
th { color: var(--muted); font-weight: 600; }
th, td { border-color: var(--line); }

/* Auth layout: one consistent two-panel layout for login / signup / verify */
.auth-hero {
  background: linear-gradient(160deg, rgba(47,158,119,.28), rgba(15,20,18,.9)), var(--bg-elev) !important;
  border-right: 1px solid var(--line); color: var(--text);
}
.auth-hero .brand { font-family: var(--font); }
.auth-panel { background: transparent; }
.auth-card { border: 1px solid var(--line); border-radius: var(--radius); }

/* Light-theme top bars rethemed */
.catalog-top, .pricing-top { background: rgba(12,16,14,.85) !important; border-bottom: 1px solid var(--line); }
.catalog-brand, .pricing-brand { color: var(--text) !important; font-family: var(--font); }
.pricing-nav a { color: var(--text); }

/* Passwordless auth */
.auth-card input[inputmode="numeric"], #code {
  font-family: var(--mono);
  font-size: 1.35rem;
  letter-spacing: 0.28em;
  text-align: center;
}
.auth-hero { padding: clamp(28px, 5vw, 48px); }
@media (max-width: 900px) {
  .auth-hero { min-height: 180px; padding: 28px 20px; }
  .auth-hero .brand { font-size: 2.4rem; }
  .auth-panel { padding: 20px 16px 40px; }
  .auth-card { padding: 22px 18px; }
}

/* Onboarding progress */
.ob-progress { margin: 0 0 14px; }
.ob-progress-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.ob-progress-track { height: 6px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.ob-progress-track span { display: block; height: 100%; width: 25%; background: var(--accent); border-radius: 99px; transition: width .2s ease; }
.onboard-shell { max-width: 880px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.integration-list { display: grid; gap: 10px; margin: 12px 0 16px; }
.integration-row { display: flex; gap: 12px; align-items: flex-start; }
.integration-row .stat-pill { flex: none; }

/* Processing queue rows */
.processing-sku-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.pdp-frame .btn, #closePdp { background: var(--bg-elev) !important; color: var(--text) !important; }

/* The main menu is long enough that a fixed sidebar used to clip the lower links. */
.app-shell .sidebar,
.processing-page .app-shell .sidebar { overflow-x: hidden; overflow-y: auto; }

/* Processing PC, download, terms, helper dialog */
.pair-box { margin-top: 16px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.pair-code { font-family: var(--mono); font-size: 2rem; letter-spacing: 0.14em; margin: 6px 0; }
.device-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.device-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.folder-chip.ok { color: #9fd4b5; }
.folder-chip.warn, .folder-chip.pending { color: #f0d48a; }
.helper-banner { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(47,158,119,.12); border: 1px solid rgba(47,158,119,.4); }
.helper-banner a { color: #9fd4b5; }
.download-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.download-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--bg-deep); }
.download-card.is-recommended { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.download-card h2 { font-size: 1.05rem; margin: 0 0 6px; }
.download-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.terms-check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.terms-check input { margin-top: 4px; }
.terms-doc { max-width: 760px; margin: 8px auto 40px; padding: 0 4px 24px; }
.terms-doc h1 { margin-bottom: 4px; }
.terms-doc h2 { margin-top: 22px; font-size: 1.05rem; }
.draft-flag { display: inline-block; margin: 0 0 12px; padding: 4px 8px; border-radius: 99px; background: rgba(212,160,23,.16); color: #f0d48a; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.helper-modal { position: fixed; inset: 0; z-index: 80; background: rgba(8,12,10,.72); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.helper-modal.hidden { display: none; }
.helper-modal-card { width: min(460px, 100%); background: var(--bg-elev); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow, 0 16px 40px rgba(0,0,0,.35)); }
.helper-modal-card h2 { margin: 0 0 8px; }
.helper-modal-card .btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
@media (min-width: 700px) { .helper-modal { align-items: center; } }

/* Keep workflow chips usable on a phone */
@media (max-width: 900px) {
  .workflow-group { display: flex; flex-wrap: wrap; }
  .processing-main { padding-bottom: 32px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .settings-grid { grid-template-columns: 1fr; }
  .device-row { flex-direction: column; align-items: stretch; }
  .helper-modal-card .btn-row { flex-direction: column; }
  .helper-modal-card .btn { width: 100%; }
}

/* Release 15.23p: keep the left menu fixed in view on every portal page.
   The grid column still reserves the menu width, so content does not slide
   under it or leave a gap. The menu itself scrolls if it is taller than
   the viewport. overflow-x is kept off the shell so position:sticky is not
   broken by a second scroll container (Processing Tools previously set
   overflow-x:hidden on .app-shell). */
@media (min-width: 901px) {
  .app-shell,
  .processing-page .app-shell {
    align-items: start;
    overflow-x: visible;
  }
  .app-shell .sidebar,
  .processing-page .sidebar,
  .processing-page .app-shell .sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    max-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
  }
  .app-shell.sidebar-collapsed .sidebar,
  .processing-page .app-shell.sidebar-collapsed .sidebar {
    height: 0;
    max-height: 0;
    overflow: hidden;
  }
  .app-shell > .main,
  .processing-page .processing-workspace,
  .processing-page .app-shell > .main {
    min-width: 0;
  }
}
