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

:root {
  --bg: #F8F7F4;
  --surface: #FFFFFF;
  --border: #E5E3DC;
  --text: #1A1917;
  --text-muted: #6B6860;
  --text-light: #9B9890;
  --accent: #2563EB;
  --accent-light: #EFF6FF;
  --success: #16A34A;
  --success-light: #DCFCE7;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── NAVBAR ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
}
.nav-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; margin-right: 8px; }
.brand-icon { font-size: 18px; }
.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-link { padding: 6px 14px; border-radius: 8px; font-size: 13.5px; color: var(--text-muted); transition: all .15s; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 16px; position: relative; padding: 4px; }
.badge-dot { position: absolute; top: -2px; right: -4px; background: var(--danger); color: #fff; font-size: 10px; font-family: 'DM Mono', monospace; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.nav-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-light); color: var(--accent); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* ── LAYOUT ── */
.main-content { max-width: 1200px; margin: 0 auto; padding: 28px 24px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } .nav-links { display: none; } }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: 1fr 1fr; } }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all .15s; position: relative;
}
.stat-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.stat-card.danger { border-left: 3px solid var(--danger); }
.stat-card.warning { border-left: 3px solid var(--warning); }
.stat-card.success { border-left: 3px solid var(--success); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-body { flex: 1; }
.stat-num { font-size: 26px; font-weight: 600; font-family: 'DM Mono', monospace; letter-spacing: -1px; line-height: 1; }
.stat-lbl { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.stat-trend { font-size: 11px; position: absolute; bottom: 10px; right: 14px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ── CARDS ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 600; }
.card-link { font-size: 13px; color: var(--accent); }
.card-body { padding: 16px 18px; }

/* ── SEARCH ── */
.search-wrap { position: relative; padding: 14px 18px; }
.search-input { width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--border); border-radius: var(--radius); font-family: 'DM Sans', sans-serif; font-size: 14px; background: var(--bg); color: var(--text); outline: none; transition: border .15s; }
.search-input:focus { border-color: var(--accent); background: #fff; }
.search-icon { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); font-size: 15px; pointer-events: none; }
.search-results { padding: 0 10px 10px; }
.search-item { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; cursor: pointer; transition: background .1s; }
.search-item:hover { background: var(--bg); }
.si-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.si-body { flex: 1; }
.si-name { font-weight: 500; font-size: 13.5px; }
.si-meta { font-size: 12px; color: var(--text-muted); }
.si-arrow { color: var(--text-light); }
.no-result { padding: 12px 8px; font-size: 13px; color: var(--text-muted); }

/* ── LIST ITEMS ── */
.list-items { padding: 0 10px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 8px; cursor: pointer; transition: background .1s; }
.list-item:hover { background: var(--bg); }
.li-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.li-body { flex: 1; min-width: 0; }
.li-title { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-date { font-size: 11px; color: var(--text-light); font-family: 'DM Mono', monospace; white-space: nowrap; }
.badge-warn { background: var(--warning-light); color: var(--warning); padding: 2px 7px; border-radius: 12px; font-weight: 500; }
.badge-danger { background: var(--danger-light); color: var(--danger); padding: 2px 7px; border-radius: 12px; font-weight: 500; }
.badge-success { background: var(--success-light); color: var(--success); padding: 2px 7px; border-radius: 12px; font-weight: 500; }
.badge-info { background: var(--accent-light); color: var(--accent); padding: 2px 7px; border-radius: 12px; font-weight: 500; }

/* ── BUTTONS ── */
.btn-primary { background: var(--accent); color: #fff; border: none; padding: 9px 18px; border-radius: var(--radius); font-family: 'DM Sans', sans-serif; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: opacity .15s; display: inline-block; }
.btn-primary:hover { opacity: 0.88; }
.btn-outline { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 9px 18px; border-radius: var(--radius); font-family: 'DM Sans', sans-serif; font-size: 13.5px; cursor: pointer; transition: all .15s; display: inline-block; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 9px 18px; border-radius: var(--radius); font-family: 'DM Sans', sans-serif; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-control { width: 100%; padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--radius); font-family: 'DM Sans', sans-serif; font-size: 14px; background: #fff; color: var(--text); outline: none; transition: border .15s; }
.form-control:focus { border-color: var(--accent); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { padding: 10px 14px; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); background: var(--bg); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); cursor: pointer; }

/* ── CUSTOMER PROFILE ── */
.profile-header { display: flex; align-items: center; gap: 16px; padding: 20px; border-bottom: 1px solid var(--border); }
.profile-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; flex-shrink: 0; }
.profile-name { font-size: 18px; font-weight: 600; }
.profile-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.profile-badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.profile-section { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.profile-section:last-child { border-bottom: none; }
.section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 12px; }
.info-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }
.info-val { font-weight: 500; text-align: right; }
.product-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.product-item:last-child { border-bottom: none; }
.product-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.svc-entry { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; font-size: 13.5px; }
.svc-entry:last-child { border-bottom: none; }
.svc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }

/* ── MODAL ── */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── TABS ── */
.tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.tab { padding: 12px 16px; font-size: 13.5px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-muted); transition: all .15s; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── ALERT CHIPS ── */
.alert-chip { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid; margin-bottom: 10px; }
.alert-chip.red { background: var(--danger-light); border-color: #FECACA; }
.alert-chip.amber { background: var(--warning-light); border-color: #FDE68A; }
.alert-chip.green { background: var(--success-light); border-color: #BBF7D0; }

/* ── WHATSAPP ── */
.wa-preview { background: #ECE5DD; border-radius: var(--radius-lg); padding: 16px; }
.wa-bubble { background: #fff; border-radius: 12px 12px 12px 2px; padding: 10px 14px; font-size: 13.5px; max-width: 85%; line-height: 1.5; }
.wa-time { font-size: 11px; color: var(--text-light); text-align: right; margin-top: 4px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; }
.empty-state p { font-size: 14px; }

/* ── FILTER BAR ── */
.filter-bar { display: flex; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.filter-bar input { flex: 1; min-width: 200px; padding: 8px 13px; border: 1px solid var(--border); border-radius: var(--radius); font-family: 'DM Sans', sans-serif; font-size: 13.5px; background: var(--bg); outline: none; }
.filter-bar input:focus { border-color: var(--accent); background: #fff; }
.filter-bar select { padding: 8px 13px; border: 1px solid var(--border); border-radius: var(--radius); font-family: 'DM Sans', sans-serif; font-size: 13.5px; background: var(--bg); cursor: pointer; outline: none; }
