:root {
  --akon-primary: #10B981;
  --akon-primary-hover: #059669;
  --akon-secondary: #FACC15;
  --akon-accent: #EAB308;
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-muted: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ico {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.ico-sm { width: 14px; height: 14px; }
.ico-lg { width: 20px; height: 20px; }
.ico-xl { width: 24px; height: 24px; }

/* Root Layout */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f1f5f9;
}

.console-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  z-index: 40;
  box-shadow: var(--shadow-xs);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  background: #fff;
}

.brand-title {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
  color: var(--text-main);
}
.brand-sub {
  font-size: 10px;
  font-weight: 700;
  color: var(--akon-primary-hover);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-pills::-webkit-scrollbar { display: none; }

.mobile-role-bar {
  display: none;
  background: #fff;
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 12px;
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 9px; }
.btn-lg { padding: 11px 18px; font-size: 13px; border-radius: 14px; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--akon-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}
.btn-primary:hover { background: var(--akon-primary-hover); }

.btn-secondary {
  background: var(--akon-secondary);
  color: #0f172a;
}
.btn-secondary:hover { background: var(--akon-accent); }

.btn-purple { background: #7c3aed; color: #fff; }
.btn-purple:hover { background: #6d28d9; }
.btn-danger { background: #e11d48; color: #fff; }
.btn-danger:hover { background: #be123c; }
.btn-outline {
  background: #fff;
  color: var(--text-body);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--bg-muted); color: var(--text-main); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-main); }
.btn-soft-primary {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.btn-soft-primary:hover { background: #d1fae5; }

.traffic-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  padding: 5px 10px;
  border-radius: 11px;
  font-size: 11px;
  color: var(--text-muted);
}
.traffic-pill select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 700;
  color: var(--akon-primary-hover);
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

/* Main Canvas */
.main-canvas {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Standalone App Container & Phone Frame */
.standalone-shell {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
}

.phone-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 100%;
}

.phone-bezel {
  width: 100%;
  max-width: 412px;
  height: 830px;
  max-height: calc(100vh - 96px);
  background: #e2e8f0;
  border-radius: 44px;
  padding: 12px;
  border: 6px solid #cbd5e1;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.phone-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  position: relative;
}

.phone-notch {
  width: 96px;
  height: 18px;
  background: #0f172a;
  border-radius: 999px;
}

.phone-screen {
  flex: 1 1 auto;
  min-height: 0;
  background: #fff;
  border-radius: 32px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-homebar {
  width: 110px;
  height: 4px;
  border-radius: 999px;
  background: #94a3b8;
  margin: 8px auto 2px;
}

/* App Shell Inside Standalone/Phone */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-page);
  color: var(--text-main);
  overflow: hidden;
}

.app-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.app-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 24px;
}

.bottom-nav {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 8px;
  z-index: 20;
}

.bottom-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.bottom-tab.active {
  color: var(--akon-primary-hover);
  font-weight: 800;
  background: #ecfdf5;
}
.bottom-tab.active-amber {
  color: #b45309;
  font-weight: 800;
  background: #fef3c7;
}

.badge-count {
  position: absolute;
  top: 1px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Common Cards, Grids, Typography */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.card {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-xs);
}

.card-muted {
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}
.text-xs { font-size: 12px; }
.text-2xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid transparent;
}
.badge-green { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge-amber { background: #fefce8; color: #a16207; border-color: #fde047; }
.badge-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-rose { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.badge-purple { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge-slate { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }

/* Hero & Banners */
.hero-banner {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 148px;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  color: #fff;
  background: linear-gradient(125deg, var(--akon-primary-hover), var(--akon-primary));
  border: 1px solid var(--border-subtle);
}
.hero-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}
.hero-content { position: relative; z-index: 2; max-width: 600px; }

.banner-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.banner-card {
  flex: 0 0 280px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #fff;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}
.banner-card img {
  width: 100%;
  height: 104px;
  object-fit: cover;
  display: block;
}

/* Service Grid */
.service-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-lg);
  background: #fff;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, background-color 0.15s;
}
.service-card:hover {
  border-color: var(--akon-primary);
  transform: translateY(-1px);
}
.service-card.selected {
  border-color: var(--akon-primary);
  background: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
}
.service-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.service-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--akon-primary), var(--akon-secondary));
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.service-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.product-card {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
}
.product-thumb {
  position: relative;
  height: 132px;
  background: var(--bg-muted);
  overflow: hidden;
}
.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-body {
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
}

/* Forms & Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-body);
}
.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-main);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--akon-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Search Dropdown */
.autocomplete-wrap { position: relative; }
.autocomplete-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 60;
}
.autocomplete-item {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.autocomplete-item:hover { background: #ecfdf5; }

/* Map Container */
.map-box {
  position: relative;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #eef2f6;
}
.map-canvas {
  width: 100%;
  height: 100%;
}
.map-fallback {
  width: 100%;
  height: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 16px 16px;
}

/* Admin Workspace */
.admin-wrap {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tab-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  background: #fff;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}
.tab-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab-btn.active {
  background: var(--akon-primary);
  color: #fff;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #fff;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.table th, .table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
}
.table th {
  background: var(--bg-page);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

/* Modal & Drawer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-panel {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  padding: 18px;
}

/* Dual Sync Grid */
.dual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
  width: 100%;
}

/* Pure CSS Bar Chart */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 150px;
  padding: 12px 8px 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.chart-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--akon-primary), var(--akon-secondary));
  min-height: 6px;
  transition: height 0.3s ease;
}

/* Offline & Toast & Standalone Float */
.offline-banner {
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  color: #92400e;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}

.toast-host {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  pointer-events: none;
}
.toast-item {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--akon-primary);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  color: var(--text-main);
  pointer-events: auto;
}

.standalone-exit-btn {
  position: fixed;
  bottom: 72px;
  right: 16px;
  z-index: 70;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .nav-pills { display: none; }
  .mobile-role-bar { display: flex; }
  .dual-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .traffic-pill { display: none; }
  .console-header { padding: 8px 12px; }
}
