/* ============================================================
   EXPENSIO — dashboard.css
   Enqueued by functions.php on all app page templates.
   BEM blocks: .layout .nav .topbar .stat-card .panel
               .pending .recent .quick-access .chart-panel
               .badge .avatar .btn .page-header .month-selector
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg-base:        #0d0f14;
  --bg-surface:     #13161e;
  --bg-raised:      #1a1e2a;
  --bg-hover:       #21263a;
  --bg-active:      #252b3d;

  --accent:         #00e5a0;
  --accent-dim:     rgba(0,229,160,.12);
  --accent-glow:    rgba(0,229,160,.25);
  --accent2:        #7c6ef5;
  --accent2-dim:    rgba(124,110,245,.12);

  --text-primary:   #eef0f6;
  --text-secondary: #8b90a7;
  --text-muted:     #525870;

  --border:         rgba(255,255,255,.06);
  --border-strong:  rgba(255,255,255,.10);

  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;

  --font-display:   'Syne', sans-serif;
  --font-body:      'DM Sans', sans-serif;
  --font-mono:      'DM Mono', monospace;

  --nav-width:      220px;
  --topbar-h:       64px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 2px; }

/* ============================================================
   BLOCK: layout
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "topbar" "main";
  min-height: 100vh;
}

.layout--nav-open .nav { transform: translateX(0); }
.layout--nav-open .layout__overlay { opacity: 1; pointer-events: auto; }

.layout__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s cubic-bezier(.4,0,.2,1);
}

.layout__main {
  grid-area: main;
  padding: 24px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 1024px) {
  .layout {
    grid-template-columns: var(--nav-width) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas: "nav topbar" "nav main";
  }
  .layout__overlay { display: none !important; }
  .layout__main { padding: 28px 32px; }
}

/* ============================================================
   BLOCK: nav
   ============================================================ */
.nav {
  grid-area: nav;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0 0 24px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--nav-width);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

@media (min-width: 1024px) {
  .nav { position: sticky; top: 0; height: 100vh; transform: none; transition: none; }
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.nav__logo {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.nav__wordmark {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--text-primary);
}

.nav__wordmark span { color: var(--accent); }

.nav__section { padding: 0 12px; flex: 1; }

.nav__section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  transition: background .18s, color .18s;
  position: relative;
  margin-bottom: 2px;
  cursor: pointer;
}

.nav__item:hover { background: var(--bg-hover); color: var(--text-primary); }

.nav__item--active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}

.nav__item--active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav__item-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.nav__item--active .nav__item-icon { opacity: 1; }

.nav__item-badge {
  margin-left: auto;
  background: var(--accent);
  color: #0d0f14;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.nav__divider { height: 1px; background: var(--border); margin: 12px; }

.nav__user {
  padding: 12px 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
}

.nav__user-info { flex: 1; min-width: 0; }

.nav__user-name {
  font-size: 13px; font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nav__user-role { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.nav__user-action {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background .18s, color .18s;
}

.nav__user-action:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================
   BLOCK: topbar
   ============================================================ */
.topbar {
  grid-area: topbar;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  position: sticky;
  top: 0; z-index: 80;
}

@media (min-width: 1024px) { .topbar { padding: 0 32px; } }

.topbar__hamburger {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background .18s, color .18s;
}

.topbar__hamburger:hover { background: var(--bg-hover); color: var(--text-primary); }

@media (min-width: 1024px) { .topbar__hamburger { display: none; } }

.topbar__title { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.topbar__subtitle { font-size: 13px; color: var(--text-muted); display: none; }
@media (min-width: 640px) { .topbar__subtitle { display: block; } }

.topbar__spacer { flex: 1; }

.topbar__search {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 36px; width: 220px;
  transition: border-color .18s, width .18s;
}

.topbar__search:focus-within { border-color: var(--accent); width: 260px; }
@media (min-width: 768px) { .topbar__search { display: flex; } }

.topbar__search input {
  background: none; border: none; outline: none;
  font-family: var(--font-body); font-size: 13px;
  color: var(--text-primary); width: 100%;
}
.topbar__search input::placeholder { color: var(--text-muted); }
.topbar__search-icon { color: var(--text-muted); flex-shrink: 0; }

.topbar__actions { display: flex; align-items: center; gap: 4px; }

.topbar__action {
  position: relative;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background .18s, color .18s;
}

.topbar__action:hover { background: var(--bg-hover); color: var(--text-primary); }

.topbar__action-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.topbar__avatar-wrap {
  width: 34px; height: 34px;
  margin-left: 4px;
  cursor: pointer;
  border-radius: 50%;
  transition: outline .15s;
  outline: 2px solid transparent;
  outline-offset: 2px;
  text-decoration: none;
}

.topbar__avatar-wrap:hover { outline-color: var(--accent); }

/* ============================================================
   BLOCK: avatar
   ============================================================ */
.avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700; color: #fff;
  overflow: hidden; flex-shrink: 0;
}

.avatar--lg { width: 42px; height: 42px; font-size: 15px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   BLOCK: stat-card
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 767px) { .stats-row { grid-template-columns: 1fr 1fr; } }

@media (min-width: 1024px) { .stats-row { grid-template-columns: repeat(3, 1fr); } }

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color .18s, transform .18s;
}

.stat-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat-card--accent  { background: var(--accent-dim);  border-color: rgba(0,229,160,.2); }
.stat-card--accent2 { background: var(--accent2-dim); border-color: rgba(124,110,245,.2); }

.stat-card__header { display: flex; align-items: center; justify-content: space-between; }
.stat-card__label  { font-size: 12px; color: var(--text-muted); letter-spacing: .03em; }

.stat-card__icon {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}

.stat-card__icon--green  { background: var(--accent-dim);             color: var(--accent); }
.stat-card__icon--purple { background: var(--accent2-dim);            color: var(--accent2); }
.stat-card__icon--amber  { background: rgba(245,171,53,.12);  color: #f5ab35; }
.stat-card__icon--red    { background: rgba(239,83,80,.12);   color: #ef5350; }

.stat-card__value {
  font-family: var(--font-mono);
  font-size: 26px; font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -.02em; line-height: 1;
}

.stat-card__footer { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.stat-card__trend  { display: flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; font-family: var(--font-mono); }
.stat-card__trend--up   { color: var(--accent); }
.stat-card__trend--down { color: #ef5350; }

/* ============================================================
   BLOCK: panel
   ============================================================ */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.panel__title { font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: .02em; }

.panel__action {
  font-size: 12px; color: var(--accent); font-weight: 500;
  padding: 4px 10px; border-radius: var(--radius-sm);
  transition: background .18s;
}

.panel__action:hover { background: var(--accent-dim); }
.panel__body { padding: 16px 20px; }

/* ============================================================
   BLOCK: pending
   ============================================================ */
.pending__list { display: flex; flex-direction: column; gap: 2px; }

.pending__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: background .18s;
  cursor: pointer;
}

.pending__item:hover { background: var(--bg-hover); }

.pending__item-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.pending__item-label { flex: 1; font-size: 13px; color: var(--text-secondary); }
.pending__item-value { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--text-primary); }
.pending__item-value--alert { color: #f5ab35; }

/* ============================================================
   BLOCK: recent
   ============================================================ */
.recent__table { width: 100%; border-collapse: collapse; font-size: 13px; }

.recent__table th {
  text-align: left;
  font-size: 10px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px 10px;
}

.recent__table th:last-child { text-align: right; }

.recent__table td {
  padding: 10px 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.recent__table tr:hover td { background: var(--bg-hover); }
.recent__table td:first-child { color: var(--text-primary); }

.recent__amount { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--text-primary); text-align: right; }
.recent__amount--large { color: #ef5350; }

/* ============================================================
   BLOCK: badge
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 500; letter-spacing: .04em;
  white-space: nowrap;
}

.badge--green   { background: rgba(0,229,160,.12);  color: var(--accent); }
.badge--purple  { background: rgba(124,110,245,.12); color: #a99bf8; }
.badge--amber   { background: rgba(245,171,53,.12);  color: #f5ab35; }
.badge--red     { background: rgba(239,83,80,.12);   color: #ef7472; }
.badge--blue    { background: rgba(64,169,255,.12);  color: #60b8ff; }
.badge--teal    { background: rgba(38,198,218,.12);  color: #4dd0e1; }

/* ============================================================
   BLOCK: quick-access
   ============================================================ */
.quick-access__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 480px) { .quick-access__grid { grid-template-columns: repeat(4, 1fr); } }

.quick-access__btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 18px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary); text-align: center;
  transition: background .18s, border-color .18s, color .18s, transform .18s;
}

.quick-access__btn:hover {
  background: var(--bg-hover); border-color: var(--border-strong);
  color: var(--text-primary); transform: translateY(-2px);
}

.quick-access__btn-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}

.quick-access__btn--expense .quick-access__btn-icon { background: var(--accent-dim);  color: var(--accent); }
.quick-access__btn--receipt .quick-access__btn-icon { background: var(--accent2-dim); color: var(--accent2); }
.quick-access__btn--report  .quick-access__btn-icon { background: rgba(245,171,53,.12); color: #f5ab35; }
.quick-access__btn--trip    .quick-access__btn-icon { background: rgba(64,169,255,.12); color: #60b8ff; }

/* ============================================================
   BLOCK: chart-panel / breakdown
   ============================================================ */
.charts-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .charts-row { grid-template-columns: 3fr 2fr; } }

.chart-panel__canvas-wrap { position: relative; height: 200px; }

.chart-panel__legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }

.chart-panel__legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }

.chart-panel__legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.breakdown__list { display: flex; flex-direction: column; gap: 14px; }

.breakdown__item-header {
  display: flex; justify-content: space-between;
  font-size: 12px; margin-bottom: 6px; color: var(--text-secondary);
}

.breakdown__item-value { font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); }

.breakdown__bar-track { height: 4px; background: var(--bg-raised); border-radius: 2px; overflow: hidden; }

.breakdown__bar-fill { height: 100%; border-radius: 2px; transition: width .6s cubic-bezier(.4,0,.2,1); }

/* ============================================================
   BLOCK: page-header
   ============================================================ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}

.page-header__title { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.2; }
.page-header__subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.page-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   BLOCK: btn
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-md);
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  transition: background .18s, transform .18s, border-color .18s;
  cursor: pointer; border: 1px solid transparent;
}

.btn--primary { background: var(--accent); color: #0d0f14; }
.btn--primary:hover { background: #00ffb3; transform: translateY(-1px); }

.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text-secondary); }
.btn--ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================
   BLOCK: month-selector
   ============================================================ */
.month-selector {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 4px 8px;
  font-size: 12px; color: var(--text-secondary);
}

.month-selector__btn {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; color: var(--text-muted);
  transition: background .18s, color .18s;
}

.month-selector__btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.month-selector__label { font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); min-width: 72px; text-align: center; }

/* ============================================================
   Grid helpers
   ============================================================ */
.grid-2col { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px)  { .grid-2col { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .grid-2col--wide { grid-template-columns: 3fr 2fr; } }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.layout__main > * { animation: fadeUp .3s ease both; }
.layout__main > *:nth-child(1) { animation-delay: .04s; }
.layout__main > *:nth-child(2) { animation-delay: .08s; }
.layout__main > *:nth-child(3) { animation-delay: .12s; }
.layout__main > *:nth-child(4) { animation-delay: .16s; }
.layout__main > *:nth-child(5) { animation-delay: .20s; }
.layout__main > *:nth-child(6) { animation-delay: .24s; }

/* ============================================================
   Toast notification (used by app.js)
   ============================================================ */
.expensio-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  transition: opacity .3s ease;
}

.expensio-toast--success { background: var(--accent); color: #0d0f14; }
.expensio-toast--error   { background: #ef5350;       color: #fff; }

/* ============================================================
   Block: drawer 
   ============================================================ */
input#dash-subject:focus, input#dash-amount:focus, input#dash-date:focus, select#dash-category:focus, textarea#dash-notes:focus {
    border-color: rgba(0,229,160,.5) !important;
    box-shadow: 0 0 0 3px rgba(0,229,160,.08);
}
