/* =====================================================================
   24Giftagent - stylesheet
   Palette: pine (trust), ribbon (action), gold (the prize), paper (calm)
   Type: Bricolage Grotesque (display) + Figtree (text)
   ===================================================================== */

:root {
  --pine: #0E3B43;
  --pine-2: #14505A;
  --pine-deep: #082A30;
  --ribbon: #C72B57;
  --ribbon-dark: #A81F46;
  --gold: #F2B632;
  --gold-soft: #FBE9B8;
  --ink: #14272B;
  --muted: #5B6F72;
  --line: #D9E4E2;
  --field-border: #7C9694;
  --paper: #F4F8F7;
  --white: #FFFFFF;

  --ok: #17794A;
  --warn: #8A5A00;
  --danger: #B3261E;
  --info: #1F5FA8;

  --font-display: 'Bricolage Grotesque', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 22px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
}
img, svg { max-width: 100%; }
a { color: var(--pine-2); text-underline-offset: 3px; }
a:hover { color: var(--ribbon-dark); }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--pine);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; }

:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--gold);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--gold); color: var(--pine); padding: 0.6rem 1rem;
  border-radius: var(--r-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.container { width: min(1120px, calc(100% - 2.5rem)); margin-inline: auto; }
.narrow { width: min(760px, calc(100% - 2.5rem)); margin-inline: auto; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.4rem; border-radius: 999px; border: 2px solid transparent;
  font-family: var(--font-body); font-size: 1rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--ribbon); color: #fff; }
.btn-primary:hover { background: var(--ribbon-dark); color: #fff; }
.btn-dark { background: var(--pine); color: #fff; }
.btn-dark:hover { background: var(--pine-deep); color: #fff; }
.btn-gold { background: var(--gold); color: var(--pine); }
.btn-gold:hover { background: #E3A71F; color: var(--pine); }
.btn-ghost { background: transparent; color: var(--pine); border-color: var(--pine); }
.btn-ghost:hover { background: var(--pine); color: #fff; }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.btn-ghost-light:hover { background: #fff; color: var(--pine); border-color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.92rem; }

/* ---------- Header ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; min-height: 70px; }
.logo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-display); font-weight: 800; font-size: 1.4rem;
  letter-spacing: -0.02em; color: var(--pine); text-decoration: none;
}
.logo:hover { color: var(--pine); }
.logo svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.nav a:not(.btn) {
  padding: 0.45rem 0.9rem; border-radius: 999px; color: var(--ink);
  text-decoration: none; font-weight: 500;
}
.nav a:not(.btn):hover { background: var(--paper); color: var(--pine); }
.nav a[aria-current="page"] { background: var(--gold-soft); color: var(--pine); }
.nav .btn { margin-left: 0.4rem; }
.nav-toggle {
  display: none; align-items: center; gap: 0.5rem; background: transparent;
  border: 2px solid var(--pine); color: var(--pine); border-radius: 999px;
  padding: 0.4rem 0.95rem; font: 600 0.95rem var(--font-body); cursor: pointer;
}

@media (max-width: 820px) {
  .js .nav-toggle { display: inline-flex; }
  .js .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; background: #fff;
    border-bottom: 1px solid var(--line); padding: 0.75rem 1.25rem 1.1rem;
  }
  .js .nav.is-open { display: flex; }
  .js .nav a:not(.btn) { padding: 0.7rem 0.9rem; }
  .js .nav .btn { margin: 0.5rem 0 0; }
}

/* ---------- Flash messages & alerts ---------- */
.alert {
  padding: 0.85rem 1.1rem; border-radius: var(--r-md); margin: 0 0 1rem;
  border: 1px solid; font-size: 0.98rem;
}
.alert-success { background: #E8F6EE; color: #0F5132; border-color: #A9DBC0; }
.alert-danger  { background: #FDECEA; color: #8A1C15; border-color: #F2B8B3; }
.alert-warning { background: #FFF4DB; color: #6B4500; border-color: #F0D58B; }
.alert-info    { background: #E7F0FB; color: #174A82; border-color: #B5CFEE; }
.flash-wrap { padding-top: 1.25rem; }
.flash-wrap:empty { display: none; }

/* ---------- Badges (status labels) ---------- */
.badge {
  display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: 0.82rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.badge-success   { background: #DDF2E6; color: #0F5132; }
.badge-warning   { background: #FFEFC2; color: #6B4500; }
.badge-danger    { background: #FBDAD6; color: #8A1C15; }
.badge-info      { background: #DCE9F8; color: #174A82; }
.badge-secondary { background: #E6ECEB; color: #3C4F52; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.15rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.input, .textarea, .select {
  width: 100%; padding: 0.7rem 0.85rem; font: inherit; color: var(--ink);
  background: #fff; border: 1.5px solid var(--field-border); border-radius: var(--r-md);
}
.textarea { min-height: 9rem; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--pine); }
.help { font-size: 0.9rem; color: var(--muted); margin-top: 0.3rem; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1rem; }
.pw { position: relative; }
.pw .input { padding-right: 4.6rem; }
.pw button {
  position: absolute; right: 0.45rem; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--pine-2); font: 600 0.9rem var(--font-body);
  padding: 0.35rem 0.6rem; border-radius: var(--r-sm); cursor: pointer;
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Generic card & table (used by dashboards) ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.5rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
.table th, .table td { text-align: left; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-weight: 600; color: var(--muted); font-size: 0.88rem; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section--tint { background: var(--paper); }
.section-head { max-width: 40rem; margin-bottom: 2.5rem; }
.section-head p { color: var(--muted); font-size: 1.1rem; margin: 0; }

/* ---------- Home: hero with the gift tag ---------- */
.hero { background: var(--pine); color: #fff; overflow: hidden; }
.hero-grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3rem; align-items: center;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}
.hero h1 { color: #fff; font-size: clamp(2.7rem, 6.4vw, 4.8rem); margin-bottom: 0.4em; }
.hero .lead { color: #CFE3E1; font-size: 1.2rem; max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.75rem 0 1.1rem; }
.hero-note { color: #A9C7C4; font-size: 0.95rem; max-width: 34rem; }
.hero-note a { color: var(--gold); }
.hero-note a:hover { color: #fff; }

.tag-stage { display: flex; flex-direction: column; align-items: center; }
.tag { position: relative; width: min(320px, 100%); padding-top: 72px; transform-origin: 50% 0; filter: drop-shadow(0 20px 26px rgba(0, 0, 0, 0.38)); animation: tag-swing 2.8s ease-out 0.2s 1 both; }
.tag-string { position: absolute; left: 50%; top: 0; width: 3px; height: 100px; margin-left: -1.5px; background: var(--gold); z-index: 2; }
.tag-card {
  position: relative; background: #fff; color: var(--ink); padding: 3.2rem 1.6rem 1.5rem;
  clip-path: polygon(16% 0, 84% 0, 100% 7%, 100% 100%, 0 100%, 0 7%);
}
.tag-hole { position: absolute; top: 1.05rem; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--pine); box-shadow: inset 0 0 0 3px var(--gold); }
.tag-kind { font-size: 0.9rem; color: var(--muted); margin: 0; }
.tag-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--pine); margin: 0.1rem 0 1rem; }
.tag-value { margin: 0; padding-top: 0.9rem; border-top: 2px dashed var(--line); font-size: 0.9rem; color: var(--muted); }
.tag-amount { display: block; font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; line-height: 1.1; color: var(--ribbon); }
.tag-actions { display: grid; gap: 0.5rem; margin-top: 1.1rem; }
.tag-btn { display: block; text-align: center; padding: 0.6rem; border-radius: 999px; font-weight: 600; font-size: 0.95rem; }
.tag-btn--solid { background: var(--pine); color: #fff; }
.tag-btn--line { border: 2px solid var(--pine); color: var(--pine); }
.tag-caption { margin-top: 1rem; color: #A9C7C4; font-size: 0.9rem; text-align: center; }

@keyframes tag-swing {
  0%   { transform: rotate(9deg); }
  18%  { transform: rotate(-6deg); }
  36%  { transform: rotate(4deg); }
  54%  { transform: rotate(-2.5deg); }
  72%  { transform: rotate(1.4deg); }
  100% { transform: rotate(0); }
}

/* ---------- Home: how it works ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; list-style: none; margin: 0; padding: 0; }
.step { border-top: 3px solid var(--pine); padding-top: 1rem; }
.step-num { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2.8rem; line-height: 1; color: var(--ribbon); margin-bottom: 0.6rem; }
.step h3 { margin-bottom: 0.3rem; }
.step p { margin: 0; color: var(--muted); }

/* ---------- Home: claim or convert ---------- */
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
.duo-card { border-radius: var(--r-lg); padding: 2rem; }
.duo-card h3 { font-size: 1.5rem; }
.duo-card ul { margin: 1rem 0 0; padding-left: 1.2rem; }
.duo-card li { margin-bottom: 0.4rem; }
.duo-claim { background: #fff; border: 2px solid var(--pine); }
.duo-convert { background: var(--pine); color: #CFE3E1; }
.duo-convert h3 { color: #fff; }

/* ---------- Home: facts ---------- */
.facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem 3rem; margin: 0; }
.fact { display: grid; grid-template-columns: auto 1fr; gap: 0.9rem; align-items: start; }
.fact-icon { width: 2rem; height: 2rem; border-radius: 50%; background: var(--gold); color: var(--pine); display: grid; place-items: center; font-weight: 800; font-size: 0.95rem; }
.fact h3 { font-size: 1.15rem; margin: 0 0 0.2rem; }
.fact p { margin: 0; color: var(--muted); }

/* ---------- Call-to-action band ---------- */
.cta-band { background: var(--ribbon); color: #fff; padding-block: clamp(2.5rem, 6vw, 4rem); }
.cta-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; }
.cta-band h2 { color: #fff; margin: 0 0 0.3rem; }
.cta-band p { margin: 0; color: #FFE3EA; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.cta-band .btn-light { background: #fff; color: var(--ribbon-dark); }
.cta-band .btn-light:hover { background: var(--gold-soft); color: var(--pine); }

/* ---------- Inner pages ---------- */
.page-hero { background: var(--pine); color: #fff; padding-block: clamp(2.5rem, 6vw, 4rem); }
.page-hero h1 { color: #fff; margin-bottom: 0.3em; }
.page-hero p { color: #CFE3E1; font-size: 1.15rem; max-width: 38rem; margin: 0; }
.prose { max-width: 44rem; }
.prose p { font-size: 1.08rem; }
.prose h2 { margin-top: 2.2rem; }
.faq { border-bottom: 1px solid var(--line); padding: 1.1rem 0; }
.faq:first-of-type { border-top: 1px solid var(--line); }
.faq summary { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--pine); cursor: pointer; }
.faq p { margin: 0.7rem 0 0; color: var(--muted); max-width: 40rem; }

.contact-grid { display: grid; grid-template-columns: 1.3fr 0.8fr; gap: 3rem; align-items: start; }
.contact-details { background: var(--paper); border-radius: var(--r-lg); padding: 1.75rem; }
.contact-details h2 { font-size: 1.4rem; }
.contact-details dt { font-weight: 700; color: var(--pine); margin-top: 1rem; }
.contact-details dd { margin: 0.1rem 0 0; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.site-footer { background: var(--pine-deep); color: #B7D0CE; padding-block: 3rem 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.site-footer .logo, .site-footer .logo:hover { color: #fff; }
.site-footer h3 { color: #fff; font-size: 1rem; margin-bottom: 0.7rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 0.4rem; }
.site-footer a { color: #B7D0CE; }
.site-footer a:hover { color: var(--gold); }
.footer-note { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid rgba(255, 255, 255, 0.14); font-size: 0.9rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; }

/* ---------- Login pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 0.9fr) 1.1fr; }
.auth-side { background: var(--pine); color: #fff; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.auth-side .logo, .auth-side .logo:hover { color: #fff; }
.auth-pitch h2 { color: #fff; font-size: clamp(1.9rem, 3.4vw, 2.8rem); }
.auth-pitch p { color: #CFE3E1; max-width: 26rem; }
.auth-side .back-link { color: #B7D0CE; font-size: 0.95rem; }
.auth-side .back-link:hover { color: var(--gold); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: var(--paper); }
.auth-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 2.2rem 2rem; }
.auth-card h1 { font-size: 1.9rem; margin-bottom: 0.25rem; }
.auth-card .sub { color: var(--muted); margin-bottom: 1.5rem; }
.auth-foot { margin: 1.25rem 0 0; font-size: 0.95rem; color: var(--muted); text-align: center; }

/* ---------- Temporary app pages (replaced by dashboards in later steps) ---------- */
.app-bar { background: var(--pine); color: #fff; }
.app-bar .bar { min-height: 64px; }
.app-bar .logo, .app-bar .logo:hover { color: #fff; }
.app-bar-right { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.app-bar-right span { color: #CFE3E1; font-size: 0.95rem; }
.app-bar form { margin: 0; }
.app-page { padding-block: 2.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .contact-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-side { padding: 1.5rem; }
  .auth-pitch { display: none; }
}
@media (max-width: 640px) {
  .steps, .duo, .facts, .field-row, .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .auth-card { padding: 1.6rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* =====================================================================
   Admin area
   ===================================================================== */
.page-admin { background: var(--paper); }
.admin { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.admin-side {
  background: var(--pine-deep); color: #B7D0CE; padding: 1.4rem 1rem;
  display: flex; flex-direction: column; gap: 1.5rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-side .logo, .admin-side .logo:hover { color: #fff; padding: 0 0.5rem; }
.admin-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.admin-nav a, .admin-nav .is-soon {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.55rem 0.75rem; border-radius: var(--r-sm); color: #B7D0CE;
  text-decoration: none; font-weight: 500;
}
.admin-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.admin-nav a[aria-current="page"] { background: var(--gold); color: var(--pine); }
.admin-nav .is-soon { opacity: 0.55; cursor: default; }
.nav-count { background: var(--ribbon); color: #fff; border-radius: 999px; font-size: 0.78rem; font-weight: 700; padding: 0.05rem 0.5rem; min-width: 1.4rem; text-align: center; }
.soon-tag { font-size: 0.72rem; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px; padding: 0 0.45rem; }
.admin-side-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, 0.14); padding-top: 1rem; display: grid; gap: 0.6rem; font-size: 0.92rem; }
.admin-side-foot form { margin: 0; }
.admin-main { min-width: 0; }
.admin-top { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1rem; padding: 1.05rem 1.75rem; background: #fff; border-bottom: 1px solid var(--line); }
.admin-top h1 { font-size: 1.55rem; margin: 0; flex: 1; }
.admin-top-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.admin-menu-btn {
  display: none; background: transparent; border: 2px solid var(--pine); color: var(--pine);
  border-radius: 999px; padding: 0.35rem 0.9rem; font: 600 0.92rem var(--font-body); cursor: pointer;
}
.admin-content { padding: 1.75rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.1rem 1.25rem; }
.stat-label { color: var(--muted); font-size: 0.92rem; margin: 0; }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--pine); line-height: 1.15; margin: 0.15rem 0; overflow-wrap: anywhere; }
.stat-sub { font-size: 0.88rem; color: var(--muted); margin: 0; }
.stat--alert .stat-value { color: var(--ribbon); }
.stat--total { background: var(--pine); border-color: var(--pine); }
.stat--total .stat-label, .stat--total .stat-sub { color: #CFE3E1; }
.stat--total .stat-value { color: #fff; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 1.5rem; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; padding: 0.95rem 1.25rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.15rem; margin: 0; }
.panel-body { padding: 1.25rem; }
.panel .table th:first-child, .panel .table td:first-child { padding-left: 1.25rem; }
.panel .table th:last-child, .panel .table td:last-child { padding-right: 1.25rem; }
.panel .table tr:last-child td { border-bottom: 0; }
.empty { padding: 1.5rem; color: var(--muted); text-align: center; }

.user-layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 1.5rem; align-items: start; }
.user-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-bottom: 1.25rem; }
.user-head h2 { margin: 0; font-size: 1.6rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0; font-size: 0.95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.form-narrow { max-width: 620px; }
.panel form .field:last-of-type { margin-bottom: 1rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.toolbar .input, .toolbar .select { width: auto; min-width: 190px; }
.toolbar .grow { flex: 1; min-width: 220px; }

.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt-credit { color: var(--ok); font-weight: 600; }
.amt-debit { color: var(--danger); font-weight: 600; }
.nowrap { white-space: nowrap; }
.cell-sub { display: block; color: var(--muted); font-size: 0.88rem; }
.thumb { width: 48px; height: 48px; border-radius: var(--r-sm); object-fit: cover; background: var(--paper); display: grid; place-items: center; font-size: 1.4rem; }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; margin-top: 1.25rem; }
.pager a, .pager span { padding: 0.35rem 0.8rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--pine); }
.pager a:hover { border-color: var(--pine); }
.pager .current { background: var(--pine); border-color: var(--pine); color: #fff; }
.pager .disabled { opacity: 0.45; }

.unread { font-weight: 700; }
.dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--ribbon); margin-right: 0.45rem; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.05rem; }
.checkbox { display: flex; gap: 0.5rem; align-items: center; font-weight: 500; }
.checkbox input { width: 1.1rem; height: 1.1rem; }
.gift-preview { max-width: 220px; border-radius: var(--r-md); margin-bottom: 0.6rem; }

@media (max-width: 1100px) {
  .user-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .admin { grid-template-columns: minmax(0, 1fr); }
  .admin-side { position: static; height: auto; }
  .js .admin-side { display: none; }
  .js .admin-side.is-open { display: flex; }
  .js .admin-menu-btn { display: inline-flex; }
  .admin-top, .admin-content { padding-inline: 1.1rem; }
}

/* =====================================================================
   User area
   ===================================================================== */
[hidden] { display: none !important; }
.page-user { background: var(--paper); }
.user-bar { background: var(--pine); color: #fff; }
.user-bar .bar { min-height: 66px; }
.user-bar .logo, .user-bar .logo:hover { color: #fff; }
.user-collapse { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; flex: 1 1 auto; margin-left: 1.5rem; }
.user-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.user-nav a {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.85rem;
  border-radius: 999px; color: #CFE3E1; text-decoration: none; font-weight: 500;
}
.user-nav a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.user-nav a[aria-current="page"] { background: var(--gold); color: var(--pine); }
.user-bar-right { display: flex; align-items: center; gap: 0.8rem; white-space: nowrap; }
.user-bar-right span { color: #CFE3E1; font-size: 0.95rem; }
.user-bar-right form { margin: 0; }
.user-menu-btn {
  display: none; background: transparent; border: 2px solid rgba(255, 255, 255, 0.6); color: #fff;
  border-radius: 999px; padding: 0.35rem 0.9rem; font: 600 0.92rem var(--font-body); cursor: pointer;
}
.page-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1rem; margin-bottom: 1.25rem; }
.page-title h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); margin: 0; flex: 1; }

.notice {
  padding: 1rem 1.2rem; border-radius: var(--r-md); border: 1px solid; border-left-width: 6px;
  margin-bottom: 1.25rem; overflow-wrap: anywhere;
}
.notice-label { display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 0.2rem; opacity: 0.85; }
.notice p { margin: 0; }
.notice-info    { background: #E7F0FB; color: #174A82; border-color: #1F5FA8; }
.notice-success { background: #E8F6EE; color: #0F5132; border-color: #17794A; }
.notice-warning { background: #FFF4DB; color: #6B4500; border-color: #C98A00; }
.notice-danger  { background: #FDECEA; color: #8A1C15; border-color: #B3261E; }

.wallet { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.wallet-total { background: var(--pine); color: #fff; border-radius: var(--r-lg); padding: 1.5rem 1.6rem; display: flex; flex-direction: column; justify-content: space-between; gap: 1.25rem; }
.wallet-total .label { color: #CFE3E1; margin: 0; }
.wallet-total .amount { font-family: var(--font-display); font-size: clamp(2.3rem, 5vw, 3.3rem); font-weight: 800; line-height: 1.05; margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.wallet .stat { display: flex; flex-direction: column; justify-content: center; }

.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.gift-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; }
.gift-media { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--paper); }
.gift-media--icon { display: grid; place-items: center; font-size: 3.4rem; }
.gift-card-body { padding: 1.1rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.gift-card-body h3 { margin: 0; font-size: 1.2rem; }
.gift-kind { color: var(--muted); font-size: 0.9rem; margin: 0; }
.gift-value { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: var(--pine); margin: 0.2rem 0; }
.gift-card-foot { margin-top: auto; padding-top: 0.6rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }

.gift-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 2rem; align-items: start; margin-bottom: 1.5rem; }
.gift-layout .gift-media { border-radius: var(--r-lg); border: 1px solid var(--line); }
.gift-detail .gift-value { font-size: 2.4rem; }
.choice-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.choice { border: 2px solid var(--line); border-radius: var(--r-md); padding: 1.25rem; background: #fff; display: flex; flex-direction: column; gap: 0.6rem; }
.choice h3 { margin: 0; font-size: 1.15rem; }
.choice p { margin: 0; color: var(--muted); font-size: 0.97rem; }
.choice form { margin-top: auto; padding-top: 0.5rem; }
.choice--convert { border-color: var(--pine); }

.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }
.tabs a { padding: 0.4rem 0.95rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--pine); text-decoration: none; font-weight: 500; }
.tabs a:hover { border-color: var(--pine); }
.tabs a[aria-current="page"] { background: var(--pine); border-color: var(--pine); color: #fff; }

.notif { display: flex; gap: 0.9rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif.is-unread { background: #FFFBEF; }
.notif-main { flex: 1; min-width: 0; }
.notif-title { font-weight: 700; margin: 0; }
.notif-text { margin: 0.1rem 0 0.25rem; overflow-wrap: anywhere; }
.notif-time { font-size: 0.85rem; color: var(--muted); }

.form-section-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--pine); margin: 1.25rem 0 0.6rem; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }

@media (max-width: 900px) {
  .user-bar .bar { flex-wrap: wrap; }
  .js .user-menu-btn { display: inline-flex; }
  .js .user-collapse { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; margin: 0 0 1rem; gap: 0.75rem; }
  .js .user-collapse.is-open { display: flex; }
  .user-nav { flex-direction: column; }
  .user-bar-right { justify-content: space-between; }
  .wallet { grid-template-columns: minmax(0, 1fr); }
  .gift-layout, .profile-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Withdrawals (step 5) ---------- */
.method-box { border: 2px solid var(--gold); background: #FFFBEF; border-radius: var(--r-md); padding: 1.1rem 1.25rem; margin: 1rem 0; }
.method-box h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.method-box .kv dd { font-weight: 600; user-select: all; }
.proof-img { max-width: 260px; max-height: 260px; border-radius: var(--r-md); border: 1px solid var(--line); display: block; margin-top: 0.4rem; }
.big-amount { font-family: var(--font-display); font-weight: 800; font-size: 2.2rem; color: var(--pine); line-height: 1.1; margin: 0; }
.pre-line { white-space: pre-line; overflow-wrap: anywhere; }
.split-2 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.5rem; align-items: start; }
.inline-form { display: inline; margin: 0; }
@media (max-width: 1100px) { .split-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Mobile safety (tables and grids never push the page sideways) ---------- */
.split-2 > *, .user-layout > *, .profile-grid > *, .gift-layout > *, .contact-grid > *, .hero-grid > *, .wallet > *, .stat-grid > * { min-width: 0; }
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
.panel, .card { max-width: 100%; }
@media (max-width: 640px) {
  .table { font-size: 0.9rem; }
  .table th, .table td { padding: 0.6rem 0.55rem; }
  .panel .table th:first-child, .panel .table td:first-child { padding-left: 0.85rem; }
  .panel .table th:last-child, .panel .table td:last-child { padding-right: 0.85rem; }
  .panel-head, .panel-body { padding-inline: 1rem; }
  .app-page { padding-block: 1.5rem; }
}
