@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg:        #F7F5F1;
  --bg2:       #EFECE6;
  --teal:      #0E6E6E;
  --teal-dark: #0A5252;
  --teal-mid:  #1A7A6E;
  --teal-light:#E8F4F3;
  --teal-pale: #C8E8E6;
  --tan:       #C4956A;
  --tan-dark:  #8A5530;
  --tan-light: #F3EEE8;
  --ink:       #1A2E2E;
  --ink2:      #2E4A4A;
  --muted:     #6A9090;
  --gray:      #9AADAD;
  --gray-light:#D8E4E4;
  --white:     #FFFFFF;
  --shadow:    rgba(14,110,110,0.12);
  --red:       #C0392B;
  --orange:    #D68910;
  --green:     #1A7A4A;
  --sidebar-w: 240px;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 500; color: var(--ink); line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.8rem); }
h3 { font-size: 1.15rem; }
p  { color: var(--ink2); }
a  { color: var(--teal); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--teal-dark); }

/* ── SIDEBAR LAYOUT ─────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: #0B3B3B;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 16px 16px;
  flex-shrink: 0;
  position: relative;
}
.sidebar-logo::after {
  content: '';
  position: absolute;
  bottom: 0; left: 16px; right: 16px;
  height: 1px;
  background: linear-gradient(90deg, rgba(196,149,106,0.4) 0%, rgba(255,255,255,0.04) 100%);
}

.sidebar-logo-img {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255,255,255,0.10);
  border: 1.5px solid rgba(196,149,106,0.35);
  padding: 5px;
  flex-shrink: 0;
}
.sidebar-logo-placeholder {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(196,149,106,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #C4956A;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 1px;
  flex-shrink: 0;
  user-select: none;
}

.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--white);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0.2px;
}

.sidebar-brand-sub {
  font-size: 9.5px;
  color: rgba(196,149,106,0.65);
  letter-spacing: 0.8px;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.8px;
  color: rgba(255,255,255,0.22);
  padding: 14px 10px 5px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border: none;
  background: none;
  font-family: var(--font-body);
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item:hover {
  color: rgba(255,255,255,0.88);
  background: rgba(255,255,255,0.06);
}

.nav-item.active {
  color: var(--white);
  background: rgba(255,255,255,0.09);
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: #C4956A;
  border-radius: 0 3px 3px 0;
}

.nav-item svg { flex-shrink: 0; opacity: 0.6; transition: opacity 0.15s; }
.nav-item.active svg,
.nav-item:hover svg { opacity: 1; }

.nav-item-soon { opacity: 0.35; cursor: not-allowed; }
.nav-item-soon:hover { background: none !important; color: rgba(255,255,255,0.35) !important; }

.soon-badge {
  margin-left: auto;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(196,149,106,0.2);
  color: var(--tan);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.nav-logout:hover {
  color: #FF8A80 !important;
  background: rgba(192,57,43,0.12) !important;
}

.sidebar-footer {
  padding: 8px 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

/* ── Collapsible nav groups ──────────────────────────────────── */
.nav-group { margin-bottom: 2px; }

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.nav-group-header:hover { background: rgba(255,255,255,0.05); }

.nav-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
}
.nav-group.open .nav-group-label { color: rgba(255,255,255,0.55); }

.nav-group-arrow {
  color: rgba(255,255,255,0.25);
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
}
.nav-group.open .nav-group-arrow { transform: rotate(180deg); color: rgba(255,255,255,0.4); }

.nav-group-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.22s ease;
}
.nav-group.open .nav-group-items { max-height: 400px; }

.nav-sub {
  padding-left: 20px !important;
  font-size: 12.5px !important;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #0E4F4F;
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.mobile-brand {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--white);
}

.page-content {
  padding: 36px 40px 80px;
  flex: 1;
}

/* ── UTILITIES ───────────────────────────────────────────────── */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--tan);
  margin-bottom: 6px;
  display: block;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-teal   { background: var(--teal-light); color: var(--teal-dark); }
.badge-tan    { background: var(--tan-light);  color: var(--tan-dark);  }
.badge-red    { background: rgba(192,57,43,0.1);  color: var(--red);   }
.badge-orange { background: rgba(214,137,16,0.1); color: var(--orange); }
.badge-green  { background: rgba(26,122,74,0.1);  color: var(--green);  }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.card-teal { background: var(--teal-light); border-color: rgba(14,110,110,0.2); }
.card-tan  { background: var(--tan-light);  border-color: rgba(196,149,106,0.25); }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary   { background: var(--teal);       color: var(--white); }
.btn-primary:hover { background: var(--teal-dark); color: var(--white); }
.btn-secondary { background: var(--teal-light); color: var(--teal-dark); border: 1px solid rgba(14,110,110,0.2); }
.btn-secondary:hover { background: var(--teal-pale); }
.btn-tan       { background: var(--tan);  color: var(--white); }
.btn-tan:hover { background: var(--tan-dark); }
.btn-ghost     { background: transparent; color: var(--muted); border: 1px solid var(--gray-light); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-danger    { background: transparent; color: var(--red); border: 1px solid rgba(192,57,43,0.2); }
.btn-danger:hover { background: rgba(192,57,43,0.06); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 12px; font-weight: 600; letter-spacing: 0.5px; color: var(--ink); text-transform: uppercase; }

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white);
  transition: border-color var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,110,110,0.08);
}
textarea { resize: vertical; min-height: 80px; }

/* ── DIVIDER ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--gray-light); margin: 20px 0; }

/* ── STICKY TABLE HEADERS ────────────────────────────────────── */
thead th { position: sticky; top: 0; z-index: 2; }

/* ── TOAST ───────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--white); background: var(--ink); box-shadow: 0 4px 20px rgba(0,0,0,0.15); animation: toastIn 0.3s ease forwards; }
.toast.success { background: var(--teal); }
.toast.error   { background: var(--red);  }
@keyframes toastIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(26,46,46,0.5); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--white); border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 500px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); transform: translateY(16px); transition: transform 0.25s ease; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.modal-close { width: 28px; height: 28px; border-radius: 50%; border: none; background: var(--bg2); color: var(--muted); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.modal-close:hover { background: var(--gray-light); color: var(--ink); }

/* ── LOADING ─────────────────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 40px; color: var(--muted); font-size: 14px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--gray-light); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: 0.4; display: block; }
.empty-state h3 { font-size: 1rem; color: var(--muted); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; }

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── PRINT ───────────────────────────────────────────────────── */
@media print {
  .sidebar, .mobile-topbar, .sidebar-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 20px !important; }
  body { background: white; }
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .mobile-topbar { display: flex; }
  .page-content { padding: 20px 14px 72px; }

  /* Modal → bottom sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px 16px 28px;
    max-width: 100% !important;
    max-height: 92vh;
    overflow-y: auto;
  }

  /* Stats bars: wrap to 2-column grid */
  .stats-bar { flex-wrap: wrap; }
  .stats-bar .stat-item {
    flex: 0 0 50%;
    border-right: 1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .stats-bar .stat-item:nth-child(2n) { border-right: none; }

  /* Modal form grids: single column */
  .modal-grid { grid-template-columns: 1fr !important; }
  .modal-grid .full { grid-column: 1 !important; }

  /* Page header: stack title + action button */
  .page-header { flex-direction: column; gap: 10px; }
  .page-header > a.btn,
  .page-header > button.btn { width: 100%; justify-content: center; }

  /* Toast: full-width centered at bottom */
  .toast-container { right: 14px; left: 14px; bottom: 16px; }

  /* Buttons: comfortable touch targets */
  .btn { min-height: 42px; }
  .btn-sm { min-height: 34px; }

  /* Overflow tables: enable smooth touch scroll */
  .sku-table-wrap,
  #orders-container { -webkit-overflow-scrolling: touch; }

  /* Typography: tighten on small screens */
  h1 { font-size: clamp(1.5rem, 6vw, 2rem); }
}
