:root {
  --ink: #17211e;
  --muted: #65716c;
  --surface: #f3f6f3;
  --surface-high: #ffffff;
  --surface-soft: #e8efeb;
  --brand: #143e34;
  --brand-strong: #0d2f27;
  --brand-soft: #d9ebe3;
  --accent: #d8a935;
  --accent-soft: #fbf0d3;
  --success: #167554;
  --success-soft: #dff3ea;
  --danger: #b84d46;
  --danger-soft: #fbe6e3;
  --outline: #dbe2de;
  --shadow: 0 14px 40px rgb(20 62 52 / 8%);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--surface); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgb(216 169 53 / 45%); outline-offset: 2px; }
[hidden] { display: none !important; }

.eyebrow { display: block; margin-bottom: var(--space-2); color: var(--success); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.brand-lockup { display: flex; align-items: center; gap: var(--space-3); font-size: .95rem; font-weight: 700; letter-spacing: .01em; }
.brand-mark { display: grid; width: 46px; height: 46px; place-items: center; border: 1px solid rgb(255 255 255 / 28%); border-radius: 50% 50% 46% 54% / 52% 45% 55% 48%; background: rgb(255 255 255 / 10%); color: #fff; font-family: Georgia, serif; font-size: 1.1rem; }

.login-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(380px, 1.05fr) minmax(420px, .95fr); }
.login-brand { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; overflow: hidden; padding: var(--space-7); background: var(--brand); color: #fff; }
.login-brand::before, .login-brand::after { position: absolute; content: ""; border-radius: 50%; }
.login-brand::before { right: -150px; bottom: -150px; width: 520px; height: 520px; border: 1px solid rgb(255 255 255 / 10%); box-shadow: 0 0 0 70px rgb(255 255 255 / 3%), 0 0 0 140px rgb(255 255 255 / 2%); }
.login-brand::after { top: 26%; right: 9%; width: 9px; height: 9px; background: var(--accent); box-shadow: 42px 35px 0 -2px rgb(216 169 53 / 55%), -20px 73px 0 -3px rgb(216 169 53 / 40%); }
.login-copy { position: relative; z-index: 1; max-width: 650px; margin: auto 0; }
.login-copy .eyebrow { color: #d8c17d; }
.login-copy h1 { max-width: 620px; margin: 0 0 var(--space-5); font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.2rem, 6vw, 6.3rem); font-weight: 500; letter-spacing: -.045em; line-height: .95; }
.login-copy p { max-width: 570px; margin: 0; color: #cbd8d3; font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.65; }
.brand-ribbon { position: absolute; right: 6%; bottom: 11%; width: 150px; height: 42px; transform: rotate(-11deg); border-radius: 50%; border-top: 3px solid var(--accent); opacity: .75; }
.login-panel { display: grid; min-height: 100vh; padding: var(--space-7); place-items: center; background: #f8faf8; }
.login-card { display: grid; width: min(100%, 440px); gap: var(--space-5); }
.login-card h2 { margin: 0 0 var(--space-3); font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.04em; }
.login-card p { margin: 0; color: var(--muted); line-height: 1.55; }
label { display: grid; gap: var(--space-2); color: #34423d; font-size: .84rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--outline); border-radius: var(--radius-sm); background: var(--surface-high); color: var(--ink); transition: border-color .18s, box-shadow .18s; }
input, select { height: 50px; padding: 0 var(--space-4); }
textarea { resize: vertical; padding: var(--space-4); line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #aebdb6; }
.login-card small { color: #84908b; text-align: center; }
.form-error { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger) !important; font-size: .88rem; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: var(--space-2); border: 0; border-radius: 12px; padding: 0 20px; font-weight: 750; transition: transform .15s, background .15s, opacity .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button-primary { background: var(--brand); color: #fff; }
.button-primary:hover { background: var(--brand-strong); }
.button-light { background: #fff; color: var(--brand); }
.button-success { background: var(--success); color: #fff; }
.button-outline { border: 1px solid var(--outline); background: #fff; color: var(--ink); }
.button-wide { width: 100%; }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 245px 1fr; }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: var(--space-5) var(--space-4); background: var(--brand); color: #fff; }
.sidebar-brand { padding: 0 var(--space-2) var(--space-6); }
.sidebar-brand > span:last-child { display: grid; gap: 2px; }
.sidebar-brand small { color: #9eb5ad; font-size: .65rem; font-weight: 500; }
.sidebar nav { display: grid; gap: var(--space-2); }
.nav-item { display: flex; width: 100%; min-height: 46px; align-items: center; gap: var(--space-3); border: 0; border-radius: 12px; padding: 0 var(--space-4); background: transparent; color: #bcd0c9; font-weight: 650; text-align: left; }
.nav-item:hover, .nav-item.active { background: rgb(255 255 255 / 10%); color: #fff; }
.nav-item.active { box-shadow: inset 3px 0 var(--accent); }
.nav-item span { width: 22px; color: #d8c17d; text-align: center; }
.sidebar-footer { display: grid; gap: var(--space-3); margin-top: auto; }
.integration-badge { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3); border-radius: 10px; background: rgb(0 0 0 / 13%); color: #c7d8d2; font-size: .74rem; }
.integration-badge span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgb(216 169 53 / 12%); }
.integration-badge.connected span { background: #51d598; box-shadow: 0 0 0 4px rgb(81 213 152 / 12%); }
.integration-badge.error span { background: #ef8d82; }

.workspace { min-width: 0; }
.topbar { display: flex; min-height: 96px; align-items: center; gap: var(--space-4); border-bottom: 1px solid var(--outline); padding: var(--space-4) var(--space-6); background: rgb(255 255 255 / 82%); backdrop-filter: blur(12px); }
.topbar h1 { margin: 0; font-size: 1.55rem; letter-spacing: -.025em; }
.topbar .eyebrow { margin-bottom: 2px; font-size: .62rem; }
.operator { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.operator-avatar { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: .75rem; font-weight: 800; }
.operator > span:last-child { display: grid; gap: 2px; font-size: .82rem; }
.operator small { max-width: 180px; overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; }
.menu-button { display: none !important; }
.content { padding: var(--space-6); }
.hero-card { position: relative; display: flex; min-height: 190px; align-items: center; justify-content: space-between; gap: var(--space-5); overflow: hidden; border-radius: var(--radius-lg); padding: var(--space-6); background: linear-gradient(115deg, var(--brand) 0%, #215548 100%); color: #fff; box-shadow: var(--shadow); }
.hero-card::after { position: absolute; right: -80px; width: 320px; height: 320px; content: ""; border: 50px solid rgb(255 255 255 / 4%); border-radius: 48% 52% 44% 56%; transform: rotate(28deg); }
.hero-card > * { position: relative; z-index: 1; }
.hero-card .eyebrow { color: #e5c96e; }
.hero-card h2 { max-width: 700px; margin: 0 0 var(--space-3); font-family: Georgia, serif; font-size: clamp(1.7rem, 3vw, 2.45rem); font-weight: 500; line-height: 1.08; }
.hero-card p { margin: 0; color: #c9d8d3; }
.stats-grid { display: grid; margin: var(--space-5) 0; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.stat-card { display: flex; min-height: 135px; align-items: flex-start; gap: var(--space-4); border: 1px solid var(--outline); border-radius: var(--radius-md); padding: var(--space-5); background: var(--surface-high); box-shadow: 0 6px 24px rgb(28 51 43 / 3%); }
.stat-card > div { display: grid; gap: 3px; }
.stat-card span:not(.stat-icon) { color: var(--muted); font-size: .76rem; font-weight: 700; }
.stat-card strong { margin: 2px 0; font-size: 2rem; letter-spacing: -.04em; }
.stat-card small { color: #8d9894; font-size: .7rem; }
.stat-icon { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 11px; font-weight: 900; }
.stat-total .stat-icon { background: var(--brand-soft); color: var(--brand); }
.stat-answered .stat-icon { background: var(--success-soft); color: var(--success); }
.stat-unanswered .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat-pending .stat-icon { background: var(--accent-soft); color: #9a7212; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); gap: var(--space-5); }
.panel { border: 1px solid var(--outline); border-radius: var(--radius-md); background: var(--surface-high); box-shadow: 0 6px 24px rgb(28 51 43 / 3%); }
.progress-panel, .activity-panel { padding: var(--space-5); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.panel-heading h3 { margin: 0; font-size: 1.1rem; }
.progress-number { color: var(--brand); font-family: Georgia, serif; font-size: 2.2rem; }
.progress-track { height: 12px; overflow: hidden; margin: var(--space-6) 0 var(--space-4); border-radius: 99px; background: #edf1ef; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--success), #54b58f); transition: width .4s ease; }
.progress-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); color: var(--muted); font-size: .73rem; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.dot.answered { background: var(--success); }.dot.unanswered { background: var(--danger); }.dot.pending { background: var(--accent); }
.list-selector-wrap { display: grid; grid-template-columns: auto minmax(190px, 1fr); align-items: center; gap: var(--space-4); margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--outline); }
.list-selector-wrap select { height: 42px; }
.activity-list { display: grid; gap: var(--space-3); margin-top: var(--space-5); }
.activity-item { display: flex; align-items: center; gap: var(--space-3); }
.activity-item-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: var(--surface-soft); color: var(--brand); font-size: .78rem; }
.activity-item > span:last-child { display: grid; min-width: 0; gap: 2px; }
.activity-item strong { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.activity-item small { color: var(--muted); font-size: .68rem; }
.empty-inline { padding: var(--space-5); color: var(--muted); font-size: .82rem; text-align: center; }

.contacts-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-5); }
.contacts-heading h2 { margin: 0 0 var(--space-2); font-family: Georgia, serif; font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 500; letter-spacing: -.025em; }
.contacts-heading p { margin: 0; color: var(--muted); }
.sheet-select { width: min(100%, 370px); }
.contact-panel { overflow: hidden; }
.contact-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); border-bottom: 1px solid var(--outline); padding: var(--space-4) var(--space-5); }
.search-box { position: relative; width: min(100%, 340px); }
.search-box span { position: absolute; top: 50%; left: 16px; color: var(--muted); transform: translateY(-50%); }
.search-box input { height: 42px; padding-left: 42px; background: var(--surface); }
.status-tabs { display: flex; gap: var(--space-1); padding: 4px; border-radius: 10px; background: var(--surface); }
.status-tab { min-height: 34px; border: 0; border-radius: 8px; padding: 0 12px; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 700; }
.status-tab.active { background: #fff; color: var(--brand); box-shadow: 0 2px 8px rgb(20 62 52 / 8%); }
.table-wrap { min-height: 410px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: var(--space-3) var(--space-5); background: #fafcfb; color: #77837e; font-size: .67rem; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
td { border-top: 1px solid #edf1ef; padding: var(--space-4) var(--space-5); vertical-align: middle; }
.contact-name { display: grid; gap: 3px; }
.contact-name strong { font-size: .86rem; }
.contact-name small { color: var(--muted); font-size: .73rem; }
.status-pill { display: inline-flex; min-height: 27px; align-items: center; gap: 6px; border-radius: 99px; padding: 0 10px; font-size: .68rem; font-weight: 750; }
.status-pill::before { width: 6px; height: 6px; border-radius: 50%; content: ""; }
.status-pending { background: var(--accent-soft); color: #805d08; }.status-pending::before { background: var(--accent); }
.status-answered { background: var(--success-soft); color: var(--success); }.status-answered::before { background: var(--success); }
.status-unanswered { background: var(--danger-soft); color: var(--danger); }.status-unanswered::before { background: var(--danger); }
.actions-heading { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.action-button { display: inline-flex; min-height: 38px; align-items: center; gap: 7px; border: 1px solid var(--outline); border-radius: 9px; padding: 0 11px; background: #fff; color: #42514c; font-size: .7rem; font-weight: 700; text-decoration: none; }
.action-button:hover { border-color: #a9bbb3; background: var(--surface); }
.action-button.whatsapp { border-color: #b8ddca; color: var(--success); }
.action-button.promotion { background: var(--brand); color: #fff; }
.action-button.sent { background: var(--success-soft); color: var(--success); }
.empty-state { display: grid; min-height: 370px; place-content: center; text-align: center; }
.empty-state span { color: #b9c5c0; font-size: 2rem; }.empty-state h3 { margin: var(--space-3) 0 var(--space-2); }.empty-state p { margin: 0; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--outline); padding: var(--space-3) var(--space-5); color: var(--muted); font-size: .74rem; }
.pagination > div { display: flex; gap: var(--space-2); }
.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--outline); border-radius: 10px; background: #fff; color: var(--ink); }
.icon-button:disabled { cursor: not-allowed; opacity: .4; }

.modal { width: min(92vw, 480px); border: 0; border-radius: 22px; padding: 0; box-shadow: 0 30px 100px rgb(11 36 29 / 28%); }
.modal::backdrop { background: rgb(10 27 22 / 58%); backdrop-filter: blur(3px); }
.modal form { position: relative; display: grid; gap: var(--space-4); padding: var(--space-6); }
.modal h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }.modal p { margin: 0; color: var(--muted); line-height: 1.5; }
.modal-close { position: absolute; top: 14px; right: 14px; display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 1.3rem; }
.modal-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; background: var(--brand-soft); color: var(--brand); font-size: 1.25rem; }.modal-icon.whatsapp { background: var(--success-soft); color: var(--success); }
.modal-actions { display: flex; gap: var(--space-3); margin-top: var(--space-2); }.modal-actions .button { flex: 1; }
.modal-note { border-radius: 10px; padding: var(--space-3); background: var(--accent-soft); color: #765a12 !important; font-size: .76rem; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(400px, calc(100vw - 32px)); transform: translateY(20px); border-radius: 12px; padding: 14px 18px; background: var(--brand-strong); color: #fff; box-shadow: var(--shadow); font-size: .82rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }.toast.visible { transform: translateY(0); opacity: 1; }.toast.error { background: #7e2f2a; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .row-actions { min-width: 360px; }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 38vh; padding: var(--space-5); }
  .login-copy { margin: var(--space-7) 0 var(--space-5); }
  .login-copy h1 { font-size: clamp(2.5rem, 13vw, 4rem); }
  .login-panel { min-height: 62vh; padding: var(--space-6) var(--space-5); }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 50; left: 0; width: 245px; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgb(0 0 0 / 20%); }
  .menu-button { display: inline-grid !important; flex: 0 0 auto; }
  .topbar { min-height: 78px; padding: var(--space-3) var(--space-4); }
  .topbar h1 { font-size: 1.2rem; }
  .operator > span:last-child { display: none; }
  .content { padding: var(--space-4); }
  .hero-card { align-items: flex-start; flex-direction: column; padding: var(--space-5); }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .stat-card { min-height: 125px; flex-direction: column; gap: var(--space-2); padding: var(--space-4); }
  .stat-card strong { font-size: 1.65rem; }
  .contacts-heading, .contact-toolbar { align-items: stretch; flex-direction: column; }
  .sheet-select, .search-box { width: 100%; }
  .status-tabs { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .status-tab { white-space: nowrap; }
  .table-wrap { overflow: visible; padding: var(--space-3); }
  table, tbody { display: block; }
  thead { display: none; }
  tbody { display: grid; gap: var(--space-3); }
  tr { display: grid; grid-template-columns: 1fr auto; gap: var(--space-3); border: 1px solid var(--outline); border-radius: 14px; padding: var(--space-4); background: #fff; }
  td { display: block; border: 0; padding: 0; }
  td:last-child { grid-column: 1 / -1; }
  .contact-name strong { font-size: .82rem; }
  .row-actions { min-width: 0; justify-content: stretch; flex-wrap: wrap; }
  .action-button { min-height: 42px; flex: 1 1 145px; justify-content: center; }
  .list-selector-wrap { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .stats-grid { grid-template-columns: 1fr; }
  .operator { display: none; }
  .hero-card .button { width: 100%; }
  .modal-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
