﻿/* ===========================================================
   GearUp CRM 2.0 - Premium Design System
   Font: DM Sans (headings) + Geist (body/mono)
   Theme: Light / Dark / Blue - CSS vars throughout
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;0,9..40,900;1,9..40,400&display=swap');

/* -- Design Tokens ------------------------------------------- */
:root {
  /* Light theme */
  --bg:         #f0f4fb;
  --surface:    #ffffff;
  --surface2:   #f7faff;
  --surface3:   #eef3fc;
  --border:     #e3eaf8;
  --border2:    #d0dcf4;
  --text:       #0d1b35;
  --text2:      #3d5170;
  --muted:      #7488ab;

  --blue:       #1a6cff;
  --blue-end:   #00b4d8;
  --blue-soft:  rgba(26,108,255,.10);
  --blue-ring:  rgba(26,108,255,.22);

  --green:      #00a878;
  --green-soft: rgba(0,168,120,.10);
  --red:        #f03060;
  --red-soft:   rgba(240,48,96,.10);
  --amber:      #f5a623;
  --amber-soft: rgba(245,166,35,.10);
  --violet:     #7c3aed;
  --violet-soft:rgba(124,58,237,.10);
  --teal:       #0d9488;

  --shadow-sm:  0 2px 8px rgba(13,27,53,.06);
  --shadow:     0 8px 28px rgba(13,27,53,.08);
  --shadow-lg:  0 20px 60px rgba(13,27,53,.10);
  --radius:     18px;
  --sidebar-w:  280px;
}

body.theme-dark {
  --bg:         #080e1e;
  --surface:    #0f1a2e;
  --surface2:   #14213a;
  --surface3:   #1a2a44;
  --border:     #1f2f4a;
  --border2:    #2a3d5a;
  --text:       #e8f0ff;
  --text2:      #8fa8cc;
  --muted:      #4f688a;
  --blue-soft:  rgba(26,108,255,.15);
  --shadow:     0 8px 28px rgba(0,0,0,.30);
  --shadow-lg:  0 20px 60px rgba(0,0,0,.40);
}

body.theme-blue {
  --bg:         #e8f2ff;
  --surface:    #ffffff;
  --surface2:   #f0f7ff;
  --surface3:   #dfeeff;
  --border:     #cfe4ff;
  --border2:    #b5d3ff;
  --text:       #092051;
  --text2:      #2a4e7a;
  --muted:      #5a80aa;
  --blue:       #005fd4;
  --blue-soft:  rgba(0,95,212,.10);
}

/* -- Reset & Base --------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grid dot background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 80% 5%, rgba(26,108,255,.12) 0%, transparent 40%),
    radial-gradient(circle at 8% 88%, rgba(0,180,216,.08) 0%, transparent 36%);
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

/* -- Sidebar -------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 24px 16px;
  z-index: 100;
  box-shadow: var(--shadow);
  transition: width .22s ease;
}

/* brand */
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--blue), var(--blue-end));
  display: grid; place-items: center;
  color: #fff; font-size: 22px;
  box-shadow: 0 8px 24px var(--blue-ring);
  flex-shrink: 0;
  transition: .2s;
}

.logo.big {
  width: 64px; height: 64px;
  border-radius: 20px;
  font-size: 28px;
  margin: 0 auto 16px;
}

.brand b {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}

.brand span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

/* nav */
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: 13px;
  color: var(--text2);
  font-size: 14.5px;
  font-weight: 600;
  transition: all .16s ease;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid transparent;
}

.sidebar nav a span {
  font-size: 17px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: .7;
}

.sidebar nav a:hover {
  background: var(--surface2);
  color: var(--text);
  transform: translateX(2px);
}

.sidebar nav a.active {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--border2);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.sidebar nav a.active span { opacity: 1; }

/* sidebar footer */
.side-profit {
  margin-top: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface2);
  margin-bottom: 12px;
}

.side-profit span, .side-profit small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.side-profit b {
  display: block;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.05em;
  margin: 4px 0 2px;
  color: var(--text);
}

.logout {
  width: 100%;
  border: 1px solid var(--red-soft);
  border-radius: 12px;
  padding: 11px;
  background: var(--red-soft);
  color: var(--red);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: .16s;
}

.logout:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* collapsed sidebar */
.sidebar.collapsed { width: 76px; }
.sidebar.collapsed .brand div:not(.logo),
.sidebar.collapsed nav a > span + *,
.sidebar.collapsed .side-profit,
.sidebar.collapsed .logout,
.sidebar.collapsed .brand span,
.sidebar.collapsed .brand b { display: none; }
.sidebar.collapsed nav a { padding: 11px; justify-content: center; }
.sidebar.collapsed nav a span { width: auto; }

/* -- Main content --------------------------------------------- */
.main {
  margin-left: var(--sidebar-w);
  padding: 24px 30px 40px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  transition: margin-left .22s ease;
}

.sidebar.collapsed + .main { margin-left: 76px; }

/* -- Topbar --------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 18px;
  margin-bottom: 28px;
  position: sticky;
  top: 16px;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
}

/* search */
.global-search-wrap { position: relative; flex: 1; max-width: 520px; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  height: 44px;
  transition: .16s;
}

.search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
  background: var(--surface);
}

.search span { color: var(--muted); font-size: 18px; flex-shrink: 0; }

.search input {
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  font-size: 14px;
  color: var(--text);
  width: 100%;
}

.search input::placeholder { color: var(--muted); }

/* search results */
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 200;
  max-height: 400px;
  overflow-y: auto;
}

.search-results.show { display: block; }

.search-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  transition: .12s;
}

.search-item:hover { background: var(--blue-soft); }
.search-type { font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .06em; min-width: 60px; padding-top: 2px; }
.search-item b { display: block; font-size: 14px; font-weight: 600; }
.search-item small { color: var(--muted); font-size: 12px; }

/* quick actions */
.quick-actions { display: flex; align-items: center; gap: 10px; }

.circle {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--blue-end));
  color: #fff;
  font-size: 22px;
  text-decoration: none;
  box-shadow: 0 6px 18px var(--blue-ring);
  transition: .16s;
  border: 0;
  cursor: pointer;
}

.circle:hover { transform: translateY(-2px); box-shadow: 0 10px 24px var(--blue-ring); }

.muted-circle {
  background: var(--surface2) !important;
  color: var(--text2) !important;
  box-shadow: var(--shadow-sm) !important;
  border: 1px solid var(--border) !important;
}

.theme-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .14s;
}

.theme-btn:hover { background: var(--surface3); color: var(--text); }

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

.user span { font-size: 22px; }
.user b { display: block; font-size: 14px; font-weight: 700; }
.user small { display: block; color: var(--muted); font-size: 12px; }

/* -- Page header ---------------------------------------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
}

.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--blue);
  margin-bottom: 8px;
}

.page-head h1 {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -.05em;
  line-height: 1;
  color: var(--text);
}

.page-head > div > p {
  color: var(--muted);
  font-size: 15px;
  margin-top: 6px;
}

/* -- Card ----------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}

.card h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 18px;
  color: var(--text);
}

/* -- Section title -------------------------------------------- */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title h2 { margin-bottom: 0; }

.mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border2);
  white-space: nowrap;
  transition: .14s;
}

a.mini-pill:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

/* -- KPI card ------------------------------------------------- */
.kpi {
  min-height: 130px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.kpi-icon {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 19px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.kpi-icon.green  { background: var(--green-soft);  color: var(--green); }
.kpi-icon.blue   { background: var(--blue-soft);   color: var(--blue); }
.kpi-icon.violet { background: var(--violet-soft); color: var(--violet); }
.kpi-icon.orange { background: var(--amber-soft);  color: var(--amber); }
.kpi-icon.yellow { background: var(--amber-soft);  color: var(--amber); }
.kpi-icon.red    { background: var(--red-soft);    color: var(--red); }

.kpi span {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.kpi b {
  display: block;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -.05em;
  margin-top: 5px;
  color: var(--text);
}

.kpi small { color: var(--muted); font-size: 12px; margin-top: 2px; display: block; }

/* -- Grid layouts --------------------------------------------- */
.grid { display: grid; gap: 18px; }
.cards { grid-template-columns: repeat(4, 1fr); }
.two   { grid-template-columns: 1fr 1fr; }
.three { grid-template-columns: repeat(3, 1fr); }
.one   { grid-template-columns: 1fr; }

/* -- Dashboard specific --------------------------------------- */
.ref-top {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.ref-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 0;
  margin-bottom: 18px;
  overflow: hidden;
}

.ref-kpi-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-right: 1px solid var(--border);
  transition: background .14s;
}

.ref-kpi-item:last-child { border-right: 0; }
.ref-kpi-item:nth-child(5) { border-top: 1px solid var(--border); }
.ref-kpi-item:nth-child(6) { border-top: 1px solid var(--border); border-right: 1px solid var(--border); }
.ref-kpi-item:nth-child(7) { border-top: 1px solid var(--border); border-right: 1px solid var(--border); }
.ref-kpi-item:nth-child(8) { border-top: 1px solid var(--border); border-right: 0; }

.ref-kpi-item:hover { background: var(--surface2); }

.ref-kpi-item > div span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.ref-kpi-item > div b {
  display: block;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.04em;
  margin: 3px 0 2px;
  color: var(--text);
}

.ref-kpi-item > div small { font-size: 12px; color: var(--muted); }

/* 2-row KPI strip for 8 items */
@supports (grid-template-rows: auto) {
  .ref-kpi-strip {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr 1fr;
  }
}

.ref-main-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.ref-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 18px;
  align-items: start;
}

.ref-side-stack { display: flex; flex-direction: column; gap: 18px; min-width: 230px; }

/* -- Goal card ------------------------------------------------ */
.goal-card { padding: 24px; }

.ref-goal {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
}

.ref-goal label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  display: block;
}

.input-money {
  display: flex;
  align-items: center;
  border: 1px solid var(--border2);
  border-radius: 12px;
  background: var(--surface2);
  overflow: hidden;
  height: 48px;
  margin-top: 8px;
}

.input-money input {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 14px !important;
  border-radius: 0 !important;
  font-size: 18px;
  font-weight: 800;
  width: 100%;
  height: 100%;
  color: var(--text);
}

.input-money span {
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  border-left: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  background: var(--surface3);
  white-space: nowrap;
}

.ref-progress {
  height: 10px;
  background: var(--surface3);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.ref-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue-end));
  border-radius: 999px;
  transition: width .6s ease;
}

.ref-goal-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.ref-goal-numbers span {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.ref-goal-numbers span b { display: block; font-size: 17px; font-weight: 800; color: var(--text); margin-top: 3px; }

/* -- Finance grid --------------------------------------------- */
.finance-card { padding: 24px; }

.ref-finance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ref-finance-grid > div {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 14px;
}

.ref-finance-grid span {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.ref-finance-grid b {
  display: block;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.04em;
  margin-top: 5px;
  color: var(--text);
}

/* -- Chart ---------------------------------------------------- */
.chart-card { min-height: 300px; }

.ref-chart {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  height: 200px;
  margin-top: 8px;
  padding: 12px 0 0;
  position: relative;
}

.y-lines {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0;
  padding-right: 8px;
  padding-bottom: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  height: 100%;
}

.bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: calc(100% - 24px);
}

.bars i {
  flex: 1;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-end) 100%);
  min-height: 6px;
  opacity: .8;
  transition: opacity .2s;
  cursor: pointer;
}

.bars i:hover { opacity: 1; }
.bars i:nth-child(3n+2) { background: linear-gradient(180deg, var(--green) 0%, #00d4a0 100%); }
.bars i:nth-child(5n+4) { background: linear-gradient(180deg, var(--violet) 0%, #a78bfa 100%); }

.days {
  position: absolute;
  bottom: 0; left: 55px; right: 0;
  display: flex;
  gap: 6px;
}

.days span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; }

/* -- Recent sales --------------------------------------------- */
.recent-list { display: flex; flex-direction: column; gap: 6px; }

.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  transition: .14s;
}

.recent-row:hover { background: var(--blue-soft); border-color: var(--border2); }
.recent-row > div { flex: 1; min-width: 0; }
.recent-row b { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-row small { display: block; font-size: 12px; color: var(--muted); }
.recent-row strong { font-size: 15px; font-weight: 800; white-space: nowrap; }

.mini-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface3);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

/* -- Tables --------------------------------------------------- */
.table-scroll { width: 100%; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  padding: 11px 14px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
}

tr:last-child td { border-bottom: 0; }

tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface2); }

.ref-table { font-size: 13.5px; }
.ref-table th, .ref-table td { padding: 10px 12px; }

/* -- Mini insights -------------------------------------------- */
.mini-insight {
  padding: 18px 20px;
}

.mini-insight span {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.mini-insight h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.3;
}

.mini-insight b {
  display: block;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -.05em;
  margin: 8px 0 4px;
}

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

.urgent-mini { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.urgent-ico { font-size: 30px; opacity: .3; }

/* -- Activity feed -------------------------------------------- */
.activity-list { display: flex; flex-direction: column; gap: 4px; }

.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  transition: background .12s;
}

.activity-row:hover { background: var(--surface2); }

.activity-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--blue-soft);
  border: 1px solid var(--border2);
  display: grid; place-items: center;
  font-size: 14px;
  flex-shrink: 0;
  color: var(--blue);
}

.activity-row > div { flex: 1; min-width: 0; }
.activity-row b { display: block; font-size: 13.5px; font-weight: 700; }
.activity-row small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.activity-row time { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; padding-top: 2px; }

/* -- Buttons -------------------------------------------------- */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), var(--blue-end));
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--blue-ring);
  transition: .16s;
  white-space: nowrap;
  text-decoration: none;
}

.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px var(--blue-ring); }
.primary:active { transform: translateY(0); }

button, .link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: .14s;
  white-space: nowrap;
  text-decoration: none;
}

button:hover, .link:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border2);
}

.ghost {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--blue);
}

.ghost:hover { background: var(--blue-soft); border-color: var(--blue); }

.danger, button.danger {
  background: var(--red-soft) !important;
  color: var(--red) !important;
  border-color: transparent !important;
}

.danger:hover { background: var(--red) !important; color: #fff !important; }

.small { height: 32px; padding: 0 11px; font-size: 13px; }

.big {
  height: 52px !important;
  font-size: 16px !important;
  width: 100%;
  border-radius: 14px !important;
}

/* -- Forms ---------------------------------------------------- */
label {
  display: grid;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text2);
}

.check {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 600;
}

.check input { width: auto; }

input, select, textarea {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: .16s;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
  background: var(--surface);
}

textarea { height: 90px; padding: 12px 14px; resize: vertical; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.wide { grid-column: 1 / -1; }

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.stack { display: grid; gap: 14px; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 6px;
}

/* -- Toolbar -------------------------------------------------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.toolbar form { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar form input, .toolbar form select { height: 40px; font-size: 13.5px; width: auto; }

/* -- Status badges -------------------------------------------- */
.badge, .pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid var(--border2);
  white-space: nowrap;
}

.status { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.good { background: var(--green-soft); color: var(--green); border: 1px solid rgba(0,168,120,.2); }
.bad  { background: var(--red-soft);   color: var(--red);   border: 1px solid rgba(240,48,96,.2); }

.money { color: var(--green) !important; }
.danger-text { color: var(--red) !important; }
.accent-text { color: var(--blue) !important; }

/* -- Alerts --------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.ok  { background: var(--green-soft); color: var(--green); border: 1px solid rgba(0,168,120,.2); }
.err { background: var(--red-soft);   color: var(--red);   border: 1px solid rgba(240,48,96,.2); }

/* -- Empty state ---------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state > div { font-size: 40px; margin-bottom: 12px; }
.empty-state b { display: block; font-size: 16px; color: var(--text2); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* -- Product grid --------------------------------------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.product-card {
  display: flex;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: .18s;
  position: relative;
  overflow: hidden;
}

.product-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.thumb {
  width: 110px; height: 110px;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}

.thumb img { width: 88%; height: 88%; object-fit: contain; }

.product-body { flex: 1; min-width: 0; }
.product-card h3 { font-size: 15px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 6px; line-height: 1.25; }

.row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}

.mini-grid span {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.mini-grid b { display: block; color: var(--text); font-size: 14px; font-weight: 800; margin-top: 2px; }

.actions, .table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.table-actions a { text-decoration: none; }

/* -- Sale rows (form) ----------------------------------------- */
.sale-row {
  display: grid;
  grid-template-columns: 1fr 90px 130px 38px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.items-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 6px;
}

.items-title h3 { font-size: 16px; font-weight: 800; }
.items-title span { font-size: 12px; color: var(--muted); }

/* -- Drawer --------------------------------------------------- */
.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,27,53,.3);
  backdrop-filter: blur(2px);
  z-index: 150;
}

.drawer-backdrop.show { display: block; }

.sale-drawer {
  position: fixed;
  right: -520px;
  top: 16px; bottom: 16px;
  width: min(480px, calc(100vw - 28px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  padding: 24px;
  transition: right .28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  color: var(--text);
}

.sale-drawer.show { right: 16px; }

.drawer-close {
  position: absolute;
  right: 16px; top: 14px;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 20px;
  cursor: pointer;
  display: grid; place-items: center;
  color: var(--text2);
  transition: .14s;
}

.drawer-close:hover { background: var(--red-soft); color: var(--red); border-color: transparent; }

.drawer-head { padding-right: 44px; margin-bottom: 18px; }
.drawer-head h2 { font-size: 22px; font-weight: 900; letter-spacing: -.04em; }
.drawer-head p { color: var(--muted); font-size: 13px; }

.drawer-money {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.drawer-money > div {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px;
}

.drawer-money span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.drawer-money b { display: block; font-size: 20px; font-weight: 900; letter-spacing: -.04em; margin-top: 4px; }

.drawer-products { display: grid; gap: 8px; margin-bottom: 18px; }

.drawer-product {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 11px;
}

.drawer-product img { width: 46px; height: 46px; object-fit: contain; background: var(--surface2); border-radius: 10px; }
.drawer-product b { display: block; font-size: 13.5px; font-weight: 700; }
.drawer-product small { display: block; font-size: 12px; color: var(--muted); }

/* Timeline */
.time-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.time-item:last-child { border-bottom: 0; }

.time-item i {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--blue-end));
  margin-top: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.time-item b { display: block; font-size: 13.5px; font-weight: 700; }
.time-item small { display: block; font-size: 12px; color: var(--muted); }

/* -- Quick sale ----------------------------------------------- */
.quick-layout {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 22px;
  align-items: start;
}

.quick-products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-product {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  cursor: pointer;
  transition: .16s;
  position: relative;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

.quick-product:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: var(--shadow); }

.quick-product.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px var(--blue-ring);
}

.quick-product img {
  width: 56px; height: 56px;
  object-fit: contain;
  background: var(--surface2);
  border-radius: 12px;
  flex-shrink: 0;
}

.quick-product > span { flex: 1; min-width: 0; }
.quick-product b { display: block; font-size: 14px; font-weight: 800; }
.quick-product small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-product strong { font-size: 16px; font-weight: 900; white-space: nowrap; }

.stock-dot {
  position: absolute;
  right: 10px; bottom: 8px;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  padding: 3px 8px;
}

.stock-dot.low { background: var(--red-soft); color: var(--red); }

.quick-form { position: sticky; top: 108px; }

.quick-summary {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin: 14px 0;
}

.quick-summary span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.quick-summary b { display: block; font-size: 30px; font-weight: 900; letter-spacing: -.05em; margin: 4px 0 2px; }
.quick-summary small { color: var(--muted); font-size: 13px; }

/* -- Smart list (stock page) ---------------------------------- */
.smart-list { display: flex; flex-direction: column; gap: 6px; }

.smart-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface2);
  transition: background .12s;
}

.smart-row:hover { background: var(--blue-soft); border-color: var(--border2); }
.smart-row img { width: 46px; height: 46px; object-fit: contain; border-radius: 10px; background: var(--surface); }
.smart-row b { display: block; font-size: 13.5px; font-weight: 700; }
.smart-row small { font-size: 12px; color: var(--muted); }

.stock-badge {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--red-soft);
  color: var(--red);
}

/* -- Stock hero ----------------------------------------------- */
.stock-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.stock-hero h2 { font-size: 32px; font-weight: 900; letter-spacing: -.05em; margin-bottom: 6px; }

/* -- Hero section --------------------------------------------- */
.hero, .quick-hero, .clean-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hero h2 { font-size: 28px; font-weight: 900; letter-spacing: -.04em; margin-bottom: 6px; }
.hero p, .quick-hero p { color: var(--muted); font-size: 14.5px; }

.hero-actions { display: flex; gap: 10px; align-items: center; }

/* -- Line items ----------------------------------------------- */
.line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.line:last-child { border-bottom: 0; }
.line small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }

/* -- Login page ----------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 15% 15%, rgba(26,108,255,.15) 0%, transparent 40%),
    radial-gradient(circle at 88% 85%, rgba(0,180,216,.12) 0%, transparent 38%),
    var(--bg);
}

.login-shell {
  width: min(940px, 95vw);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 20px;
}

.login-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 500px;
}

.mini-logo {
  font-size: 14px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -.01em;
}

.login-preview h2 {
  font-size: 42px;
  line-height: 1.0;
  letter-spacing: -.06em;
  font-weight: 900;
  margin: 36px 0 14px;
}

.login-preview p { color: var(--muted); font-size: 16px; line-height: 1.6; }

.preview-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 28px;
}

.preview-cards > div {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.preview-cards span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.preview-cards b { display: block; font-size: 26px; font-weight: 900; letter-spacing: -.05em; margin-top: 6px; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 16px;
  align-content: center;
  text-align: center;
}

.login-card h1 { font-size: 32px; font-weight: 900; letter-spacing: -.05em; }
.login-card > p { color: var(--muted); margin-top: -6px; }
.login-card label { text-align: left; }

.login-note {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* -- Misc helpers --------------------------------------------- */
.muted, small { color: var(--muted); }

.is-hidden { display: none !important; }
.center { display: block; margin: 16px auto; }

.compact-head { margin-bottom: 20px; }
.compact-head h1 { font-size: clamp(28px, 3.5vw, 44px); }
.compact-head .eyebrow { margin-bottom: 6px; }

/* -- Responsive ----------------------------------------------- */
@media (max-width: 1400px) {
  :root { --sidebar-w: 252px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .ref-kpi-strip { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1200px) {
  .ref-top { grid-template-columns: 1fr; }
  .ref-main-grid { grid-template-columns: 1fr; }
  .ref-bottom-grid { grid-template-columns: 1fr 1fr; }
  .ref-side-stack { flex-direction: row; }
  .quick-layout { grid-template-columns: 1fr; }
  .quick-form { position: static; }
}

@media (max-width: 980px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: relative;
    width: 100% !important;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    border-radius: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .sidebar nav a { flex-shrink: 0; padding: 9px 12px; }
  .brand { padding: 0 8px 0 0; border-bottom: 0; margin-bottom: 0; }
  .side-profit, .sidebar form { display: none; }
  .main { margin-left: 0 !important; }
  .topbar { height: auto; flex-wrap: wrap; padding: 12px; border-radius: 16px; }
  .search { max-width: 100%; width: 100%; }
}

@media (max-width: 720px) {
  .main { padding: 16px; }
  .cards, .ref-kpi-strip { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .ref-bottom-grid, .ref-side-stack { grid-template-columns: 1fr; flex-direction: column; }
  .quick-products { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-preview { display: none; }
  .ref-finance-grid { grid-template-columns: 1fr 1fr; }
  .ref-goal-numbers { grid-template-columns: 1fr; }
  .sale-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .topbar { top: 8px; }
  .drawer-money { grid-template-columns: 1fr; }
}

/* -- Activity compact ----------------------------------------- */
.activity-card { padding: 20px; }
.activity-card .section-title { margin-bottom: 12px; }
