/* Buchly design system — dark gold theme */
:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #1a1a24;
  --border: #1e1e2a;
  --border-light: #2a2a38;
  --gold: #c9a84c;
  --gold-dim: #8a7234;
  --gold-glow: rgba(201,168,76,0.12);
  --gold-glow-strong: rgba(201,168,76,0.22);
  --green: #4caf7d;
  --green-dim: rgba(76,175,125,0.15);
  --red: #e05252;
  --red-dim: rgba(224,82,82,0.15);
  --blue: #5b8dee;
  --blue-dim: rgba(91,141,238,0.12);
  --text: #e8e6e1;
  --text-dim: #8a8880;
  --text-bright: #ffffff;
  --radius: 8px;
  --radius-lg: 12px;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Typography */
h1,h2,h3,h4 { font-family: 'Space Grotesk', sans-serif; }

/* Layout */
.layout { display:flex; min-height:100vh; }

/* Sidebar */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}
.logo-mark span { color: var(--gold); }

.sidebar-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.65rem;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-left: 2px solid transparent;
}

.nav-item:hover {
  color: var(--text);
  background: var(--gold-glow);
}

.nav-item.active {
  color: var(--gold);
  background: var(--gold-glow);
  border-left-color: var(--gold);
}

.nav-item svg { width:16px; height:16px; flex-shrink:0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Main content */
.main {
  margin-left: 240px;
  flex: 1;
  padding: 0;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
}

.page-content { padding: 32px; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--gold-dim);
  background: var(--gold-glow);
}

.upload-icon {
  width: 48px;
  height: 48px;
  background: var(--gold-glow);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--gold);
}

.upload-zone h3 {
  color: var(--text-bright);
  font-size: 1rem;
  margin-bottom: 6px;
}

.upload-zone p {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border-light); }

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }
.stat-value.gold { color: var(--gold); }

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  background: var(--surface-2);
  padding: 10px 16px;
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--gold-glow); }

.data-table td.amount {
  font-family: 'Space Grotesk', sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.data-table td.amount.expense { color: var(--red); }
.data-table td.amount.revenue { color: var(--green); }

/* Category badge */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  white-space: nowrap;
}

.cat-badge.revenue {
  background: var(--green-dim);
  border-color: rgba(76,175,125,0.3);
  color: var(--green);
}

/* VAT badge */
.vat-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  background: var(--gold-glow);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gold);
  color: #0a0a0f;
}
.btn-primary:hover { background: #d4b860; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-light);
  background: var(--surface-2);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(224,82,82,0.3);
  font-size: 0.75rem;
  padding: 4px 10px;
}
.btn-danger:hover { background: rgba(224,82,82,0.25); }

/* Progress bar */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  min-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--gold); }

@keyframes slideIn {
  from { opacity:0; transform: translateY(8px); }
  to { opacity:1; transform: translateY(0); }
}

/* Processing state */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,0.8);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* VAT breakdown */
.vat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.vat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.vat-rate-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.vat-rate-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
}

/* Month chart */
.month-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  padding-bottom: 4px;
}

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

.month-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  transition: height 0.4s ease;
}
.month-bar.expense { background: rgba(224,82,82,0.7); }
.month-bar.revenue { background: rgba(76,175,125,0.7); }
.month-label { font-size: 0.6rem; color: var(--text-dim); }

/* Empty state */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-dim);
}
.empty-state p { font-size: 0.85rem; }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); }
.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Filter row */
.filter-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.filter-select:focus { border-color: var(--gold-dim); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .main { margin-left: 200px; }
  .page-content { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
