/* ============================================================================
   DFPL — shared design system
   Loaded by every page via <link rel="stylesheet" href="/assets/css/app.css">
   (public/ and admin/ pages use ../assets/css/app.css)
   ============================================================================ */

:root {
  color-scheme: light;

  /* -- palette -- */
  --ink: #121826;
  --ink-soft: #1D2536;
  --paper: #F4F6F5;
  --surface: #FFFFFF;
  --saffron: #F5A623;
  --saffron-dark: #D68C0F;
  --ember: #E1552F;
  --ember-soft: #FCEAE3;
  --pitch: #1E9E6C;
  --pitch-soft: #E7F8F1;
  --slate: #5B6472;
  --slate-light: #8B93A1;
  --border: #E4E7EB;
  --border-soft: #EEF0F2;

  /* -- type -- */
  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;

  /* -- scale -- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(18,24,38,0.04), 0 8px 24px -12px rgba(18,24,38,0.12);
  --shadow-pop: 0 4px 8px rgba(18,24,38,0.06), 0 16px 40px -16px rgba(18,24,38,0.22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(64px + var(--safe-top)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(52% 38% at 14% 0%, rgba(245,166,35,0.09), transparent 62%),
    radial-gradient(46% 34% at 100% 8%, rgba(30,158,108,0.08), transparent 58%),
    radial-gradient(40% 30% at 48% 100%, rgba(225,85,47,0.05), transparent 62%),
    var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--saffron-dark); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* -- layout shell -- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(115deg, var(--ink) 0%, var(--ink) 55%, var(--ink-soft) 100%);
  padding-top: var(--safe-top);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.app-header-bar { max-width: 880px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: transparent; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex: none; }
.brand-sub { display: block; font-family: var(--font-body); font-weight: 500; font-size: 0.68rem; color: #A9B0BE; margin-top: 1px; }

.nav-toggle { display: none; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { color: #C7CCD6; text-decoration: none; font-size: 0.86rem; font-weight: 600; padding: 8px 12px; border-radius: 999px; transition: background 0.15s, color 0.15s; white-space: nowrap; }
.nav-links a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-links a.is-active { background: var(--saffron); color: var(--ink); }
.hamburger { display: none; }

@media (max-width: 920px) {
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--ink-soft);
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 8px 14px calc(14px + var(--safe-bottom));
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.22s ease, opacity 0.18s ease;
  }
  .nav-links a { padding: 11px 12px; border-radius: 10px; }
  .nav-toggle:checked ~ .nav-links { max-height: 60vh; opacity: 1; overflow-y: auto; }
  .hamburger {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 34px; height: 34px; border-radius: 8px; cursor: pointer; flex: none;
  }
  .hamburger span { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; margin: 0 auto; transition: transform 0.2s, opacity 0.2s; }
  .nav-toggle:checked ~ .hamburger-wrap .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle:checked ~ .hamburger-wrap .hamburger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .hamburger-wrap .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

.app-main { max-width: 880px; margin: 0 auto; padding: 28px 20px 60px; }
.app-main.narrow { max-width: 560px; min-height: calc(100dvh - 66px); display: flex; flex-direction: column; justify-content: center; }

/* -- cards -- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
  border: 1px solid var(--border-soft);
}
.card + .card { margin-top: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card h2 { font-size: 1.08rem; margin-bottom: 4px; }
.card-subtitle { color: var(--slate); font-size: 0.87rem; margin: 0 0 18px; }

/* -- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.92rem;
  padding: 12px 20px; border-radius: 999px; border: none; cursor: pointer;
  text-decoration: none; transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s;
  line-height: 1.2;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-soft); }
.btn-gold { background: var(--saffron); color: var(--ink); }
.btn-gold:hover { background: var(--saffron-dark); }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--slate-light); }
.btn-danger { background: var(--ember-soft); color: var(--ember); }
.btn-danger:hover { background: #F9DACE; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* -- forms -- */
label { display: block; font-size: 0.83rem; font-weight: 700; color: var(--ink); margin: 16px 0 6px; }
label:first-child { margin-top: 0; }
.field-hint { color: var(--slate); font-size: 0.78rem; margin-top: 5px; }
input[type=text], input[type=password], input[type=number], input[type=email], textarea, select {
  width: 100%; font-family: var(--font-body); font-size: 0.95rem;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--saffron-dark); box-shadow: 0 0 0 3px rgba(245,166,35,0.18); outline: none; }
input:disabled, select:disabled, textarea:disabled { background: var(--border-soft); color: var(--slate-light); }
textarea { resize: vertical; min-height: 110px; }

/* -- badges / pills -- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.badge-gold  { background: #FDF1DA; color: #92620A; }
.badge-pitch { background: var(--pitch-soft); color: #0F6E48; }
.badge-ember { background: var(--ember-soft); color: #B23F1D; }
.badge-ink   { background: var(--ink); color: #fff; }
.badge-slate { background: var(--border-soft); color: var(--slate); }

/* -- messages -- */
.msg { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 18px; border: 1px solid transparent; line-height: 1.5; }
.msg-success { background: var(--pitch-soft); color: #0F6E48; border-color: #BFEBD9; }
.msg-error   { background: var(--ember-soft); color: #B23F1D; border-color: #F5C7B4; }
.msg-warn    { background: #FEF6E7; color: #92620A; border-color: #F7E3B0; }

/* -- tables (collapse to cards on mobile) -- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
table.data th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--slate); font-weight: 700; padding: 10px 12px; border-bottom: 2px solid var(--border); }
table.data td { padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data.responsive-stack tbody tr:nth-child(even) { background: var(--paper); }
.text-right { text-align: right; }
.amt { font-family: var(--font-display); font-weight: 700; }

@media (max-width: 640px) {
  table.data.responsive-stack thead { display: none; }
  table.data.responsive-stack, table.data.responsive-stack tbody, table.data.responsive-stack tr, table.data.responsive-stack td { display: block; width: 100%; }
  table.data.responsive-stack tr { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 4px 12px; }
  table.data.responsive-stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-soft); padding: 9px 0; text-align: right; }
  table.data.responsive-stack td:last-child { border-bottom: none; }
  table.data.responsive-stack td::before { content: attr(data-label); font-size: 0.72rem; font-weight: 700; color: var(--slate); text-transform: uppercase; letter-spacing: 0.03em; text-align: left; }
}

/* -- misc content patterns -- */
.stat-block { background: linear-gradient(135deg, var(--pitch-soft), #F4FBF8); border: 1px solid #BFEBD9; border-radius: var(--radius-md); padding: 18px 20px; margin-bottom: 20px; }
.stat-block .amount { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: #0F6E48; line-height: 1.1; }
.stat-block .label { font-size: 0.8rem; color: #0F6E48; margin-top: 4px; }

.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); margin-bottom: 8px; }
.list-row .name { font-weight: 700; font-size: 0.92rem; }
.list-row .meta { color: var(--slate); font-size: 0.78rem; }
.list-row .right { text-align: right; }

.section-title { font-family: var(--font-display); font-weight: 700; font-size: 0.98rem; margin: 26px 0 10px; }
.section-title:first-of-type { margin-top: 0; }
.eyebrow-label { font-size: 0.78rem; font-weight: 700; color: var(--slate); margin: 14px 0 8px; }
.empty-state { color: var(--slate-light); font-size: 0.88rem; padding: 6px 0; }
.divider { border: none; border-top: 1px dashed var(--border); margin: 22px 0; }
.muted { color: var(--slate); font-size: 0.82rem; }
.link { color: var(--saffron-dark); font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* -- auth / marketing style pages -- */
.auth-shell { min-height: 100dvh; display: flex; align-items: center; padding: 24px; }
.auth-card { max-width: 440px; margin: 0 auto; width: 100%; }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo .brand-mark { width: 52px; height: 52px; border-radius: 16px; font-size: 1.6rem; margin: 0 auto 12px; }
.home-fab { position: fixed; top: calc(20px + var(--safe-top)); left: 20px; display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.92); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; font-size: 0.82rem; font-weight: 700; color: var(--ink); text-decoration: none; box-shadow: var(--shadow-card); z-index: 50; }
.home-fab:hover { background: #fff; box-shadow: var(--shadow-pop); }

