/* ============================================================================
   Green Acres · Vendor Deal Reimbursement Tool
   Shared design system — dark navy / glassmorphism / ambient glow
   Fonts: Fraunces (display) · Outfit (body) · JetBrains Mono (data)
   ============================================================================ */

:root {
  /* Surfaces */
  --bg:        #0b0e16;
  --bg-2:      #0e1220;
  --surface:   #141a2b;
  --surface-2: #19203450;
  --surface-3: #1f273e;
  --glass:     rgba(22, 28, 46, 0.55);
  --glass-2:   rgba(28, 36, 58, 0.45);

  /* Lines */
  --border:    #232b42;
  --border-2:  #2c3650;
  --border-hi: #3a4768;

  /* Brand / accents */
  --accent:    #5b8cff;
  --accent-2:  #8a5cff;
  --accent-3:  #2dd4bf;
  --glow:      rgba(91, 140, 255, 0.35);
  --glow-2:    rgba(138, 92, 255, 0.30);

  /* Semantic */
  --green:  #34d399;
  --amber:  #fbbf24;
  --red:    #f87171;
  --blue:   #60a5fa;

  /* Text */
  --text:   #eef1f8;
  --text-2: #9aa3bd;
  --text-3: #626b87;

  /* Geometry */
  --r:    16px;
  --r-sm: 11px;
  --r-lg: 22px;
  --shadow:    0 18px 50px -22px rgba(0,0,0,0.85);
  --shadow-hi: 0 24px 70px -28px rgba(91,140,255,0.45);

  --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Outfit', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Ambient background glow — fixed, behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 600px at 12% -5%, var(--glow), transparent 60%),
    radial-gradient(800px 700px at 95% 8%, var(--glow-2), transparent 55%),
    radial-gradient(700px 700px at 50% 120%, rgba(45,212,191,0.10), transparent 60%);
  pointer-events: none;
}
/* Faint grain overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,h2,h3,h4 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4768; }

/* ============================================================================
   APP SHELL — sidebar + topbar
   ============================================================================ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 22px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 20px; color: #fff;
  box-shadow: 0 8px 22px -6px var(--glow);
}
.brand-name { font-family: 'Fraunces', serif; font-size: 16.5px; font-weight: 600; letter-spacing: -0.02em; }
.brand-sub  { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 1px; }

.nav-label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; font-size: 14px;
  transition: background .16s, color .16s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.9; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(91,140,255,0.16), rgba(91,140,255,0.03)); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-spacer { flex: 1; }

.nav-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-3), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; color: #04121f;
}
.nav-user-name { font-size: 13px; font-weight: 600; line-height: 1.1; }
.nav-user-role { font-size: 11px; color: var(--text-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 13px; color: var(--text-2); }
.topbar-title b { color: var(--text); font-weight: 600; }
.cmdk {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 8px 13px; color: var(--text-3);
  font-size: 13px; min-width: 260px; transition: border-color .16s;
}
.cmdk:hover { border-color: var(--accent); }
.cmdk kbd {
  margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 11px;
  background: var(--surface-3); border: 1px solid var(--border-2);
  border-radius: 5px; padding: 1px 6px; color: var(--text-2);
}

.page { padding: 30px 32px 64px; max-width: 1240px; width: 100%; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 30px; }
.page-head p { color: var(--text-2); margin-top: 5px; }
.page-head-row { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.page-head-row .grow { flex: 1; }

/* ============================================================================
   CARDS · GLASS
   ============================================================================ */
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 17px; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); }
.card-head .right { margin-left: auto; }

/* ============================================================================
   STAT CARDS
   ============================================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px 20px; backdrop-filter: blur(12px);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.stat:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: var(--shadow-hi); }
.stat::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 70%); opacity: .5;
}
.stat-label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.stat-label svg { width: 15px; height: 15px; stroke-width: 2; color: var(--accent); }
.stat-value { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 600; margin: 9px 0 4px; letter-spacing: -0.02em; }
.stat-delta { font-size: 12px; font-family: 'JetBrains Mono', monospace; display: flex; align-items: center; gap: 5px; }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }
.spark { margin-top: 10px; height: 30px; width: 100%; }

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 17px; border-radius: 10px; font-weight: 600; font-size: 14px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
  transition: background .15s, border-color .15s, transform .1s;
}
.btn svg { width: 17px; height: 17px; stroke-width: 2; }
.btn:hover { background: var(--surface-3); border-color: var(--border-hi); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; color: #fff; box-shadow: 0 10px 26px -10px var(--glow);
}
.btn-primary:hover { filter: brightness(1.07); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--red); border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.08); }
.btn-danger:hover { background: rgba(248,113,113,0.16); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.input, .select, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  font-family: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,140,255,0.18);
}
.input::placeholder { color: var(--text-3); }
textarea.input { resize: vertical; min-height: 84px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%239aa3bd' stroke-width='2'%3E%3Cpath d='M3 5l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px; }
.input-group { position: relative; }
.input-group .prefix { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-family: 'JetBrains Mono', monospace; }
.input-group .input { padding-left: 28px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

/* ============================================================================
   BADGES / PILLS
   ============================================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--border-2); color: var(--text-2); background: var(--surface-2);
}
.badge.green  { color: var(--green); background: rgba(52,211,153,0.10); border-color: rgba(52,211,153,0.28); }
.badge.amber  { color: var(--amber); background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.28); }
.badge.red    { color: var(--red);   background: rgba(248,113,113,0.10); border-color: rgba(248,113,113,0.28); }
.badge.blue   { color: var(--blue);  background: rgba(96,165,250,0.10); border-color: rgba(96,165,250,0.28); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.pill {
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2);
  transition: all .15s;
}
.pill:hover { color: var(--text); border-color: var(--border-hi); }
.pill.on { background: rgba(91,140,255,0.16); border-color: var(--accent); color: var(--text); }
.pill-row { display: flex; flex-wrap: wrap; gap: 9px; }

/* ============================================================================
   TABLES
   ============================================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl thead th {
  text-align: left; padding: 13px 18px; font-size: 11px; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-3); font-weight: 600;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
table.tbl tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border); }
table.tbl tbody tr { transition: background .12s; cursor: pointer; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-family: 'JetBrains Mono', monospace; }

/* ============================================================================
   TOASTS
   ============================================================================ */
#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 11px; min-width: 270px; max-width: 380px;
  padding: 13px 16px; border-radius: 12px; background: var(--surface-3);
  border: 1px solid var(--border-2); box-shadow: var(--shadow); font-size: 13.5px;
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2);
}
.toast.out { animation: toastOut .25s forwards; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.ok svg { color: var(--green); }
.toast.err svg { color: var(--red); }
.toast.info svg { color: var(--blue); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ============================================================================
   MODAL
   ============================================================================ */
.modal-bg {
  position: fixed; inset: 0; z-index: 150; background: rgba(5,8,16,0.7);
  backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 460px; background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--r-lg); padding: 26px;
  box-shadow: var(--shadow); animation: modalIn .25s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.modal h3 { font-size: 21px; margin-bottom: 8px; }
.modal p { color: var(--text-2); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ============================================================================
   EMPTY / LOADING
   ============================================================================ */
.empty { text-align: center; padding: 56px 24px; color: var(--text-3); }
.empty svg { width: 44px; height: 44px; stroke-width: 1.4; opacity: .5; margin-bottom: 14px; }
.empty h3 { font-size: 19px; color: var(--text-2); margin-bottom: 6px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 38px; height: 38px; border: 3px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* shimmer text on greeting name */
.shimmer-name {
  background: linear-gradient(110deg, var(--text) 30%, var(--accent) 50%, var(--text) 70%);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; animation: nameShimmer 4s linear infinite;
}
@keyframes nameShimmer { to { background-position: 200% center; } }

/* staggered page-load reveal */
.reveal { opacity: 0; transform: translateY(14px); animation: reveal .5s forwards cubic-bezier(.2,.7,.3,1); }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 940px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex !important; }
  .cmdk { min-width: 0; flex: 1; }
}
@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .page, .topbar { padding-left: 18px; padding-right: 18px; }
  .cmdk kbd { display: none; }
}
.menu-toggle { display: none; }
