/* =====================================================================
   UNIFIED ERP — "Industrial Blue / King Coil Gold" Theme
   Palette:
     --ink:          #0B1F3A   (deep industrial navy - headers, sidebar)
     --ink-2:        #122C52   (secondary navy - panels)
     --steel:        #1E4D8C   (primary blue - gas cylinder steel)
     --steel-light:  #2E6FBF   (interactive blue)
     --gold:         #C8932B   (King Coil brass/gold - premium accent)
     --gold-light:   #E0AC4C
     --canvas:       #F4F7FB   (page background)
     --surface:      #FFFFFF
     --line:         #DCE4EF
     --ash:          #5B6B85   (muted text)
     --success:      #1E8E5A
     --danger:       #C0392B
     --warning:      #C8932B
   Typography:
     Display: 'Sora' (geometric, confident — for headers/brand)
     Body:    'Inter' (clean, legible — for data-dense UI)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #0B1F3A;
  --ink-2: #122C52;
  --steel: #1E4D8C;
  --steel-light: #2E6FBF;
  --gold: #C8932B;
  --gold-light: #E0AC4C;
  --canvas: #F4F7FB;
  --surface: #FFFFFF;
  --line: #DCE4EF;
  --ash: #5B6B85;
  --success: #1E8E5A;
  --danger: #C0392B;
  --warning: #C8932B;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(11, 31, 58, 0.08);
  --shadow-md: 0 6px 20px rgba(11, 31, 58, 0.10);
  --sidebar-width: 88px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, .brand-font {
  font-family: 'Sora', 'Inter', sans-serif;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

a { color: var(--steel); text-decoration: none; }
a:hover { color: var(--steel-light); }

/* ---------------- App shell ---------------- */

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

/* ── Narrow icon sidebar ── */
.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #DCE6F5;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-sidebar .brand {
  padding: 18px 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  width: 100%;
  display: flex;
  justify-content: center;
}

.app-sidebar .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  color: var(--ink);
  font-size: 17px;
  flex-shrink: 0;
}

/* ── Category nav items ── */
.app-nav {
  flex: 1;
  width: 100%;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.app-nav a.nav-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 68px;
  padding: 10px 6px;
  border-radius: 10px;
  color: rgba(220, 230, 245, 0.70);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.app-nav a.nav-cat svg { opacity: 0.80; }

.app-nav a.nav-cat:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.app-nav a.nav-cat:hover svg { opacity: 1; }

.app-nav a.nav-cat.active {
  background: rgba(200,147,43,0.20);
  color: var(--gold-light);
  border-bottom: 2px solid var(--gold);
}

.app-nav a.nav-cat.active svg { opacity: 1; }

/* ── Sidebar footer (avatar only) ── */
.app-sidebar .sidebar-footer {
  padding: 14px 0 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  width: 100%;
  display: flex;
  justify-content: center;
}

.app-sidebar .avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--steel);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
}

/* ── Main area ── */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 56px;
}

.app-topbar .topbar-left {
  flex-shrink: 0;
  padding: 14px 20px 14px 0;
  border-right: 1px solid var(--line);
  min-width: 200px;
}

.app-topbar h1 {
  font-size: 17px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Horizontal sub-nav (sits between title and user) ── */
.app-subnav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-subnav::-webkit-scrollbar { display: none; }

.app-subnav .snav-link {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ash);
  text-decoration: none;
  transition: background 0.13s, color 0.13s;
  border-bottom: 2px solid transparent;
}

.app-subnav .snav-link:hover {
  background: var(--canvas);
  color: var(--ink);
}

.app-subnav .snav-link.active {
  color: var(--steel);
  background: #EBF1FB;
  border-bottom: 2px solid var(--steel);
  font-weight: 600;
}

.app-topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--canvas);
  border-radius: 999px;
  border: 1px solid var(--line);
}

.user-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--steel);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
}

.user-chip .role-pill {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.app-content {
  padding: 26px 28px 60px;
}

/* ---------------- Cards / KPI tiles ---------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--steel), var(--gold));
}

.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--ash);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.kpi-card .kpi-value {
  font-family: 'Sora', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--ash);
  margin-top: 4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2, .card-header h3 {
  font-size: 15.5px;
  margin: 0;
}

.card-body { padding: 20px; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
}

.btn-primary {
  background: var(--steel);
  color: #fff;
}
.btn-primary:hover { background: var(--steel-light); color: #fff; }

.btn-gold {
  background: var(--gold);
  color: var(--ink);
}
.btn-gold:hover { background: var(--gold-light); color: var(--ink); }

.btn-outline {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-outline:hover { border-color: var(--steel); color: var(--steel); }

.btn-danger {
  background: #FBEAE7;
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success {
  background: #E5F4ED;
  color: var(--success);
}
.btn-success:hover { background: var(--success); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Forms ---------------- */

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
  display: block;
}

.form-control, .form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.8px;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--steel-light);
  box-shadow: 0 0 0 3px rgba(46, 111, 191, 0.15);
}

.form-text { font-size: 12px; color: var(--ash); margin-top: 4px; }
.text-danger { color: var(--danger); font-size: 12.5px; }
.field-validation-error { color: var(--danger); font-size: 12.5px; }
.input-validation-error { border-color: var(--danger) !important; }

/* ---------------- Tables ---------------- */

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

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ash);
  background: var(--canvas);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.data-table tbody tr:hover { background: #F8FAFD; }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* ---------------- Badges / status pills ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-blue { background: #E3EDFB; color: var(--steel); }
.badge-gold { background: #FAF0DC; color: #8A6418; }
.badge-green { background: #E1F4EA; color: var(--success); }
.badge-red { background: #FBE7E4; color: var(--danger); }
.badge-gray { background: #ECEFF4; color: var(--ash); }

/* ---------------- Modal (Bootstrap overrides) ---------------- */

.modal-content {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow-md);
}

.modal-header {
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
  background: var(--canvas);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.modal-header .modal-title {
  font-family: 'Sora', sans-serif;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
}

.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--line); }

/* ---------------- Toasts ---------------- */

.toast-container { z-index: 1080; }
.toast { border-radius: 10px; border: none; box-shadow: var(--shadow-md); }
.toast.bg-success-custom { background: var(--success); color: #fff; }
.toast.bg-danger-custom { background: var(--danger); color: #fff; }

/* ---------------- Login page — Gas Expert -------------------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  background: #071642;
}

/* ── Left decorative panel ── */
.auth-art {
  flex: 1.1;
  background: linear-gradient(150deg, #071642 0%, #0e2d8c 50%, #1a56db 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  overflow: hidden;
}

/* decorative blobs */
.auth-blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.auth-blob-1 {
  width: 420px; height: 420px;
  top: -140px; right: -100px;
  background: radial-gradient(circle, rgba(96,165,250,0.15) 0%, transparent 70%);
}
.auth-blob-2 {
  width: 240px; height: 240px;
  bottom: 40px; left: -80px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
}
.auth-blob-3 {
  width: 100px; height: 100px;
  top: 48%; right: 72px;
  background: rgba(96,165,250,0.1);
  border-radius: 50%;
}

.auth-logo-wrap { margin-bottom: 36px; }

.auth-flame-icon {
  width: 68px; height: 68px;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
}

.auth-product-name {
  font-family: 'Sora', sans-serif;
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 9px;
}

.auth-tagline {
  font-size: 13px;
  color: rgba(147,197,253,0.85);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-desc {
  color: rgba(255,255,255,0.6);
  font-size: 14.5px;
  line-height: 1.7;
  max-width: 380px;
  margin: 0 0 44px;
}

.auth-stats {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 18px 22px;
  max-width: 380px;
}

.auth-stat-item { flex: 1; text-align: center; }

.auth-stat-val {
  font-family: 'Sora', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: #93c5fd;
  line-height: 1;
  margin-bottom: 5px;
}

.auth-stat-lbl {
  font-size: 10.5px;
  color: rgba(255,255,255,0.45);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-stat-divider {
  width: 1px;
  height: 34px;
  background: rgba(255,255,255,0.14);
  flex-shrink: 0;
  margin: 0 4px;
}

/* ── Right form panel ── */
.auth-panel {
  flex: 1;
  background: #f0f5ff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.auth-form-card { width: 100%; max-width: 380px; }

.auth-form-card h2 {
  font-family: 'Sora', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #0a1740;
  margin-bottom: 6px;
}

.auth-form-card .subtitle {
  color: #64748b;
  font-size: 13.5px;
  margin-bottom: 30px;
}

.auth-field { margin-bottom: 18px; }
.auth-field .form-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
  display: block;
}

.auth-input-wrap { position: relative; }
.auth-input-icon {
  position: absolute;
  left: 13px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px;
  color: #94a3b8;
  pointer-events: none;
}

.auth-input {
  width: 100%;
  padding: 11px 13px 11px 38px !important;
  border: 1.8px solid #dce4f0 !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  background: #fff !important;
  color: #111827 !important;
  outline: none;
  box-shadow: none !important;
  transition: border-color .15s, box-shadow .15s !important;
}
.auth-input:focus {
  border-color: #1a56db !important;
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1) !important;
}

.auth-remember {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}
.auth-remember label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #64748b; font-weight: 500;
  cursor: pointer;
}
.auth-remember input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: #1a56db;
}

.auth-submit-btn {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #1a56db 0%, #1e40af 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(26,86,219,0.38);
  letter-spacing: 0.01em;
}
.auth-submit-btn:hover { opacity: 0.93; box-shadow: 0 6px 22px rgba(26,86,219,0.48); }
.auth-submit-btn:active { transform: scale(.98); opacity: .88; }

.demo-creds {
  margin-top: 20px;
  padding: 12px 14px;
  background: #e4ecff;
  border-radius: 9px;
  font-size: 11.5px;
  color: #4b6395;
  border: 1px solid #c3d4f5;
  line-height: 1.75;
}
.demo-creds strong { color: #0a1740; }

/* ---------------- Utility ---------------- */

.text-muted-custom { color: var(--ash); }
.fw-bold-custom { font-weight: 700; }
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--ash);
}
.empty-state svg { opacity: 0.35; margin-bottom: 14px; }

@media (max-width: 768px) {
  .app-sidebar { position: fixed; left: -100px; top: 0; z-index: 100; transition: left 0.2s ease; }
  .app-sidebar.open { left: 0; }
  .app-topbar { padding: 0 14px; }
  .app-topbar .topbar-left { min-width: 120px; padding-right: 12px; }
  .app-content { padding: 16px; }
  .app-subnav { padding: 0 10px; }
}

/* ── Auth page — mobile (left panel hidden, clean form only) ── */
@media (max-width: 640px) {
  .auth-shell { flex-direction: column; background: #f0f5ff; }
  .auth-art { display: none; }
  .auth-panel { width: 100%; padding: 0; background: #f0f5ff; align-items: flex-start; min-height: 100vh; }
  .auth-form-card { max-width: 100%; width: 100%; }

  .auth-mobile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 36px 24px 28px;
    background: linear-gradient(135deg, #071642 0%, #1a56db 100%);
    margin-bottom: 0;
  }
  .auth-mobile-flame {
    width: 46px; height: 46px;
    background: rgba(255,255,255,0.13);
    border: 1.5px solid rgba(255,255,255,0.22);
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .auth-mobile-title {
    font-family: 'Sora', sans-serif;
    font-size: 22px; font-weight: 800; color: #fff;
    letter-spacing: -0.4px;
  }
  .auth-mobile-sub { font-size: 12px; color: rgba(147,197,253,0.85); margin-top: 3px; }

  .auth-form-inner { padding: 30px 24px 48px; }
}

@media (min-width: 641px) {
  .auth-mobile-header { display: none; }
  .auth-form-inner { } /* no extra padding on desktop, .auth-panel handles it */
}
