:root {
  --bg: #0f172a;         /* slate-900 */
  --panel: #111827;      /* gray-900 */
  --text: #e5e7eb;       /* gray-200 */
  --muted: #9ca3af;      /* gray-400 */
  --brand: #22c55e;      /* green-500 */
  --accent: #3b82f6;     /* blue-500 */
  --border: #1f2937;     /* gray-800 */
  /* Chart color: neon blue for dark mode */
  --chart-primary: #00e5ff;
}
/* Light theme variables: ensure text is dark */
body.theme-light {
  --bg: #f8fafc;        /* slate-50 */
  --panel: #ffffff;     /* white */
  --text: #0f172a;      /* slate-900 */
  --muted: #475569;     /* slate-600 */
  --brand: #2563eb;     /* blue-600 */
  --accent: #2563eb;    /* blue-600 */
  --border: #e5e7eb;    /* gray-200 */
  /* Chart color: dark blue for light mode */
  --chart-primary: #1e3a8a;
}
.h2 { font-size: 20px; margin: 12px 0; }

.upload {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; margin: 12px 0 8px;
}
input[type="file"] {
  padding: 8px; background: #0b1220; color: var(--text);
  border: 1px dashed #334155; border-radius: 10px;
}
.theme-light input[type="file"] {
  background: #ffffff; color: #0f172a; border-color: #cbd5e1;
}

.file-list { list-style: none; padding-left: 0; }
.file-list li { margin: 6px 0; }
.file-list a { color: var(--accent); text-decoration: none; }
.file-list a:hover { text-decoration: underline; }

.flash-wrap { margin: 8px 0 12px; }
.flash { padding:10px; border-radius:10px; margin-bottom:6px; font-size:14px; }
.flash.info { background:#123; border:1px solid #246; }
.flash.success { background:#123d2a; border:1px solid #1f6a40; }
.flash.logout { background:#f87171; border:1px solid #dc2626; color:#ffffff; }
.flash.error { background:#3a1212; border:1px solid #6a1f1f; }

/* Light mode flash styles */
body.theme-light .flash { color: #0f172a; }
body.theme-light .flash.success { background:#ecfdf5; border:1px solid #10b981; color:#065f46; }
body.theme-light .flash.error,
body.theme-light .flash.danger { background:#fef2f2; border:1px solid #ef4444; color:#7f1d1d; }
body.theme-light .flash.info { background:#eff6ff; border:1px solid #3b82f6; color:#1e3a8a; }
body.theme-light .flash.warning { background:#fffbeb; border:1px solid #f59e0b; color:#7c2d12; }
body.theme-light .flash.logout { background:#fee2e2; border:1px solid #ef4444; color:#7f1d1d; }

/* On the login page, show flash messages as fixed toasts */
body.auth-page .flash-wrap {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10000;
  margin: 0;
  padding: 0;
  width: auto;
  max-width: 360px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(135deg, #0b1220, #111827 60%, #0b1220);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
/* Light mode overall page background */
body.theme-light { background: #f7f8fb; }

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }
.layout.container {
  max-width: 100%;
  width: 100%;
  padding: 16px 32px;
}

/* Form fields default appearance */
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  background: #0b1220; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
}
.theme-light input[type="text"],
.theme-light input[type="number"],
.theme-light input[type="date"],
.theme-light input[type="password"],
.theme-light input[type="search"],
.theme-light input[type="file"],
.theme-light input:not([type]),
.theme-light select,
.theme-light textarea {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
.theme-light .btn-reset { background: #f1f5f9 !important; color: #0f172a !important; border-color: #cbd5e1 !important; }
.theme-light ::placeholder { color: #64748b; opacity: 1; }
.theme-light thead { background: #e5e7eb !important; color: #0f172a !important; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(17, 24, 39, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  min-height: 88px;
  display: flex;
  align-items: center;
}
.topbar .container {
  max-width: 100%;
  width: 100%;
  padding: 12px 40px;
}
.theme-light .topbar { background: rgba(255,255,255,0.9); }
.topbar-content { display: flex; align-items: center; gap: 24px; width: 100%; }
.mobile-menu-button {
  display: none;
  align-items: center;
  gap: 10px;
  border: 0;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.mobile-menu-button:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}
.mobile-menu-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.mobile-menu-icon {
  position: relative;
  width: 18px;
  height: 14px;
  display: inline-block;
}
.mobile-menu-icon::before,
.mobile-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.mobile-menu-icon::before { top: 0; }
.mobile-menu-icon::after { bottom: 0; }
.mobile-menu-bar {
  position: absolute;
  top: 6px;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: opacity 0.2s ease;
}
.mobile-menu-label {
  font-size: 14px;
}
.brand { font-weight: 800; letter-spacing: 0.5px; color: #ffffff; font-size: 26px; margin-right: auto; }
.topbar-tagline { flex: 1; text-align: center; color: var(--muted); font-size: 15px; letter-spacing: 0.35px; }
.theme-light .topbar-tagline { color: #1f2937; }
.theme-light .brand { color: #0f172a; }

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: flex-end;
  margin-left: auto;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  opacity: 0.9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav a:hover { color: var(--accent); }
.logout-btn { color: #ffffff; }
.theme-light .logout-btn { color: #ffffff !important; }

.am-dashboard {
  display: grid;
  gap: 20px;
}

.am-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.am-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.am-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.am-panel .panel-body { position: relative; }
.am-panel .panel-footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.home-link {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  transition: color 0.2s ease;
  font-size: 16px;
  color: #111827;
}
.theme-light .home-link { color: #111827; }
.home-link:hover { color: #2563eb; }
.home-icon {
  width: 22px;
  height: 22px;
  display: block;
}
.logout-btn {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.logout-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25);
}
.theme-light .logout-btn {
  color: #ffffff !important;
}
.icon-btn { border:0; background: transparent; color: var(--text); font-size: 18px; cursor: pointer; margin-right: 8px; }
.icon-btn:hover { opacity: .85; }

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  margin-top: 16px;
  flex: 1;
}

/* LEFT SIDEBAR - Figma Style */
.sidebar {
  position: sticky;
  top: 64px; /* below topbar */
  align-self: start;
  padding-bottom: 24px;
  display: grid;
  gap: 16px;
}
.side-group {
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 12px;
}
.theme-light .side-group { background: #ffffff; }
/* Figma-style visual hierarchy with better spacing and typography */
.side-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 16px 24px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  padding-left: 32px;
}
.side-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Simple list item style (icon + text) */
.side-item {
  display: flex; align-items: center; gap: 12px;
  color: var(--text); text-decoration: none;
  padding: 12px 16px; border-radius: 12px;
  font-weight: 500;
  position: relative;
  transition: all 0.2s ease;
}
.side-item:hover { 
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
  transform: translateY(-1px);
}
.theme-light .side-item:hover { 
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(37, 99, 235, 0.04));
}

/* Figma-style Sidebar icons and visual elements */
.side-item::before {
  content: '';
  width: 24px;
  height: 24px;
  margin-right: 16px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.8;
  transition: all 0.2s ease;
  border-radius: 6px;
  background-color: rgba(59, 130, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.side-item:hover::before {
  opacity: 1;
  background-color: rgba(59, 130, 246, 0.2);
  transform: scale(1.05);
}
.side-item.active::before {
  background-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

/* Dot default (invisible/grey) */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  border: 1px solid var(--muted);
}

/* Only active ones get filled */
.side-item.active .dot,
.side-sub-item.active .dot {
  background: var(--accent);
  border-color: var(--accent);
}

/* Card-style links shown on the LEFT */
.side-card {
  display: block;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  text-decoration: none; color: var(--text);
  margin: 10px 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.theme-light .side-card { background: #ffffff; }
.side-card:hover { border-color: #2a3b58; }
.side-card-title { font-weight: 700; margin-bottom: 6px; font-size: 16px; }
.side-card-desc  { color: var(--muted); font-size: 13px; }

/* Figma-like sidebar item container (opt-in) */
.side-container {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(59, 130, 246, 0.1);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(59, 130, 246, 0.08);
  backdrop-filter: blur(8px);
}
.theme-light .side-container { 
  background: rgba(255, 255, 255, 0.95); 
  border: 1px solid rgba(59, 130, 246, 0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.04), 0 2px 8px rgba(59, 130, 246, 0.04);
}
.side-container .side-title { margin: 4px 12px 12px; }
.side-container .side-item { gap: 12px; padding: 12px 16px; border-radius: 12px; }
.side-container .side-item:hover { 
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.08));
  transform: translateY(-1px);
}
.theme-light .side-container .side-item:hover { 
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
}

/* MAIN CONTENT AREA */
.content-area { min-height: 60vh; }

/* Figma-style Main Content Layout */
.main-content {
  flex: 1;
  padding: 32px 24px;
  margin-left: 250px;
  transition: all 0.3s ease;
  background: var(--bg);
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.main-content > .panel:first-child {
  margin-top: 0;
}
.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.content-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.content-subtitle {
  font-size: 16px;
  color: var(--muted);
  margin: 4px 0 0 0;
}

.h1 { font-size: 28px; margin: 8px 0 8px; }
.muted { color: var(--muted); }
/* Figma-style Panel Blocks */
.panel {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(59, 130, 246, 0.1) !important;
  border-radius: 16px !important;
  padding: 24px !important;
  margin-top: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(59, 130, 246, 0.08);
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}
.panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(59, 130, 246, 0.12);
}
.theme-light .panel { 
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(59, 130, 246, 0.08) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.04), 0 2px 8px rgba(59, 130, 246, 0.04);
}
.theme-light .panel:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.06), 0 4px 12px rgba(59, 130, 246, 0.08);
}

/* Footer Blocks - Figma Style */
.footer-blocks {
  margin-top: 24px;
  padding: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(17, 24, 39, 0.9);
}

.theme-light .footer-blocks {
  background: rgba(255, 255, 255, 0.96);
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 140px;
}

.footer-content.footer-status-only {
  justify-content: space-between;
  align-items: flex-end;
}

.footer-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-block h3,
.footer-block h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.footer-block h3 {
  font-size: 18px;
  font-weight: 700;
}

.footer-block.main-block { gap: 6px; }

.footer-logo-card {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 12px 20px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  height: 160px;
}

.theme-light .footer-logo-card {
  background: #ffffff;
}

.footer-block.main-block .footer-logo { max-width: 110px; }

.footer-block.main-block img { width: 100%; height: auto; }

.footer-block p {
  margin: 4px 0 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* Main Footer Block */
/* Company logo styling */
.company-logo {
  max-height: 150px;
  width: auto;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  padding: 0;
  margin: 0;
}

.footer-blocks .container {
  padding: 16px 32px;
  max-width: 100%;
}

/* Footer logo container adjustments */
.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.logo-text h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.logo-text p {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Footer Links */
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 0;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.footer-links a:hover {
  color: var(--text);
  transform: translateX(4px);
}

/* System Info */
.system-info {
  margin-top: 8px;
}

/* Theme toggle switch styling */
.theme-toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.theme-toggle-input {
  display: none;
}

.theme-toggle-label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 26px;
  background: linear-gradient(135deg, #2388ff 0%, #0a77ed 100%);
  border-radius: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.theme-light .theme-toggle-label {
  background: #f1f5f9;
  box-shadow: inset 0 1px 2px rgba(148, 163, 184, 0.4);
}

.theme-toggle-input:checked + .theme-toggle-label {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.toggle-slider {
  position: absolute;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  left: 2px;
}

.theme-toggle-input:checked + .theme-toggle-label .toggle-slider {
  transform: translateX(26px);
}

.theme-icon {
  position: absolute;
  font-size: 14px;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.theme-icon.sun {
  left: 6px;
  opacity: 1;
}

.theme-icon.moon {
  right: 6px;
  opacity: 0;
}

.theme-toggle-input:checked + .theme-toggle-label .theme-icon.sun {
  opacity: 0;
}

.theme-toggle-input:checked + .theme-toggle-label .theme-icon.moon {
  opacity: 1;
}

.theme-text {
  font-size: 13px;
}

/* Status Indicators */
.status-block {
  text-align: right;
  gap: 10px;
  align-items: flex-end;
}

.status-indicators {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.footer-divider {
  width: 120px;
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  margin: 8px 0 6px;
}

.status-contact {
  font-size: 13px;
  color: var(--muted);
}

.status-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.5;
}

.status-dot.online {
  background: #22c55e;
  opacity: 1;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.footer-meta {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.footer-meta small {
  color: var(--muted);
  font-size: 12px;
}

/* Responsive Footer */
@media (max-width: 900px) {
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

@media (max-width: 600px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .footer-blocks {
    padding: 24px 0 20px;
  }
}

.footer {
  margin-top: 24px; padding: 16px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

/* Sidebar sub-items - Figma Style */
.side-sub { margin: 8px 0 0 24px; display: grid; gap: 4px; }
.side-sub-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  color: var(--muted); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all 0.2s ease;
}
.side-sub-item:hover { 
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(37, 99, 235, 0.04));
  color: var(--text);
  transform: translateX(2px);
}
.theme-light .side-sub-item:hover { 
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(37, 99, 235, 0.03));
  color: var(--text);
}

/* Active states - Figma Style */
.side-item.active { 
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.side-item.active,
.side-sub-item.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  font-weight: 600;
}
.theme-light .side-item.active { 
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
}
.theme-light .side-sub-item.active { 
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
}
.side-item.active .dot,
.side-sub-item.active .dot {
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 30;
}
.sidebar-overlay[hidden] {
  display: none !important;
}
.theme-light .sidebar-overlay {
  background: rgba(15, 23, 42, 0.35);
}

/* Responsive helpers */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  margin-bottom: 16px;
}
.table-responsive table {
  width: 100%;
  min-width: 720px;
}

.table-responsive table.table-stock {
  min-width: 840px;
}

@media (max-width: 900px) {
  .table-responsive table {
    min-width: 640px;
  }
  .table-responsive table.table-stock {
    min-width: 720px;
  }
}

@media (max-width: 600px) {
  .table-responsive {
    border-radius: 12px;
  }
  .table-responsive table {
    min-width: 560px;
  }
  .table-responsive table.table-stock {
    min-width: 640px;
  }
}

/* Figma-style responsive design adjustments */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { 
    position: static; 
    width: 100%;
    margin-left: 0;
  }
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
    gap: 16px;
  }
  .side-container {
    border-radius: 12px;
    padding: 12px;
  }
  .panel {
    border-radius: 12px !important;
    padding: 16px !important;
    margin-top: 12px;
  }
  .table-stock {
    border-radius: 12px;
    font-size: 12px;
  }
  .table-stock th, .table-stock td {
    padding: 12px 16px;
  }
  .content-title {
    font-size: 24px;
  }
  .btn-modern {
    padding: 12px 20px;
    font-size: 13px;
  }
}

@media (max-width: 1180px) {
  .layout.container {
    padding: 16px 20px;
  }
  .topbar .container {
    padding: 12px 24px;
  }
  .topbar-tagline {
    font-size: 14px;
  }
}

@media (max-width: 1024px) {
  .mobile-menu-button {
    display: inline-flex;
  }
  .topbar-content {
    gap: 16px;
  }
  .topbar-tagline {
    display: none;
  }
  .nav {
    gap: 16px;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .container {
    padding-inline: 18px;
  }
  [data-mobile-sidebar] {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(80vw, 300px);
    max-width: 320px;
    height: 100vh;
    padding: 24px 20px 40px;
    background: rgba(17, 24, 39, 0.98);
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    z-index: 40;
    overflow-y: auto;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.35);
  }
  .theme-light [data-mobile-sidebar] {
    background: #ffffff;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.15);
  }
  [data-mobile-sidebar].is-open {
    transform: translateX(0);
  }
  body.sidebar-open {
    overflow: hidden;
  }
  body.sidebar-open .sidebar-overlay {
    display: block;
  }
  body.sidebar-open .mobile-menu-button .mobile-menu-icon::before {
    transform: translateY(6px) rotate(45deg);
  }
  body.sidebar-open .mobile-menu-button .mobile-menu-icon::after {
    transform: translateY(-6px) rotate(-45deg);
  }
  body.sidebar-open .mobile-menu-button .mobile-menu-bar {
    opacity: 0;
  }
  .content-area {
    padding: 12px 0 40px;
  }
  .fx-cards {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .fx-card {
    grid-template-columns: 1fr;
  }
  .fx-spark {
    width: 100%;
    height: 48px;
    justify-self: stretch;
  }
  .news-header {
    align-items: flex-start;
  }
  .news-controls {
    flex-wrap: wrap;
  }
  .filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  }
  .filters .pair {
    grid-template-columns: 1fr !important;
  }
  .filters .helper {
    width: 100%;
    justify-content: flex-start;
  }
  [style*="grid-template-columns: repeat(7"],
  [style*="grid-template-columns: repeat(6"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .topbar .container {
    padding: 10px 16px;
  }
  .brand {
    font-size: 22px;
  }
  .nav {
    gap: 12px;
  }
  .content-area {
    padding: 12px 0 32px;
  }
  .container {
    padding: 12px 16px;
  }
  .fx-widget,
  .news-widget,
  .panel,
  .side-group {
    border-radius: 16px;
  }
  .fx-cards {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
  .filters {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 10px 12px;
  }
  [style*="grid-template-columns: repeat(7"],
  [style*="grid-template-columns: repeat(6"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(2"] {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  }
  [style*="grid-template-columns: repeat(auto-fit"] {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  }
  table,
  .table-stock {
    font-size: 13px;
  }
  .table-stock th,
  .table-stock td {
    padding: 12px;
  }
  .flash {
    font-size: 13px;
  }
}

@media (max-width: 600px) {
  .nav {
    gap: 10px;
  }
  .nav .logout-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  .home-link {
    width: 20px;
    height: 20px;
  }
  .fx-header,
  .news-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .news-controls {
    width: 100%;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .news-select {
    flex: 1;
  }
  .filters,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .filters .field,
  .form-grid label {
    width: 100%;
  }
  .form-actions {
    justify-content: stretch;
  }
  .form-actions .btn {
    width: 100%;
  }
  .footer-blocks .footer-content {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  .footer-blocks .footer-block {
    width: 100%;
    text-align: center;
  }
  [style*="grid-template-columns: repeat(7"],
  [style*="grid-template-columns: repeat(6"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns: repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .brand {
    font-size: 20px;
  }
  .mobile-menu-button {
    padding: 8px 12px;
  }
  .mobile-menu-label {
    font-size: 13px;
  }
  .container {
    padding: 10px 14px;
  }
  h1, .h1 {
    font-size: 24px;
  }
  h2, .h2 {
    font-size: 18px;
  }
  .fx-card {
    padding: 12px;
  }
  .fx-value {
    font-size: 20px;
  }
}

.is-hidden { display: none; }

.side-sub-item.active-sub {
  background: #0b1220;
  color: var(--text);
  border-radius: 10px;
}

.btn-danger {
  display: inline-block;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  padding: 10px 14px;
  border: 0; border-radius: 12px;
  font-weight: 700; cursor: pointer;
}
.btn-danger:hover { filter: brightness(1.05); }

/* Unified button system */
.btn { display:inline-block; padding:10px 14px; border-radius:12px; font-weight:700; cursor:pointer; border:0; }
.btn:hover { filter: brightness(1.05); }
.btn-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); color:#fff; }
.btn-secondary { background: linear-gradient(135deg, #e5e7eb, #cbd5e1); color:#0f172a; }
.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); color:#fff; }

.panel.danger {
  border: 1px solid #7f1d1d;
  background: rgba(127, 29, 29, 0.12);
}

/* Figma-style Table Blocks */
.table-stock {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  background: rgba(17, 24, 39, 0.95);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(59, 130, 246, 0.08);
  backdrop-filter: blur(8px);
}
.theme-light .table-stock {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 32px rgba(0,0,0,0.04), 0 2px 8px rgba(59, 130, 246, 0.04);
}
.table-stock th, .table-stock td {
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}
.table-stock th {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.theme-light .table-stock th {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(37, 99, 235, 0.04));
}
.table-stock tbody tr {
  transition: all 0.2s ease;
}
.table-stock tbody tr:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(37, 99, 235, 0.02));
  transform: translateY(-1px);
}
.theme-light .table-stock tbody tr:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.04), rgba(37, 99, 235, 0.02));
}
.table-stock tbody tr:last-child td {
  border-bottom: none;
}
.table-stock th {
  background: #1e293b;
  text-align: left;
}
.theme-light .table-stock th { background: #eef2f7; color: #0f172a; }
.table-stock tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.03);
}
.theme-light .table-stock tr:nth-child(even) td { background: #f8fafc; }
.row-details td { background: rgba(255,255,255,0.02); }
.table-stock.inner { margin: 8px 0 0; }
.expander { text-decoration: none; }
.expander:hover { text-decoration: underline; }

/* Light theme fixes for expanded detail tables */
.theme-light .row-details td { background: #ffffff !important; color: #0f172a !important; }
.theme-light .table-stock.inner th { background: #eef2f7 !important; color: #0f172a !important; }
.theme-light .table-stock.inner td { background: #ffffff !important; color: #0f172a !important; }
.theme-light tr.detail-row { background: #ffffff !important; }
.theme-light tr.detail-row td { background: #ffffff !important; color: #0f172a !important; }
.theme-light tr.detail-row thead { background: #e5e7eb !important; color: #0f172a !important; }
.theme-light tr.detail-row tbody td { border-bottom-color: #e5e7eb !important; }

/* FX widget on home page */
.fx-widget {
  margin-top: 28px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.theme-light .fx-widget {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.fx-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.fx-updated {
  font-size: 13px;
}

.fx-body {
  display: grid;
  gap: 16px;
}

.fx-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
}
.theme-light .fx-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: #991b1b;
}

.fx-cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.fx-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.05));
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 6px;
  min-height: 120px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  align-items: center;
}
.fx-card:hover,
.fx-card:focus {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.24);
}
.fx-card:focus { outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35); }
.fx-card-disabled,
.fx-card-disabled:hover,
.fx-card-disabled:focus {
  transform: none;
  box-shadow: none;
  cursor: default;
}
.fx-card-disabled {
  opacity: 0.85;
  pointer-events: none;
}
.theme-light .fx-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(56, 189, 248, 0.1));
  border-color: rgba(37, 99, 235, 0.16);
}

.fx-main {
  display: grid;
  gap: 6px;
}

.fx-main header {
  display: grid;
  gap: 3px;
}

.fx-pair {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fx-flag {
  font-size: 16px;
  display: inline-flex;
  align-items: center;
}

.fx-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fx-spark {
  width: 64px;
  height: 56px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.08);
  padding: 6px;
  box-sizing: border-box;
}

.fx-spark polyline {
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.theme-light .fx-spark polyline {
  stroke: rgba(37, 99, 235, 0.75);
}

.fx-spark.fx-spark-empty {
  background: rgba(59, 130, 246, 0.04);
}

.fx-name {
  font-size: 12px;
  color: var(--muted);
}

.fx-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fx-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 120px;
  font-size: 14px;
  color: var(--muted);
}

.fx-empty {
  text-align: center;
  padding: 24px 12px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(59, 130, 246, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: fx-spin 0.9s linear infinite;
}

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

.news-widget {
  margin-top: 24px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.news-widget + .news-widget {
  margin-top: 18px;
}
.theme-light .news-widget {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}


.news-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.news-title-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.news-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.news-label {
  font-size: 13px;
  color: var(--muted);
}

.news-select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}
.theme-light .news-select {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(37, 99, 235, 0.3);
}

.news-updated { font-size: 13px; }

.news-body { display: grid; gap: 16px; }

.news-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
}
.theme-light .news-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: #991b1b;
}

.news-table-wrap { overflow-x: auto; }

.news-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 320px;
  background: transparent;
}

.news-table th,
.news-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

.news-table th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.news-table a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.news-table a:hover,
.news-table a:focus {
  text-decoration: underline;
}

.news-published { white-space: nowrap; font-size: 13px; color: var(--muted); }

.news-placeholder td {
  text-align: center;
  color: var(--muted);
}

.progress-shell {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.18);
  font-size: 13px;
  color: var(--muted);
}
.theme-light .progress-shell {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.16);
  color: #1f2937;
}

.progress-shell[hidden] { display: none; }

.progress-bar {
  position: relative;
  width: 120px;
  height: 6px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.2);
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: progress-slide 1.2s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { transform: translateX(0); opacity: 0.2; }
  50% { transform: translateX(250%); opacity: 0.7; }
  100% { transform: translateX(500%); opacity: 0; }
}

/* Generic tables used across pages */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table thead th { background: #1d1d1d; color: #fff; position: sticky; top: 0; }
.table tbody tr:nth-child(odd) td { background: rgba(255,255,255,0.03); }
.table tbody tr:hover td { background: rgba(255,255,255,0.06); }
.theme-light .table thead th { background: #e5e7eb; color: #0f172a; }
body:not(.theme-light) .table a,
body:not(.theme-light) .table-stock a {
  color: #60a5fa;
  text-decoration: none;
}
body:not(.theme-light) .table a:hover,
body:not(.theme-light) .table a:focus,
body:not(.theme-light) .table-stock a:hover,
body:not(.theme-light) .table-stock a:focus {
  color: #93c5fd;
  text-decoration: underline;
}
body:not(.theme-light) a.button {
  color: #60a5fa;
  text-decoration: none;
}
body:not(.theme-light) a.button:hover,
body:not(.theme-light) a.button:focus {
  color: #93c5fd;
  text-decoration: underline;
}

/* Figma-style table block (opt-in: add class `table-block` or `block`) */
.table.table-block,
.table.block {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden; /* rounds header corners */
}
.table.table-block thead th,
.table.block thead th {
  background: linear-gradient(180deg, #1f2937, #111827);
  color: #ffffff;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.theme-light .table.table-block thead th,
.theme-light .table.block thead th {
  background: #eef2f7 !important;
  color: #0f172a !important;
}
.table.table-block th, .table.table-block td,
.table.block th, .table.block td {
  border-bottom: 1px solid var(--border);
}
.table.table-block tbody tr:last-child td,
.table.block tbody tr:last-child td {
  border-bottom: 0; /* clean bottom edge */
}
/* Utilities to align numeric columns like Figma */
.num, .text-right { text-align: right; }
.text-center { text-align: center; }
/* Compact density option */
.dense .table.table-block th, .dense .table.table-block td,
.dense .table.block th, .dense .table.block td { padding: 6px 8px; }
/* Status pill (used in tables) */
.pill { display:inline-block; padding:2px 8px; border-radius:999px; font-size:12px; line-height:1.6; border:1px solid var(--border); color: var(--text); }
.pill.success { background: rgba(16,185,129,0.15); border-color:#10b981; color:#10b981; }
.pill.warn { background: rgba(234,179,8,0.15); border-color:#eab308; color:#eab308; }
.pill.danger { background: rgba(239,68,68,0.15); border-color:#ef4444; color:#ef4444; }

/* Consistent card appearance used by reports and widgets */
.card {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 16px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.theme-light .card { background: #ffffff; box-shadow: 0 6px 18px rgba(0,0,0,0.08); }

/* Tobacco HK tweaks */
.hk-card { margin-bottom: 18px; }

.theme-select {
  min-width: 160px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 6px 10px;
  font: inherit;
}
.theme-light .theme-select {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

.hk-growth-summary {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
  min-width: 180px;
  background: rgba(15, 23, 42, 0.35);
}
.theme-light .hk-growth-summary {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.hk-table-scroll {
  margin-top: 16px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
}
.theme-light .hk-table-scroll {
  background: #ffffff;
  border-color: #cbd5e1;
}

.hk-table thead th {
  position: sticky;
  top: 0;
  background: #111827;
  color: #f8fafc;
  z-index: 1;
}
.theme-light .hk-table thead th {
  background: #e2e8f0;
  color: #0f172a;
}

.hk-table th,
.hk-table td {
  font-size: 13px;
}

.hk-num { text-align: right; }

.hk-sortable { cursor: pointer; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}
.link-button:hover,
.link-button:focus {
  text-decoration: underline;
}
.theme-light .link-button {
  color: #2563eb;
}

/* Finance News Section */
.news-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap:12px; }
.news-card { padding:12px !important; }
.news-header { display:flex; align-items:center; justify-content:space-between; }
.news-region { font-weight:700; color: var(--text); }
.news-list { list-style:none; padding:0; margin:8px 0 0; }
.news-item { margin:8px 0; }
.news-link { color: var(--text); text-decoration:none; }
.news-link:hover { color: var(--accent); text-decoration: underline; }
.news-date { font-size:12px; }

/* Light mode fine-tuning for news cards */
body.theme-light .news-link { color: #0f172a; }
body.theme-light .news-link:hover { color: #2563eb; }

/* AUTH PAGE */
.auth-page {
  /* Brand-inspired gradient using JSU blue + subtle orange glow */
  background:
    radial-gradient(1200px 600px at -10% -10%, rgba(245, 158, 11, 0.25), transparent 60%),
    radial-gradient(1000px 500px at 110% 110%, rgba(245, 158, 11, 0.18), transparent 55%),
    linear-gradient(135deg, #123c7c, #1e3a8a);
  min-height: 100vh;
  color: #0f172a;
}
.auth-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
}
.auth-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  background: #ffffff;
  width: min(100%, 20cm); /* tightened from 25cm */
  height: 10cm; /* slight increase for more breathing room */
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}
.auth-left {
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  padding: 0.5cm 32px;
  color: #eaf2ff;
  position: relative;
}
.auth-left::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0));
  pointer-events: none;
}
.auth-brand { font-weight: 900; letter-spacing: 1px; opacity: .95; color:#1e3a8a; }
.auth-tagline-img { display:block; max-width: 360px; width: 85%; margin: 6px 0 0; height:auto; }
.auth-welcome { font-size: 40px; margin: 8px 0 8px; color: #ffffff; }
.auth-desc { color: #e5e7eb; max-width: 46ch; line-height: 1.5; }
.auth-note { position: absolute; bottom: 20px; left: 32px; color: #e5e7eb; opacity: .9; font-size: 13px; }

.auth-right { padding: 0.5cm 32px; }
.auth-title { font-size: 26px; margin: 0 0 12px; color: #0f172a; font-weight: 800; }
.auth-sub { color: #475569; margin-bottom: 12px; }
.auth-form { display: grid; gap: 10px; }
.auth-form label { font-size: 13px; color: #334155; }
.auth-form input[type="text"],
.auth-form input[type="password"] {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #ffffff;   /* keep login inputs light */
  color: #0f172a;
}
.auth-form ::placeholder { color: #64748b; opacity: 1; }
/* Prevent autofill from turning the box dark */
.auth-form input:-webkit-autofill,
.auth-form input:-webkit-autofill:hover,
.auth-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: #0f172a;
  transition: background-color 5000s ease-in-out 0s;
}
.auth-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 2px 0 6px;
}
.chk { display: inline-flex; align-items: center; gap: 8px; color: #64748b; }
.small { font-size: 12px; }
.btn-primary {
  display: inline-block; width: 100%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; border: 0; border-radius: 12px;
  padding: 12px 14px; font-weight: 800; letter-spacing: .03em;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.05); }
.auth-foot { margin-top: 10px; }

/* Generic filters area used in report pages */
.theme-light .filters .field label { color: #334155 !important; }

@media (max-width: 900px) {
  .auth-card { grid-template-columns: 1fr; }
  .auth-note { position: static; margin-top: 18px; display: block; }
}

/* Settings / forms */
.settings-card { max-width: 760px; }
.form-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px 14px;
  align-items: center;
  margin-top: 8px;
}
.form-grid input[type="text"],
.form-grid input[type="password"],
.form-grid input[type="number"],
.form-grid input[type="date"],
.form-grid select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  border-radius: 10px;
  outline: none;
}
.form-grid label { color: var(--text); opacity: .9; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; margin-top: 6px; }

/* Adjust primary button width inside settings */
.settings-card .btn-primary { width: auto; padding-left: 18px; padding-right: 18px; }

/* Figma-style modern button styling */
.btn-modern {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.9));
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 16px;
  padding: 16px 24px;
  color: white;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.12), 0 2px 8px rgba(59, 130, 246, 0.08);
  backdrop-filter: blur(8px);
  font-size: 14px;
  letter-spacing: 0.25px;
}
.btn-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15), 0 4px 12px rgba(59, 130, 246, 0.12);
  filter: brightness(1.05);
}
.btn-modern::before {
  content: '';
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: inline-block;
}
.input-figma {
  font-size: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}
.btn-figma {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  padding: 12px 0;
  width: 100%;
  font-size: 18px;
  border: none;
  box-shadow: 0 2px 8px rgba(37,99,235,0.08);
  transition: background 0.2s;
}
.btn-figma:hover {
  background: #1d4ed8;
}
.auth-welcome {
  font-size: 32px;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 24px;
}
.auth-title {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 12px;
}
.auth-sub {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 24px;
}
.auth-form { display: grid; gap: 10px; }
.auth-form label { font-size: 13px; color: #334155; }
.auth-form input[type="text"],
.auth-form input[type="password"] {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #ffffff;   /* keep login inputs light */
  color: #0f172a;
}
.auth-form ::placeholder { color: #64748b; opacity: 1; }
/* Prevent autofill from turning the box dark */
.auth-form input:-webkit-autofill,
.auth-form input:-webkit-autofill:hover,
.auth-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: #0f172a;
  transition: background-color 5000s ease-in-out 0s;
}
.auth-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 2px 0 6px;
}
.chk { display: inline-flex; align-items: center; gap: 8px; color: #64748b; }
.small { font-size: 12px; }
.btn-primary {
  display: inline-block; width: 100%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; border: 0; border-radius: 12px;
  padding: 12px 14px; font-weight: 800; letter-spacing: .03em;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.05); }
.auth-foot { margin-top: 10px; }

/* Generic filters area used in report pages */
.theme-light .filters .field label { color: #334155 !important; }

@media (max-width: 900px) {
  .auth-card { grid-template-columns: 1fr; }
  .auth-note { position: static; margin-top: 18px; display: block; }
}

/* Settings / forms */
.settings-card { max-width: 760px; }
.form-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px 14px;
  align-items: center;
  margin-top: 8px;
}
.form-grid input[type="text"],
.form-grid input[type="password"],
.form-grid input[type="number"],
.form-grid input[type="date"],
.form-grid select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  border-radius: 10px;
  outline: none;
}
.form-grid label { color: var(--text); opacity: .9; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; margin-top: 6px; }

/* Adjust primary button width inside settings */
.settings-card .btn-primary { width: auto; padding-left: 18px; padding-right: 18px; }

/* Figma-style modern button styling */
.btn-modern {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.9));
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 16px;
  padding: 16px 24px;
  color: white;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.12), 0 2px 8px rgba(59, 130, 246, 0.08);
  backdrop-filter: blur(8px);
  font-size: 14px;
  letter-spacing: 0.25px;
}
.btn-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15), 0 4px 12px rgba(59, 130, 246, 0.12);
  filter: brightness(1.05);
}
.btn-modern::before {
  content: '';
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: inline-block;
}

/* Figma Login Page Styles */
.figma-login-page {
  margin: 0;
  min-height: 100vh;
  background: #f5f7fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: #252c32;
}

.figma-login-wrapper {
  width: 100%;
  padding: 80px 64px;
}

.figma-login-hero {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 64px;
}

.figma-login-visual {
  flex: 0 0 550px;
  height: 820px;
  border-radius: 30px;
  overflow: hidden;
  background: #dfe3eb;
}

.figma-login-visual-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.figma-login-card {
  flex: 0 0 648px;
  min-height: 830px;
  background: #ffffff;
  border-radius: 8px;
  padding: 80px 64px 100px;
  display: flex;
  flex-direction: column;
}

.figma-login-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  margin-bottom: 32px;
}

.figma-login-title {
  margin: 0;
  font-size: 40px;
  font-weight: 600;
  line-height: 48px;
  color: #252c32;
}

.figma-login-subtitle {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: #6b7280;
}

.figma-login-section-title {
  margin: 0 0 64px;
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  color: #252c32;
}

.figma-login-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.figma-login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.figma-login-label {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #6b7280;
}

input.figma-login-input {
  width: 100%;
  height: 48px;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid #b0babf;
  font-size: 16px;
  line-height: 24px;
  color: #252c32;
  background: #ffffff !important;
  background-color: #ffffff !important;
  box-shadow: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input.figma-login-input::placeholder {
  color: #9ca3af;
}

input.figma-login-input:focus {
  outline: none;
  border-color: #4094f7;
  box-shadow: 0 0 0 3px rgba(64, 148, 247, 0.2);
}

input.figma-login-input-focus {
  border-color: #4094f7;
  box-shadow: 0 0 0 3px rgba(64, 148, 247, 0.2);
}

input.figma-login-input:-webkit-autofill,
input.figma-login-input:-webkit-autofill:hover,
input.figma-login-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #252c32;
  border-color: #4094f7;
}

.figma-login-button {
  height: 48px;
  padding: 0 16px;
  background: #4094f7;
  border-radius: 8px;
  border: none;
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.figma-login-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(64, 148, 247, 0.25);
}

.figma-login-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.figma-login-support {
  margin-top: 120px;
  text-align: center;
}

.figma-login-support-text {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  color: #9ca3af;
}

/* Flash Messages for Figma Login */
.figma-login-page .flash-wrap {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  max-width: 400px;
}

.figma-login-page .flash {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.figma-login-page .flash.success {
  background: #f0fff4;
  border: 1px solid #68d391;
  color: #22543d;
}

.figma-login-page .flash.error {
  background: #fed7d7;
  border: 1px solid #fc8181;
  color: #742a2a;
}

.figma-login-page .flash.info {
  background: #ebf8ff;
  border: 1px solid #63b3ed;
  color: #2a4365;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .figma-login-wrapper {
    padding: 64px 48px;
  }

  .figma-login-hero {
    flex-direction: column;
    align-items: center;
  }

  .figma-login-visual,
  .figma-login-card {
    flex: none;
  }
}

@media (max-width: 768px) {
  .figma-login-page {
    padding: 24px 0;
  }

  .figma-login-wrapper {
    padding: 48px 24px;
  }

  .figma-login-visual {
    height: 400px;
    border-radius: 24px;
  }

  .figma-login-card {
    width: 100%;
    padding: 56px 32px 72px;
    min-height: auto;
  }

  .figma-login-support {
    margin-top: 64px;
  }
}

@media (max-width: 640px) {
  .figma-login-wrapper {
    padding: 40px 20px;
  }
  .figma-login-hero {
    gap: 32px;
  }
  .figma-login-visual {
    display: none;
  }
  .figma-login-card {
    padding: 40px 28px 56px;
    border-radius: 20px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
  }
  .figma-login-support {
    margin-top: 40px;
  }
}

@media (max-width: 480px) {
  .figma-login-wrapper {
    padding: 32px 16px;
  }

  .figma-login-visual {
    height: 320px;
  }

  .figma-login-card {
    padding: 40px 20px 56px;
  }

  .figma-login-title {
    font-size: 32px;
    line-height: 40px;
  }

  .figma-login-section-title {
    margin-bottom: 48px;
  }
}
/* Sidebar sub-items - Figma Style */
.side-sub { margin: 8px 0 0 24px; display: grid; gap: 4px; }
.side-sub-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  color: var(--muted); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all 0.2s ease;
}
.side-sub-item:hover { 
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(37, 99, 235, 0.04));
  color: var(--text);
  transform: translateX(2px);
}
.theme-light .side-sub-item:hover { 
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(37, 99, 235, 0.03));
  color: var(--text);
}

/* Active states - Figma Style */
.side-item.active { 
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.side-item.active,
.side-sub-item.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  font-weight: 600;
}
.theme-light .side-item.active { 
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
}
.theme-light .side-sub-item.active { 
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
}
.side-item.active .dot,
.side-sub-item.active .dot {
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
}

/* Figma-style responsive design adjustments */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { 
    position: static; 
    width: 100%;
    margin-left: 0;
  }
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
    gap: 16px;
  }
  .side-container {
    border-radius: 12px;
    padding: 12px;
  }
  .panel {
    border-radius: 12px !important;
    padding: 16px !important;
    margin-top: 12px;
  }
  .table-stock {
    border-radius: 12px;
    font-size: 12px;
  }
  .table-stock th, .table-stock td {
    padding: 12px 16px;
  }
  .content-title {
    font-size: 24px;
  }
  .btn-modern {
    padding: 12px 20px;
    font-size: 13px;
  }
}

.is-hidden { display: none; }

.side-sub-item.active-sub {
  background: #0b1220;
  color: var(--text);
  border-radius: 10px;
}

.btn-danger {
  display: inline-block;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  padding: 10px 14px;
  border: 0; border-radius: 12px;
  font-weight: 700; cursor: pointer;
}
.btn-danger:hover { filter: brightness(1.05); }

/* Unified button system */
.btn { display:inline-block; padding:10px 14px; border-radius:12px; font-weight:700; cursor:pointer; border:0; }
.btn:hover { filter: brightness(1.05); }
.btn-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); color:#fff; }
.btn-secondary { background: linear-gradient(135deg, #e5e7eb, #cbd5e1); color:#0f172a; }
.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); color:#fff; }

.panel.danger {
  border: 1px solid #7f1d1d;
  background: rgba(127, 29, 29, 0.12);
}

/* Figma-style Table Blocks */
.table-stock {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  background: rgba(17, 24, 39, 0.95);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(59, 130, 246, 0.08);
  backdrop-filter: blur(8px);
}
.theme-light .table-stock {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 32px rgba(0,0,0,0.04), 0 2px 8px rgba(59, 130, 246, 0.04);
}
.table-stock th, .table-stock td {
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}
.table-stock th {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.theme-light .table-stock th {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(37, 99, 235, 0.04));
}
.table-stock tbody tr {
  transition: all 0.2s ease;
}
.table-stock tbody tr:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(37, 99, 235, 0.02));
  transform: translateY(-1px);
}
.theme-light .table-stock tbody tr:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.04), rgba(37, 99, 235, 0.02));
}
.table-stock tbody tr:last-child td {
  border-bottom: none;
}
.table-stock th {
  background: #1e293b;
  text-align: left;
}
.theme-light .table-stock th { background: #eef2f7; color: #0f172a; }
.table-stock tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.03);
}
.theme-light .table-stock tr:nth-child(even) td { background: #f8fafc; }
.row-details td { background: rgba(255,255,255,0.02); }
.table-stock.inner { margin: 8px 0 0; }
.expander { text-decoration: none; }
.expander:hover { text-decoration: underline; }

/* Light theme fixes for expanded detail tables */
.theme-light .row-details td { background: #ffffff !important; color: #0f172a !important; }
.theme-light .table-stock.inner th { background: #eef2f7 !important; color: #0f172a !important; }
.theme-light .table-stock.inner td { background: #ffffff !important; color: #0f172a !important; }
.theme-light tr.detail-row { background: #ffffff !important; }
.theme-light tr.detail-row td { background: #ffffff !important; color: #0f172a !important; }
.theme-light tr.detail-row thead { background: #e5e7eb !important; color: #0f172a !important; }
.theme-light tr.detail-row tbody td { border-bottom-color: #e5e7eb !important; }

/* Generic tables used across pages */
.btn-refresh {
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: transparent;
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-refresh:hover,
.btn-refresh:focus {
  background: rgba(59, 130, 246, 0.12);
}
.btn-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-refresh.is-loading::after {
  content: '…';
  margin-left: 6px;
}
