:root {
  --primary: #0f172a;
  --accent: #3b82f6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --sidebar-width: 260px;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-box {
  width: 32px;
  height: 32px;
  background-color: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-decoration: none;
  color: #94a3b8;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.nav-item:hover, .nav-item.active {
  background-color: rgba(255,255,255,0.1);
  color: white;
}

.nav-item.active {
  background-color: var(--accent);
}

/* Main Content */
main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  width: calc(100% - var(--sidebar-width));
}

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

.page-title h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.page-title p {
  color: var(--text-muted);
  margin-top: 4px;
}

.actions {
  display: flex;
  gap: 12px;
}

/* UI Components */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background-color: var(--accent);
  color: white;
}

.btn-secondary {
  background-color: white;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.stat-card .label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 12px 0 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-card .trend {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }

/* Dashboard Specifics */
.main-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.chart-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.chart-container {
  height: 300px;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  justify-content: space-around;
}

.bar {
  width: 40px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  position: relative;
}

.bar-dual {
  display: flex;
  gap: 4px;
  align-items: flex-end;
}

.bar-1 { background: var(--accent); width: 15px; }
.bar-2 { background: var(--success); width: 15px; }

.ratio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.ratio-card {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
}

.ratio-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ratio-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.ratio-val {
  font-weight: 700;
  color: var(--accent);
}

.ratio-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.ratio-fill {
  height: 100%;
  background: var(--accent);
}

.insight-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.insight-item:last-child {
  border-bottom: none;
}

.icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.insight-content h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.insight-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Compliance Badge */
.badge {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }

.compliance-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px;
  background: #f0f9ff;
  border-radius: 8px;
  border: 1px solid #bae6fd;
}

.compliance-status span {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Table styling for Ledger */
.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  background: #f8fafc;
}

.table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.table tr:hover {
  background-color: #f8fafc;
}

.placeholder-image {
  background: #e2e8f0;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fadeIn 0.4s ease-out forwards;
}

.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }
