:root {
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-light: #ccfbf1;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f7f8;
  --sidebar: #0b2230;
  --sidebar-hover: #123b4d;
  --danger: #e11d48;
  --success: #059669;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

a { text-decoration: none; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 254px;
  flex: 0 0 254px;
  background: linear-gradient(180deg, #0b2230 0%, #0d2f3d 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: #fff; display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 8px 18px rgba(13,148,136,.3);
}
.brand-name { color: #fff; font-weight: 700; letter-spacing: -.3px; }
.brand-sub { font-size: 11px; color: #7dd3fc; margin-top: 2px; }

.sidebar-nav { padding: 14px 12px; flex: 1; }
.nav-section {
  font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  color: #64859a; padding: 16px 10px 6px; font-weight: 700;
}
.sidebar-nav .nav-link {
  color: #b6c7d3; border-radius: 9px; padding: 10px 12px;
  display: flex; align-items: center; gap: 11px; font-weight: 500;
  margin-bottom: 2px; transition: .15s ease;
}
.sidebar-nav .nav-link i { font-size: 17px; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(13,148,136,.28); }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 16px 18px; display: flex; align-items: center; gap: 11px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #134e4a; color: #5eead4;
  display: grid; place-items: center; font-weight: 700;
}
.user-name { font-size: 13px; color: #fff; font-weight: 600; }
.user-business { font-size: 11px; color: #8ba9b8; }
.sidebar-backdrop { display: none; }

.app-main { flex: 1; min-width: 0; margin-left: 254px; display: flex; flex-direction: column; }

.topbar {
  height: 68px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  position: sticky; top: 0; z-index: 1030;
}
.menu-btn { display: none; border: 0; background: transparent; font-size: 24px; color: var(--ink); }
.topbar-heading { flex: 1; min-width: 0; }
.topbar-title { font-size: 17px; font-weight: 700; display: block; line-height: 1.2; }
.topbar-sub { font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 26px 28px 10px; flex: 1; }
.app-footer { padding: 22px 0 18px; color: #94a3b8; font-size: 11px; text-align: center; }
.app-alert { border-radius: 10px; }

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 14px; margin-bottom: 20px;
}
.page-head h1 { font-size: 22px; font-weight: 750; margin: 0 0 4px; letter-spacing: -.4px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn { border-radius: 8px; font-weight: 600; font-size: 13px; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }

.card { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 10px rgba(15,23,42,.035); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 700; padding: 14px 18px; }
.card-body { padding: 18px; }
.card-title { font-size: 14px; font-weight: 700; margin: 0; }
.card-subtitle { font-size: 12px; color: var(--muted); }

.stat-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 18px; height: 100%; position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; inset: auto -20px -35px auto; width: 100px; height: 100px; border-radius: 50%; background: var(--brand-light); opacity: .45; }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; margin-bottom: 14px; }
.stat-icon.teal { background: #ccfbf1; color: #0f766e; }
.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.rose { background: #ffe4e6; color: #be123c; }
.stat-icon.violet { background: #ede9fe; color: #6d28d9; }
.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat-value { font-size: 21px; font-weight: 750; letter-spacing: -.5px; position: relative; z-index: 1; }
.stat-foot { font-size: 11px; color: #94a3b8; margin-top: 6px; }

.table { --bs-table-bg: transparent; font-size: 13px; }
.table thead th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 700; border-bottom-color: var(--line);
  white-space: nowrap; background: #f8fafc;
}
.table tbody td { border-color: #eef2f6; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .total-row td { font-weight: 700; background: #f0fdfa; border-top: 1px solid #99f6e4; }
.table .grand-row td { font-weight: 750; background: #ccfbf1; }

.badge-soft { border-radius: 6px; padding: 5px 9px; font-size: 11px; font-weight: 700; }
.badge-income { background: #d1fae5; color: #047857; }
.badge-expense { background: #ffe4e6; color: #be123c; }
.badge-journal { background: #e0e7ff; color: #4338ca; }
.badge-opening { background: #fef3c7; color: #b45309; }
.badge-inactive { background: #f1f5f9; color: #64748b; }

.amount-positive { color: var(--success); font-weight: 650; }
.amount-negative { color: var(--danger); font-weight: 650; }
.text-muted-small { font-size: 11px; color: var(--muted); }

.form-label { font-size: 12px; font-weight: 650; color: #334155; margin-bottom: 5px; }
.form-control, .form-select { border-radius: 8px; border-color: #d7dee6; font-size: 13px; padding: 9px 11px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,148,136,.12); }
.input-group-text { background: #f8fafc; border-color: #d7dee6; font-size: 12px; }
.form-text { font-size: 11px; color: var(--muted); }

.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.filter-bar .form-label { margin-bottom: 3px; }

.chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 10px; }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 18px; }
.chart-bars { width: 100%; max-width: 34px; height: 140px; display: flex; align-items: flex-end; gap: 3px; justify-content: center; }
.chart-bar { width: 13px; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .3s ease; }
.chart-bar.revenue { background: linear-gradient(180deg, #14b8a6, #0d9488); }
.chart-bar.expense { background: linear-gradient(180deg, #fda4af, #e11d48); }
.chart-label { font-size: 10px; color: var(--muted); white-space: nowrap; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-state i { font-size: 32px; color: #cbd5e1; }
.report-note { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 10px; padding: 12px 14px; font-size: 12px; }
.report-note i { margin-right: 6px; }

.tax-tabs .nav-link { color: var(--muted); font-weight: 650; border-radius: 9px; }
.tax-tabs .nav-link.active { background: var(--brand); color: #fff; }
.tax-section-title { font-size: 13px; font-weight: 750; color: #0f766e; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.tax-total { background: #f0fdfa; font-weight: 700; }

.journal-entry { border: 1px solid var(--line); border-radius: 11px; margin-bottom: 12px; overflow: hidden; }
.journal-head { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); font-size: 12px; }
.journal-head strong { font-size: 13px; }

.line-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr auto; gap: 8px; margin-bottom: 8px; align-items: start; }
.line-row .form-control, .line-row .form-select { font-size: 12.5px; padding: 8px; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1035; }
  .app-main { margin-left: 0; }
  .menu-btn { display: block; }
  .content { padding: 18px 14px; }
  .topbar { padding: 0 14px; }
  .line-row { grid-template-columns: 1fr 1fr; }
}

@media print {
  .sidebar, .topbar, .app-footer, .page-actions, .filter-bar, .no-print { display: none !important; }
  .app-main { margin-left: 0; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; font-size: 11px; }
  .table thead th { background: #eee !important; }
}
