@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300..700;14..32,800;14..32,900&display=swap');

:root {
  --bg: #f8f3ed;
  --bg-gradient: radial-gradient(ellipse at 50% 0%, #f3ece3 0%, #f8f3ed 70%);
  --card: #ffffff;
  --text: #1a1613;
  --text-secondary: #6b5e52;
  --muted: #9a8b7c;
  --line: #e0d6cb;
  --line-light: #ede6dc;
  --primary: #c8922e;
  --primary-rgb: 200, 146, 46;
  --primary-hover: #b07d24;
  --primary-light: rgba(200, 146, 46, 0.08);
  --accent: #872642;
  --accent-rgb: 135, 38, 66;
  --accent-hover: #6e1e35;
  --accent-light: rgba(135, 38, 66, 0.08);
  --danger: #9a2b58;
  --danger-rgb: 154, 43, 88;
  --danger-light: rgba(154, 43, 88, 0.08);
  --success: #1a7244;
  --success-rgb: 26, 114, 68;
  --success-light: rgba(26, 114, 68, 0.08);
  --warning: #a67c00;
  --warning-rgb: 166, 124, 0;
  --warning-light: rgba(166, 124, 0, 0.08);
  --gem-ruby: #872642;
  --gem-emerald: #1a7244;
  --gem-sapphire: #1b3a6b;
  --gem-amethyst: #6b3fa0;
  --gem-topaz: #c8922e;
  --sidebar-bg: #ece4d8;
  --sidebar-text: #29251f;
  --sidebar-hover: #e1d7c8;
  --sidebar-active: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 20px -2px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.06), 0 10px 10px -5px rgba(0,0,0,0.04);
  --shadow-xl: 0 30px 50px -12px rgba(0,0,0,0.08);
  --shadow-gold: 0 4px 20px rgba(200, 146, 46, 0.2);
  --border-radius-card: 16px;
  --border-radius-input: 10px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0c0a09;
  --bg-gradient: radial-gradient(ellipse at 50% 0%, #14100d 0%, #0c0a09 70%);
  --card: #15110e;
  --text: #ede8e2;
  --text-secondary: #9a8b7c;
  --muted: #6b5e52;
  --line: #26211c;
  --line-light: #1c1814;
  --primary: #d4a53a;
  --primary-rgb: 212, 165, 58;
  --primary-hover: #e0b84a;
  --primary-light: rgba(212, 165, 58, 0.1);
  --accent: #c43a5e;
  --accent-rgb: 196, 58, 94;
  --accent-hover: #d84c70;
  --accent-light: rgba(196, 58, 94, 0.1);
  --danger: #ef4444;
  --danger-rgb: 239, 68, 68;
  --danger-light: rgba(239, 68, 68, 0.1);
  --success: #1a9b5a;
  --success-rgb: 26, 155, 90;
  --success-light: rgba(26, 155, 90, 0.1);
  --warning: #e8b800;
  --warning-rgb: 232, 184, 0;
  --warning-light: rgba(232, 184, 0, 0.1);
  --gem-ruby: #c43a5e;
  --gem-emerald: #1a9b5a;
  --gem-sapphire: #3b6fc4;
  --gem-amethyst: #8b5cf6;
  --gem-topaz: #d4a53a;
  --sidebar-bg: #100d0b;
  --sidebar-text: #e5e7eb;
  --sidebar-hover: #1c1814;
  --sidebar-active: #1f1a16;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.6);
  --shadow-xl: 0 30px 60px rgba(0,0,0,0.7);
  --shadow-gold: 0 4px 24px rgba(212, 165, 58, 0.15);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

html { scroll-behavior: smooth; }

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(var(--primary-rgb), 0.25);
  color: var(--text);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
}

/* ─── Layout ─── */

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  transition: grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.layout.menu-hidden { grid-template-columns: 0 minmax(0, 1fr); }

/* ─── Sidebar ─── */

.sidebar {
  background: var(--sidebar-bg);
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--line);
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.menu-hidden .sidebar { transform: translateX(-100%); }

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  min-width: 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #e8c86a, var(--primary));
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35), inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo::before {
  content: '◆';
  font-size: 18px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
  z-index: 1;
}

.logo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.5) 45%, rgba(255,255,255,0.6) 50%, transparent 55%);
  animation: diamondShine 2.5s ease-in-out infinite;
}

@keyframes diamondShine {
  0% { transform: translate(-60%, -60%) rotate(25deg) scale(1.5); }
  30% { transform: translate(-10%, -10%) rotate(25deg) scale(1); }
  60% { transform: translate(10%, 10%) rotate(25deg) scale(1); }
  100% { transform: translate(60%, 60%) rotate(25deg) scale(1.5); }
}

.brand-copy strong {
  font-size: 17px;
  letter-spacing: 0.5px;
  font-weight: 800;
  color: var(--text);
  display: block;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-copy .muted { font-size: 11px; color: var(--muted); }

.hide-menu {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
  line-height: 1;
}
.hide-menu:hover { background: var(--line); }

.show-menu {
  display: none;
  position: fixed;
  left: 14px;
  top: 14px;
  z-index: 40;
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
  transition: transform var(--transition), background var(--transition);
}
.show-menu:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.mobile-sales-btn {
  display: none;
  position: fixed;
  left: 14px;
  top: 68px;
  z-index: 40;
  border: 0;
  background: #7c3aed;
  color: #fff;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  transition: transform var(--transition), background var(--transition);
}
.mobile-sales-btn:hover {
  background: #6d28d9;
  transform: scale(1.05);
  color: #fff;
}
.mobile-sales-btn:active { transform: scale(0.95); }
.menu-hidden .mobile-sales-btn { display: block; }
.menu-hidden .show-menu { display: block; }

/* ─── Navigation ─── */

.nav { flex: 1; min-width: 0; }

.nav-group {
  border-top: 1px solid var(--line);
  padding: 8px 0;
}

.nav-group summary {
  cursor: pointer;
  padding: 10px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color var(--transition);
  user-select: none;
}
.nav-group summary::before {
  content: '◇';
  font-size: 8px;
  margin-right: 6px;
  color: var(--primary);
  opacity: 0.5;
  transition: opacity var(--transition);
}
.nav-group summary:hover { color: var(--text); }
.nav-group summary:hover::before { opacity: 1; }
.nav-group[open] > summary::before { content: '◆'; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  transition: transform 0.2s;
}
.nav-group[open] summary::after { transform: rotate(180deg); }

.nav-group a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--border-radius-input);
  margin: 3px 0;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  transition: background var(--transition), color var(--transition), padding-left var(--transition);
  min-width: 0;
  position: relative;
}

.nav-group a:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
  padding-left: 16px;
}

.nav-group a.active {
  background: var(--sidebar-active);
  color: var(--primary);
  font-weight: 700;
  box-shadow: var(--shadow-sm), 0 0 10px rgba(var(--primary-rgb), 0.05);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--border-radius-input) var(--border-radius-input) 0;
}

/* ─── User Card ─── */

.user-card {
  margin-top: auto;
  padding: 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  transition: background 0.3s, border-color 0.3s;
}
.user-card strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.user-card .muted {
  flex: 0 0 100%;
  margin-top: -4px;
  font-size: 11px;
}
.user-logout {
  font-size: 12px;
  color: var(--danger);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(var(--danger-rgb), 0.2);
  transition: background var(--transition), border-color var(--transition);
}
.user-logout:hover {
  background: var(--danger-light);
  border-color: rgba(var(--danger-rgb), 0.3);
  text-decoration: none;
}

/* ─── Theme Toggle ─── */

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background var(--transition), transform var(--transition);
  width: 100%;
}
.theme-toggle-btn:hover {
  background: var(--sidebar-hover);
  transform: translateY(-1px);
}

/* ─── Main Content ─── */

.main {
  padding: 62px 30px 30px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  transition: padding 0.3s;
  animation: fadeSlideIn 0.35s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Cards ─── */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  box-shadow: var(--shadow-md);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, background-color 0.3s, border-color 0.3s;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  position: relative;
}

.card.pad { padding: 24px; overflow-x: auto; }

.card:hover {
  box-shadow: var(--shadow-lg), var(--shadow-gold);
  border-color: rgba(var(--primary-rgb), 0.2);
}

/* ─── KPI Cards ─── */

.kpi {
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
  opacity: 0.6;
}
.kpi::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
}
.kpi:hover::after { transform: scaleX(1); }
.kpi:hover {
   transform: translateY(-3px);
   box-shadow: var(--shadow-lg);
}
a.kpi { cursor: pointer; text-decoration: none; color: inherit; display: block; }
a.kpi:hover { text-decoration: none; color: inherit; }

.kpi h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.kpi strong {
  font-size: 30px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
}

/* ─── Grid ─── */

.grid {
  display: grid;
  gap: 24px;
  min-width: 0;
  max-width: 100%;
}
.grid.two { grid-template-columns: 1fr; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ─── Top Bar ─── */

.topbar {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--card);
  box-shadow: var(--shadow-md);
  position: relative;
}
.topbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  border-radius: 0 0 2px 2px;
}
.title h2 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.title p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ─── Tables ─── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--border-radius-input);
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 0;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-light);
  text-align: left;
  font-size: 14px;
}

th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.06), rgba(var(--primary-rgb), 0.02));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}

td { color: var(--text); }

tbody tr { transition: background-color 0.15s; }
tbody tr:nth-child(even) { background: rgba(var(--primary-rgb), 0.02); }
tbody tr:hover { background: var(--primary-light); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Forms ─── */

input, select, textarea, button {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
}

input, select, textarea {
   width: 100%;
   padding: 12px 16px;
   border: 1px solid var(--line);
   border-radius: var(--border-radius-input);
   background: var(--card);
   color: var(--text);
   transition: border-color var(--transition), box-shadow var(--transition), background-color 0.3s;
   min-width: 0;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12), 0 1px 2px rgba(0,0,0,0.05);
}

::placeholder { color: var(--muted); opacity: 0.7; }

/* ─── Buttons ─── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: var(--border-radius-input);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  gap: 8px;
  user-select: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.35);
}

.btn-light {
  background: var(--sidebar-bg);
  border-color: var(--line);
}
.btn-light:hover { background: var(--line); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(var(--danger-rgb), 0.25);
}
.btn-danger:hover {
  background: #b83260;
  box-shadow: 0 6px 16px rgba(var(--danger-rgb), 0.35);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition);
  flex: 0 0 auto;
}
.icon-btn:hover {
  background: var(--line);
  transform: scale(1.05);
}
.icon-btn.primary {
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.2);
}
.icon-btn.primary:hover { background: var(--primary-hover); }

/* ─── Form Grid ─── */

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.form-grid label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.form-grid label input,
.form-grid label select,
.form-grid label textarea {
  margin-top: 6px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
}

/* ─── Utilities ─── */

.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  min-width: 0;
}
.head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.tag {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  background: var(--accent-light);
  color: var(--accent);
}
.tag-ruby {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.15);
}
.tag-emerald {
  background: var(--success-light);
  color: var(--success);
  border-color: rgba(var(--success-rgb), 0.15);
}
.tag-sapphire {
  background: rgba(27, 58, 107, 0.1);
  color: var(--gem-sapphire);
  border-color: rgba(27, 58, 107, 0.15);
}
.tag-amethyst {
  background: rgba(107, 63, 160, 0.1);
  color: var(--gem-amethyst);
  border-color: rgba(107, 63, 160, 0.15);
}
.tag-topaz {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.15);
}
.tag-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.15);
}
.tag-success {
  background: var(--success-light);
  color: var(--success);
  border-color: rgba(var(--success-rgb), 0.15);
}
.tag-warning {
  background: var(--warning-light);
  color: var(--warning);
  border-color: rgba(var(--warning-rgb), 0.15);
}

.flash {
  margin-bottom: 24px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(var(--success-rgb), 0.2);
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: flashIn 0.35s ease;
}

@keyframes flashIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.muted { color: var(--muted); }
.text-secondary { color: var(--text-secondary); }

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.small { font-size: 12px; color: var(--text-secondary); }

.inline-form { display: grid; gap: 14px; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ─── Jewel Sparkle ─── */

.sparkle {
  position: relative;
}
.sparkle::after {
  content: '✦';
  position: absolute;
  font-size: 8px;
  color: var(--primary);
  opacity: 0.5;
  animation: float 3s ease-in-out infinite;
  pointer-events: none;
}

.gold-text {
  background: linear-gradient(135deg, var(--primary), #e8c86a, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gold-border {
  border: 1px solid rgba(var(--primary-rgb), 0.3) !important;
  box-shadow: var(--shadow-gold);
}

/* ─── Sales Cards ─── */

.sales-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}
.sales-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px 40px;
  border-radius: 20px;
  text-decoration: none;
  color: #fff;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, box-shadow 0.25s ease;
  min-height: 280px;
}
.sales-card:active { transform: scale(0.96); }
.sales-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.08);
  opacity: 0;
  transition: opacity 0.2s;
}
.sales-card:hover::after { opacity: 1; }

.sales-card--estimate {
  background: linear-gradient(145deg, #d4a847, #b8922e);
  box-shadow: 0 8px 30px rgba(212, 168, 71, 0.35);
}
.sales-card--gold {
  background: linear-gradient(145deg, #c97f2a, #a8661f);
  box-shadow: 0 8px 30px rgba(201, 127, 42, 0.35);
}
.sales-card--billing {
  background: linear-gradient(145deg, #0f8a8c, #0b6d6f);
  box-shadow: 0 8px 30px rgba(15, 138, 140, 0.35);
}
.sales-card--customers {
  background: linear-gradient(145deg, #2563eb, #1a4bbf);
  box-shadow: 0 8px 30px rgba(37, 99, 235, 0.35);
}
.sales-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  color: #fff;
}

.sales-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.2);
  flex: 0 0 auto;
}
.sales-icon svg { width: 26px; height: 26px; stroke: #fff; }

.sales-card h3 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}
.sales-card p {
  margin: 0 0 24px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
  max-width: 240px;
  font-weight: 500;
}

.sales-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: 999px;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.2s, gap 0.2s;
  backdrop-filter: blur(4px);
}
.sales-card:hover .sales-cta {
  background: rgba(255,255,255,0.3);
  gap: 10px;
}

/* ─── Print / Invoice ─── */

.bar {
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.bar button, .bar a {
  padding: 10px 20px;
  border-radius: var(--border-radius-input);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
  text-decoration: none;
}
.bar button:hover, .bar a:hover {
  background: var(--sidebar-bg);
  transform: translateY(-1px);
}

/* ─── Login Page ─── */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(var(--primary-rgb), 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(var(--accent-rgb), 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  background: var(--card);
  padding: 40px;
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xl);
  width: min(420px, 92vw);
  text-align: center;
  position: relative;
  animation: fadeSlideIn 0.5s ease;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 24px 24px 0 0;
}

.login-card .logo-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #e8c86a, var(--primary), var(--accent));
  background-size: 200% 200%;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.35), var(--shadow-gold);
  position: relative;
  overflow: hidden;
  animation: shimmer 4s ease-in-out infinite;
}
.login-card .logo-large::before {
  content: '◆';
  font-size: 26px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 1;
}
.login-card .logo-large::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.5) 45%, rgba(255,255,255,0.6) 50%, transparent 55%);
  animation: diamondShine 2.5s ease-in-out infinite;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
}
.login-card p {
  color: var(--text-secondary);
  margin: 0 0 28px;
  font-size: 14px;
}
.login-card input {
  margin-bottom: 16px;
  padding: 14px 16px;
}
.login-card button { margin-top: 8px; width: 100%; padding: 14px; font-size: 15px; }

.msg {
  color: var(--danger);
  background: var(--danger-light);
  border: 1px solid rgba(var(--danger-rgb), 0.2);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 500;
  animation: flashIn 0.3s ease;
}

.captcha-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

/* ─── Badge / Status ─── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ─── Divider ─── */

.divider {
  height: 1px;
  background: var(--line);
  margin: 24px 0;
  border: 0;
}

/* ─── Animations ─── */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideLeft {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25); }
  50% { box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.45); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes skeleton {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%) scale(0.9); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(100%) scale(0.9); }
}

/* ─── Animation Utility Classes ─── */

.anim-fade-in { animation: fadeIn 0.4s ease; }
.anim-slide-up { animation: slideUp 0.4s ease; }
.anim-slide-down { animation: slideDown 0.4s ease; }
.anim-slide-left { animation: slideLeft 0.4s ease; }
.anim-slide-right { animation: slideRight 0.4s ease; }
.anim-scale-in { animation: scaleIn 0.3s ease; }
.anim-drop-in { animation: dropIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.anim-pulse { animation: pulse 2s ease-in-out infinite; }
.anim-float { animation: float 3s ease-in-out infinite; }
.anim-breathe { animation: breathe 2s ease-in-out infinite; }
.anim-spin { animation: spin 1s linear infinite; }

.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }
.anim-delay-4 { animation-delay: 0.4s; }
.anim-delay-5 { animation-delay: 0.5s; }

.anim-duration-fast { animation-duration: 0.2s; }
.anim-duration-slow { animation-duration: 0.6s; }

/* ─── Staggered Children ─── */

.stagger > * {
  opacity: 0;
  animation: slideUp 0.4s ease forwards;
}
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }
.stagger > *:nth-child(9) { animation-delay: 0.45s; }
.stagger > *:nth-child(10) { animation-delay: 0.5s; }

/* ─── Apply Animations to Elements ─── */

.topbar { animation: slideUp 0.4s ease; }

.card { animation: slideUp 0.4s ease; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }

table tbody tr {
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}
table tbody tr:nth-child(1) { animation-delay: 0.03s; }
table tbody tr:nth-child(2) { animation-delay: 0.06s; }
table tbody tr:nth-child(3) { animation-delay: 0.09s; }
table tbody tr:nth-child(4) { animation-delay: 0.12s; }
table tbody tr:nth-child(5) { animation-delay: 0.15s; }
table tbody tr:nth-child(6) { animation-delay: 0.18s; }
table tbody tr:nth-child(7) { animation-delay: 0.21s; }
table tbody tr:nth-child(8) { animation-delay: 0.24s; }
table tbody tr:nth-child(9) { animation-delay: 0.27s; }
table tbody tr:nth-child(10) { animation-delay: 0.3s; }
table tbody tr:nth-child(11) { animation-delay: 0.33s; }
table tbody tr:nth-child(12) { animation-delay: 0.36s; }
table tbody tr:nth-child(13) { animation-delay: 0.39s; }
table tbody tr:nth-child(14) { animation-delay: 0.42s; }
table tbody tr:nth-child(15) { animation-delay: 0.45s; }
table tbody tr:nth-child(16) { animation-delay: 0.48s; }

.sales-card:nth-child(1) { animation: slideUp 0.5s ease 0.05s both; }
.sales-card:nth-child(2) { animation: slideUp 0.5s ease 0.15s both; }
.sales-card:nth-child(3) { animation: slideUp 0.5s ease 0.25s both; }
.sales-card:nth-child(4) { animation: slideUp 0.5s ease 0.35s both; }

.kpi {
  animation: slideUp 0.4s ease both;
}
.kpi:nth-child(1) { animation-delay: 0.05s; }
.kpi:nth-child(2) { animation-delay: 0.1s; }
.kpi:nth-child(3) { animation-delay: 0.15s; }
.kpi:nth-child(4) { animation-delay: 0.2s; }

.flash {
  animation: dropIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  animation: breathe 3s ease-in-out infinite;
}

.sales-card {
  animation: slideUp 0.5s ease both;
}

.user-logout {
  position: relative;
  overflow: hidden;
}
.user-logout::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.user-logout:hover::after { opacity: 1; }

/* ─── Skeleton Loading ─── */

.skeleton {
  background: linear-gradient(90deg, var(--line-light) 25%, var(--line) 50%, var(--line-light) 75%);
  background-size: 200px 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
  border: none !important;
}

/* ─── Loading Spinner ─── */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* ─── Page Transition Overlay ─── */

.page-enter { animation: fadeSlideIn 0.35s ease; }

/* ─── Toast / Notification ─── */

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 14px;
}
.toast.removing { animation: toastOut 0.3s ease forwards; }

/* ─── Progress Bar ─── */

.progress {
  height: 4px;
  border-radius: 999px;
  background: var(--line-light);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Responsive ─── */

@media (max-width: 900px) {
  .sales-grid { grid-template-columns: repeat(2, 1fr); }
  .grid.four { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .sales-grid { grid-template-columns: 1fr; gap: 14px; }
  .sales-card { padding: 32px 20px 28px; min-height: 200px; border-radius: 16px; }
  .sales-icon { width: 44px; height: 44px; border-radius: 12px; }
  .sales-icon svg { width: 22px; height: 22px; }
  .sales-card h3 { font-size: 19px; }
  .grid.four { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
  .layout, .layout.menu-hidden { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 0 0 20px rgba(0,0,0,0.15);
  }

  .layout.menu-hidden .sidebar { transform: translateX(-100%); }
  .layout:not(.menu-hidden) .sidebar { transform: translateX(0); }
  .layout.menu-hidden .show-menu { display: block; }
  .layout:not(.menu-hidden) .show-menu { display: none; }

  .grid.two, .grid.three, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }

  .main { padding: 102px 16px 24px; }

  .rate-ticker { left: 0; }

  th, td { padding: 12px; }
}
