:root {
  --emerald-950: #06280E;
  --emerald-900: #093915;
  --emerald-800: #11692B;
  --emerald-700: #147800;
  --emerald-100: #E8F6EB;
  --emerald-50: #F4FBF5;
  --gold-500: #F5B82E;
  --gold-200: #FBE4A4;
  --crimson-600: #C8102E;
  --crimson-700: #A50D26;
  --porcelain: #F5F7F5;
  --surface: #FFFFFF;
  --ink-900: #0F172A;
  --ink-600: #475569;
  --ink-400: #94A3B8;
  --line: #DDE7DF;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-soft: 0 12px 32px rgba(9, 57, 21, 0.07);
  --ease-lux: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif; background: var(--porcelain); color: var(--ink-900); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; transition: transform 140ms var(--ease-lux), background-color 160ms var(--ease-lux), border-color 160ms var(--ease-lux); }
button:active { transform: scale(0.975); }

.hidden { display: none !important; }

/* Login Gate */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top right, rgba(245, 184, 46, 0.16), transparent 40%),
              linear-gradient(135deg, var(--emerald-950) 0%, var(--emerald-900) 55%, var(--emerald-800) 100%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 26px;
  padding: 32px;
  border: 2px solid var(--gold-500);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.32);
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-logo img { height: 38px; object-fit: contain; }
.auth-title { margin: 0 0 6px; font-size: 22px; font-weight: 900; color: var(--emerald-900); }
.auth-sub { margin: 0 0 20px; font-size: 13.5px; color: var(--ink-600); line-height: 1.55; }

/* App Shell */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--emerald-950) 0%, var(--emerald-900) 100%);
  color: #fff;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 2px solid var(--gold-500);
  position: sticky;
  top: 0;
  height: 100vh;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 6px; }
.sb-brand-logo { background: #fff; padding: 5px 8px; border-radius: 10px; display: inline-flex; }
.sb-brand-logo img { height: 28px; display: block; }
.sb-brand-text { font-weight: 900; font-size: 14px; line-height: 1.2; letter-spacing: 0.02em; }
.sb-brand-chip { display: inline-block; margin-top: 3px; font-size: 10px; font-weight: 800; color: var(--emerald-950); background: var(--gold-500); padding: 2px 7px; border-radius: 999px; }

.sb-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-btn {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 14px; border-radius: 14px; border: 1px solid transparent;
  background: transparent; color: rgba(255, 255, 255, 0.84); font-weight: 700; font-size: 13.5px; text-align: left;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.nav-btn.active { background: rgba(245, 184, 46, 0.16); color: var(--gold-500); border-color: rgba(245, 184, 46, 0.45); }
.nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.sb-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.14); display: flex; flex-direction: column; gap: 8px; }
.sb-status { font-size: 11.5px; color: #b7e4c2; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: #22C55E; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
.dot.warn { background: var(--gold-500); }
.dot.err { background: var(--crimson-600); }

.main { padding: 24px 28px 80px; max-width: 1460px; width: 100%; margin: 0 auto; }

/* Hero Band */
.hero-band {
  background: linear-gradient(100deg, var(--emerald-900) 0%, var(--emerald-800) 75%, #168029 100%);
  color: #fff;
  border-radius: 24px;
  padding: 22px 26px;
  border: 1.5px solid var(--gold-500);
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  box-shadow: var(--shadow-soft);
  margin-bottom: 22px;
}
.hero-band h1 { margin: 4px 0 0; font-size: clamp(20px, 2.3vw, 26px); font-weight: 900; }
.hero-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-500); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons & Inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; font-weight: 800; font-size: 13px; border: 1.5px solid transparent; text-decoration: none;
}
.btn-gold { background: var(--gold-500); color: var(--emerald-950); }
.btn-crimson { background: var(--crimson-600); color: #fff; }
.btn-crimson:hover { background: var(--crimson-700); }
.btn-emerald { background: var(--emerald-800); color: #fff; }
.btn-outline { background: #fff; color: var(--emerald-900); border-color: var(--line); }
.btn-ghost-dark { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255, 255, 255, 0.22); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.input, .select {
  padding: 10px 13px; border-radius: 12px; border: 1.5px solid #cbd5e1; background: #fff; color: var(--ink-900); font-size: 13.5px;
}
.input:focus, .select:focus { outline: none; border-color: var(--emerald-700); }

/* Cards & Grids */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 4px 14px rgba(9, 57, 21, 0.04); }
.kpi-label { font-size: 12px; font-weight: 700; color: var(--ink-600); }
.kpi-val { font-size: 26px; font-weight: 900; color: var(--emerald-900); margin-top: 6px; }
.kpi-card.highlight { border-color: var(--crimson-600); background: #FFF8F8; }
.kpi-card.highlight .kpi-val { color: var(--crimson-600); }

.lang-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.lang-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 6px 18px rgba(9, 57, 21, 0.04);
}
.lang-card-top { display: flex; align-items: center; gap: 12px; }
.lang-mascot { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; border: 1.5px solid var(--emerald-100); flex-shrink: 0; }
.lang-name { font-weight: 900; font-size: 15px; color: var(--emerald-900); }
.lang-host { font-size: 11.5px; color: var(--ink-600); font-weight: 600; }
.lang-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: var(--emerald-50); border-radius: 12px; padding: 8px; text-align: center; }
.lang-metrics strong { display: block; font-size: 16px; color: var(--emerald-900); }
.lang-metrics span { font-size: 10.5px; color: var(--ink-600); font-weight: 600; }
.lang-actions { display: flex; gap: 8px; }
.lang-actions .btn { flex: 1; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow-soft); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-title { margin: 0; font-size: 17px; font-weight: 900; color: var(--emerald-900); }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar .input { flex: 1; min-width: 210px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-600); padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #edf2ee; vertical-align: top; }
tr:hover td { background: #FAFDFB; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.pill-green { background: #DCFCE7; color: #11692B; }
.pill-gold { background: #FEF3C7; color: #92400E; }
.pill-red { background: #FEE2E2; color: #B91C1C; }
.pill-slate { background: #E2E8F0; color: #334155; }
.pill-blue { background: #DBEAFE; color: #1D4ED8; }

.channel-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.channel-box { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--emerald-50); }
.channel-box h4 { margin: 0 0 6px; font-size: 13.5px; color: var(--emerald-900); }
.channel-box p { margin: 0; font-size: 12px; color: var(--ink-600); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(6, 40, 14, 0.55); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal-card { width: 100%; max-width: 520px; background: #fff; border-radius: 22px; padding: 24px; border: 2px solid var(--gold-500); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.form-field label { font-size: 12px; font-weight: 800; color: var(--emerald-900); }

/* Toast */
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--emerald-900); color: #fff; padding: 11px 16px; border-radius: 14px; border-left: 4px solid var(--gold-500); font-size: 13px; font-weight: 700; box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18); }

/* Mobile Bottom Nav */
.mobile-nav { display: none; }

/* Pro CRM Modules: Kanban, Split Layouts & DISC Grid */
.kanban-grid { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kanban-col { background: var(--emerald-50); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 260px; }
.kanban-col-head { display: flex; justify-content: space-between; align-items: center; }
.kanban-cards { display: flex; flex-direction: column; gap: 10px; }
.k-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: 0 4px 12px rgba(9, 57, 21, 0.05); }
.pro-split { display: grid; grid-template-columns: 1.45fr 0.95fr; gap: 18px; align-items: start; }
.disc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.disc-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lang-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .channel-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pro-split { grid-template-columns: 1fr; }
  .disc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 840px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 14px 14px 86px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lang-grid { grid-template-columns: 1fr; }
  .channel-strip { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .mobile-nav {
    display: flex; overflow-x: auto; gap: 2px; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--emerald-950); border-top: 2px solid var(--gold-500); z-index: 50; padding: 6px 4px;
    scrollbar-width: none;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav button {
    flex: 1 0 64px; background: transparent; border: none; color: rgba(255, 255, 255, 0.8); font-size: 10.5px; font-weight: 800;
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; white-space: nowrap;
  }
  .mobile-nav button.active { color: var(--gold-500); }
  .mobile-nav svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.9; }
}
