﻿:root {
  --primary: #1a73e8;
  --primary-600: #1557b0;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --grid: 8px;
  --sidebar-width: 260px;
  --sidebar-collapsed: 84px;
  --topbar-height: 64px;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #0ea5e9;
  --chip-bg: #eaf2ff;
  --skeleton: #e9edf5;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Roboto', system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body.auth-page {
  background:
    linear-gradient(rgba(11, 25, 56, 0.62), rgba(11, 25, 56, 0.62)),
    url('../../../img/auth/login-bg.jpg') center/cover no-repeat fixed;
}

body.dark {
  --bg: #0f172a;
  --surface: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #1f2937;
  --chip-bg: rgba(26, 115, 232, 0.15);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: calc(var(--grid) * 2);
  display: flex;
  flex-direction: column;
  gap: calc(var(--grid) * 2);
  transition: width 0.2s ease;
  z-index: 20;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--grid);
  padding: var(--grid);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: var(--grid);
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: calc(var(--grid) * 1.5);
  padding: calc(var(--grid) * 1.25) calc(var(--grid) * 1.5);
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-item .material-symbols-outlined { font-size: 20px; }

.nav-item.active,
.nav-item:hover {
  background: var(--chip-bg);
  color: var(--primary);
}

.nav-item.is-disabled,
.bottom-nav a.is-disabled {
  opacity: 0.38;
  color: #9ca3af !important;
  background: transparent !important;
  filter: grayscale(0.35);
  cursor: not-allowed;
  pointer-events: none;
}

.nav-item.is-disabled .material-symbols-outlined,
.bottom-nav a.is-disabled .material-symbols-outlined {
  opacity: 0.7;
}

.content { display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(var(--grid) * 3);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left,
.topbar-right { display: flex; align-items: center; gap: calc(var(--grid) * 2); }

.main {
  padding: calc(var(--grid) * 3);
  display: flex;
  flex-direction: column;
  gap: calc(var(--grid) * 3);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: calc(var(--grid) * 2.5);
  animation: rise 0.25s ease;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--grid);
  margin-bottom: calc(var(--grid) * 2);
}

.grid { display: grid; gap: calc(var(--grid) * 2); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--grid) calc(var(--grid) * 2);
  justify-content: space-around;
  z-index: 30;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.bottom-nav a.active { color: var(--primary); }

@media (max-width: 1200px) {
  .app { grid-template-columns: var(--sidebar-collapsed) 1fr; }
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .label, .logo-text { display: none; }
}

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    width: var(--sidebar-width);
    transition: left 0.25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { left: 0; }
  .bottom-nav { display: flex; }
  .main { padding-bottom: 80px; }
}

.focus-ring:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.hidden { display: none; }

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--skeleton);
  border-radius: 8px;
  min-height: 12px;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0; left: -150%;
  width: 150%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% { left: -150%; }
  100% { left: 150%; }
}

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

/* Google-inspired light banking refresh. Keep legacy selectors intact. */
:root {
  --primary: #1a73e8;
  --primary-600: #1765cc;
  --primary-700: #1557b0;
  --primary-soft: #e8f0fe;
  --bg: #f8f9fa;
  --bg-elevated: #f1f3f4;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --text: #202124;
  --text-secondary: #5f6368;
  --muted: #5f6368;
  --border: #e0e3e7;
  --border-strong: #d2d6dc;
  --success: #188038;
  --warning: #f9ab00;
  --danger: #d93025;
  --info: #1a73e8;
  --chip-bg: #e8f0fe;
  --chip-text: #174ea6;
  --shadow-xs: 0 1px 2px rgba(60, 64, 67, 0.08);
  --shadow-sm: 0 1px 3px rgba(60, 64, 67, 0.16);
  --shadow-md: 0 6px 18px rgba(60, 64, 67, 0.12);
  --shadow: var(--shadow-sm);
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 24px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --sidebar-width: 272px;
  --sidebar-collapsed: 92px;
  --topbar-height: 72px;
  --content-max: 1440px;
  --focus-ring: 0 0 0 3px rgba(26, 115, 232, 0.18);
}

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(26, 115, 232, 0.05), transparent 26%),
    linear-gradient(180deg, #f8f9fa 0%, #f5f7fb 100%);
}

body.auth-page {
  background:
    linear-gradient(rgba(11, 25, 56, 0.58), rgba(11, 25, 56, 0.58)),
    url("../../../img/auth/login-bg.jpg") center/cover no-repeat fixed;
}

body.dark {
  --text-secondary: #9ca3af;
}

.app {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  padding: var(--space-5) var(--space-4);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.98) 100%);
  overflow: hidden;
  transition: width 0.2s ease, left 0.25s ease;
}

.logo {
  gap: var(--space-3);
  padding: var(--space-3);
  min-height: 64px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(224, 227, 231, 0.7);
}

.logo-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.nav {
  gap: var(--space-1);
  padding-right: var(--space-1);
}

.nav::-webkit-scrollbar {
  width: 8px;
}

.nav::-webkit-scrollbar-thumb {
  background: rgba(95, 99, 104, 0.18);
  border-radius: 999px;
}

.nav-item {
  gap: var(--space-3);
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text-secondary);
}

.nav-item.active,
.nav-item:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.content {
  min-width: 0;
}

.topbar {
  min-height: var(--topbar-height);
  height: auto;
  padding: 0 var(--space-6);
  background: rgba(248, 249, 250, 0.88);
  border-bottom: 1px solid rgba(224, 227, 231, 0.9);
  backdrop-filter: blur(14px);
  gap: var(--space-4);
}

.topbar-left,
.topbar-right {
  gap: var(--space-3);
  min-width: 0;
}

.main {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-6);
  gap: var(--space-6);
}

.card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: var(--space-5);
}

.card-header {
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.grid {
  gap: var(--space-5);
  min-width: 0;
}

.bottom-nav {
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}

.bottom-nav a {
  min-width: 56px;
  justify-content: center;
  color: var(--text-secondary);
  font-weight: 500;
}

.bottom-nav a.active {
  color: var(--primary);
}

.focus-ring:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

@media (max-width: 1200px) {
  .app {
    grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
  }

  .sidebar {
    width: var(--sidebar-collapsed);
  }
}

@media (max-width: 1023px) {
  .topbar {
    padding: 0 var(--space-5);
  }

  .main {
    padding: var(--space-5);
    gap: var(--space-5);
  }
}

@media (max-width: 767px) {
  .sidebar {
    width: min(86vw, var(--sidebar-width));
    box-shadow: var(--shadow-md);
  }

  .topbar {
    min-height: 64px;
    padding: 0 var(--space-4);
  }

  .main {
    padding: var(--space-4);
    gap: var(--space-4);
    padding-bottom: 96px;
  }

  .card {
    padding: var(--space-4);
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
  }
}
