/* =========================================================================
   DappleOS Brand Tokens — DAP-001 Revenue Dashboard
   Canonical fonts: Degulardisplay (headings) + Inter (body)
   Tokens sourced from dappleos.com live CSS
   ========================================================================= */

/* ---- @font-face: Degulardisplay (14 variants, CDN-hosted) ---- */
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea3ca0a0ddd3d4d9634_DegularDisplay-Thin.otf) format("opentype");font-weight:100;font-style:normal;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea3a203281d542ea353_DegularDisplay-ThinItalic.otf) format("opentype");font-weight:100;font-style:italic;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea38bdb48594ad3d7d2_DegularDisplay-Light.otf) format("opentype");font-weight:300;font-style:normal;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea372508828847102aa_DegularDisplay-LightItalic.otf) format("opentype");font-weight:300;font-style:italic;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea3cdebe0a37a32b9e7_DegularDisplay-Regular.otf) format("opentype");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea323d742b9a3dfa301_DegularDisplay-RegularItalic.otf) format("opentype");font-weight:400;font-style:italic;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea3a203281d542ea36f_DegularDisplay-Medium.otf) format("opentype");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea345d714537f2f42ea_DegularDisplay-MediumItalic.otf) format("opentype");font-weight:500;font-style:italic;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea3c7731fc6a13a889d_DegularDisplay-Semibold.otf) format("opentype");font-weight:600;font-style:normal;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea389e2394cc13d6b54_DegularDisplay-SemiboldItalic.otf) format("opentype");font-weight:600;font-style:italic;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea375179f701b69383d_DegularDisplay-Bold.otf) format("opentype");font-weight:700;font-style:normal;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea315c6cf1b7af5f4fc_DegularDisplay-BoldItalic.otf) format("opentype");font-weight:700;font-style:italic;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea39266cccd395a977a_DegularDisplay-Black.otf) format("opentype");font-weight:900;font-style:normal;font-display:swap}
@font-face{font-family:Degulardisplay;src:url(https://cdn.prod.website-files.com/6837d1b78d384e89e87248f8/683adea31b0de7dd828cd809_DegularDisplay-BlackItalic.otf) format("opentype");font-weight:900;font-style:italic;font-display:swap}

/* ---- Design tokens (light mode) ---- */
:root {
  --brand-purple: #645aff;
  --brand-purple-dark: #7873ff;
  --brand-purple-soft: #cecaff;
  --brand-purple-tint: #e8e4ff;

  --ink-900: #0a0a0a;
  --ink-800: #101214;
  --ink-700: #222;
  --ink-600: #333;
  --ink-500: #3c4c5a;
  --ink-400: #647280;
  --ink-300: #9ea8b2;

  --border-200: #e0e4e8;
  --surface-100: #f4f6f8;
  --surface-50: #fafafa;
  --white: #ffffff;
  --blue-link: #3898ec;

  --success: #12b76a;
  --warning: #f79009;
  --danger: #f04438;

  /* Semantic (map to tokens) */
  --bg: var(--white);
  --bg-muted: var(--surface-50);
  --surface: var(--white);
  --surface-alt: var(--surface-100);
  --border: var(--border-200);
  --text: var(--ink-700);
  --text-muted: var(--ink-400);
  --text-strong: var(--ink-900);
  --accent: var(--brand-purple);
  --accent-hover: var(--brand-purple-dark);
  --accent-tint: var(--brand-purple-tint);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(10,10,10,.04), 0 1px 1px rgba(10,10,10,.03);
  --shadow: 0 4px 16px rgba(10,10,10,.06), 0 1px 2px rgba(10,10,10,.04);

  --font-display: Degulardisplay, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: Inter, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* ---- Dark mode ---- */
:root[data-theme="dark"] {
  --bg: #0b0d10;
  --bg-muted: #101318;
  --surface: #14181f;
  --surface-alt: #1a1f27;
  --border: #252b34;
  --text: #e6eaf0;
  --text-muted: #8a94a3;
  --text-strong: #ffffff;
  --accent: #7873ff;
  --accent-hover: #9690ff;
  --accent-tint: rgba(120, 115, 255, .18);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 8px 32px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.3);
}

/* ---- Base ---- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-strong);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }

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

button { font-family: var(--font-body); cursor: pointer; }

/* ---- Layout primitives ---- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(12px);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-strong);
}
.topbar-brand .logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-dark));
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--surface-alt); }
.icon-btn svg { width: 18px; height: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  transition: all .15s ease;
}
.btn:hover { background: var(--surface-alt); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.last-refreshed {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 4px;
}

/* ---- Sections ---- */
main { padding: 32px 0 80px; }
.section { margin-bottom: 48px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-head h2 {
  font-size: 22px;
  font-weight: 600;
}
.section-head .section-sub {
  color: var(--text-muted);
  font-size: 13px;
}

/* ---- KPI cards (exec summary) ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.kpi-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.kpi-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  color: var(--text-strong);
  margin-top: 8px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 6px;
}
.kpi-delta.up    { color: var(--success); }
.kpi-delta.down  { color: var(--danger); }
.kpi-delta.flat  { color: var(--text-muted); }
.kpi-context {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Chart cards ---- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-head h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}
.card-head .card-sub {
  color: var(--text-muted);
  font-size: 12px;
}
.chart-wrap { position: relative; width: 100%; height: 280px; }
.chart-wrap.tall { height: 340px; }

/* ---- Breakdown cells (this-month revenue movement) ---- */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
@media (max-width: 800px) { .mini-grid { grid-template-columns: repeat(2, 1fr); } }
.mini-cell {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.mini-cell .mini-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 500;
}
.mini-cell .mini-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  margin-top: 4px;
  color: var(--text-strong);
}
.mini-cell.pos .mini-value { color: var(--success); }
.mini-cell.neg .mini-value { color: var(--danger); }

/* ---- Table ---- */
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.table th, table.table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
table.table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
table.table tbody tr:hover { background: var(--surface-alt); }

/* ---- Filters ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { background: var(--surface-alt); }
.chip.active {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

/* ---- Utility ---- */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  gap: 24px;
  flex-wrap: wrap;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-strong);
}
.hero-sub {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 6px;
}
