.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  background: var(--ink-950);
  border-right: 1px solid var(--border-soft);
  padding: var(--space-5) var(--space-4);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; width: 260px; height: 100vh;
  overflow-y: auto;
  z-index: 40;
}
/* The sidebar is now out of grid flow (position: fixed), so its 260px grid
   column is otherwise empty. Push the content column over by the same
   amount so nothing sits underneath it. */
.app-shell > div:last-child { grid-column: 2; margin-left: 0; }
[data-theme="light"] .sidebar { background: var(--ink-900); }
.sidebar .brand { color: var(--paper-000); padding: 0 var(--space-2); margin-bottom: var(--space-6); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--slate-300); font-size: 14px; font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.side-link .ic { width: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.side-link:hover { background: rgba(255,255,255,0.05); color: var(--paper-000); }
.side-link.active { background: var(--accent-soft); color: var(--emerald-300); }
.side-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-400); padding: var(--space-4) 14px 6px; }
.side-foot { border-top: 1px solid rgba(255,255,255,0.08); padding-top: var(--space-4); margin-top: var(--space-4); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 6px; margin-bottom: 8px; }
.side-avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft); color: var(--emerald-300);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-display); font-size: 13px;
}
.side-user .name { font-size: 13.5px; color: var(--paper-000); font-weight: 600; }
.side-user .role { font-size: 11.5px; color: var(--slate-400); }
.logout-link { color: var(--rose-400); }

.sidebar-close, .menu-toggle { display: none; }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; }
.topbar-right { display: flex; align-items: center; gap: var(--space-3); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); position: relative;
}
.icon-btn:hover { color: var(--accent-bright); border-color: var(--accent-bright); }
.icon-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold-400); }

.main-content { padding: var(--space-6); max-width: 1180px; }

/* ---- Stat cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-bottom: var(--space-6); }
.stat-card { position: relative; overflow: hidden; transition: transform 0.2s var(--ease), border-color 0.2s var(--ease); }
.stat-card:hover { transform: translateY(-3px); border-color: var(--accent-bright); }
.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: var(--space-2); }
.stat-card .value { font-family: var(--font-mono); font-size: 24px; font-weight: 600; }
.stat-card .delta { font-size: 12px; margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.stat-card .delta.up { color: var(--emerald-400); }
.stat-card .delta.down { color: var(--rose-400); }
.stat-icon {
  position: absolute; top: var(--space-4); right: var(--space-4);
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  background: var(--accent-soft); color: var(--accent-bright);
}

/* ---- Section card w/ header ---- */
.panel { margin-bottom: var(--space-6); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.panel-head h2 { font-size: 16.5px; }
.panel-head a, .panel-head button.link { font-size: 13px; color: var(--accent-bright); font-weight: 600; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; padding: 10px 14px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--text-muted); border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-inset); }

/* ---- Activity list ---- */
.activity-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.activity-body { flex: 1; min-width: 0; }
.activity-body .title { font-size: 13.5px; font-weight: 500; }
.activity-body .time { font-size: 12px; color: var(--text-muted); }
.activity-amt { font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; white-space: nowrap; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,8,16,0.6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: var(--space-4);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.25s var(--ease), visibility 0.25s var(--ease);
}
.modal-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal {
  background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: var(--space-6); width: 100%; max-width: 420px; box-shadow: var(--shadow-pop);
  transform: scale(0.94) translateY(8px);
  transition: transform 0.28s var(--ease);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-5); }
.modal-head h3 { font-size: 17px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.modal-close:hover { background: var(--bg-inset); color: var(--text-primary); }
.modal-close svg { width: 16px; height: 16px; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--border-soft); margin-bottom: var(--space-5); }
.tab-btn { padding: 10px 4px; margin-right: var(--space-5); background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); font-weight: 600; font-size: 13.5px; }
.tab-btn.active { color: var(--accent-bright); border-color: var(--accent-bright); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 260px; z-index: 200;
    transform: translateX(-100%); transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; align-items: center; justify-content: center; position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; background: none; border: none; color: var(--slate-300); border-radius: 50%; }
  .sidebar-close:hover { background: rgba(255,255,255,0.08); }
  .menu-toggle { display: flex; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .main-content { padding: var(--space-4); }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 16px; }
}

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150;
}
.sidebar-backdrop.open { display: block; }

/* ---- Analytics ---- */
.chart-card { padding: var(--space-5); }
.chart-card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-4); }
.chart-card-head h3 { font-size: 14.5px; }
.chart-card-head .chart-total { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }

.breakdown-row { display: grid; grid-template-columns: 120px 1fr 90px; align-items: center; gap: 12px; padding: 9px 0; }
.breakdown-label { font-size: 13px; color: var(--text-secondary); }
.breakdown-track { height: 8px; border-radius: 999px; background: var(--bg-inset); overflow: hidden; }
.breakdown-fill { height: 100%; border-radius: 999px; transition: width 0.6s var(--ease); }
.breakdown-value { font-size: 12.5px; text-align: right; color: var(--text-primary); }

@media (max-width: 560px) {
  .breakdown-row { grid-template-columns: 90px 1fr 70px; gap: 8px; }
}

/* ---- Stepped deposit flow ---- */
.step-progress { display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-5); }
.step-progress .step-seg { flex: 1; height: 4px; border-radius: 999px; background: var(--bg-inset); overflow: hidden; }
.step-progress .step-seg span { display: block; height: 100%; width: 0%; background: var(--accent-bright); transition: width 0.3s var(--ease); }
.step-progress .step-seg.done span, .step-progress .step-seg.active span { width: 100%; }
.step-label { font-size: 12px; color: var(--text-muted); margin-bottom: var(--space-4); }

.method-pick { display: flex; flex-direction: column; gap: 10px; margin-bottom: var(--space-4); }
.method-pick-item {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; cursor: pointer; transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.method-pick-item:hover { border-color: var(--accent-bright); }
.method-pick-item.selected { border-color: var(--accent-bright); background: var(--accent-soft); }
.method-pick-item .m-name { font-size: 14px; font-weight: 600; }
.method-pick-item .m-type { font-size: 12px; color: var(--text-muted); }

.copy-box {
  background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; white-space: pre-wrap; font-size: 13.5px; font-family: var(--font-mono);
  margin-bottom: var(--space-3); position: relative;
}

.upload-drop {
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm); padding: 24px;
  text-align: center; cursor: pointer; margin-bottom: var(--space-4); transition: border-color 0.15s var(--ease);
}
.upload-drop:hover { border-color: var(--accent-bright); }
.upload-drop img { max-width: 100%; max-height: 180px; border-radius: var(--radius-sm); }

/* ---- Notifications dropdown ---- */
.notif-panel {
  display: none;
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); z-index: 50;
}
.notif-panel.open { display: block; }
.notif-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
  font-size: 13px; font-weight: 600; position: sticky; top: 0; background: var(--bg-elevated);
}
.btn-link { background: none; border: none; color: var(--accent-bright); font-size: 12px; cursor: pointer; padding: 0; }
.notif-panel-list { padding: 6px; }
.notif-item { padding: 10px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s var(--ease); }
.notif-item:hover { background: var(--bg-inset); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item.unread::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-bright); margin-right: 6px; }
.notif-item-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notif-item-msg { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 4px; }
.notif-item-time { font-size: 11px; color: var(--text-muted); }
.notif-empty { padding: 24px 14px; text-align: center; font-size: 13px; color: var(--text-muted); }
.notif-panel-foot {
  display: block; text-align: center; padding: 10px; font-size: 12.5px;
  color: var(--accent-bright); border-top: 1px solid var(--border-soft);
  position: sticky; bottom: 0; background: var(--bg-elevated);
}

/* ---- Print (receipts) ---- */
@media print {
  body * { visibility: hidden; }
  #receipt-print-area, #receipt-print-area * { visibility: visible; }
  #receipt-print-area { position: absolute; top: 0; left: 0; width: 100%; padding: 24px; }
  .no-print { display: none !important; }
}


/* ---- Welcome banner (dashboard) ---- */
.welcome-banner {
  margin-bottom: var(--space-6);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-400);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
}
.welcome-banner h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}
@media (max-width: 720px) {
  .welcome-banner { padding: var(--space-4); }
  .welcome-banner h2 { font-size: 18px; }
}
