:root {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fb;
  --bg-input: #f5f7fa;
  --border: #e5e7eb;
  --border-light: #d1d5db;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-blue: #4361ee;
  --accent-yellow: #f59e0b;
  --accent-purple: #7c3aed;
  --gradient-main: linear-gradient(135deg, #4361ee, #7c3aed);
  --gradient-green: linear-gradient(135deg, #10b981, #059669);
  --gradient-red: linear-gradient(135deg, #ef4444, #dc2626);
  --gradient-gold: linear-gradient(135deg, #f59e0b, #d97706);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.12), 0 4px 6px rgba(0,0,0,.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

/* === BODY BACKGROUND RESET === */
html, body { background: #f8fafc !important; margin: 0; }

/* ==============================
   NimitExpo Premium Design System
   ============================== */

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; }

/* === LAYOUT === */
.app-layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; margin-left: 220px; padding: 20px 24px; background: #f8fafc; min-height: calc(100vh - 32px); }
#react-sidebar { display: contents; }

/* === TOP BAR === */
.top-bar { display: flex !important; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 0.5px solid #e8ecf0; }
.top-bar h1 { font-size: 1.3rem !important; font-weight: 700 !important; color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; margin: 0 !important; display: block !important; line-height: 1.3 !important; }
.top-bar h1 i { font-size: 1.2rem; }
.top-bar p, .top-bar .text-muted { color: #64748b; font-size: 0.82rem; margin: 2px 0 0; }

/* === CARDS === */
.card {
  background: #fff;
  border: 0.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-1px); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 0.5px solid #f1f5f9;
}
.card-title { font-size: 0.9rem; font-weight: 700; color: #0f172a; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 0; }

/* === STAT CARDS === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: 0.5px solid #e2e8f0; border-radius: 12px;
  padding: 18px 20px; position: relative; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-1px); }
.stat-card .stat-label { font-size: 0.72rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; color: #0f172a; line-height: 1.1; }
.stat-card .stat-change { font-size: 0.72rem; font-weight: 600; margin-top: 4px; }
.stat-card .stat-icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.8rem; opacity: .12; }

/* === SECTION HEADERS === */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; margin-top: 8px; }
.section-header h2, .section-header h3 {
  font-size: 0.9rem; font-weight: 700; color: #0f172a; margin: 0;
  display: flex; align-items: center; gap: 7px;
}
.section-header h2 i, .section-header h3 i { font-size: 1rem; }

h2.section-title, h3.section-title {
  font-size: 0.9rem; font-weight: 700; color: #0f172a; margin: 0 0 14px;
  display: flex; align-items: center; gap: 7px;
  padding-bottom: 10px; border-bottom: 0.5px solid #f1f5f9;
}

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 0.84rem;
  font-weight: 600; cursor: pointer; border: none;
  text-decoration: none; transition: all .15s; line-height: 1.4;
  white-space: nowrap;
}
.btn-sm { padding: 5px 10px; font-size: 0.78rem; border-radius: 6px; }
.btn-lg { padding: 11px 22px; font-size: 0.92rem; border-radius: 10px; }
.btn-primary { background: #4338ca; color: #fff; box-shadow: 0 2px 8px rgba(67,56,202,.25); }
.btn-primary:hover { background: #3730a3; box-shadow: 0 4px 12px rgba(67,56,202,.35); }
.btn-success { background: #059669; color: #fff; box-shadow: 0 2px 8px rgba(5,150,105,.25); }
.btn-success:hover { background: #047857; }
.btn-danger  { background: #dc2626; color: #fff; box-shadow: 0 2px 8px rgba(220,38,38,.25); }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning { background: #d97706; color: #fff; }
.btn-outline { background: #fff; color: #374151; border: 0.5px solid #d1d5db; }
.btn-outline:hover { background: #f8fafc; border-color: #94a3b8; }
.btn-ghost { background: transparent; color: #4338ca; }
.btn-ghost:hover { background: #ede9fe; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* === BADGES === */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 0.7rem; font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: #f1f5f9; color: #475569; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }

/* === TABLES === */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.data-table th {
  text-align: left; padding: 10px 12px; font-weight: 600; font-size: 0.72rem;
  color: #64748b; text-transform: uppercase; letter-spacing: .05em;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.data-table td { padding: 10px 12px; border-bottom: 0.5px solid #f1f5f9; color: #334155; vertical-align: middle; }
.data-table tr:hover td { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; border-radius: 10px; border: 0.5px solid #e2e8f0; background: #fff; }

/* === FORMS === */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: #374151; margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 8px 12px; border: 0.5px solid #d1d5db; border-radius: 8px;
  font-size: 0.84rem; color: #1e293b; background: #fff;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #4338ca; box-shadow: 0 0 0 3px rgba(67,56,202,.1);
}

/* === TABS === */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #e2e8f0; margin-bottom: 16px; }
.tab-btn { padding: 8px 16px; font-size: 0.83rem; font-weight: 600; color: #64748b; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: all .15s; margin-bottom: -1px; }
.tab-btn.active { color: #4338ca; border-bottom-color: #4338ca; }
.tab-btn:hover:not(.active) { color: #374151; }

/* === GRID LAYOUTS === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* === ALERTS === */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 0.83rem; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 8px; }
.alert-success { background: #dcfce7; border: 0.5px solid #86efac; color: #166534; }
.alert-danger  { background: #fee2e2; border: 0.5px solid #fca5a5; color: #991b1b; }
.alert-warning { background: #fef3c7; border: 0.5px solid #fcd34d; color: #92400e; }
.alert-info    { background: #dbeafe; border: 0.5px solid #93c5fd; color: #1e40af; }

/* === MODE BANNER === */
.mode-banner { text-align: center; padding: 7px 16px; font-size: 0.78rem; font-weight: 600; letter-spacing: .04em; }
.mode-banner.paper { background: #059669; color: #fff; }
.mode-banner.live  { background: #dc2626; color: #fff; }

/* === UTILITY === */
.text-success { color: #059669 !important; }
.text-danger  { color: #dc2626 !important; }
.text-warning { color: #d97706 !important; }
.text-muted   { color: #64748b !important; }
.text-primary { color: #4338ca !important; }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.mt-0{margin-top:0} .mt-1{margin-top:4px} .mt-2{margin-top:8px} .mt-3{margin-top:12px} .mt-4{margin-top:16px}
.mb-0{margin-bottom:0} .mb-2{margin-bottom:8px} .mb-3{margin-bottom:12px} .mb-4{margin-bottom:16px}
.p-0{padding:0} .p-3{padding:12px} .p-4{padding:16px}
.flex { display: flex; } .flex-1 { flex: 1; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2{gap:8px} .gap-3{gap:12px} .gap-4{gap:16px}
.rounded { border-radius: 8px; } .rounded-lg { border-radius: 12px; }
.border { border: 0.5px solid #e2e8f0; }
.bg-white { background: #fff; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === MOBILE === */
@media (max-width: 768px) {
  .main-content { margin-left: 0 !important; padding: 12px 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  aside#sidebar { transform: translateX(-100%); transition: transform .3s; z-index: 1000; }
  aside#sidebar.open { transform: translateX(0); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* === OVERRIDE LANDING PAGE style.css h1 SIZES ON APP PAGES === */
.main-content h1,
.main-content h2,
.main-content h3 {
  font-size: revert;
  letter-spacing: normal;
  line-height: 1.3;
}
.main-content h1 { font-size: 1.3rem !important; font-weight: 700 !important; color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; margin-bottom: 4px !important; }
.main-content h2 { font-size: 1.1rem !important; font-weight: 700 !important; color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; }
.main-content h3 { font-size: 0.95rem !important; font-weight: 700 !important; color: #1e293b !important; -webkit-text-fill-color: #1e293b !important; }
