@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Lora:ital,wght@0,400;0,500;0,600;1,400&display=swap');

/* ── Design tokens (light mode) ──────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-body:          #f0ecf6;
  --bg-surface:       #ffffff;
  --bg-surface-alt:   #f8f5fc;
  --bg-surface-alt2:  #f4f0f8;
  --bg-surface-hover: #ede8f6;
  --bg-analysis:      #f4f0f8;

  /* Text */
  --text-primary:   #1e1530;
  --text-secondary: #382858;
  --text-muted:     #7060a0;
  --text-faint:     #9888b4;

  /* Borders */
  --border:       #e0d8f0;
  --border-input: #d0c8e4;
  --border-card:  transparent;

  /* Navbar */
  --navbar-bg-from:   #1e1530;
  --navbar-bg-to:     #2e2050;
  --navbar-shadow:    rgba(0,0,0,0.10);
  --navbar-link:      #4a3878;
  --navbar-link-hover:#1e1530;
  --navbar-brand:     #b8a000;

  /* Profession headers (always dark) */
  --prof-bg-from:  #1e1530;
  --prof-bg-to:    #2e2050;
  --prof-text:     #e0d0f8;
  --prof-count:    #9080c0;
  --prof-shadow:   rgba(0,0,0,0.12);
  --prof-hover-from: #261840;
  --prof-hover-to:   #382860;

  /* Table */
  --table-header-bg:   #2e2050;
  --table-header-text: #c0b0e0;
  --table-row-even:    #f8f5fc;
  --table-row-hover:   #ede8f6;
  --table-border:      #e8e0f4;
  --table-shadow:      rgba(0,0,0,0.06);

  /* Expansion groups */
  --exp-bg:      #f0ecf8;
  --exp-hover:   #e8e0f4;
  --exp-border:  #5a4890;
  --exp-text:    #2e2050;
  --exp-count:   #6858a8;

  /* Tabs */
  --tab-border:        #e0d8f0;
  --tab-text:          #6858a0;
  --tab-text-hover:    #2e2050;
  --tab-active-text:   #2e2050;
  --tab-active-border: #5a4890;
  --tab-hover-bg:      rgba(90,72,144,0.05);

  /* Status bar */
  --status-bg:     #ffffff;
  --status-border: #0066CC;

  /* Cards */
  --card-bg:     #ffffff;
  --card-shadow: rgba(0,0,0,0.10);

  /* Inputs / selects */
  --input-bg:        #ffffff;
  --input-border:    #d0c8e4;
  --input-focus:     #0066CC;
  --input-focus-ring:rgba(0,102,204,0.12);

  /* Modals */
  --modal-overlay:   rgba(8,4,16,0.65);
  --modal-bg:        #ffffff;
  --modal-shadow:    rgba(0,0,0,0.25);
  --modal-hdr-from:  #1e1530;
  --modal-hdr-to:    #2e2050;

  /* Buttons */
  --btn-primary-bg:    #0066CC;
  --btn-primary-hover: #0052a3;
  --btn-primary-shadow:rgba(0,102,204,0.3);
  --btn-outline-bg:    transparent;
  --btn-outline-text:  #555;
  --btn-outline-border:#d0c8e4;
  --btn-outline-hover: #f4f0f8;
  --btn-toggle-border: #d0c8e4;
  --btn-toggle-hover:  #ede8f6;
  --btn-toggle-text:   #6858a0;

  /* Profession filter pills */
  --pill-bg:     #ffffff;
  --pill-border: #d0c8e4;
  --pill-text:   #444;
  --pill-hover-bg:     #2e2050;
  --pill-hover-text:   #e0d0f8;
  --pill-hover-border: #2e2050;

  /* Currency */
  --gold-color:   #b8860b;
  --silver-color: #888;
  --copper-color: #a06830;

  /* Profit */
  --profit-pos: #0e6e30;
  --profit-neg: #c0392b;
  --best-price: #0e5228;

  --trend-down-text: #00438a;

  /* Alerts */
  --alert-success-bg: #d4f0de; --alert-success-text: #0e5228; --alert-success-border: #1a7f40;
  --alert-error-bg:   #fce8ea; --alert-error-text:   #7b1c22; --alert-error-border:   #d9363e;
  --alert-info-bg:    #daeef7; --alert-info-text:    #0a4a60; --alert-info-border:    #1a90b8;


  /* Cheaper badge */
  --cheaper-bg:     #c8f0d8; --cheaper-text: #0e5228; --cheaper-border: #5acc88;

  /* Icon placeholder */
  --icon-placeholder-bg:     #2a2040;
  --icon-placeholder-border: #504878;

  /* Auth page */
  --auth-body-from: #0e0c16;
  --auth-body-via:  #1e1530;
  --auth-body-to:   #1a1428;
  --auth-card-bg:   #1c1630;
  --auth-card-text: #e0d8f0;
  --auth-card-border:#382858;
  --auth-label:     #a898c8;
  --auth-input-bg:  #120e1e;
  --auth-input-border:#2e2248;
  --auth-input-text:#e0d0f4;
  --auth-input-focus:#FFD700;
  --auth-link-text: #807098;
  --auth-link-color:#FFD700;
  --auth-h1:        #FFD700;
  --auth-h2:        #807098;
}

/* ── Dark mode overrides ──────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    /* Backgrounds */
    --bg-body:          #0e0c16;
    --bg-surface:       #18162a;
    --bg-surface-alt:   #1e1a30;
    --bg-surface-alt2:  #1a1628;
    --bg-surface-hover: #261e40;
    --bg-analysis:      #1e1a30;

    /* Text */
    --text-primary:   #e8e0f4;
    --text-secondary: #c0b0e0;
    --text-muted:     #7868a8;
    --text-faint:     #5a4888;

    /* Borders */
    --border:       #2e2850;
    --border-input: #342e58;
    --border-card:  #2c2448;

    /* Navbar */
    --navbar-link:      #c0b0e0;
    --navbar-link-hover:#e8e0f4;

    /* Expansion groups */
    --exp-bg:      #1e1a40;
    --exp-hover:   #261e50;
    --exp-border:  #6858a8;
    --exp-text:    #c8b8e8;
    --exp-count:   #7060a8;

    /* Tabs */
    --tab-border:        #2e2850;
    --tab-text:          #7060a0;
    --tab-text-hover:    #c8b8e8;
    --tab-active-text:   #d8c8f0;
    --tab-active-border: #7868b0;
    --tab-hover-bg:      rgba(100,80,168,0.08);

    /* Status bar */
    --status-bg:     #18162a;
    --status-border: #3388e8;

    /* Cards */
    --card-bg:     #18162a;
    --card-shadow: rgba(0,0,0,0.4);

    /* Inputs / selects */
    --input-bg:         #12101e;
    --input-border:     #342e58;
    --input-focus:      #4488e8;
    --input-focus-ring: rgba(68,136,232,0.18);

    /* Modals */
    --modal-overlay:  rgba(4,2,10,0.78);
    --modal-bg:       #18162a;
    --modal-shadow:   rgba(0,0,0,0.5);

    /* Buttons */
    --btn-primary-bg:    #1a70dd;
    --btn-primary-hover: #1260c0;
    --btn-primary-shadow:rgba(26,112,221,0.35);
    --btn-outline-bg:    transparent;
    --btn-outline-text:  #9080b0;
    --btn-outline-border:#342e58;
    --btn-outline-hover: #1e1a30;
    --btn-toggle-border: #342e58;
    --btn-toggle-hover:  #261e50;
    --btn-toggle-text:   #7868a8;

    /* Profession filter pills */
    --pill-bg:          #1e1a30;
    --pill-border:      #342e58;
    --pill-text:        #a090c0;
    --pill-hover-bg:    #382870;
    --pill-hover-text:  #e0d0f8;
    --pill-hover-border:#584898;

    /* Table */
    --table-header-bg:   #0e0c18;
    --table-header-text: #8870b8;
    --table-row-even:    #1c1828;
    --table-row-hover:   #231e40;
    --table-border:      #261e3c;
    --table-shadow:      rgba(0,0,0,0.3);

    /* Currency */
    --gold-color:   #d4a820;
    --silver-color: #9090a8;
    --copper-color: #b87040;

    /* Profit */
    --profit-pos: #3cb86a;
    --profit-neg: #e06060;
    --best-price: #3cb86a;

    --trend-down-text: #70a8e0;

    /* Alerts */
    --alert-success-bg: #0c2818; --alert-success-text: #3cb86a; --alert-success-border: #1e6840;
    --alert-error-bg:   #2a1018; --alert-error-text:   #e06060; --alert-error-border:   #681828;
    --alert-info-bg:    #001830; --alert-info-text:    #70a8e0; --alert-info-border:    #003468;

    /* Cheaper badge */
    --cheaper-bg:     #0c2818; --cheaper-text: #3cb86a; --cheaper-border: #1e6840;

    /* Auth page — stays dark in both modes */
    --auth-body-from: #080810;
    --auth-body-via:  #100e18;
    --auth-body-to:   #100e18;
    --auth-card-bg:   #141228;
    --auth-card-text: #c8b8e0;
    --auth-card-border:#201838;
    --auth-label:     #7868a0;
    --auth-input-bg:  #0c0a14;
    --auth-input-border:#281e38;
    --auth-input-text:#d0c0e8;
    --auth-input-focus:#FFD700;
    --auth-link-text: #5a5080;
    --auth-link-color:#FFD700;
    --auth-h1:        #FFD700;
    --auth-h2:        #5a5080;
  }
}

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

body {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  transition: background-color 0.2s, color 0.2s;
}

h1, h2, h3 { font-family: 'Cinzel', 'Trajan Pro', serif; color: var(--text-primary); margin-top: 0; letter-spacing: 0.04em; }

a { color: var(--btn-primary-bg); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-body);
  color: var(--text-primary);
  padding: 0 28px;
  height: 72px;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 120px;
  width: auto;
  pointer-events: none;
}

.navbar-links { display: flex; align-items: center; gap: 16px; }

.navbar-links a {
  color: var(--navbar-link);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s;
}
.navbar-links a:hover { color: var(--navbar-link-hover); text-decoration: none; }

/* ── Container ───────────────────────────────────────────────── */
.container {
  max-width: 1060px;
  margin: 28px auto;
  padding: 0 24px;
}

/* ── Auth page ───────────────────────────────────────────────── */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(160deg,
    var(--auth-body-from) 0%,
    var(--auth-body-via)  60%,
    var(--auth-body-to)   100%);
}

body.auth-page h1 {
  font-size: 22px;
  font-family: 'Cinzel', 'Trajan Pro', serif;
  letter-spacing: 2px;
  margin-bottom: 4px;
  color: var(--auth-h1);
  text-align: center;
  text-shadow: 0 0 20px rgba(255,215,0,0.3);
}
body.auth-page h2 {
  font-size: 14px;
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--auth-h2);
  margin-bottom: 24px;
  text-align: center;
}

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 32px;
  box-shadow: 0 4px 24px var(--card-shadow);
  margin-bottom: 20px;
  border: 1px solid var(--border-card);
}

body.auth-page .card {
  width: 100%;
  max-width: 400px;
  background: var(--auth-card-bg);
  color: var(--auth-card-text);
  border: 1px solid var(--auth-card-border);
}

body.auth-page .form-group label { color: var(--auth-label); }

body.auth-page .form-group input {
  background: var(--auth-input-bg);
  border-color: var(--auth-input-border);
  color: var(--auth-input-text);
}
body.auth-page .form-group input:focus { border-color: var(--auth-input-focus); }

body.auth-page .auth-link { color: var(--auth-link-text); }
body.auth-page .auth-link a { color: var(--auth-link-color); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-group input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  font-size: 14px;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.hint { font-weight: 400; color: var(--text-faint); font-size: 12px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  background-color: var(--btn-primary-bg);
  color: #fff;
  border: none;
  padding: 9px 18px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 500;
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn:hover:not(:disabled) {
  background-color: var(--btn-primary-hover);
  box-shadow: 0 2px 6px var(--btn-primary-shadow);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled              { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background-color: var(--btn-primary-bg); }
.btn-full    { width: 100%; padding: 12px; font-size: 15px; margin-top: 8px; }
.btn-sm      { padding: 5px 12px; font-size: 13px; }
.btn-outline {
  background: var(--btn-outline-bg);
  color: var(--btn-outline-text);
  border: 1px solid var(--btn-outline-border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--btn-outline-hover);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: none;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 11px 16px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 14px;
  border-left: 4px solid transparent;
}

.alert.hidden  { display: none; }
.alert.success { background: var(--alert-success-bg); color: var(--alert-success-text); border-left-color: var(--alert-success-border); }
.alert.error   { background: var(--alert-error-bg);   color: var(--alert-error-text);   border-left-color: var(--alert-error-border); }
.alert.info    { background: var(--alert-info-bg);    color: var(--alert-info-text);    border-left-color: var(--alert-info-border); }

/* ── Table ───────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 6px var(--table-shadow);
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--table-border);
  font-size: 13.5px;
}

th {
  background: var(--table-header-bg);
  color: var(--table-header-text);
  font-family: 'Cinzel', 'Trajan Pro', serif;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--table-row-even); }
tr:hover td { background: var(--table-row-hover) !important; }

table.hidden { display: none; }

/* ── Toolbar ─────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.region-select {
  padding: 7px 12px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s;
}
.region-select:focus { outline: none; border-color: var(--input-focus); }

/* ── Item icons ──────────────────────────────────────────────── */
.item-icon {
  width: 36px;
  height: 36px;
  border: 2px solid var(--icon-placeholder-border);
  border-radius: 5px;
  display: block;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.item-icon-placeholder {
  display: block;
  width: 36px;
  height: 36px;
  background: var(--icon-placeholder-bg);
  border: 2px solid var(--icon-placeholder-border);
  border-radius: 5px;
}

/* ── Currency ────────────────────────────────────────────────── */
.price       { white-space: nowrap; }
.gold        { color: var(--gold-color);   font-weight: 700; }
.silver      { color: var(--silver-color); font-weight: 500; }
.copper      { color: var(--copper-color); }

/* ── Status bar ──────────────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--status-bg);
  border-radius: 8px;
  padding: 11px 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 6px var(--table-shadow);
  border-left: 3px solid var(--status-border);
  border: 1px solid var(--border-card);
  border-left-width: 3px;
  border-left-color: var(--status-border);
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--modal-overlay);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--modal-bg);
  border-radius: 12px;
  width: 90%;
  max-width: 780px;
  box-shadow: 0 16px 48px var(--modal-shadow);
  overflow: hidden;
  border: 1px solid var(--border-card);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: linear-gradient(135deg, var(--modal-hdr-from) 0%, var(--modal-hdr-to) 100%);
  color: #FFD700;
  font-family: 'Cinzel', 'Trajan Pro', serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.06em;
}

.modal-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.modal-body { padding: 20px; }

/* ── Crafting table ──────────────────────────────────────────── */
.crafting-row td { font-weight: 500; }

.variant-row td {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface-alt2) !important;
  padding-top: 4px;
  padding-bottom: 4px;
}

.best-price { color: var(--best-price); font-weight: 700; }

.cheaper-badge {
  font-size: 10.5px;
  background: var(--cheaper-bg);
  color: var(--cheaper-text);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 5px;
  border: 1px solid var(--cheaper-border);
}

.btn-tiny { padding: 0 5px; font-size: 11px; height: 17px; }

.reagent-row td {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-surface-alt) !important;
  padding-top: 6px;
  padding-bottom: 6px;
}

.quality-tier-row td {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-surface-alt2) !important;
  padding-top: 4px;
  padding-bottom: 4px;
}
.qtier-label {
  color: #c9a227;
  font-weight: 700;
  letter-spacing: 1px;
  margin-right: 4px;
}
.qtier-sell { font-weight: 600; }
.qtier-toggle { margin-right: 2px; color: #c9a227; }

.reagent-name { padding-left: 28px !important; }

.craft-qty { color: var(--text-muted); font-size: 12px; margin-left: 4px; }

/* ── Craft count input & batch result row ────────────────────── */
.craft-count-cell {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
}
.craft-count-input {
  width: 52px;
  padding: 3px 6px;
  border: 1px solid var(--input-border);
  border-radius: 5px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  text-align: center;
}
.craft-count-input:focus { outline: none; border-color: var(--input-focus); }
/* Hide browser spin arrows */
.craft-count-input::-webkit-outer-spin-button,
.craft-count-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.craft-count-input[type=number] { -moz-appearance: textfield; }

.batch-row td { padding: 0; }
.batch-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 14px 6px 48px;
  background: var(--hover-bg);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.batch-label { font-weight: 600; color: var(--text-muted); }
.batch-arrow { color: var(--text-muted); }
.batch-yield { font-weight: 700; color: var(--text-primary); }
.batch-sep   { color: var(--border-color); }
.batch-stat  { color: var(--text-secondary); }
.batch-stat strong { color: var(--text-primary); }
.batch-stat.profit-positive strong { color: var(--profit-pos); }
.batch-stat.profit-negative strong { color: var(--profit-neg); }
.batch-note {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--tag-bg, rgba(128,128,128,0.12));
  border-radius: 4px;
  padding: 1px 6px;
}

.profit-positive { color: var(--profit-pos); font-weight: 700; }
.profit-negative { color: var(--profit-neg); font-weight: 700; }
.profit-best { outline: 2px solid var(--profit-pos); outline-offset: -2px; border-radius: 3px; }
.sell-tier-row { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.sell-tier-label { font-size: 0.75em; color: var(--text-muted); min-width: 16px; }
.sell-lq-price { color: var(--text-muted); font-size: 0.88em; }
.gear-section-divider { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; color: var(--text-muted); font-size: 0.85em; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.gear-section-divider::before, .gear-section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.btn-toggle {
  background: none;
  border: 1px solid var(--btn-toggle-border);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  color: var(--btn-toggle-text);
  transition: background 0.12s, border-color 0.12s;
}
.btn-toggle:hover { background: var(--btn-toggle-hover); border-color: var(--border); }
.btn-toggle.btn-text { width: auto; height: auto; padding: 3px 10px; font-size: 13px; white-space: nowrap; }

/* ── Profession groups ───────────────────────────────────────── */
.profession-group { margin-bottom: 10px; scroll-margin-top: 160px; }

@keyframes profGroupHighlight {
  0%, 100% { outline: 2px solid transparent; }
  30%       { outline: 2px solid var(--pill-hover-border); }
}
.prof-group-highlight { animation: profGroupHighlight 1s ease; }

.profession-group > details > summary {
  background: linear-gradient(90deg, var(--prof-bg-from) 0%, var(--prof-bg-to) 100%);
  color: var(--prof-text);
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Cinzel', 'Trajan Pro', serif;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  list-style: none;
  user-select: none;
  transition: background 0.15s;
  box-shadow: 0 2px 6px var(--prof-shadow);
}
.profession-group > details > summary::-webkit-details-marker { display: none; }
.profession-group > details > summary::before {
  content: '▶';
  font-size: 10px;
  transition: transform 0.18s;
  flex-shrink: 0;
  opacity: 0.7;
}
.profession-group > details[open] > summary::before { transform: rotate(90deg); }
.profession-group > details > summary:hover {
  background: linear-gradient(90deg, var(--prof-hover-from) 0%, var(--prof-hover-to) 100%);
}

.prof-count {
  color: var(--prof-count);
  font-size: 12px;
  font-weight: 400;
  margin-left: auto;
}

.expansion-groups { padding: 5px 0 2px 0; }

/* ── Expansion sub-groups ────────────────────────────────────── */
.expansion-group { margin: 5px 0; }

.expansion-group > details > summary {
  background: var(--exp-bg);
  color: var(--exp-text);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Cinzel', 'Trajan Pro', serif;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.07em;
  border-left: 3px solid var(--exp-border);
  list-style: none;
  user-select: none;
  transition: background 0.15s;
}
.expansion-group > details > summary::-webkit-details-marker { display: none; }
.expansion-group > details > summary::before {
  content: '▶';
  font-size: 9px;
  transition: transform 0.18s;
  flex-shrink: 0;
  opacity: 0.6;
}
.expansion-group > details[open] > summary::before { transform: rotate(90deg); }
.expansion-group > details > summary:hover { background: var(--exp-hover); }

.exp-count { color: var(--exp-count); font-size: 12px; font-weight: 400; margin-left: auto; }

.expansion-group > details > div { padding-top: 5px; }

/* ── Profession filter buttons ───────────────────────────────── */
.prof-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

#professionFilter {
  position: sticky;
  top: 72px;
  z-index: 40;
  background: var(--bg-body);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.prof-btn {
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  color: var(--pill-text);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.prof-btn:hover {
  background: var(--pill-hover-bg);
  color: var(--pill-hover-text);
  border-color: var(--pill-hover-border);
}
.prof-btn.active {
  background: var(--pill-hover-bg);
  color: var(--pill-hover-text);
  border-color: var(--pill-hover-border);
}

/* ── Tabs ────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--tab-border);
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Cinzel', 'Trajan Pro', serif;
  letter-spacing: 0.05em;
  color: var(--tab-text);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  border-radius: 4px 4px 0 0;
}

.tab-btn:hover  { color: var(--tab-text-hover); background: var(--tab-hover-bg); }
.tab-btn.active { color: var(--tab-active-text); border-bottom-color: var(--tab-active-border); }

.tab-pane { }

.tab-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}

/* ── Crafting search ─────────────────────────────────────────── */
.crafting-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.crafting-search {
  padding: 7px 32px 7px 12px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text-primary);
  width: 200px;
  transition: border-color 0.15s, width 0.2s;
}
.crafting-search:focus {
  outline: none;
  border-color: var(--input-focus);
  width: 260px;
}
.crafting-search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 0;
  line-height: 1;
}
.crafting-search-clear:hover { color: var(--text-primary); }

/* ── Flipping tab ────────────────────────────────────────────── */
.flip-category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.flip-cat-btn {
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--pill-text);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.flip-cat-btn:hover,
.flip-cat-btn.active {
  background: var(--pill-hover-bg);
  color: var(--pill-hover-text);
  border-color: var(--pill-hover-border);
}

.flip-realm-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flip-realm-entry {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.flip-realm-name {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  flex-shrink: 1;
}

.flip-buy-price  { color: var(--profit-pos); font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.flip-sell-price { color: var(--trend-down-text); font-weight: 600; white-space: nowrap; flex-shrink: 0; }

.flip-spread {
  font-weight: 700;
  color: var(--gold-color);
  white-space: nowrap;
  font-size: 14px;
}

.flip-quality {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.flip-ilvl {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Snipe table */
#snipeTable td { vertical-align: top; padding-top: 8px; padding-bottom: 8px; }
.snipe-realm-list { display: flex; flex-direction: column; gap: 3px; }
.snipe-realm-entry { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.snipe-realm-best .snipe-realm-name { color: var(--text-primary); font-weight: 600; }
.snipe-realm-best .snipe-realm-price { color: var(--profit-pos); font-weight: 700; }
.snipe-realm-name { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; flex-shrink: 1; }
.snipe-realm-price { color: var(--text-secondary); font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.snipe-prof-badge { display: inline-block; font-size: 11px; color: var(--text-muted); background: var(--bg-surface-alt); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-left: 5px; vertical-align: middle; }

/* ── Realm selector dropdown ─────────────────────────────────── */
.realm-select-wrap { position: relative; }
.realm-select-btn.realm-btn-active { border-color: var(--input-focus, #4a5a9e); color: var(--input-focus, #4a5a9e); }
.realm-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.13);
  padding: 8px;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.realm-dropdown.hidden { display: none; }
.realm-dropdown-top { display: flex; gap: 6px; align-items: center; }
.realm-dropdown-search {
  flex: 1;
  padding: 5px 10px;
  border: 1px solid var(--border-input);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-surface);
  color: var(--text-primary);
}
.realm-dropdown-search:focus { outline: none; border-color: var(--input-focus, #4a5a9e); }
.realm-dropdown-clear {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.realm-dropdown-clear:hover { color: var(--text-primary); background: var(--bg-surface-alt); }
.realm-dropdown-list {
  overflow-y: auto;
  max-height: 260px;
  display: flex;
  flex-direction: column;
}
.realm-dropdown-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  user-select: none;
}
.realm-dropdown-item:hover { background: var(--bg-surface-hover); }
.realm-dropdown-item input[type="checkbox"] { flex-shrink: 0; cursor: pointer; }
.realm-dropdown-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* Flipping table — tighter vertical padding since cells have multi-line content */
#flipTable td { vertical-align: top; padding-top: 10px; padding-bottom: 10px; }

/* Crafting rows that show realm sell data need top-aligned cells */
.crafting-row-realm td { vertical-align: top; }
.crafting-realm-sell-cell { min-width: 200px; }

/* ── Misc ────────────────────────────────────────────────────── */
.hidden      { display: none; }
.muted       { color: var(--text-muted); font-size: 13px; margin: 8px 0; }
.auth-link   { text-align: center; font-size: 13.5px; margin-top: 16px; }

/* ── Page layout: main content + optional ad sidebars ─────────── */
.page-layout {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
}

.page-layout > .container {
  width: 100%;
  min-width: 0;
}

/* ── Ad sidebars ──────────────────────────────────────────────── */
.ad-sidebar {
  position: fixed;
  top: 72px;
  width: 160px;
  padding: 12px 8px;
  z-index: 50;
}

.ad-sidebar-left  { left: 0; }
.ad-sidebar-right { right: 0; }

.ad-slot {
  width: 160px;
  height: 600px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  user-select: none;
}

/* Hide sidebars when there isn't enough room for them */
@media (max-width: 1380px) {
  .ad-sidebar { display: none; }
}

/* ── Character filter panel ──────────────────────────────────── */
.char-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.char-panel-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.char-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.char-panel-hint {
  font-size: 12.5px;
  color: var(--text-muted);
}

.char-panel-inputs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.char-input {
  padding: 6px 10px;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-size: 13.5px;
  width: 180px;
}

.char-input:focus {
  outline: none;
  border-color: var(--tab-active-border);
}

.char-load-btn {
  padding: 6px 16px;
  font-size: 13.5px;
  font-weight: 600;
}

.char-clear-btn {
  padding: 6px 12px;
  font-size: 13px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.char-clear-btn:hover { border-color: #c0392b; color: #c0392b; }

.char-status {
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

.char-status-error { color: #c0392b; }

.char-professions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.char-prof-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--exp-bg);
  border: 1px solid var(--exp-border);
  border-radius: 20px;
  font-size: 12.5px;
}

.char-prof-name   { font-weight: 600; color: var(--text-primary); }
.char-prof-skill  { color: var(--text-muted); }
.char-prof-recipes { color: var(--exp-border); font-weight: 600; }

/* Hide crafting rows filtered out by character */
tr.char-hidden { display: none; }

/* ── Crafting stats section (inside char-panel) ──────────────── */
.char-crafting-stats {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.cstat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.cstat-hint {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}

.cstat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.cstat-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cstat-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cstat-input {
  width: 68px;
  padding: 4px 7px;
  border: 1px solid var(--border-input);
  border-radius: 5px;
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-size: 13px;
  text-align: right;
}

.cstat-input:focus { outline: none; border-color: var(--tab-active-border); }

.cstat-unit {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Ingenuity pool bars */
.char-concentration { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px; }

.conc-entry {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
}

.conc-prof   { font-weight: 600; color: var(--text-primary); }
.conc-track  { width: 70px; }
.conc-nums   { color: var(--text-muted); }
.conc-recharge { font-size: 11.5px; color: var(--text-faint); }

/* Sub-craft profit column */
.sub-craft-profit { position: relative; border-left: 2px solid var(--border); }

/* Sub-craft badge on reagent rows */
.subcraft-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 5px;
  font-weight: 500;
  white-space: nowrap;
}
.subcraft-cheaper {
  background: rgba(39, 174, 96, 0.12);
  color: #27ae60;
  border: 1px solid rgba(39, 174, 96, 0.3);
}
.subcraft-pricier {
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Sub-reagent rows (one level deeper than reagent rows) */
.sub-reagent-row td { background: var(--bg-surface-alt2); font-size: 12.5px; }
.sub-reagent-row .reagent-name { color: var(--text-secondary); }

/* Adjusted profit column */
.adj-profit { position: relative; border-left: 2px solid var(--border); }

.adj-delta {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

/* ── Profession skill bar (expansion toolbar) ─────────────────── */
.char-skill-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-left: 8px;
}

.skill-bar-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
}

.skill-bar-prof {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.skill-bar-track {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.skill-bar-fill-max { background: #27ae60; }
.skill-bar-fill-mid { background: #f39c12; }
.skill-bar-fill-low { background: #e74c3c; }

.skill-bar-nums {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.skill-bar-none {
  font-size: 12.5px;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Buy Me a Coffee — navbar button ─────────────────────────── */
.bmac-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  margin-left: 12px;
  background: var(--btn-primary-bg);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 20px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.bmac-nav-btn:hover  { background: var(--btn-primary-hover); transform: translateY(-1px); }
.bmac-nav-btn:active { transform: translateY(0); }

.feedback-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.feedback-nav-btn:hover { color: var(--text); border-color: var(--accent); background: rgba(255,255,255,0.04); }

.feedback-textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  background: var(--input-bg, rgba(255,255,255,0.05));
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.feedback-textarea:focus { outline: none; border-color: var(--accent); }

.feedback-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}

.feedback-status { font-size: 13px; color: var(--text-muted); }
.feedback-status.success { color: #6dbf6d; }
.feedback-status.error   { color: #e06060; }

/* ── Vertical Crafting ───────────────────────────────────────── */
.vc-char-bar {
  padding: 8px 14px;
  margin-bottom: 14px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.vc-char-info { font-weight: 500; }

.vc-search-wrap { position: relative; max-width: 520px; margin-bottom: 16px; }

.vc-search-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 20px var(--card-shadow);
  max-height: 340px; overflow-y: auto;
}
.vc-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid var(--table-border);
}
.vc-result-item:last-child { border-bottom: none; }
.vc-result-item:hover { background: var(--bg-surface-hover); }
.vc-result-text { display: flex; flex-direction: column; gap: 1px; }
.vc-result-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.vc-result-meta { font-size: 11px; color: var(--text-muted); }
.vc-no-results { padding: 10px 12px; color: var(--text-muted); font-size: 13px; }

.vc-chain { display: flex; flex-direction: column; }
.vc-chain-arrow {
  text-align: center; font-size: 22px; padding: 4px 0;
  color: var(--text-muted); user-select: none; line-height: 1;
}

.vc-step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 1px 4px var(--table-shadow);
}

.vc-step-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.vc-step-left { display: flex; align-items: center; gap: 10px; }
.vc-step-titles { display: flex; flex-direction: column; gap: 2px; }
.vc-step-num {
  font-size: 10px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-muted);
}
.vc-step-name { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.vc-step-actions { display: flex; gap: 4px; align-items: center; }
.vc-remove-btn { color: var(--profit-neg, #c0392b) !important; }

.vc-step-stats {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--bg-surface-alt);
  border-radius: 6px; border: 1px solid var(--border);
}
.vc-stat-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
}
.vc-stat-input {
  width: 70px; padding: 3px 7px; font-size: 12px;
  border: 1px solid var(--border-input); border-radius: 4px;
  background: var(--input-bg); color: var(--text-primary);
}

.vc-reagent-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px; margin-bottom: 10px;
}
.vc-reagent-table th {
  text-align: left; padding: 5px 10px;
  background: var(--table-header-bg); color: var(--table-header-text);
  font-size: 11px; font-weight: 500;
}
.vc-reagent-table th:nth-child(3),
.vc-reagent-table th:nth-child(4) { text-align: right; }
.vc-reagent-table td { padding: 6px 10px; border-bottom: 1px solid var(--table-border); }
.vc-reagent-table tr:last-child td { border-bottom: none; }
.vc-reagent-table td.price { text-align: right; }
.vc-reagent-table td:nth-child(3),
.vc-reagent-table td:nth-child(4) { text-align: right; }

.vc-variant-select { font-size: 12px; padding: 2px 6px; max-width: 180px; }

.vc-chain-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
  white-space: nowrap;
}
.vc-chain-toggle input { margin: 0; cursor: pointer; }
.vc-chain-price { font-size: 12px; color: var(--text-muted); }

.vc-step-footer {
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--table-border);
  font-size: 13px; color: var(--text-secondary);
}
.vc-step-footer strong { color: var(--text-primary); }
.vc-ah-label { color: var(--text-muted); }

.vc-summary {
  margin-top: 16px; padding: 14px 20px;
  background: var(--bg-surface);
  border: 2px solid var(--exp-border);
  border-radius: 8px;
}
.vc-summary-inner {
  display: flex; gap: 28px; align-items: center; flex-wrap: wrap;
}
.vc-summary-label { font-size: 14px; color: var(--text-secondary); }
.vc-summary-label strong { color: var(--text-primary); font-size: 15px; }

@media (prefers-color-scheme: dark) {
  .vc-stat-input { background: var(--input-bg); color: var(--text-primary); }
}
.recipe-stats-reset:hover { background: var(--btn-outline-hover); color: var(--text-primary); }

/* ── Midnight Inscription / Prospecting pipeline ─────────────── */
.mi-subtabs {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.mi-sub {
  padding: 6px 18px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.mi-sub.active {
  background: var(--exp-border); color: #fff; border-color: var(--exp-border);
}
.mi-stats-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 16px;
  background: var(--bg-surface-alt); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px;
}
.mi-stats-bar label { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.mi-stats-bar input[type=number] {
  width: 72px; padding: 3px 6px; border: 1px solid var(--border-input);
  border-radius: 4px; font-size: 13px; background: var(--bg-surface);
  color: var(--text-primary);
}
.mi-panel.hidden { display: none; }

.mi-stats-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.mi-stats-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.mi-stat-field { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); }
.mi-stat-input {
  width: 64px; padding: 3px 6px; border: 1px solid var(--border-input);
  border-radius: 4px; font-size: 13px; background: var(--bg-surface); color: var(--text-primary);
}
.mi-quality-sel { width: auto; min-width: 72px; }

.mi-step-title {
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--prof-text);
  background: linear-gradient(90deg, var(--prof-bg-from), var(--prof-bg-to));
  display: flex; align-items: center; gap: 10px;
}
.mi-collapsible { cursor: pointer; user-select: none; }
.mi-collapsible:hover { opacity: 0.9; }
.mi-chevron { margin-left: auto; font-size: 11px; flex-shrink: 0; }
.mi-step-card.collapsed .mi-step-body { display: none; }
.mi-step-note { font-size: 11px; font-weight: 400; color: var(--prof-count); }
.mi-craft-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 0; }

.mi-step-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 12px; overflow: hidden;
}
.mi-step-card h3 {
  margin: 0; padding: 10px 14px;
  background: linear-gradient(90deg, var(--prof-bg-from), var(--prof-bg-to));
  color: var(--prof-text); font-size: 14px; font-weight: 600;
}

.mi-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.mi-table th {
  background: var(--table-header-bg); color: var(--table-header-text);
  padding: 6px 10px; text-align: left; font-weight: 500; font-size: 12px;
}
.mi-table th.r, .mi-table td.r { text-align: right; }
.mi-table td { padding: 6px 10px; border-bottom: 1px solid var(--table-border); }
.mi-table tr:last-child td { border-bottom: none; }
.mi-table tr:nth-child(even) td { background: var(--table-row-even); }
.mi-num {
  width: 72px; padding: 3px 6px; border: 1px solid var(--border-input);
  border-radius: 4px; font-size: 13px; text-align: right;
  background: var(--bg-surface); color: var(--text-primary);
}

.mi-pool {
  padding: 10px 14px; background: var(--bg-surface-alt);
  border-top: 1px solid var(--border);
}
.mi-pool-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px;
}
.mi-pool-items { display: flex; flex-wrap: wrap; gap: 8px; }
.mi-pool-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  background: var(--bg-surface); border: 1px solid var(--border);
  font-size: 13px;
}
.mi-pool-item img { width: 20px; height: 20px; border-radius: 3px; }

.alch-reset-costs-btn { margin-left: auto; margin-right: 8px; font-size: 11px; padding: 2px 8px; }
.alch-pool-item { align-items: center; gap: 10px; flex-wrap: wrap; }
.alch-pool-name { min-width: 140px; }
.alch-pool-field { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.alch-pool-field-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.mi-pool-price { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

.mi-ink-block { margin-bottom: 2px; }
.mi-craft-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-bottom: 1px solid var(--table-border);
}
.mi-craft-row:last-child { border-bottom: none; }
.mi-craft-label { flex: 1; font-size: 13px; color: var(--text-secondary); }
.mi-craft-out { font-weight: 600; min-width: 80px; text-align: right; }
.mi-craft-stat { font-size: 12px; color: var(--text-muted); min-width: 100px; }

.mi-quality-tiers {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px 14px 8px; font-size: 12px; color: var(--text-muted);
}
.mi-quality-tiers:empty { display: none; }
.qtier-item { display: flex; align-items: center; gap: 3px; }
.qtier-item.active { font-weight: 600; color: var(--text-primary); }

.mi-foot {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--bg-surface-alt2);
  border-top: 1px solid var(--border); font-size: 13px;
}
.mi-foot-label { color: var(--text-muted); }
.mi-computed { font-weight: 600; color: var(--text-primary); }
.mi-item-name { color: var(--text-secondary); }
.mi-note-row {
  padding: 6px 14px; font-size: 12px; color: var(--text-muted);
  background: var(--bg-surface-alt); border-top: 1px solid var(--border);
}

.jc-ore-pool {
  display: flex; gap: 10px; flex-wrap: wrap; padding: 10px 0 8px;
}
.jc-ore-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--bg-surface); border: 1px solid var(--border); min-width: 170px;
}
.jc-ore-card-name { font-size: 13px; font-weight: 600; }
.jc-ore-card-name a { color: var(--text-primary); text-decoration: none; }
.jc-ore-card-name a:hover { text-decoration: underline; }
.jc-qual-btns { display: flex; gap: 4px; }
.jc-qual-btn {
  padding: 2px 10px; border-radius: 4px; border: 1px solid var(--border);
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 12px; cursor: pointer; transition: background 0.12s, color 0.12s;
}
.jc-qual-btn:hover { background: var(--bg-surface-alt); }
.jc-qual-btn.active {
  background: var(--btn-primary-bg); color: #fff; border-color: var(--btn-primary-bg); font-weight: 600;
}
.jc-ore-card-qty { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.jc-ore-card-price { font-size: 12px; color: var(--text-muted); }
.jc-ore-hdr-row td { background: var(--table-header-bg); color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.jc-prosp-ore-label { padding: 5px 10px; }
.mi-crush-section-title {
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); background: var(--bg-surface-alt);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.jc-ore-qty-inp {
  width: 72px; padding: 3px 6px; border: 1px solid var(--border-input);
  border-radius: 4px; font-size: 13px; background: var(--bg-surface); color: var(--text-primary);
}
.jc-sub-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}
.jc-sub-section:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.jc-sub-title {
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.jc-profit-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.6;
}

.tab-info {
  margin: 0 0 16px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-left: 3px solid var(--accent, #7c5cbf);
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}
.tab-info--sub {
  margin-bottom: 12px;
  font-size: 12.5px;
}

/* ── Vertical crafting tab summary bar ───────────────────── */
#ins-tab-summary, #alch-tab-summary, #lw-tab-summary { margin-top: 16px; }
.mi-tab-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  flex-wrap: wrap;
}
.mi-sum-lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.mi-sum-val { font-weight: 600; }
.mi-sum-sep { color: var(--muted); padding: 0 4px; }

.site-footer {
  text-align: center;
  padding: 24px 28px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.7;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--text-muted); text-decoration: underline; }
.site-footer a:hover { color: var(--text); }
