:root {
  --gold: #c8952b;
  --gold-dark: #a97a1c;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1c2430;
  --muted: #6b7684;
  --line: #e4e7ec;
  --green: #1a8f5a;
  --red: #d1435b;
  --amber: #c8952b;
  --sidebar: #12181f;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: var(--sidebar);
  color: #cbd3dc;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; }
.brand-mark { color: var(--gold); font-size: 22px; }
.brand strong { display: block; color: #fff; font-size: 15px; }
.brand small { color: #7c8794; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

.org-pill {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.org-name { display: block; color: #fff; font-weight: 600; font-size: 13px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.nav-label {
  padding: 15px 12px 5px;
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #6b7682;
  font-weight: 700;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #aeb8c4;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  transition: background .12s ease, color .12s ease;
}
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: var(--gold); color: #1a1a1a; font-weight: 600; }
.ico { width: 17px; height: 17px; flex: 0 0 17px; opacity: .78; }
.nav a:hover .ico { opacity: 1; }
.nav a.active .ico { opacity: 1; }

.nav-secondary {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 14px;
  color: #7c8794;
  font-size: 12.5px;
  padding: 9px 12px;
  border-radius: 8px;
}
.nav-secondary:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-secondary .ico { width: 16px; height: 16px; flex: 0 0 16px; opacity: .7; }

.sidebar-footer { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer small { display: block; color: #7c8794; font-size: 12px; margin-bottom: 4px; word-break: break-all; }
.logout { color: #e79aa6; font-size: 12.5px; }

.content { flex: 1; padding: 28px 34px; max-width: 1100px; }

/* ---- Header ---- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin: 0 0 14px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---- Stat ---- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 6px; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat.gold { background: linear-gradient(135deg, #fff8ea, #fdefcf); border-color: #f0dcae; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-type { background: rgba(255,255,255,.12); color: #f0d9a8; }
.badge-green { background: #e3f6ec; color: var(--green); }
.badge-red { background: #fbe4e8; color: var(--red); }
.badge-amber { background: #fbf0d8; color: var(--gold-dark); }
.badge-gray { background: #eef1f4; color: var(--muted); }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: #f7f8fa; text-decoration: none; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #1a1a1a; }
.btn-primary:hover { background: var(--gold-dark); color: #fff; }
.btn-danger { color: var(--red); border-color: #f0c4cc; }
.btn-danger:hover { background: #fbe4e8; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--gold-dark); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: inline; }

/* ---- CS contact card ---- */
.cs-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; border-left: 3px solid var(--gold); }
.cs-card .cs-info { min-width: 240px; flex: 1; }
.cs-wa { white-space: nowrap; }

/* ---- SOP steps ---- */
.sop-step { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.sop-step:first-of-type { border-top: 0; }
.sop-num {
  flex: 0 0 30px; height: 30px; width: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--gold); color: #1a1a1a;
  font-weight: 700; font-size: 14px;
}
.sop-step h3 { margin: 2px 0 6px; font-size: 15px; }
.sop-step p { margin: 0 0 6px; color: var(--ink); }
.sop-step ul { margin: 6px 0; padding-left: 18px; color: var(--ink); }
.sop-step ul li { margin: 3px 0; }

/* ---- FAQ accordion ---- */
.faq-item { border-top: 1px solid var(--line); }
.faq-item:first-of-type { border-top: 0; }
.faq-item > summary {
  cursor: pointer; list-style: none;
  padding: 14px 28px 14px 0; position: relative;
  font-weight: 600; font-size: 14px;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: "+"; position: absolute; right: 4px; top: 12px;
  font-size: 20px; font-weight: 400; color: var(--muted); line-height: 1;
}
.faq-item[open] > summary::after { content: "\2212"; }
.faq-item .faq-body { padding: 0 0 14px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* ---- Price change chips ---- */
.pct-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pct-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 92px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
}
.pct-chip .pct-label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.pct-chip .pct-val { font-size: 14px; font-weight: 700; }
.pct-chip.up { background: #e9f7ef; border-color: #bfe6cf; }
.pct-chip.up .pct-val { color: var(--green); }
.pct-chip.down { background: #fcebef; border-color: #f2c6d0; }
.pct-chip.down .pct-val { color: var(--red); }
.pct-chip.flat .pct-val { color: var(--muted); }
.pct-chip.na .pct-val { color: #b6bec8; font-weight: 600; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 5px; }
label .req { color: var(--red); }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(200,149,43,.35); border-color: var(--gold); }
textarea { resize: vertical; min-height: 72px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

/* ---- Flash ---- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 13.5px; font-weight: 500; }
.flash-success { background: #e3f6ec; color: var(--green); border: 1px solid #b7e6ca; }
.flash-error { background: #fbe4e8; color: var(--red); border: 1px solid #f2c2cc; }
.flash-info { background: #e6f0fb; color: #1c5fb0; border: 1px solid #bcd6f2; }
.flash-floating { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.12); }

/* ---- Radio group ---- */
.radio-group { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.radio-group .radio { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.radio-group .radio input { width: auto; margin: 0; }

/* ---- Auth ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background:
    radial-gradient(620px circle at 12% 18%, rgba(200,149,43,.20), transparent 45%),
    radial-gradient(720px circle at 88% 82%, rgba(200,149,43,.12), transparent 50%),
    radial-gradient(circle at top, #1c2430, #0c1015);
}
.auth-split { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 22px; align-items: stretch; width: 100%; max-width: 960px; }
.auth-split.auth-solo { grid-template-columns: 400px; justify-content: center; }

/* Premium dark-gold showcase panel */
.auth-showcase {
  background: linear-gradient(160deg, #202b39 0%, #141a22 100%);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
  color: #cdd5df;
  display: flex;
  flex-direction: column;
}
.auth-showcase .showcase-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.auth-showcase .showcase-brand .brand-mark { color: var(--gold); font-size: 20px; }
.auth-showcase .showcase-brand strong { display: block; color: #fff; font-size: 14px; }
.auth-showcase .showcase-brand small { color: #7c8794; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.auth-showcase .showcase-tagline { margin: 0 0 18px; color: #9aa4b1; font-size: 13px; line-height: 1.5; max-width: 40ch; }
.auth-showcase .showcase-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.auth-showcase .showcase-head h2 { font-size: 17px; margin: 0 0 2px; color: #fff; }
.auth-showcase .muted { color: #7c8794 !important; }
.auth-showcase .stat { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); }
.auth-showcase .stat .label { color: #8a94a2; }
.auth-showcase .stat .value { color: #fff; }
.auth-showcase .stat .value.value-gold { color: var(--gold); }
.auth-showcase .showcase-chart { margin-top: auto; }

/* Price chips on dark */
.auth-showcase .pct-chip { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
.auth-showcase .pct-chip .pct-label { color: #8a94a2; }
.auth-showcase .pct-chip.up { background: rgba(26,143,90,.16); border-color: rgba(26,143,90,.35); }
.auth-showcase .pct-chip.up .pct-val { color: #4ecb8a; }
.auth-showcase .pct-chip.down { background: rgba(209,67,91,.16); border-color: rgba(209,67,91,.35); }
.auth-showcase .pct-chip.down .pct-val { color: #f2879b; }
.auth-showcase .pct-chip.flat .pct-val { color: #aeb8c4; }
.auth-showcase .pct-chip.na .pct-val { color: #6b7682; }

.chart-collapsible { position: relative; overflow: hidden; }
.chart-collapsible.collapsed { max-height: 68px; }
.chart-collapsible.collapsed::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 48px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
  pointer-events: none;
}
.auth-showcase .chart-collapsible.collapsed::after { background: linear-gradient(to bottom, rgba(20,26,34,0), #141a22); }
.chart-toggle { margin-top: 10px; align-self: flex-start; }
.auth-showcase .chart-toggle { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #fff; }
.auth-showcase .chart-toggle:hover { background: rgba(255,255,255,.12); }
.auth-footer { color: #7c8794; font-size: 12px; text-align: center; margin: 0; }
.auth-footer a { color: var(--gold); }

.auth-card { background: #fff; border-radius: 16px; padding: 34px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.35); border-top: 3px solid var(--gold); }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; max-width: 460px; }
  .auth-showcase { order: 2; }
  .auth-card { order: 1; max-width: none; }
}
.auth-card .brand { justify-content: center; padding-bottom: 22px; }
.auth-card .brand strong { color: var(--ink); }
.auth-card .brand small { color: var(--muted); }
.auth-card h1 { font-size: 19px; text-align: center; margin: 0 0 4px; }
.auth-card .sub { text-align: center; color: var(--muted); margin: 0 0 22px; }
.auth-card label { margin-top: 12px; }
.auth-card .btn { width: 100%; margin-top: 20px; padding: 11px; }
.auth-alt { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 6px; }

.muted { color: var(--muted); }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-link { display: block; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 18px; transition: box-shadow .15s; }
.card-link:hover { box-shadow: 0 6px 18px rgba(0,0,0,.06); text-decoration: none; }
.card-link h3 { margin: 0 0 4px; font-size: 15px; color: var(--ink); }

/* ---- Mobile top bar & off-canvas nav ---- */
.topbar { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 860px) {
  .topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--sidebar);
    color: #fff;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  .hamburger { background: transparent; border: 0; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; }
  .topbar-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .layout { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 264px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 60;
    padding-top: calc(20px + env(safe-area-inset-top));
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.5); }
  body.nav-open .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; }

  .content { padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); max-width: 100%; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .actions .btn, .page-head > a.btn { width: 100%; text-align: center; }

  /* Horizontal scroll for wide tables */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card table { min-width: 560px; }

  /* Prevent iOS auto-zoom on input focus */
  input, select, textarea { font-size: 16px; }
}

