/* ══════════════════════════════════════════════════════════════════════════════
   GARIBALDI v5.0 — NOC Dark Theme
   Network Operations Center inspired design system
   ══════════════════════════════════════════════════════════════════════════════ */

/* Local Fonts */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300; font-display: swap; src: url('/fonts/inter-300.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-400.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter-500.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-600.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter-700.ttf') format('truetype'); }
@font-face { font-family: 'Fira Code'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/firacode-400.ttf') format('truetype'); }
@font-face { font-family: 'Fira Code'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/firacode-500.ttf') format('truetype'); }

/* ── DESIGN TOKENS (NOC Dark) ─────────────────────────────────────────────── */
:root, html.dark {
  --bg:        #0a0f1a;
  --bg2:       #0f1629;
  --surface:   #1e293b;
  --surface2:  #253349;
  --surface3:  #2d3d56;
  --border:    #334155;
  --border2:   #475569;
  --tx:        #f1f5f9;
  --tx2:       #94a3b8;
  --tx3:       #64748b;
  --ac:        #06b6d4;
  --ac2:       #0891b2;
  --ac-bg:     rgba(6,182,212,.1);
  --ac-glow:   rgba(6,182,212,.25);
  --green:     #10b981; --green-bg: rgba(16,185,129,.1);
  --red:       #f43f5e; --red-bg:   rgba(244,63,94,.1);
  --yellow:    #f59e0b; --yellow-bg:rgba(245,158,11,.1);
  --blue:      #3b82f6; --blue-bg:  rgba(59,130,246,.1);
  --purple:    #a855f7; --purple-bg:rgba(168,85,247,.1);
  --orange:    #f97316; --orange-bg:rgba(249,115,22,.1);
  --gray:      #64748b; --gray-bg:  rgba(100,116,139,.1);
  --cyan:      #06b6d4; --cyan-bg:  rgba(6,182,212,.1);
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.6);
  --sw: 220px;
  --sw-collapsed: 64px;
  --th: 48px;
  --r:  8px;
  --r-sm: 5px;
  --r-lg: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'Fira Code', 'Cascadia Code', monospace;
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

/* ── LIGHT MODE ───────────────────────────────────────────────────────────── */
html.light {
  --bg:        #f8fafc;
  --bg2:       #f1f5f9;
  --surface:   #ffffff;
  --surface2:  #f8fafc;
  --surface3:  #f1f5f9;
  --border:    #e2e8f0;
  --border2:   #cbd5e1;
  --tx:        #0f172a;
  --tx2:       #475569;
  --tx3:       #94a3b8;
  --ac:        #0891b2;
  --ac2:       #0e7490;
  --ac-bg:     rgba(8,145,178,.06);
  --ac-glow:   rgba(8,145,178,.15);
  --shadow:    0 2px 12px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.1);
}

@media (prefers-color-scheme: light) {
  html:not(.dark):not(.light) {
    --bg: #f8fafc; --bg2: #f1f5f9; --surface: #ffffff; --surface2: #f8fafc;
    --surface3: #f1f5f9; --border: #e2e8f0; --border2: #cbd5e1;
    --tx: #0f172a; --tx2: #475569; --tx3: #94a3b8;
    --ac: #0891b2; --ac2: #0e7490;
    --ac-bg: rgba(8,145,178,.06); --ac-glow: rgba(8,145,178,.15);
    --shadow: 0 2px 12px rgba(0,0,0,.06); --shadow-sm: 0 1px 4px rgba(0,0,0,.05);
  }
}

/* ── RESET ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--tx);
  font-size: .8125rem;
  line-height: 1.6;
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--ac); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: .85; }
code, pre { font-family: var(--mono); font-size: .75rem; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; border-radius: var(--r-sm); }

/* ── LAYOUT ───────────────────────────────────────────────────────────────── */
.g-layout { display: flex; min-height: 100vh; }
.g-main {
  flex: 1;
  margin-left: var(--sw);
  padding-top: var(--th);
  min-height: 100vh;
  background: var(--bg);
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}
.sb-collapsed .g-main { margin-left: var(--sw-collapsed); }
@media (max-width: 768px) { .g-main { margin-left: 0; } }

/* ── SIDEBAR ──────────────────────────────────────────────────────────────── */
.g-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sw);
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width .3s cubic-bezier(.4,0,.2,1), transform .3s;
  overflow: hidden;
}
.g-sidebar.collapsed { width: var(--sw-collapsed); }
.g-sidebar.collapsed .g-nav-label,
.g-sidebar.collapsed .g-sb-brand,
.g-sidebar.collapsed .g-nav-section,
.g-sidebar.collapsed .g-ver { display: none; }
.g-sidebar.collapsed .g-sb-header { justify-content: center; padding: .75rem; }
.g-sidebar.collapsed .g-nav-item { justify-content: center; padding: .6rem; }
.g-sidebar.collapsed .g-logout-btn { justify-content: center; }

@media (max-width: 768px) {
  .g-sidebar { transform: translateX(-100%); width: 260px; box-shadow: var(--shadow-lg); }
  .g-sidebar.open { transform: translateX(0); }
}

.g-sb-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.g-sb-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--ac), var(--ac2));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.g-sb-brand { flex: 1; min-width: 0; overflow: hidden; }
.g-sb-name { font-weight: 700; font-size: .8rem; color: var(--tx); white-space: nowrap; }
.g-sb-tagline { font-size: .6rem; color: var(--tx3); white-space: nowrap; }
.g-sb-close { display: none; background: none; border: none; color: var(--tx2); cursor: pointer; padding: 4px; border-radius: var(--r-sm); }
@media (max-width: 768px) { .g-sb-close { display: block; } }

.g-nav { flex: 1; overflow-y: auto; padding: .5rem 0; }
.g-nav::-webkit-scrollbar { width: 2px; }
.g-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.g-nav-section {
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--tx3);
  padding: 1rem .75rem .3rem;
  text-transform: uppercase;
}
.g-nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  margin: 1px .5rem;
  color: var(--tx2);
  border-radius: var(--r-sm);
  transition: all var(--transition);
  font-weight: 500;
  font-size: .78rem;
  position: relative;
  white-space: nowrap;
}
.g-nav-item svg { flex-shrink: 0; width: 16px; height: 16px; }
.g-nav-item:hover { background: var(--surface); color: var(--tx); }
.g-nav-item.active {
  color: var(--ac);
  background: var(--ac-bg);
}
.g-nav-item.active::before {
  content: '';
  position: absolute;
  left: -0.5rem; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--ac);
  border-radius: 0 3px 3px 0;
}
.g-nav-label { flex: 1; }
.g-nav-badge {
  font-size: .6rem;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

.g-sb-footer {
  border-top: 1px solid var(--border);
  padding: .6rem .75rem;
  flex-shrink: 0;
}
.g-logout-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .5rem;
  color: var(--tx2);
  border-radius: var(--r-sm);
  font-size: .78rem;
  font-weight: 500;
  transition: all var(--transition);
}
.g-logout-btn:hover { background: var(--red-bg); color: var(--red); }
.g-ver { font-size: .6rem; color: var(--tx3); margin-top: .3rem; padding-left: .5rem; }

/* ── TOPBAR ───────────────────────────────────────────────────────────────── */
.g-topbar {
  position: fixed;
  top: 0;
  left: var(--sw);
  right: 0;
  height: var(--th);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 150;
  transition: left .3s cubic-bezier(.4,0,.2,1);
  backdrop-filter: blur(8px);
}
.sb-collapsed .g-topbar { left: var(--sw-collapsed); }
@media (max-width: 768px) { .g-topbar { left: 0; } }
.g-tb-left { display: flex; align-items: center; gap: .75rem; }
.g-tb-right { display: flex; align-items: center; gap: .6rem; }
.g-hamburger {
  background: none; border: none; color: var(--tx2); cursor: pointer;
  padding: .3rem; border-radius: var(--r-sm); display: flex;
  transition: all var(--transition);
}
.g-hamburger:hover { background: var(--surface); color: var(--tx); }
.g-breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .75rem; }
.g-bc-root { color: var(--tx3); }
.g-bc-sep { color: var(--border2); }
.g-bc-cur { color: var(--tx); font-weight: 600; }
.g-clock { font-family: var(--mono); font-size: .7rem; color: var(--tx3); }
.g-theme-btn {
  background: none; border: none; color: var(--tx2); cursor: pointer;
  padding: .3rem; border-radius: var(--r-sm); display: flex;
  transition: all var(--transition);
}
.g-theme-btn:hover { background: var(--surface); color: var(--ac); }
html.dark .icon-sun { display: none; }
html.light .icon-moon { display: none; }
html:not(.dark):not(.light) .icon-sun { display: none; }

/* ── OVERLAY ──────────────────────────────────────────────────────────────── */
.g-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 190; backdrop-filter: blur(2px);
}
.g-overlay.show { display: block; }

/* ── CONTENT ──────────────────────────────────────────────────────────────── */
.g-content { padding: 1.25rem; max-width: 1400px; }
@media (max-width: 768px) { .g-content { padding: .75rem; } }

/* ── PAGE HEADER ──────────────────────────────────────────────────────────── */
.g-page-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.g-page-title { font-size: 1.25rem; font-weight: 700; color: var(--tx); letter-spacing: -.02em; }
.g-page-sub { font-size: .75rem; color: var(--tx3); margin-top: .15rem; }
.g-page-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── CARDS ─────────────────────────────────────────────────────────────────── */
.g-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.g-card:hover { border-color: var(--border2); }
.g-card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  gap: .5rem;
}
.g-card-title { font-size: .8rem; font-weight: 600; color: var(--tx); display: flex; align-items: center; gap: .4rem; }
.g-card-title svg { color: var(--ac); }
.g-card-body { padding: 1rem; }
.g-card-footer { padding: .6rem 1rem; border-top: 1px solid var(--border); background: var(--bg2); }

/* ── STAT CARDS ────────────────────────────────────────────────────────────── */
.g-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.g-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.g-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.g-stat-card:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.g-stat-cyan::before { background: var(--cyan); }
.g-stat-green::before { background: var(--green); }
.g-stat-red::before { background: var(--red); }
.g-stat-yellow::before { background: var(--yellow); }
.g-stat-blue::before { background: var(--blue); }
.g-stat-purple::before { background: var(--purple); }
.g-stat-gray::before { background: var(--gray); }
.g-stat-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.g-stat-cyan .g-stat-icon { background: var(--cyan-bg); color: var(--cyan); }
.g-stat-green .g-stat-icon { background: var(--green-bg); color: var(--green); }
.g-stat-red .g-stat-icon { background: var(--red-bg); color: var(--red); }
.g-stat-yellow .g-stat-icon { background: var(--yellow-bg); color: var(--yellow); }
.g-stat-blue .g-stat-icon { background: var(--blue-bg); color: var(--blue); }
.g-stat-purple .g-stat-icon { background: var(--purple-bg); color: var(--purple); }
.g-stat-gray .g-stat-icon { background: var(--gray-bg); color: var(--gray); }
.g-stat-body { min-width: 0; }
.g-stat-value { font-size: 1.2rem; font-weight: 700; color: var(--tx); line-height: 1.2; font-family: var(--mono); }
.g-stat-label { font-size: .68rem; color: var(--tx3); font-weight: 500; }
.g-stat-sub { font-size: .62rem; color: var(--tx3); }

/* ── TABLES ────────────────────────────────────────────────────────────────── */
.g-table-wrap { overflow-x: auto; }
.g-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}
.g-table thead { position: sticky; top: 0; z-index: 2; }
.g-table th {
  background: var(--bg2);
  color: var(--tx2);
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .55rem .75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.g-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  color: var(--tx);
  vertical-align: middle;
}
.g-table tbody tr { transition: background var(--transition); }
.g-table tbody tr:hover { background: var(--ac-bg); }
.g-table tbody tr:nth-child(even) { background: rgba(0,0,0,.02); }
.g-table tbody tr:nth-child(even):hover { background: var(--ac-bg); }
.g-table th[data-sort] { cursor: pointer; user-select: none; }
.g-table th[data-sort]:hover { color: var(--ac); }
.g-table th.asc::after { content: ' ↑'; color: var(--ac); }
.g-table th.desc::after { content: ' ↓'; color: var(--ac); }

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .85rem;
  border: 1px solid transparent;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ac); color: #fff; border-color: var(--ac); }
.btn-primary:hover { background: var(--ac2); border-color: var(--ac2); box-shadow: 0 0 12px var(--ac-glow); }
.btn-secondary { background: transparent; color: var(--ac); border-color: var(--border2); }
.btn-secondary:hover { border-color: var(--ac); background: var(--ac-bg); }
.btn-ghost { background: transparent; color: var(--tx2); }
.btn-ghost:hover { background: var(--surface2); color: var(--tx); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #e11d48; box-shadow: 0 0 12px rgba(244,63,94,.3); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-warning { background: var(--yellow); color: #000; border-color: var(--yellow); }
.btn-sm { padding: .3rem .65rem; font-size: .72rem; }
.btn-xs { padding: .2rem .45rem; font-size: .65rem; border-radius: 14px; }

/* ── BADGES ────────────────────────────────────────────────────────────────── */
.g-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .5rem;
  border-radius: 12px;
  font-size: .65rem;
  font-weight: 600;
  white-space: nowrap;
}
.g-badge-green { background: var(--green-bg); color: var(--green); }
.g-badge-red { background: var(--red-bg); color: var(--red); }
.g-badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.g-badge-blue { background: var(--blue-bg); color: var(--blue); }
.g-badge-purple { background: var(--purple-bg); color: var(--purple); }
.g-badge-gray { background: var(--gray-bg); color: var(--gray); }
.g-badge-cyan { background: var(--cyan-bg); color: var(--cyan); }

/* ── FORMS ─────────────────────────────────────────────────────────────────── */
.g-input, .g-select, .g-textarea {
  width: 100%;
  padding: .5rem .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--tx);
  font-size: .8rem;
  transition: all var(--transition);
}
.g-input:focus, .g-select:focus, .g-textarea:focus {
  border-color: var(--ac);
  box-shadow: 0 0 0 3px var(--ac-glow);
  outline: none;
}
.g-input::placeholder { color: var(--tx3); }
.g-label { display: block; font-size: .72rem; font-weight: 600; color: var(--tx2); margin-bottom: .3rem; }
.g-form-group { margin-bottom: .85rem; }
.g-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 640px) { .g-form-grid { grid-template-columns: 1fr; } }
.g-input-hint { font-size: .65rem; color: var(--tx3); margin-top: .2rem; }

/* ── TABS ──────────────────────────────────────────────────────────────────── */
.g-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.g-tab-btn {
  padding: .55rem 1rem;
  font-size: .75rem;
  font-weight: 500;
  color: var(--tx3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: .35rem;
}
.g-tab-btn:hover { color: var(--tx); background: var(--surface2); }
.g-tab-btn.active { color: var(--ac); border-bottom-color: var(--ac); }
.g-tab-btn svg { width: 14px; height: 14px; }
.g-tab-panel { display: none; }
.g-tab-panel.active { display: block; }

/* ── ALERTS ────────────────────────────────────────────────────────────────── */
.g-alert {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .75rem 1rem;
  border-radius: var(--r);
  font-size: .78rem;
  margin-bottom: .75rem;
  border: 1px solid;
}
.g-alert svg { flex-shrink: 0; margin-top: 1px; }
.g-alert-error { background: var(--red-bg); border-color: rgba(244,63,94,.2); color: var(--red); }
.g-alert-success { background: var(--green-bg); border-color: rgba(16,185,129,.2); color: var(--green); }
.g-alert-warning { background: var(--yellow-bg); border-color: rgba(245,158,11,.2); color: var(--yellow); }
.g-alert-info { background: var(--cyan-bg); border-color: rgba(6,182,212,.2); color: var(--cyan); }

/* ── TOAST ─────────────────────────────────────────────────────────────────── */
.g-toast-wrap {
  position: fixed;
  top: .75rem;
  right: .75rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  pointer-events: none;
}
.g-toast {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  border-radius: var(--r);
  font-size: .75rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  pointer-events: auto;
  cursor: pointer;
  animation: toastIn .25s ease-out;
  position: relative;
  overflow: hidden;
}
.g-toast.out { animation: toastOut .25s ease-in forwards; }
.g-toast-success { border-left: 3px solid var(--green); }
.g-toast-error { border-left: 3px solid var(--red); }
.g-toast-info { border-left: 3px solid var(--cyan); }
.g-toast-warning { border-left: 3px solid var(--yellow); }
.g-toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--ac);
  animation: toastProgress linear forwards;
  width: 100%;
}
.g-toast-undo { background: none; border: none; color: var(--ac); font-weight: 600; cursor: pointer; font-size: .72rem; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
@keyframes toastProgress { from { width: 100%; } to { width: 0; } }

/* ── DETAIL GRID ───────────────────────────────────────────────────────────── */
.g-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .g-detail-grid { grid-template-columns: 1fr; } }

/* ── DL (Description List) ─────────────────────────────────────────────────── */
.g-dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; font-size: .78rem; }
.g-dl dt { color: var(--tx3); font-weight: 500; }
.g-dl dd { color: var(--tx); }

/* ── PROGRESS BAR ──────────────────────────────────────────────────────────── */
.g-progress { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.g-progress-bar { height: 100%; border-radius: 3px; transition: width .5s; }
.g-progress-green { background: var(--green); }
.g-progress-yellow { background: var(--yellow); }
.g-progress-red { background: var(--red); }
.g-progress-cyan { background: var(--cyan); }

/* ── EMPTY STATE ───────────────────────────────────────────────────────────── */
.g-empty { text-align: center; padding: 2.5rem 1rem; }
.g-empty-icon { color: var(--tx3); margin-bottom: .5rem; opacity: .5; }
.g-empty-icon svg { width: 40px; height: 40px; }
.g-empty-title { font-size: .85rem; font-weight: 600; color: var(--tx2); }
.g-empty-sub { font-size: .72rem; color: var(--tx3); margin-top: .25rem; }

/* ── SEARCH ────────────────────────────────────────────────────────────────── */
.g-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.g-search-wrap svg { position: absolute; left: .6rem; color: var(--tx3); width: 14px; height: 14px; pointer-events: none; }
.g-search-input { padding-left: 2rem !important; max-width: 220px; }

/* ── PAGINATION ────────────────────────────────────────────────────────────── */
.g-pagination { display: flex; align-items: center; justify-content: center; gap: .3rem; padding: .75rem 0; }

/* ── COMMAND PALETTE ───────────────────────────────────────────────────────── */
.g-cmd-palette {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
.g-cmd-palette.show { display: flex; }
.g-cmd-box {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.g-cmd-input {
  width: 100%;
  padding: .85rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--tx);
  font-size: .85rem;
  outline: none;
}
.g-cmd-results { max-height: 320px; overflow-y: auto; padding: .4rem; }
.g-cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  border-radius: var(--r-sm);
  color: var(--tx);
  text-decoration: none;
  transition: background var(--transition);
}
.g-cmd-item:hover, .g-cmd-item.active { background: var(--ac-bg); color: var(--ac); }
.g-cmd-item-label { font-size: .8rem; font-weight: 500; }
.g-cmd-item-hint { font-size: .65rem; color: var(--tx3); font-family: var(--mono); }

/* ── CONFIRM MODAL ─────────────────────────────────────────────────────────── */
.g-confirm-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
.g-confirm-modal.show { display: flex; }
.g-confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}
.g-confirm-msg { font-size: .85rem; color: var(--tx); margin-bottom: 1.25rem; line-height: 1.5; }
.g-confirm-actions { display: flex; gap: .5rem; justify-content: flex-end; }

/* ── STATUS DOTS ───────────────────────────────────────────────────────────── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot-green { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse 2s infinite; }
.status-dot-red { background: var(--red); }
.status-dot-yellow { background: var(--yellow); }
.status-dot-gray { background: var(--gray); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* ── LOGIN ─────────────────────────────────────────────────────────────────── */
.g-login-wrap {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}
.g-login-brand {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg2) 0%, var(--surface) 100%);
  border-right: 1px solid var(--border);
  padding: 2rem;
}
@media (max-width: 768px) { .g-login-brand { display: none; } }
.g-login-brand-content { max-width: 360px; }
.g-login-brand-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--ac), var(--ac2));
  color: #fff;
  font-weight: 700;
  font-size: 1.5rem;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.25rem;
}
.g-login-brand-content h1 { font-size: 1.5rem; font-weight: 700; color: var(--tx); margin-bottom: .4rem; }
.g-login-brand-content p { color: var(--tx2); font-size: .85rem; margin-bottom: 1.5rem; }
.g-login-features { list-style: none; padding: 0; }
.g-login-features li {
  padding: .4rem 0;
  color: var(--tx2);
  font-size: .8rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.g-login-features li::before { content: ''; width: 6px; height: 6px; background: var(--ac); border-radius: 50%; flex-shrink: 0; }
.g-login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.g-login-box { width: 100%; max-width: 360px; }
.g-login-box h2 { font-size: 1.3rem; font-weight: 700; color: var(--tx); margin-bottom: .25rem; }
.g-login-subtitle { color: var(--tx3); font-size: .8rem; margin-bottom: 1.5rem; }
.g-login-box .g-input {
  padding: .65rem .85rem;
  font-size: .85rem;
  margin-bottom: .75rem;
}
.g-login-box .btn { width: 100%; justify-content: center; padding: .65rem; font-size: .85rem; margin-top: .5rem; }

/* ── UTILITIES ─────────────────────────────────────────────────────────────── */
.g-mono { font-family: var(--mono); }
.g-muted { color: var(--tx3); }
.g-link { color: var(--ac); }
.g-link:hover { text-decoration: underline; }
.g-sep { height: 1px; background: var(--border); margin: .75rem 0; }
.fw-600 { font-weight: 600; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--tx3); }
.text-sm { font-size: .72rem; }
.td-mono { font-family: var(--mono); font-size: .72rem; }
.td-act { display: flex; gap: .25rem; align-items: center; }
.flex { display: flex; }
.gap-sm { gap: .4rem; }
.hide-mobile { }
@media (max-width: 768px) { .hide-mobile { display: none !important; } }

/* ── SPINNER ───────────────────────────────────────────────────────────────── */
.g-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--ac);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── FLASH ─────────────────────────────────────────────────────────────────── */
.g-flash {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem 1rem; border-radius: var(--r); margin: 0 1.25rem 1rem;
  font-size: .78rem; animation: flashIn .3s;
}
.g-flash-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16,185,129,.2); }
.g-flash-error { background: var(--red-bg); color: var(--red); border: 1px solid rgba(244,63,94,.2); }
.g-flash-info { background: var(--cyan-bg); color: var(--cyan); border: 1px solid rgba(6,182,212,.2); }
.g-flash-close { background: none; border: none; color: inherit; cursor: pointer; margin-left: auto; opacity: .7; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } }

/* ── ANIMATIONS ────────────────────────────────────────────────────────────── */
.fade-in { animation: fadeIn .4s ease-out both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── ACCESSIBILITY ─────────────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link:focus {
  position: fixed; top: 0; left: 0; z-index: 9999;
  padding: .75rem 1.5rem; background: var(--ac); color: #fff;
  font-weight: 600; font-size: .9rem; border-radius: 0 0 var(--r-sm) 0;
  width: auto; height: auto; clip: auto; white-space: normal; overflow: visible; margin: 0;
}

/* ── PRINT ─────────────────────────────────────────────────────────────────── */
@media print {
  * { color-adjust: exact; -webkit-print-color-adjust: exact; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .g-sidebar, .g-topbar, .g-hamburger, .g-overlay, .g-toast-wrap,
  .g-sb-footer, .g-page-actions, .g-search-wrap, .td-act,
  .g-theme-btn, .g-clock, #gCmdPalette, .g-confirm-modal { display: none !important; }
  .g-main { margin-left: 0 !important; padding-top: 0 !important; }
  .g-layout { display: block; }
  .g-content { padding: 0 !important; }
  .g-card { break-inside: avoid; border: 1px solid #ddd !important; box-shadow: none !important; margin-bottom: .75rem; }
  .g-stat-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .g-stat-card { border: 1px solid #ddd !important; }
  .g-table { font-size: 9pt; }
  .g-table th { background: #f0f0f0 !important; border-bottom: 2px solid #333; }
  .g-badge { border: 1px solid #999; }
  a { color: #000 !important; }
}

/* ── REDUCED MOTION ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── PAYMENT PAGE (PUBLIC) ─────────────────────────────────────────────────── */
.g-pay-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--bg); }
.g-pay-box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 2rem; }
.g-pay-logo { font-size: 1.1rem; font-weight: 700; color: var(--ac); text-align: center; margin-bottom: .25rem; }
.g-pay-invoice-no { text-align: center; font-size: .75rem; color: var(--tx3); margin-bottom: 1.5rem; }
.g-pay-amount { text-align: center; font-size: 1.8rem; font-weight: 700; color: var(--tx); font-family: var(--mono); }
.g-pay-amount-label { text-align: center; font-size: .72rem; color: var(--tx3); margin-bottom: 1.5rem; }
.g-pay-status { text-align: center; padding: 1.5rem; }
.g-pay-status-icon { font-size: 2.5rem; margin-bottom: .5rem; }

/* ── SETTINGS SECTION ──────────────────────────────────────────────────────── */
.g-settings-section { margin-bottom: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.g-settings-section-hdr { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-bottom: 1px solid var(--border); background: var(--bg2); }
.g-settings-section-title { font-size: .8rem; font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.g-settings-section-body { padding: 1rem; }
