/* App shell — dashboard, transactions, reports pages */
/* Extends theme.css variables; does NOT duplicate them */

/* ============ APP SHELL ============ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  padding: 0 24px 28px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-brand span { color: var(--fg); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; padding: 0 12px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--fg); }
.nav-link.active { background: var(--accent-glow); color: var(--accent); }
.nav-link .icon { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 16px 24px 0;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.sidebar-footer a {
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
}

.sidebar-footer a:hover { color: var(--fg); }

/* Main content */
.app-main {
  margin-left: 220px;
  flex: 1;
  padding: 32px 36px;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* ============ SUMMARY CARDS ============ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-accent, var(--accent));
}

.summary-card.card-cash { --card-accent: var(--accent); }
.summary-card.card-invoices { --card-accent: var(--amber); }
.summary-card.card-bills { --card-accent: #ef4444; }

.card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 12px;
}

.card-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--card-accent, var(--fg));
}

.card-meta {
  font-size: 13px;
  color: var(--fg-muted);
}

/* ============ SECTION PANELS ============ */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

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

.panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.panel-action {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.panel-action:hover { opacity: 0.8; }

/* ============ TRANSACTIONS TABLE ============ */
.tx-table { width: 100%; border-collapse: collapse; }

.tx-table th {
  text-align: left;
  padding: 10px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.tx-table td {
  padding: 13px 20px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

.tx-table tr:last-child td { border-bottom: none; }
.tx-table tr:hover td { background: rgba(255,255,255,0.02); }

.tx-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}

.tx-merchant { font-weight: 500; color: var(--fg); }
.tx-date { color: var(--fg-muted); font-size: 13px; }

.tx-amount {
  font-family: var(--font-display);
  font-weight: 600;
  text-align: right;
}

.amount-positive { color: var(--accent); }
.amount-negative { color: var(--fg); }

/* Category badge */
.cat-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  color: var(--fg-muted);
  letter-spacing: 0.3px;
}

/* Category colors */
.cat-Income     { background: rgba(34,211,167,0.15); color: var(--accent); }
.cat-Software   { background: rgba(139,92,246,0.15); color: #a78bfa; }
.cat-Supplies   { background: rgba(245,158,11,0.15); color: var(--amber); }
.cat-Meals      { background: rgba(249,115,22,0.15); color: #fb923c; }
.cat-Travel     { background: rgba(59,130,246,0.15); color: #60a5fa; }
.cat-Utilities  { background: rgba(20,184,166,0.15); color: #2dd4bf; }
.cat-Payroll    { background: rgba(236,72,153,0.15); color: #f472b6; }
.cat-Advertising{ background: rgba(168,85,247,0.15); color: #c084fc; }
.cat-Professional{ background: rgba(99,102,241,0.15); color: #818cf8; }

/* Dot colors by category */
.dot-Income     { background: var(--accent); }
.dot-Software   { background: #a78bfa; }
.dot-Supplies   { background: var(--amber); }
.dot-Meals      { background: #fb923c; }
.dot-Travel     { background: #60a5fa; }
.dot-Utilities  { background: #2dd4bf; }
.dot-Payroll    { background: #f472b6; }
.dot-Advertising{ background: #c084fc; }
.dot-Professional{ background: #818cf8; }

/* ============ INVOICE / BILLS LISTS ============ */
.item-list { list-style: none; }

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.item-row:last-child { border-bottom: none; }
.item-row:hover { background: rgba(255,255,255,0.02); }

.item-name { flex: 1; font-weight: 500; font-size: 14px; }
.item-desc { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }

.item-amount {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}

.item-due {
  font-size: 12px;
  color: var(--fg-muted);
  min-width: 90px;
  text-align: right;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.status-outstanding { background: rgba(245,158,11,0.15); color: var(--amber); }
.status-upcoming    { background: rgba(239,68,68,0.12);  color: #f87171; }
.status-paid        { background: rgba(34,211,167,0.12); color: var(--accent); }

.overdue-badge { background: rgba(239,68,68,0.2); color: #f87171; }

/* ============ P&L REPORT ============ */
.pl-section {
  margin-bottom: 16px;
}

.pl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.pl-row:last-child { border-bottom: none; }
.pl-row:hover { background: rgba(255,255,255,0.02); }

.pl-cat-name { display: flex; align-items: center; gap: 8px; }
.pl-total-row {
  font-weight: 700;
  font-size: 15px;
  background: rgba(255,255,255,0.03);
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.pl-net-row {
  padding: 16px 20px;
  font-weight: 700;
  font-size: 1.1rem;
  background: var(--bg-card);
  border-top: 2px solid var(--border);
}

.pl-net-positive { color: var(--accent); }
.pl-net-negative { color: #f87171; }

/* ============ DATE RANGE FILTER ============ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 24px;
}

.filter-bar label { font-size: 13px; color: var(--fg-muted); }

.filter-bar input[type="date"] {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 13px;
  padding: 5px 10px;
}

.filter-bar input[type="date"]:focus {
  outline: 1px solid var(--accent);
}

.btn {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
  text-decoration: none;
}

.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: #0a0f1a; }
.btn-ghost { background: rgba(255,255,255,0.06); color: var(--fg); }

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  color: var(--fg-muted);
  border: 1px solid transparent;
  padding: 0 8px;
}

.pagination a:hover { background: rgba(255,255,255,0.05); color: var(--fg); }
.pagination span.current { border-color: var(--accent); color: var(--accent); }
.pagination .disabled { opacity: 0.3; pointer-events: none; }
.page-info { color: var(--fg-muted); flex: 1; }

/* ============ CATEGORY FILTER SELECT ============ */
.select-filter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}

.select-filter:focus { outline: 1px solid var(--accent); }

/* ============ MONTHLY CHART BARS ============ */
.chart-bar-group { display: flex; gap: 4px; align-items: flex-end; }

.month-chart {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  padding: 24px 24px 16px;
  height: 160px;
  border-bottom: 1px solid var(--border);
}

.month-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.month-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  flex: 1;
  width: 100%;
  justify-content: center;
}

.bar-income, .bar-expense {
  width: 12px;
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: opacity 0.2s;
}

.bar-income { background: var(--accent); opacity: 0.8; }
.bar-expense { background: #ef4444; opacity: 0.7; }
.bar-income:hover, .bar-expense:hover { opacity: 1; }

.month-label { font-size: 11px; color: var(--fg-muted); text-align: center; }

/* ============ EMPTY STATES ============ */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 14px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-brand, .nav-link span, .sidebar-footer { display: none; }
  .app-main { margin-left: 60px; padding: 20px; }
  .cards-grid { grid-template-columns: 1fr; }
}
