/* ==========================================================================
   RedGems member portal (rgportal01) — design system
   Tokens & components extracted from the "RedGems Dashboard" mockup
   (claude design mockups/Red Gems Landing Page Redesign/RedGems Dashboard.dc.html)
   ========================================================================== */

:root {
  /* Surfaces & ink (warm cream / near-black) */
  --bg:            #FAF6F1;
  --surface:       #ffffff;
  --ink:           #1B1712;
  --ink-2:         #6B635B;
  --ink-3:         #94897C;
  --ink-4:         #8A8175;

  /* Lines & fields */
  --line:          #ECE4DA;
  --line-strong:   #DED5CA;
  --field:         #FAF6F1;
  --field-line:    #E4DACE;
  --field-focus:   #FF9088;
  --divider:       #F1EAE0;

  /* Brand red */
  --brand:         #FF3231;
  --brand-grad:    linear-gradient(160deg, #FF5758, #FF3130);
  --brand-glow:    rgba(255, 50, 49, .26);
  --red-ink:       #D0342B;
  --red-soft-bg:   #FFF1F0;
  --red-soft-line: #FBD9D6;

  /* Success green (Drive / connected states) */
  --green:         #22A06B;
  --green-bg:      #E9F6EF;

  /* Segmented control / neutral chips */
  --chip-bg:       #F0E7DB;
  --chip-line:     #E7DCCE;

  /* Shape */
  --r-card:        18px;
  --r-btn:         11px;
  --r-pill:        999px;
  --sidebar-w:     262px;

  /* Type */
  --font-head: 'Bricolage Grotesque', system-ui, -apple-system, Segoe UI, sans-serif;
  --font-body: 'Instrument Sans', system-ui, -apple-system, Segoe UI, sans-serif;
}

/* --- reset -------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
a { text-decoration: none; color: inherit; }
button, input { font-family: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--field-focus); outline-offset: 2px; }

@keyframes ds-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Member shell: sidebar + main
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 20px 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand-logo { display: flex; align-items: center; gap: 9px; padding: 6px 8px; margin-bottom: 22px; }
.brand-logo .mark { height: 30px; width: auto; }
.brand-logo .word { height: 18px; width: auto; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  border: none; cursor: pointer; background: transparent;
  padding: 11px 13px; border-radius: 11px;
  font-size: 15px; font-weight: 600; color: #5C544B;
}
.nav-item:hover { background: var(--bg); }
.nav-item.is-active { background: var(--brand); color: #fff; }
.nav-item .ico { flex: none; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.plan-card { border: 1px solid var(--line); background: var(--bg); border-radius: 13px; padding: 15px; }
.plan-card__label { font-size: 13px; font-weight: 700; color: var(--ink); }
.plan-card__hint { font-size: 12px; color: var(--ink-2); margin: 3px 0 11px; line-height: 1.4; }
.side-link { font-size: 13px; color: var(--ink-3); padding: 2px 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 36px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.greeting { font-size: 15px; color: var(--ink-2); }
.greeting strong { color: var(--ink); }
.topbar__right { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 38px; height: 38px; border-radius: var(--r-pill);
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 800; font-size: 15px;
}
.content { padding: 30px 36px 60px; width: 100%; max-width: 1040px; margin: 0 auto; }

.page-title { font-size: 31px; font-weight: 800; margin-bottom: 6px; }
.page-sub { font-size: 15px; color: var(--ink-2); margin-bottom: 30px; }

/* ==========================================================================
   Cards, buttons, badges
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 24px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  padding: 12px 20px; border-radius: var(--r-btn); border: 1px solid transparent;
  transition: transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { color: #fff; background: var(--brand-grad); box-shadow: 0 8px 20px var(--brand-glow); }
.btn-ghost { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.btn-block { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; border-radius: var(--r-pill);
  padding: 4px 11px; border: 1px solid transparent; white-space: nowrap;
}
.badge-w4     { color: var(--ink-4);  background: var(--bg);         border-color: var(--chip-line); }
.badge-free   { color: var(--ink-4);  background: var(--bg);         border-color: var(--chip-line); }
.badge-auto   { color: var(--red-ink); background: var(--red-soft-bg); border-color: var(--red-soft-line); }
.badge-ok     { color: var(--green);  background: var(--green-bg); }

/* ==========================================================================
   Dashboard placeholder cards (W3 — real features land in W4)
   ========================================================================== */
.placeholder {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  min-height: 168px;
}
.placeholder__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.placeholder__title { font-size: 18px; font-weight: 800; }
.placeholder__blurb { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.placeholder__foot { margin-top: auto; font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: var(--r-pill); background: var(--field-line); flex: none; }

/* ==========================================================================
   Public sign-in landing + error pages (centered, no sidebar)
   ========================================================================== */
.centerwrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
}
.signin {
  width: 100%; max-width: 420px; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: 40px 34px;
  box-shadow: 0 30px 70px -40px rgba(27, 23, 18, .35);
  animation: ds-fade .3s ease;
}
.signin .mark { height: 46px; width: auto; margin: 0 auto 10px; }
.signin .word { height: 22px; width: auto; margin: 0 auto 22px; }
.signin__title { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.signin__sub { font-size: 15px; color: var(--ink-2); margin-bottom: 26px; line-height: 1.5; }
.signin .btn { font-size: 16px; padding: 13px 22px; }
.signin__legal { font-size: 12px; color: var(--ink-3); margin-top: 20px; line-height: 1.5; }

.errbox { max-width: 460px; text-align: center; animation: ds-fade .3s ease; }
.errbox .mark { height: 40px; width: auto; margin: 0 auto 18px; }
.errcode { font-family: var(--font-head); font-weight: 800; font-size: 64px; color: var(--brand); line-height: 1; }
.errbox h1 { font-size: 24px; font-weight: 800; margin: 10px 0 8px; }
.errbox p { font-size: 15px; color: var(--ink-2); margin-bottom: 24px; }

.debug-ribbon {
  position: fixed; bottom: 12px; right: 12px; z-index: 100;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: var(--red-ink);
  padding: 6px 12px; border-radius: var(--r-pill);
  box-shadow: 0 8px 20px var(--brand-glow);
}

/* ==========================================================================
   Responsive — sidebar collapses to a horizontal bar (mockup breakpoint)
   ========================================================================== */
@media (max-width: 920px) {
  .sidebar {
    position: static; width: 100%; height: auto;
    flex-direction: row; align-items: center; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }
  .nav { flex-direction: row; gap: 6px; }
  .nav-item { width: auto; white-space: nowrap; }
  .side-foot { display: none; }
  .brand-logo { margin-bottom: 0; margin-right: 8px; }
  .app-shell { flex-direction: column; }
  .content { padding: 22px 18px 48px; }
  .topbar { padding: 12px 18px; }
}
