/* BaoBoss Accounting — cream/gold theme */

:root {
  --bg:        #f7f3ea;
  --surface:   #ffffff;
  --surface-2: #faf6ec;
  --surface-3: #f0e8d3;
  --border:    #e7dec7;
  --border-strong: #d8caa1;
  --text:      #2a241a;
  --text-2:    #5c5240;
  --text-muted:#8a7e66;
  --accent:    #7a5e2c;
  --accent-2:  #b8923d;
  --accent-soft: rgba(184, 146, 61, 0.12);
  --crimson:   #b8232c;
  --crimson-soft: rgba(184, 35, 44, 0.10);
  --green:     #4e8a4e;
  --green-soft: rgba(78, 138, 78, 0.12);
  --orange:    #c47d2b;
  --orange-soft: rgba(196, 125, 43, 0.12);
  --blue:      #4e6f8a;
  --blue-soft: rgba(78, 111, 138, 0.12);
  --shadow-sm: 0 1px 2px rgba(60, 40, 0, 0.04);
  --shadow:    0 2px 8px rgba(60, 40, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(60, 40, 0, 0.08);
  --radius:    10px;
  --radius-sm: 7px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { letter-spacing: -0.01em; }

code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
}

/* ----------------------------- Layout ----------------------------- */

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

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.sidebar-logo-img {
  width: 38px; height: 38px;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.sidebar-brand h1 { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.1; }
.sidebar-brand small { display: block; font-size: 11px; color: var(--text-muted); }

.sidebar-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  padding: 14px 16px 6px;
  font-weight: 700;
}

.sidebar-nav { flex: 1; padding: 0 8px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  margin: 1px 0;
}
.sidebar-nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar-nav a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.sidebar-nav a.active svg { opacity: 1; color: #fff; }

.sidebar-user {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.user-link { display: flex; align-items: center; gap: 9px; flex: 1; color: var(--text); }
.user-link:hover { text-decoration: none; }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--orange));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-info { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.main-content { padding: 22px 28px 60px; min-width: 0; }

/* ----------------------------- Page header ----------------------------- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-header h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.page-header p { margin: 0; color: var(--text-muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ----------------------------- Filters & date presets ----------------------------- */

.filters {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--radius);
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.filters label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  gap: 4px;
  letter-spacing: 0.02em;
}
.filters input, .filters select {
  font-size: 13px;
  font-weight: 400;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  min-width: 110px;
  font-family: inherit;
}
.filters input:focus, .filters select:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.date-presets {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.chip {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 500;
}
.chip:hover { background: var(--surface-2); text-decoration: none; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ----------------------------- Stat cards ----------------------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.stat-card.positive::before { background: var(--green); }
.stat-card.negative::before { background: var(--crimson); }
.stat-card.info::before     { background: var(--blue); }
.stat-card .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.stat-card .value { font-size: 22px; font-weight: 700; margin: 5px 0 3px; line-height: 1.15; }
.stat-card .sub { font-size: 12px; color: var(--text-muted); }
.stat-card.positive .value { color: var(--green); }
.stat-card.negative .value { color: var(--crimson); }

.stats-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 18px; }
.mini-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 13px;
  min-width: 130px;
  flex: 1;
}
.mini-stat .label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.mini-stat .value { font-size: 16px; font-weight: 700; margin: 3px 0; }
.mini-stat .sub { font-size: 11px; color: var(--text-muted); }
.mini-stat.status-paid     { border-left: 3px solid var(--green); }
.mini-stat.status-pending  { border-left: 3px solid var(--orange); }
.mini-stat.status-rejected { border-left: 3px solid var(--crimson); }
.mini-stat.status-reimbursed { border-left: 3px solid var(--accent-2); }
.mini-stat.status-received { border-left: 3px solid var(--green); }
.mini-stat.status-reversed { border-left: 3px solid var(--crimson); }

/* ----------------------------- Cards ----------------------------- */

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.detail-card.no-pad { padding: 0; overflow: hidden; }
.detail-card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-card h3 small { font-weight: 400; color: var(--text-muted); text-transform: none; letter-spacing: 0; }

.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.grid-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 16px; }
@media (max-width: 980px) { .grid-2col, .grid-3col { grid-template-columns: 1fr; } }

.chart-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 16px; }
@media (max-width: 980px) { .chart-row { grid-template-columns: 1fr; } }
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.chart-card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.chart-container { position: relative; height: 280px; }
.chart-container-sm { position: relative; height: 200px; }

/* ----------------------------- Notifications ----------------------------- */

.notif-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.notif {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 13px;
  background: var(--surface);
}
.notif a { font-weight: 600; }
.notif-warn { border-color: rgba(196, 125, 43, 0.3); background: var(--orange-soft); color: #8a5618; }
.notif-info { border-color: rgba(78, 111, 138, 0.3); background: var(--blue-soft); color: #355370; }
.notif-error { border-color: rgba(184, 35, 44, 0.3); background: var(--crimson-soft); color: var(--crimson); }
.notif-icon { font-size: 16px; }

/* ----------------------------- Tables ----------------------------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.data-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .num.pos { color: var(--green); font-weight: 600; }
.data-table .num.neg { color: var(--crimson); font-weight: 600; }
.data-table .actions { white-space: nowrap; }
.data-table .actions a, .data-table .actions button { font-size: 12px; margin-right: 8px; }
.data-table tr.voided td { opacity: 0.45; text-decoration: line-through; }
.data-table tr.zero td { color: var(--text-muted); }
.data-table.compact tbody td, .data-table.compact thead th { padding: 7px 10px; }

/* ----------------------------- Badges ----------------------------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge-paid, .badge-active, .badge-operational, .badge-verified, .badge-in, .badge-received { background: var(--green-soft); color: var(--green); border-color: #c8e0c2; }
.badge-pending, .badge-planning, .badge-setup, .badge-draft, .badge-out { background: var(--orange-soft); color: var(--orange); border-color: #f3deba; }
.badge-rejected, .badge-closed, .badge-void, .badge-reversed { background: var(--crimson-soft); color: var(--crimson); border-color: #f3c5c9; }
.badge-reimbursed { background: var(--accent-soft); color: var(--accent-2); border-color: #ebdb9c; }
.badge-sent { background: var(--blue-soft); color: var(--blue); border-color: #c2d4e0; }
.badge-partial { background: var(--accent-soft); color: var(--accent-2); border-color: #ebdb9c; }
.badge-overdue { background: var(--crimson-soft); color: var(--crimson); border-color: #f3c5c9; }

/* ----------------------------- Buttons ----------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  background: none;
  font-family: inherit;
  line-height: 1.4;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.06); text-decoration: none; box-shadow: var(--shadow); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); text-decoration: none; }
.btn-danger { background: var(--crimson); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); text-decoration: none; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.link, .link-danger, .link-success {
  background: none; border: none; cursor: pointer;
  font-size: 12px; padding: 0; font-family: inherit; font-weight: 600;
}
.link { color: var(--accent); }
.link-danger { color: var(--crimson); }
.link-success { color: var(--green); }
.link:hover, .link-danger:hover, .link-success:hover { text-decoration: underline; }

/* ----------------------------- Forms ----------------------------- */

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  gap: 5px;
  text-transform: none;
}
.form-grid label.full { grid-column: 1 / -1; }
.form-grid label.required::after { content: '*'; color: var(--crimson); margin-left: 2px; }
.form-grid input, .form-grid select, .form-grid textarea {
  font-size: 14px;
  font-weight: 400;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-grid input[type="file"] { padding: 7px; background: var(--surface-2); }
.form-grid .help-text { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.checkbox-group { display: flex; align-items: center; gap: 8px; flex-direction: row !important; }
.checkbox-group input[type="checkbox"] { width: auto; }

/* ----------------------------- Alerts ----------------------------- */

.alert {
  padding: 11px 16px;
  border-radius: 7px;
  border: 1px solid;
  margin-bottom: 14px;
  font-size: 13px;
  transition: opacity 0.4s;
}
.alert-success { background: var(--green-soft); border-color: #c8e0c2; color: #2c5f2c; }
.alert-error { background: var(--crimson-soft); border-color: #f3c5c9; color: var(--crimson); }

/* ----------------------------- Auth ----------------------------- */

.auth-body {
  background:
    radial-gradient(circle at 15% 18%, rgba(184,146,61,0.22), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(78,138,78,0.14), transparent 45%),
    linear-gradient(160deg, #2c2114 0%, #4a3719 45%, #6b5226 100%);
  background-size: 200% 200%, 200% 200%, 100% 100%;
  animation: authGlow 18s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
@keyframes authGlow {
  0%, 100% { background-position: 0% 0%, 100% 100%, 0 0; }
  50%      { background-position: 30% 20%, 70% 80%, 0 0; }
}
/* animated brand scene layer (bao + steam injected via .auth-bg) */
.auth-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }

/* floating bao buns */
.auth-bun {
  position: absolute;
  width: var(--s, 80px); height: calc(var(--s, 80px) * 0.86);
  background: radial-gradient(ellipse at 38% 32%, #fffaf0 0%, #f3e6c8 45%, #e3cf9f 72%, #d4ba85 100%);
  border-radius: 50% 50% 48% 48% / 58% 58% 42% 42%;
  box-shadow: inset -6px -8px 14px rgba(150,120,60,0.25), 0 8px 22px rgba(0,0,0,0.18);
  opacity: 0.16;
  bottom: -120px;
  left: var(--x, 50%);
  animation: floatUp var(--d, 26s) linear infinite;
  animation-delay: var(--delay, 0s);
}
/* the pleated knot on top of the bao */
.auth-bun::before {
  content: '';
  position: absolute; top: -6%; left: 50%; transform: translateX(-50%);
  width: 26%; height: 22%;
  background: radial-gradient(circle, #f3e6c8 0%, #d8be8c 100%);
  border-radius: 50%;
  box-shadow: -7px 2px 0 -2px #e7d3a6, 7px 2px 0 -2px #e7d3a6;
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.18; }
  90%  { opacity: 0.16; }
  100% { transform: translateY(-118vh) rotate(var(--rot, 18deg)); opacity: 0; }
}

/* rising steam wisps */
.auth-steam {
  position: absolute;
  width: var(--sw, 10px); height: var(--sh, 130px);
  left: var(--sx, 30%);
  bottom: 8%;
  background: linear-gradient(to top, rgba(255,250,240,0) 0%, rgba(255,250,240,0.28) 45%, rgba(255,250,240,0) 100%);
  border-radius: 50%;
  filter: blur(7px);
  opacity: 0;
  animation: steamRise var(--sd, 9s) ease-in-out infinite;
  animation-delay: var(--sdelay, 0s);
}
@keyframes steamRise {
  0%   { transform: translateY(0) scaleX(1); opacity: 0; }
  25%  { opacity: 0.5; }
  60%  { transform: translateY(-160px) translateX(18px) scaleX(1.5); opacity: 0.35; }
  100% { transform: translateY(-320px) translateX(-12px) scaleX(2.1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-body, .auth-bun, .auth-steam { animation: none; }
  .auth-bun, .auth-steam { display: none; }
}
.auth-shell { width: 100%; max-width: 430px; position: relative; z-index: 1; }
.auth-card {
  background: var(--surface);
  border: 1px solid rgba(216,202,161,0.6);
  border-radius: 16px;
  padding: 38px 34px 26px;
  box-shadow: 0 24px 60px rgba(40, 26, 0, 0.30), 0 2px 8px rgba(40,26,0,0.12);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
  width: 86px; height: 86px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
  display: block;
  border: 3px solid var(--accent-2);
  box-shadow: 0 6px 18px rgba(122,94,44,0.30);
}
.auth-brand h1 { margin: 0 0 5px; font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.auth-brand p { margin: 0; font-size: 12px; color: var(--text-muted); }
.auth-footer {
  text-align: center; margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-2); font-weight: 600;
  display: flex; flex-direction: column; gap: 3px;
}
.auth-footer-sub { font-size: 10px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.02em; }
.auth-form label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; }
.auth-form input {
  display: block; width: 100%; margin-top: 5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  background: var(--surface-2);
  font-family: inherit;
}
.auth-form input:focus { outline: none; border-color: var(--accent-2); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-form .btn { margin-top: 6px; }
.auth-hint { text-align: center; font-size: 11px; color: var(--text-muted); margin: 16px 0 0; }

/* ----------------------------- Reports ----------------------------- */

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  display: block;
  transition: transform 0.15s, box-shadow 0.15s;
}
.report-card:hover { background: var(--surface-2); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.report-card .icon { font-size: 24px; color: var(--accent); margin-bottom: 8px; }
.report-card h3 { margin: 0 0 6px; font-size: 15px; }
.report-card p { margin: 0; color: var(--text-muted); font-size: 12.5px; }

/* ----------------------------- Account ledger ----------------------------- */

.balance-card {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.balance-card .label { font-size: 12px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.balance-card .value { font-size: 32px; font-weight: 700; margin-top: 6px; }
.balance-card .meta { font-size: 12px; opacity: 0.85; margin-top: 4px; }

/* ----------------------------- Misc ----------------------------- */

.empty-state, .empty-state-sm {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}
.empty-state h2 { color: var(--text-2); margin-bottom: 8px; }
.empty-state .btn { margin-top: 16px; }
.empty-state-sm { padding: 18px; font-size: 13px; }

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  font-size: 13px;
  color: var(--text-muted);
}
.pagination-controls { display: flex; gap: 6px; }

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent);
}
.attachment-link:hover { text-decoration: underline; }

.kv-table { width: 100%; }
.kv-table th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 8px 12px; font-size: 12px; width: 30%; }
.kv-table td { padding: 8px 12px; font-size: 13px; }

/* mobile */
.mobile-nav-toggle { display: none; }
.sidebar-overlay { display: none; }
@media (max-width: 900px) {
  .app-container { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -260px; top: 0;
    width: 240px;
    z-index: 100;
    transition: left 0.25s;
  }
  .sidebar.open { left: 0; }
  .mobile-nav-toggle {
    display: block;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 110;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 6px 13px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .sidebar-overlay.active { opacity: 1; pointer-events: all; }
  .main-content { padding: 60px 16px 40px; }
  .stat-card .value { font-size: 19px; }
  .data-table { font-size: 12px; }
}

/* ----------------------- Invoices ----------------------- */
.line-items input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 12.5px; background: var(--surface); }
.line-items input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-soft); }
.line-items input.num { text-align: right; font-variant-numeric: tabular-nums; }
.line-items td { vertical-align: middle; padding: 6px 6px; }
.line-items .line-amount { font-weight: 600; font-variant-numeric: tabular-nums; }

.invoice-foot-grid { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.totals-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.totals-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.totals-table th { text-align: left; font-weight: 500; color: var(--text-2); padding: 6px 4px; font-size: 12.5px; }
.totals-table td { text-align: right; padding: 6px 4px; font-variant-numeric: tabular-nums; }
.totals-table tr.grand th, .totals-table tr.grand td { border-top: 2px solid var(--border-strong); padding-top: 9px; font-size: 16px; font-weight: 700; color: var(--accent); }
.totals-input { width: 110px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; text-align: right; }
.tax-label-input { width: 56px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 5px; font: inherit; font-size: 12px; }

.data-table tfoot th, .data-table tfoot td { padding: 7px 10px; font-size: 12.5px; background: var(--surface-2); border-top: 1px solid var(--border); }
.data-table tfoot tr.grand th, .data-table tfoot tr.grand td { font-size: 14px; font-weight: 700; color: var(--accent); border-top: 2px solid var(--border-strong); }

.invoice-show-grid { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .invoice-foot-grid, .invoice-show-grid { grid-template-columns: 1fr; } }

/* --------------- Compact dashboard (fit-on-screen) --------------- */
.dash-compact .filters { margin-bottom: 10px; }
/* 6 stat cards: one even row on wide screens, then 3 / 2 cleanly — no orphan card */
.dash-compact .stats-grid { gap: 10px; margin-bottom: 12px; grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1380px) { .dash-compact .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .dash-compact .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.dash-compact .stat-card { padding: 12px 14px; }
.dash-compact .stat-card .value { font-size: 18px; margin: 3px 0 2px; }
.dash-compact .stat-card .label { font-size: 10px; }
.dash-compact .stat-card .sub { font-size: 11px; }
.dash-compact .chart-row { gap: 12px; margin-bottom: 12px; }
.dash-compact .chart-card { padding: 12px 14px; }
.dash-compact .chart-card h3 { margin: 0 0 6px; font-size: 12px; }
.dash-compact .chart-container { height: 190px; }
.dash-compact .grid-2col, .dash-compact .grid-3col { gap: 12px; margin-bottom: 12px; align-items: start; }
.dash-compact .detail-card { padding: 12px 14px; }
.dash-compact .detail-card.no-pad { padding: 0; }
.dash-compact .detail-card h3 { font-size: 12px; margin-bottom: 8px; }
.dash-compact .data-table.compact thead th { padding: 5px 8px; font-size: 10px; }
.dash-compact .data-table.compact tbody td { padding: 6px 8px; font-size: 12px; vertical-align: top; }
/* fixed table layout so long item names truncate with ellipsis instead of wrapping tall */
.dash-compact .grid-3col .data-table,
.dash-compact .grid-2col .data-table { table-layout: fixed; width: 100%; }
.dash-compact .grid-3col .data-table td,
.dash-compact .grid-2col .data-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-compact .grid-3col .data-table td .muted.small,
.dash-compact .grid-2col .data-table td .muted.small { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-compact .data-table td .muted.small { font-size: 10px; }
.dash-compact .notif-strip { margin-bottom: 10px; }
