/* v3.48 — application-wide product polish. Business logic intentionally unchanged. */
:root{
  --ui-brand:#167c62;--ui-brand-dark:#126b56;--ui-brand-soft:#eaf6f2;
  --ui-bg:#f5f7f9;--ui-surface:#fff;--ui-border:#e4e8ed;--ui-border-strong:#d8dee6;
  --ui-text:#17202f;--ui-muted:#7d8797;--ui-faint:#a1a9b5;--ui-danger:#b3261e;
  --ui-radius:12px;--ui-shadow:0 1px 2px rgba(16,24,40,.04),0 8px 24px rgba(16,24,40,.035);
}
html{background:var(--ui-bg);scroll-behavior:smooth}
body{background:linear-gradient(180deg,#f8fafb 0,#f5f7f9 100%);color:var(--ui-text);-webkit-font-smoothing:antialiased}
button,a,input,select,textarea{transition:background-color .15s,border-color .15s,color .15s,box-shadow .15s,transform .05s}
button:active{transform:translateY(1px)}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid rgba(22,124,98,.16);outline-offset:1px}

/* Sidebar / navigation */
.sidebar{background:rgba(255,255,255,.96);box-shadow:6px 0 24px rgba(16,24,40,.025);border-right-color:#e5e9ee}
.brand{padding-bottom:24px}.brandmark{box-shadow:0 5px 14px rgba(22,124,98,.18)}
.workspace{background:#fafbfc;border-color:#e8ecf1;box-shadow:0 1px 2px rgba(16,24,40,.025)}
.nav{gap:4px}.navitem{position:relative;padding:10px 12px;border:1px solid transparent}.navitem:hover{background:#f2f8f6;color:var(--ui-brand-dark)}
.navitem.active{background:var(--ui-brand-soft);color:var(--ui-brand-dark);border-color:#d7eee6;box-shadow:inset 3px 0 0 var(--ui-brand)}
.navitem.active i{font-weight:800}.navitem em{min-width:22px;text-align:center;background:#f0f2f5}

/* Global page chrome */
.content{background:transparent}header{background:rgba(255,255,255,.94);backdrop-filter:blur(10px);border-bottom-color:#e4e8ed;box-shadow:0 1px 0 rgba(16,24,40,.015)}
header h1{letter-spacing:-.02em}header p{color:#8993a2}.headerActions{gap:8px}
.iconbtn,.help,.secondary{border-color:var(--ui-border);background:#fff;box-shadow:0 1px 1px rgba(16,24,40,.025)}
.iconbtn:hover,.help:hover,.secondary:hover{border-color:#cfd6df;background:#fafbfc;color:#344054}
.primary,.smallPrimary{background:var(--ui-brand);box-shadow:0 4px 10px rgba(22,124,98,.13)}
.primary:hover,.smallPrimary:hover{background:var(--ui-brand-dark)}
.dangerButton,.dangerLink{color:var(--ui-danger)}
.page{scrollbar-gutter:stable both-edges}

/* Cards and statistics */
.card{border-color:var(--ui-border);border-radius:var(--ui-radius);box-shadow:var(--ui-shadow)}
.card:hover{border-color:#dce2e8}
.stat{min-height:112px;padding:18px}.stat h3{letter-spacing:-.025em}.statIcon{box-shadow:inset 0 0 0 1px rgba(22,124,98,.04)}
.stats{gap:16px}.grid2,.grid3{gap:16px}.cardHead h2,.tableTitle h2{letter-spacing:-.01em}

/* Tabs, toolbars and tables */
.tabs{gap:26px;border-bottom-color:#e1e5ea}.tab{padding-bottom:12px}.activeTab{border-bottom-width:3px}
.toolbar{align-items:center;flex-wrap:wrap}.search{height:38px;border-radius:9px;box-shadow:0 1px 2px rgba(16,24,40,.025)}
.search:focus-within{border-color:#9bcdbf;box-shadow:0 0 0 3px rgba(22,124,98,.08)}
.chip{border-radius:999px;background:#fff}.chip:hover{border-color:#cbd3dc}.chip.active{box-shadow:inset 0 0 0 1px rgba(22,124,98,.05)}
.tableCard{box-shadow:var(--ui-shadow)!important}.tableTop{padding-top:18px}.gridScroll{overscroll-behavior:contain;scrollbar-gutter:stable}
table{font-size:11px}th{background:#f9fafb;color:#7f8998;letter-spacing:.04em}td{height:56px;padding-top:11px;padding-bottom:11px}tbody tr:hover{background:#fbfcfc}
.contact b,.campaign>td b{font-weight:700;color:#273142}.muted{color:#8c96a5!important}

/* Inputs / forms */
.field input,.field select,.text-input,.field textarea,.templateBodyEditor{border-color:#dce2e8;border-radius:9px;background:#fff}
.field input:hover,.field select:hover,.text-input:hover,.field textarea:hover{border-color:#cbd3dc}
.field input:focus,.field select:focus,.text-input:focus,.field textarea:focus,.templateBodyEditor:focus{border-color:#78b9a7;box-shadow:0 0 0 3px rgba(22,124,98,.08)}
.field label{color:#4b5565}.fieldHint{color:#8b95a4}

/* Status system */
.completed,.state-returned{background:#e8f7f0!important;color:#237d5f!important}.running{background:#fff4dd!important;color:#a96f16!important}
.scheduled{background:#eef0ff!important;color:#5964ad!important}.pending{background:#fff6df!important;color:#936c12!important}
.rejected,.state-meta_error,.state-request_error{background:#fdecec!important;color:#a33d3d!important}.state-empty{background:#f1f3f6!important;color:#687385!important}

/* Module headers / sub-navigation */
.moduleNav{background:transparent!important;border-bottom:1px solid #e5e9ee!important;margin-bottom:18px!important;padding-bottom:10px!important}
.moduleTabs{gap:4px!important}.moduleTab{border-radius:8px!important;padding:7px 10px!important}.moduleTab:hover{background:#f1f5f7}.moduleTab.active{background:var(--ui-brand-soft)!important;color:var(--ui-brand-dark)!important;border-color:#d6eee6!important}
.moduleHead{margin-bottom:18px!important}.moduleHead h2{font-size:22px!important;letter-spacing:-.025em}.moduleHead p{color:#8791a0!important}

/* Blocking dialogs */
.modalOverlay{background:rgba(15,23,42,.48);backdrop-filter:blur(3px);padding:22px;overscroll-behavior:contain}
.modalCard{border:1px solid rgba(255,255,255,.8)!important;box-shadow:0 24px 70px rgba(15,23,42,.22)!important;border-radius:14px!important}
.modalHeader{border-bottom:1px solid #edf0f3;padding-bottom:13px}.modalClose{border:1px solid #e4e8ed!important;background:#f8fafb!important}.modalClose:hover{background:#eef2f4!important;color:#344054!important}
body.modalOpen{overflow:hidden!important;overscroll-behavior:none}

/* Inbox */
.inboxWorkspaceV3{border:1px solid var(--ui-border)!important;border-radius:14px!important;box-shadow:var(--ui-shadow)!important;overflow:hidden!important;background:#fff}
.inboxSidebarV3{border-right-color:#e5e9ee!important;background:#fbfcfc!important}.chatHeaderV3{border-bottom-color:#e5e9ee!important;background:#fff!important}
.chatMessagesV3{background:#f7f9f9!important}.bubbleV3{box-shadow:0 1px 2px rgba(16,24,40,.06)!important;border:1px solid rgba(16,24,40,.045)!important}
.composerBottomV3{border-top-color:#e5e9ee!important;background:#fff!important}

/* Campaign / template workspaces */
.templateCardV4,.campaignBuilder,.builderSection,.builderButtonRow{border-color:#e2e7ec!important;box-shadow:none}
.templateCardV4:hover{box-shadow:0 6px 18px rgba(16,24,40,.055)}.campaignBuilder{background:#fff!important}
.campaignPreview{border:1px solid #e4e9ed}.phoneFrame{box-shadow:0 18px 40px rgba(15,23,42,.16)!important}

/* Empty states */
.empty{min-height:360px}.emptyIcon{box-shadow:0 8px 18px rgba(22,124,98,.08)}

/* Keep large data surfaces contained */
.tableCard,.gridScroll,.inboxWorkspaceV3,.templateEditorPane,.templatePreviewPane{overscroll-behavior:contain}

@media(max-width:1000px){
  header{height:74px;flex-basis:74px}.page{padding-top:20px}.stats{gap:12px}.grid2,.grid3{gap:12px}
}
@media(max-width:720px){
  header{padding:0 14px}.headerActions .help{display:none}.headerActions .iconbtn{display:none}.headerActions{gap:6px}
  header h1{font-size:18px}.page{padding:16px 12px 28px}.moduleHead{align-items:flex-start}
  .stats{grid-template-columns:1fr!important}.stat{min-height:96px}.tabs{gap:17px;overflow-x:auto;scrollbar-width:none}.tabs::-webkit-scrollbar{display:none}
  .toolbar{align-items:stretch}.search{max-width:none;width:100%}.chips{overflow-x:auto;padding-bottom:2px;flex-wrap:nowrap}.chip{white-space:nowrap}
  .tableTop{gap:10px;align-items:flex-start;flex-direction:column}.gridScroll{max-height:calc(100vh - 250px)}
  .modalOverlay{padding:10px}.modalCard{width:min(100%,560px);max-height:calc(100vh - 20px)}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important}}
