:root {
  --bg: #f8f5f0;
  --surface: #ffffff;
  --surface-alt: #f3ede3;
  --sidebar: #161210;
  --sidebar-hover: #241e1a;
  --text: #1e1916;
  --text-muted: #6e635b;
  --gold: #c89b57;
  --gold-dark: #a87b38;
  --gold-light: #f6ecd9;
  --rose: #d6456b;
  --rose-light: #fcebef;
  --emerald: #1f8f6b;
  --emerald-light: #e4f6f0;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --purple: #7c4dff;
  --purple-light: #f0ebff;
  --wa-green: #25d366;
  --wa-dark: #075e54;
  --wa-chat-bg: #efeae2;
  --border: #e6dfd5;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(22, 18, 16, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  font-size: 14px;
  overflow-x: hidden;
}

/* Layout */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: #f4efe8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid #2b231e;
  z-index: 40;
}

.brand-box {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(200, 155, 87, 0.22);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-monogram {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d8af6c, #a57532);
  color: #161210;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(200, 155, 87, 0.35);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.4px;
}

.brand-sub {
  font-size: 11px;
  color: #c89b57;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.season-pill-sidebar {
  margin: 12px 14px 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(200, 155, 87, 0.14);
  border: 1px solid rgba(200, 155, 87, 0.3);
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}
.season-pill-sidebar:hover {
  background: rgba(200, 155, 87, 0.24);
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #8c7f75;
  padding: 14px 18px 6px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin: 2px 10px;
  border-radius: 9px;
  color: #d6cdc2;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  border: none;
  background: transparent;
  width: calc(100% - 20px);
  text-align: left;
  font-size: 13.5px;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, #c89b57, #b2833e);
  color: #161210;
  font-weight: 700;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 700;
}
.nav-item.active .nav-badge {
  background: #161210;
  color: #f6ecd9;
}
.nav-badge.rose {
  background: var(--rose);
  color: #fff;
}
.nav-badge.wa {
  background: var(--wa-green);
  color: #062b16;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid #2b231e;
  font-size: 12px;
  color: #9b8e83;
}

/* Main Content Area */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.topbar-title p {
  font-size: 12px;
  color: var(--text-muted);
}

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

.page-content {
  padding: 22px 24px 48px;
  max-width: 1600px;
  width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-alt);
}
.btn-primary {
  background: linear-gradient(135deg, #c89b57, #a87b38);
  color: #fff;
  border-color: #a87b38;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #b98b46, #94692b);
  color: #fff;
}
.btn-dark {
  background: #1e1916;
  color: #f6ecd9;
  border-color: #1e1916;
}
.btn-dark:hover {
  background: #332b26;
}
.btn-wa {
  background: #1fa855;
  color: #fff;
  border-color: #188c45;
}
.btn-wa:hover {
  background: #178a44;
  color: #fff;
}
.btn-rose {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold);
}
.kpi-card.rose::before { background: var(--rose); }
.kpi-card.emerald::before { background: var(--emerald); }
.kpi-card.purple::before { background: var(--purple); }
.kpi-card.wa::before { background: var(--wa-green); }

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.kpi-val {
  font-size: 24px;
  font-weight: 800;
  margin: 6px 0 4px;
  color: var(--text);
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.grid-pos {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  align-items: start;
}
.grid-wa-studio {
  display: grid;
  grid-template-columns: 300px 1fr 360px;
  gap: 18px;
  align-items: start;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text);
}
.badge-gold { background: var(--gold-light); color: #7d5618; }
.badge-rose { background: var(--rose-light); color: #a32244; }
.badge-emerald { background: var(--emerald-light); color: #116147; }
.badge-amber { background: var(--amber-light); color: #92400e; }
.badge-purple { background: var(--purple-light); color: #512da8; }

.subtabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  background: var(--surface);
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.subtab {
  padding: 8px 14px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.subtab:hover {
  background: var(--surface-alt);
  color: var(--text);
}
.subtab.active {
  background: #1e1916;
  color: #f6ecd9;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:hover td {
  background: rgba(200, 155, 87, 0.04);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
input, select, textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 155, 87, 0.18);
}

/* Variable Chips */
.var-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}
.var-chip {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--gold-light);
  color: #6b4812;
  border: 1px solid rgba(200, 155, 87, 0.4);
  cursor: pointer;
  font-family: monospace;
  font-weight: 600;
}
.var-chip:hover {
  background: var(--gold);
  color: #fff;
}

/* WhatsApp Phone Simulator */
.wa-phone {
  background: #111;
  border-radius: 28px;
  padding: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  border: 3px solid #2c2c2c;
}
.wa-screen {
  background: var(--wa-chat-bg);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 450px;
}
.wa-topbar {
  background: var(--wa-dark);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wa-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: #161210;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.wa-chat-area {
  padding: 16px 12px;
  flex: 1;
  background-image: radial-gradient(rgba(0,0,0,0.04) 1px, transparent 0);
  background-size: 16px 16px;
}
.wa-bubble {
  background: #ffffff;
  border-radius: 0 12px 12px 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  color: #111b21;
  white-space: pre-wrap;
  word-break: break-word;
}
.wa-bubble-header {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 8px;
  color: #075e54;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 6px;
}
.wa-bubble-footer {
  margin-top: 8px;
  font-size: 11px;
  color: #667781;
}
.wa-bubble-time {
  text-align: right;
  font-size: 10px;
  color: #667781;
  margin-top: 4px;
}
.wa-btn-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wa-cta-btn {
  background: #ffffff;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  color: #00a884;
  font-weight: 600;
  font-size: 12.5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Season Banner */
.season-hero {
  background: linear-gradient(135deg, #1d1714 0%, #31251e 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(200, 155, 87, 0.4);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 10, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 5;
}
.modal-body {
  padding: 20px;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-alt);
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #161210;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  border-left: 4px solid var(--gold);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  max-width: 380px;
}

@media (max-width: 1100px) {
  .grid-wa-studio, .grid-pos, .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: auto;
    position: relative;
  }
}
