/* ============================================================
   The GridX Studio — shared design system
   Palette supplied by brand. Edit variables here once,
   every page updates.
   ============================================================ */

:root {
  /* Header / brand hues */
  --rose:        #EAB4D2;
  --blue:        #A8D8E8;
  --apricot:     #F3B98A;
  --gold:        #EFD98A;

  /* Lighter cell tints (same hues) */
  --rose-tint:   #F8D8E7;
  --blue-tint:   #DCEEF6;
  --apricot-tint:#FAE3CC;
  --gold-tint:   #F8EDC4;

  /* Accent — badges / KPIs only */
  --cornflower:  #7C93E0;
  --mint:        #B9E0C4;   /* positive / savings */

  --border:      #E7E1DC;   /* warm grey gridlines */
  --text:        #2B2A33;
  --muted:       #857f88;
  --bg:          #FDFBF9;
  --card:        #FFFFFF;

  --radius:      16px;
  --shadow:      0 4px 20px rgba(43, 42, 51, 0.06);
  --shadow-lg:   0 10px 40px rgba(43, 42, 51, 0.10);
  --font:        'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Brand bar / header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 40px; width: auto; }
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-name .x { color: var(--cornflower); }

.brand-swatches { display: flex; gap: 6px; margin-top: 4px; }
.brand-swatches span { width: 26px; height: 9px; border-radius: 4px; }

.userchip {
  display: flex; align-items: center; gap: 10px;
  font-size: .9rem; color: var(--muted);
}
.userchip strong { color: var(--text); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 600; font-size: .95rem;
  padding: 11px 20px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--cornflower); color: #fff; transition: transform .12s ease, box-shadow .12s ease, opacity .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: #faf7f4; }
.btn.small { padding: 8px 14px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Auth (login / signup) ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--rose-tint), transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, var(--blue-tint), transparent 55%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--card);
  border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow-lg); padding: 34px 30px;
}
.auth-card .brand { flex-direction: column; text-align: center; gap: 8px; margin-bottom: 6px; }
.auth-card .brand img { height: 74px; }
.auth-title { text-align: center; font-size: 1.35rem; font-weight: 700; margin: 14px 0 2px; }
.auth-sub { text-align: center; color: var(--muted); font-size: .92rem; margin-bottom: 22px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  font-family: var(--font); font-size: .95rem; background: #fff; color: var(--text);
}
.field input:focus { outline: none; border-color: var(--cornflower); box-shadow: 0 0 0 3px rgba(124,147,224,.15); }

.auth-switch { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--muted); }
.notice { border-radius: 12px; padding: 10px 14px; font-size: .88rem; margin-bottom: 14px; display: none; }
.notice.err { background: var(--rose-tint); color: #8a3a5c; display: block; }
.notice.ok  { background: var(--mint); color: #2f6b45; display: block; }

/* ---------- Store / dashboard ---------- */
.hero {
  padding: 46px 28px 26px; text-align: center;
  background:
    radial-gradient(900px 360px at 50% -40%, var(--gold-tint), transparent 60%),
    var(--bg);
}
.hero h1 { font-size: 2rem; letter-spacing: -.02em; margin-bottom: 8px; }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto; }

.grid {
  max-width: 1120px; margin: 0 auto; padding: 26px 28px 70px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px;
}

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .14s ease, box-shadow .14s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.card .thumb {
  height: 140px; display: grid; place-items: center; position: relative;
  font-size: 2.6rem;
}
.card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 1.05rem; letter-spacing: -.01em; }
.card .desc { color: var(--muted); font-size: .88rem; flex: 1; }

.badge {
  position: absolute; top: 12px; right: 12px; font-size: .72rem; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; background: #fff; color: var(--text);
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 5px;
}
.badge.locked  { color: var(--muted); }
.badge.owned   { background: var(--cornflower); color: #fff; }

.card .foot { margin-top: 10px; }

/* lock overlay for locked cards */
.card.is-locked .thumb::after {
  content: ""; position: absolute; inset: 0; background: rgba(253,251,249,.55);
  backdrop-filter: blur(1px);
}

/* ---------- Modal (unlock code) ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(43,42,51,.45); display: none;
  place-items: center; z-index: 50; padding: 20px;
}
.modal-back.show { display: grid; }
.modal {
  background: var(--card); border-radius: 20px; padding: 28px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.modal h3 { margin-bottom: 4px; }
.modal p { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.modal input {
  width: 100%; text-align: center; letter-spacing: .12em; font-weight: 600; text-transform: uppercase;
  padding: 13px; border: 1px dashed var(--cornflower); border-radius: 12px; font-family: var(--font);
  font-size: 1rem; margin-bottom: 14px; background: var(--blue-tint);
}
.modal input:focus { outline: none; box-shadow: 0 0 0 3px rgba(124,147,224,.18); }
.modal .row { display: flex; gap: 10px; }
.modal .row .btn { flex: 1; }

/* ---------- Tracker page shell ---------- */
.tracker-wrap { max-width: 1000px; margin: 0 auto; padding: 28px; }
.tracker-head { display:flex; align-items:center; justify-content:space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.tracker-head h1 { font-size: 1.6rem; letter-spacing: -.02em; }
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.panel h2 { font-size: 1rem; margin-bottom: 14px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--border); }
.kpi .n { font-size: 1.7rem; font-weight: 700; }
.kpi .l { font-size: .8rem; color: var(--muted); }
.kpi.k-rose { background: var(--rose-tint); }
.kpi.k-blue { background: var(--blue-tint); }
.kpi.k-apr  { background: var(--apricot-tint); }
.kpi.k-gold { background: var(--gold-tint); }
.kpi.k-mint { background: var(--mint); }

/* task / habit rows */
.tasklist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tasklist li {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: #fff;
}
.tasklist li.done { background: var(--blue-tint); }
.tasklist li.done .txt { text-decoration: line-through; color: var(--muted); }
.tasklist input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--cornflower); cursor: pointer; }
.tasklist .txt { flex: 1; }
.tasklist .del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }

.addrow { display: flex; gap: 10px; margin-top: 12px; }
.addrow input {
  flex: 1; padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px;
  font-family: var(--font); font-size: .95rem;
}
.addrow input:focus { outline: none; border-color: var(--cornflower); }

/* habit week grid */
.habit-grid { width: 100%; border-collapse: collapse; }
.habit-grid th, .habit-grid td { border: 1px solid var(--border); padding: 8px 6px; text-align: center; font-size: .85rem; }
.habit-grid th:first-child, .habit-grid td:first-child { text-align: left; font-weight: 600; }
.habit-grid td .dot { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; display: inline-block; }
.habit-grid td .dot.on { background: var(--mint); border-color: var(--mint); }

textarea.notes {
  width: 100%; min-height: 120px; border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; font-family: var(--font); font-size: .95rem; resize: vertical; background: #fff;
}
textarea.notes:focus { outline: none; border-color: var(--cornflower); }

.save-hint { font-size: .8rem; color: var(--muted); text-align: right; margin-top: 6px; }

.footer { text-align: center; padding: 26px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--border); }

@media (max-width: 480px) {
  .topbar { padding: 12px 16px; }
  .grid { padding: 20px 16px 60px; }
  .hero h1 { font-size: 1.6rem; }
}
