@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Google+Sans+Display:wght@400;500;700&family=Roboto:wght@300;400;500;700&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────────────── */
:root {
  --blue-50:  #E8F0FE;
  --blue-100: #D2E3FC;
  --blue-200: #AECBFA;
  --blue-300: #74AAFF;
  --blue-400: #4285F4;
  --blue-500: #1A73E8;
  --blue-600: #1557B0;
  --blue-700: #0D47A1;

  --teal-400: #00ACC1;
  --teal-500: #00838F;

  --surface:   #FFFFFF;
  --surface-2: #F8F9FA;
  --surface-3: #F1F3F4;
  --surface-4: #E8EAED;

  --on-surface:     #202124;
  --on-surface-med: #5F6368;
  --on-surface-low: #9AA0A6;

  --red:    #EA4335;
  --green:  #34A853;
  --yellow: #FBBC04;
  --orange: #FA7B17;

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  --shadow-1: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --shadow-2: 0 1px 3px rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
  --shadow-3: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
  --shadow-4: 0 6px 10px 4px rgba(60,64,67,.15), 0 2px 3px rgba(60,64,67,.3);

  --sidebar-w: 256px;
  --topbar-h:  64px;
  --content-max-w: 1600px;

  --transition: 200ms cubic-bezier(.2,0,0,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Roboto', sans-serif;
  background: var(--surface-2);
  color: var(--on-surface);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--on-surface-low); }

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

/* ─── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--surface-4);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .nav-item-group { position: relative; }
.sidebar.collapsed .nav-item-group .nav-submenu {
  display: none;
  position: fixed;
  left: 76px;
  min-width: 200px;
  background: var(--surface-2);
  border: 1px solid var(--surface-4);
  border-radius: 10px;
  box-shadow: var(--shadow-4);
  padding: 6px;
  z-index: 300;
  flex-direction: column;
}
.sidebar.collapsed .nav-item-group:hover .nav-submenu,
.sidebar.collapsed .nav-item-group.open .nav-submenu {
  display: flex;
}
.sidebar.collapsed .nav-item-group .nav-submenu .nav-item .nav-label { opacity: 1; }
.sidebar.collapsed .nav-item-group .nav-item-parent .chevron { display: none; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--surface-4);
  overflow: hidden;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--blue-500);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-icon svg { width: 20px; height: 20px; fill: white; }
.sidebar-logo .logo-text {
  font-family: 'Google Sans Display', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--blue-500);
  white-space: nowrap;
  transition: opacity var(--transition);
}
.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--on-surface-low);
  white-space: nowrap;
  line-height: 1;
  margin-top: 1px;
}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .logo-sub { opacity: 0; pointer-events: none; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; overflow-x: hidden; }
.nav-section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--on-surface-low);
  padding: 16px 20px 4px;
  white-space: nowrap;
  transition: opacity var(--transition);
}
.sidebar.collapsed .nav-section-label { opacity: 0; height: 0; padding: 0; overflow: hidden; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  margin: 2px 8px;
  cursor: pointer;
  color: var(--on-surface-med);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--surface-3); color: var(--on-surface); }
.nav-item.active {
  background: var(--blue-50);
  color: var(--blue-500);
}
.nav-item .nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-item .nav-icon svg { width: 18px; height: 18px; }
.nav-item.active .nav-icon svg { fill: var(--blue-500); }
.nav-item:not(.active) .nav-icon svg { fill: var(--on-surface-med); }
.nav-item .nav-label { transition: opacity var(--transition); }
.sidebar.collapsed .nav-item .nav-label { opacity: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--blue-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  transition: opacity var(--transition);
}
.sidebar.collapsed .nav-badge { opacity: 0; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--surface-4);
}
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--on-surface-med);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  cursor: pointer;
  transition: background var(--transition);
  background: none;
  font-family: inherit;
}
.sidebar-collapse-btn:hover { background: var(--surface-3); }
.sidebar-collapse-btn svg { width: 18px; height: 18px; fill: var(--on-surface-med); flex-shrink: 0; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(32,33,36,.5);
  z-index: 90;
}
.sidebar-backdrop.open { display: block; }

/* ─── Main content & topbar ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}
.main-content.sidebar-collapsed { margin-left: 72px; }

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--surface-4);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--on-surface);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 20px; height: 20px; fill: var(--on-surface-med); }
.icon-btn .badge {
  position: absolute;
  top: 6px; right: 6px;
  min-width: 16px; height: 16px;
  padding: 0 3px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  border: 2px solid white;
  display: flex; align-items: center; justify-content: center;
}

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--blue-500);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.page-container {
  width: 100%;
  max-width: var(--content-max-w);
  margin: 0 auto;
  padding: 24px 24px 48px;
  box-sizing: border-box;
  flex: 1;
}

/* ─── Page header ───────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.page-header-left .page-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--on-surface);
}
.page-header-left .page-subtitle {
  font-size: 13px;
  color: var(--on-surface-med);
  margin-top: 2px;
}
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Google Sans', sans-serif;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--blue-500); color: white; }
.btn-primary:hover { background: var(--blue-600); box-shadow: var(--shadow-2); }
.btn-primary svg { fill: white; }
.btn-secondary { background: var(--blue-50); color: var(--blue-500); border: 1px solid var(--blue-200); }
.btn-secondary:hover { background: var(--blue-100); }
.btn-secondary svg { fill: var(--blue-500); }
.btn-outline { background: transparent; color: var(--on-surface-med); border: 1px solid var(--surface-4); }
.btn-outline:hover { background: var(--surface-3); border-color: var(--on-surface-low); }
.btn-outline svg { fill: var(--on-surface-med); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #C62828; box-shadow: var(--shadow-2); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #2d9649; box-shadow: var(--shadow-2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-link { background: none; color: var(--blue-500); padding: 4px 8px; }
.btn-link:hover { background: var(--blue-50); }

/* ─── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-4);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--surface-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--on-surface);
}
.card-subtitle { font-size: 12px; color: var(--on-surface-med); margin-top: 2px; }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--surface-4);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Stat cards ────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--surface-4);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.stat-card-header { display: flex; align-items: center; justify-content: space-between; }
.stat-card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-med);
  letter-spacing: .3px;
}
.stat-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-icon.blue   { background: var(--blue-50);  } .stat-icon.blue svg   { fill: var(--blue-500); }
.stat-icon.green  { background: #E6F4EA;          } .stat-icon.green svg  { fill: var(--green);    }
.stat-icon.yellow { background: #FEF7E0;          } .stat-icon.yellow svg { fill: var(--yellow);   }
.stat-icon.red    { background: #FCE8E6;          } .stat-icon.red svg    { fill: var(--red);      }
.stat-icon.teal   { background: #E0F7FA;          } .stat-icon.teal svg   { fill: var(--teal-400); }
.stat-icon.orange { background: #FEF3E2;          } .stat-icon.orange svg { fill: var(--orange);   }

.stat-value {
  font-family: 'Google Sans Display', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1;
}
.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}
.stat-trend.up   { color: var(--green); }
.stat-trend.down { color: var(--red);   }
.stat-trend-label { color: var(--on-surface-low); font-weight: 400; }

/* ─── Tables ────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--on-surface-med);
  background: var(--surface-2);
  border-bottom: 1px solid var(--surface-4);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--surface-4);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 12px 16px; color: var(--on-surface); vertical-align: middle; }
.td-label { font-weight: 500; }
.td-sub { font-size: 12px; color: var(--on-surface-med); margin-top: 1px; }

/* ─── Chips / badges ────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; }
.chip.active   { background: #E6F4EA; color: #137333; }   .chip.active .chip-dot   { background: var(--green); }
.chip.inactive { background: var(--surface-3); color: var(--on-surface-med); } .chip.inactive .chip-dot { background: var(--on-surface-low); }
.chip.expired  { background: #FCE8E6; color: #C5221F; }   .chip.expired .chip-dot  { background: var(--red); }
.chip.pending  { background: #FEF7E0; color: #B45309; }   .chip.pending .chip-dot  { background: var(--yellow); }
.chip.info     { background: var(--blue-50); color: var(--blue-600); } .chip.info .chip-dot { background: var(--blue-500); }
.chip.pppoe    { background: #E0F7FA; color: var(--teal-500); }
.chip.hotspot  { background: var(--blue-50); color: var(--blue-600); }
.chip.voucher  { background: #FEF3E2; color: #9A3412; }
.chip.tag      { background: var(--surface-3); color: var(--on-surface-med); }

/* ─── Forms ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-med);
  margin-bottom: 6px;
  letter-spacing: .3px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--surface-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--on-surface);
  background: var(--surface);
  outline: none;
  transition: all var(--transition);
}
.form-control:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px var(--blue-100);
}
.form-control::placeholder { color: var(--on-surface-low); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }
.form-hint { font-size: 11px; color: var(--on-surface-low); margin-top: 4px; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%235F6368' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea.form-control { resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--blue-500); width: 16px; height: 16px; cursor: pointer; }

/* ─── Tabs ──────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--surface-4);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface-med);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab-btn svg { width: 16px; height: 16px; fill: currentColor; }
.tab-btn:hover { color: var(--on-surface); background: var(--surface-3); }
.tab-btn.active { color: var(--blue-500); border-bottom-color: var(--blue-500); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Modals ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(32,33,36,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-4);
  animation: modal-in .2s cubic-bezier(.2,0,0,1);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--surface-4);
}
.modal-title { font-family: 'Google Sans', sans-serif; font-size: 17px; font-weight: 500; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--surface-4);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Alerts ────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: var(--blue-50);  color: var(--blue-700);  border: 1px solid var(--blue-200);  } .alert-info svg    { fill: var(--blue-500);  }
.alert-success { background: #E6F4EA; color: #137333; border: 1px solid #A8D5B5; } .alert-success svg { fill: var(--green); }
.alert-warning { background: #FEF7E0; color: #B45309; border: 1px solid #FCDFA2; } .alert-warning svg { fill: var(--yellow); }
.alert-danger  { background: #FCE8E6; color: #C5221F; border: 1px solid #F5C6C2; } .alert-danger svg  { fill: var(--red);   }

/* ─── Progress ──────────────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--surface-4);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--blue-500);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.progress-fill.warning { background: var(--yellow); }
.progress-fill.danger  { background: var(--red); }
.progress-fill.green   { background: var(--green); }

/* ─── Breadcrumb / pagination ───────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--on-surface-med);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--blue-500); }
.breadcrumb-sep { font-size: 14px; }
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; }
.page-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition);
  color: var(--on-surface-med);
}
.page-btn:hover { background: var(--surface-3); color: var(--on-surface); }
.page-btn.active { background: var(--blue-500); color: white; font-weight: 600; }

/* ─── Toast ─────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--on-surface);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in .3s cubic-bezier(.2,0,0,1);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ─── Filter bar ────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--surface-4);
  background: var(--surface);
  color: var(--on-surface-med);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--blue-400); color: var(--blue-500); }
.filter-chip.active { background: var(--blue-50); border-color: var(--blue-300); color: var(--blue-600); }

/* ─── Empty state ───────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}
.empty-state-icon {
  width: 64px; height: 64px;
  background: var(--surface-3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.empty-state-icon svg { width: 28px; height: 28px; fill: var(--on-surface-low); }
.empty-state h3 { font-family: 'Google Sans', sans-serif; font-size: 16px; color: var(--on-surface); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: var(--on-surface-med); max-width: 300px; }

/* ─── Charts ────────────────────────────────────────────────────────── */
.chart-area {
  height: 200px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 16px;
  overflow: hidden;
}
.chart-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: var(--blue-200);
  transition: height .5s cubic-bezier(.4,0,.2,1);
  position: relative;
  min-height: 4px;
}
.chart-bar.highlight { background: var(--blue-500); }
.chart-bar:hover { background: var(--blue-400); }
.chart-x-labels { display: flex; gap: 6px; margin-top: 8px; }
.chart-x-labels span { flex: 1; font-size: 9px; color: var(--on-surface-low); text-align: center; white-space: nowrap; transform: rotate(-45deg); transform-origin: top left; }
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 32px; }
.spark-bar {
  width: 4px;
  border-radius: 2px 2px 0 0;
  background: var(--blue-300);
  transition: background var(--transition);
}
.spark-bar:last-child { background: var(--blue-500); }

/* ─── Timeline ──────────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 16px; padding-bottom: 20px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-line { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--blue-500);
  border: 2px solid var(--blue-100);
  flex-shrink: 0;
  margin-top: 4px;
}
.timeline-connector { flex: 1; width: 2px; background: var(--surface-4); margin-top: 4px; }
.timeline-item:last-child .timeline-connector { display: none; }
.timeline-content { flex: 1; }
.timeline-title { font-size: 13px; font-weight: 500; }
.timeline-time  { font-size: 11px; color: var(--on-surface-low); margin-top: 2px; }

/* ─── Login ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E8F0FE 0%, #F8F9FA 50%, #E8F5E9 100%);
  padding: 24px;
}
.login-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-4);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  justify-content: center;
}
.login-logo-icon {
  width: 48px; height: 48px;
  background: var(--blue-500);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.login-logo-icon svg { width: 28px; height: 28px; fill: white; }
.login-logo-text {
  font-family: 'Google Sans Display', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--blue-500);
}
.login-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 20px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 6px;
}
.login-sub { font-size: 13px; color: var(--on-surface-med); text-align: center; margin-bottom: 28px; }
.login-error {
  background: #FCE8E6;
  color: #C5221F;
  border: 1px solid #F5C6C2;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  text-align: center;
  margin-bottom: 16px;
}
.role-option {
  flex: 1;
  position: relative;
  cursor: pointer;
}
.role-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.role-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Google Sans', sans-serif;
  border: 1px solid var(--surface-4);
  background: var(--surface);
  color: var(--on-surface-med);
  transition: all var(--transition);
}
.role-option:hover span { border-color: var(--blue-400); color: var(--blue-500); }
.role-option input:checked + span {
  background: var(--blue-50);
  border-color: var(--blue-300);
  color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--blue-100);
}

/* ─── Utility helpers ───────────────────────────────────────────────── */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-24 { margin-top: 24px; }
.text-med { color: var(--on-surface-med); }
.text-low { color: var(--on-surface-low); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-blue { color: var(--blue-500); }
.text-center { text-align: center; }
.mono { font-family: monospace; }
.d-none { display: none; }
.img-thumb { border-radius: var(--radius-md); object-fit: cover; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ─── Mobile bottom nav ─────────────────────────────────────────────── */
.mobile-bottom-nav { display: none; }

@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .sidebar.mobile-open { display: flex !important; box-shadow: var(--shadow-4); }
  .main-content {
    margin-left: 0 !important;
    padding-bottom: 90px !important;
  }
  .topbar { padding: 0 12px; height: 52px; }
  .topbar-title { font-size: 15px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header-actions { flex-wrap: wrap; gap: 6px; width: 100%; }
  .page-header-actions .btn { font-size: 12px; padding: 7px 12px; }
  .stat-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 640px; }
  .grid-2, .grid-3, .grid-4, .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .modal-overlay { align-items: flex-end; }
  .modal-overlay .modal {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    margin: 0;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    overflow-y: auto;
  }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; }
  .card { border-radius: 14px; }
  .card-header { padding: 14px 16px; }
  .page-container { padding: 16px 16px 90px; }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 500;
    height: 72px;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 -4px 24px rgba(0,0,0,.08), 0 -1px 0 rgba(0,0,0,.04);
    align-items: center;
    justify-content: space-around;
  }
  .mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 8px;
    border-radius: 14px;
    text-decoration: none;
    color: #888;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .2px;
    min-width: 52px;
    transition: all .2s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-bottom-nav a svg { width: 22px; height: 22px; fill: currentColor; }
  .mobile-bottom-nav a.active,
  .mobile-bottom-nav a:active { color: var(--blue-500); background: rgba(26,115,232,.08); }
  .mobile-bottom-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px; height: 4px;
    background: var(--blue-500);
    border-radius: 50%;
  }
  .mobile-bottom-nav a .nav-badge {
    position: absolute;
    top: 2px; right: 4px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 8px;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
    line-height: 14px;
  }
  .main-content { animation: pageIn .25s ease; }
  @keyframes pageIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .page-title { font-size: 18px !important; }
  .stat-card { padding: 14px !important; }
  .stat-value { font-size: 20px !important; }
  .btn { padding: 10px 14px !important; font-size: 13px !important; }
}
