:root {
  color-scheme: light;
  --ink: #13221c;
  --muted: #62716a;
  --paper: #f4f7f5;
  --panel: #ffffff;
  --line: #dce5df;
  --green: #087f5b;
  --green-dark: #075c44;
  --whatsapp: #075e54;
  --yellow: #fff19b;
  --shadow: 0 14px 36px rgba(17, 43, 32, 0.09);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 16px; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px clamp(20px, 4vw, 64px); background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: max-content; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--whatsapp); color: white; font-size: 1.35rem; font-weight: 800; transform: rotate(-3deg); }
h1, h2, p { margin: 0; }
h1 { font-size: 1.15rem; letter-spacing: -.02em; }
.brand p { margin-top: 3px; color: var(--muted); font-size: .8rem; }
.header-actions { display: flex; align-items: end; gap: 8px; }
.reviewer-field, .search-field, .select-field { display: grid; gap: 5px; color: var(--muted); font-size: .74rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.reviewer-field input { width: 150px; }
input, select { min-height: 40px; border: 1px solid #cdd9d2; border-radius: 9px; background: white; color: var(--ink); padding: 8px 11px; outline: none; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8,127,91,.12); }
.button { min-height: 40px; border: 1px solid transparent; border-radius: 9px; padding: 9px 14px; font-weight: 750; white-space: nowrap; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { background: white; border-color: #cdd9d2; color: var(--ink); }

main { width: min(1800px, 100%); margin: 0 auto; padding: 22px clamp(16px, 3vw, 48px) 80px; }
.control-deck { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 20px rgba(17,43,32,.05); overflow: hidden; }
.search-row { display: grid; grid-template-columns: minmax(240px, 2fr) minmax(220px, 1.25fr) repeat(3, minmax(140px, .65fr)); gap: 12px; padding: 16px; }
.search-field input, .select-field select { width: 100%; }
.exclude-field input { border-color: #e5d2d0; background: #fffafa; }
.advanced-filters { border-top: 1px solid var(--line); }
.advanced-filters summary { list-style: none; padding: 13px 16px; font-size: .9rem; font-weight: 750; cursor: pointer; background: #f9fbfa; }
.advanced-filters summary::-webkit-details-marker { display: none; }
.advanced-filters summary::before { content: '▾'; margin-right: 8px; color: var(--green); }
.advanced-filters:not([open]) summary::before { content: '▸'; }
#activeFilterCount { color: var(--green); }
.facet-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 20px; padding: 15px 16px 12px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip { position: relative; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: white; color: #4d5f56; font-size: .78rem; cursor: pointer; user-select: none; }
.filter-chip:has(input:checked) { border-color: var(--green); background: #e3f6ee; color: var(--green-dark); font-weight: 700; }
.filter-chip input { position: absolute; opacity: 0; pointer-events: none; }
.filter-foot { display: flex; align-items: center; gap: 20px; padding: 0 16px 15px; }
.checkbox { display: flex; align-items: center; gap: 7px; color: #44564d; font-size: .85rem; }
.checkbox input { min-height: auto; accent-color: var(--green); }
.text-button { border: 0; background: none; color: var(--green); padding: 6px; font-weight: 750; }
.filter-foot .text-button { margin-left: auto; }

.progress-strip { position: sticky; top: 75px; z-index: 10; display: flex; align-items: center; gap: 20px; margin: 14px 0 26px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(244,247,245,.94); backdrop-filter: blur(10px); }
.progress-copy { display: flex; gap: 12px; align-items: baseline; min-width: max-content; }
.progress-copy span { color: var(--muted); font-size: .85rem; }
.progress-track { flex: 1; height: 6px; overflow: hidden; border-radius: 99px; background: #dbe4df; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #19a974, #f0b429); transition: width .25s ease; }

.coverage-panel { margin: 0 0 32px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 6px 20px rgba(17,43,32,.05); }
.coverage-head { display: flex; justify-content: space-between; gap: 24px; align-items: start; }
.coverage-head h2 { font-size: 1.05rem; }
.coverage-head p { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.coverage-totals { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px 16px; color: var(--muted); font-size: .78rem; }
.coverage-totals strong { color: var(--ink); }
.star-count { color: #9b6b00; }
.like-count { color: var(--green); }
.coverage-legend { display: flex; flex-wrap: wrap; gap: 13px; margin: 14px 0 10px; color: var(--muted); font-size: .72rem; }
.coverage-legend span { display: flex; align-items: center; gap: 5px; }
.legend-cell, .coverage-cell { width: 15px; height: 15px; padding: 0; border: 1px solid rgba(27,53,41,.13); border-radius: 3px; background: #e8eeeb; }
.legend-cell { display: inline-grid; place-items: center; font-size: .62rem; font-style: normal; }
.coverage-cell { position: relative; transition: transform .1s ease, box-shadow .1s ease; }
.coverage-cell:hover, .coverage-cell:focus-visible { z-index: 2; outline: none; box-shadow: 0 0 0 2px white, 0 0 0 4px var(--green); transform: scale(1.28); }
.coverage-cell.like, .legend-cell.like { border-color: #087f5b; background: #20a979; }
.coverage-cell.superlike, .legend-cell.superlike { border-color: #c28b00; background: #f4c84d; color: #624500; }
.coverage-cell.rejected, .legend-cell.rejected { border-color: #d9aaa5; background: #f0c7c2; }
.coverage-cell.missing, .legend-cell.missing { background: #e8eeeb; }
.coverage-scroll { overflow-x: auto; padding: 5px 2px 11px; scrollbar-color: #bdcbc4 transparent; }
.coverage-grid { display: flex; align-items: flex-start; gap: 8px; min-width: max-content; }
.coverage-column { width: 86px; padding-right: 8px; border-right: 1px solid #edf1ef; }
.coverage-column-head { display: grid; align-content: end; height: 70px; margin-bottom: 7px; }
.coverage-column-head small { overflow: hidden; color: var(--muted); font-size: .56rem; font-weight: 750; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.coverage-column-head strong { display: -webkit-box; overflow: hidden; font-size: .67rem; line-height: 1.18; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.coverage-column-head span { margin-top: 3px; color: #87948e; font-size: .54rem; }
.coverage-cells { display: grid; grid-template-columns: 15px; gap: 4px; }
.coverage-inspector { display: grid; grid-template-columns: minmax(210px, .7fr) 1.3fr; gap: 16px; min-height: 65px; margin-top: 8px; padding: 11px 13px; border-radius: 10px; background: #f4f7f5; color: var(--muted); font-size: .74rem; }
.coverage-inspector > div { display: grid; align-content: center; gap: 3px; }
.coverage-inspector strong, .coverage-inspector b { color: var(--ink); }
.coverage-inspector span { overflow-wrap: anywhere; }

.lanes { display: grid; gap: 38px; }
.lane-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 12px; }
.lane-head > div { display: flex; align-items: center; gap: 9px; }
.lane h2 { font-size: 1.1rem; letter-spacing: -.02em; }
.lane-head span { padding: 2px 7px; border-radius: 99px; background: #dfe8e3; color: #4f6258; font-size: .74rem; font-weight: 800; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); align-items: start; gap: 15px; }
.template-card { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: 0 5px 16px rgba(17,43,32,.055); }
.card-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-meta > div:first-child { min-width: 0; display: grid; gap: 2px; }
.card-meta code { overflow: hidden; color: #20382d; font-size: .72rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.card-meta > div:first-child > span { overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; justify-content: end; gap: 4px; }
.badges span, .traits span { height: fit-content; padding: 3px 6px; border-radius: 6px; background: #eef3f0; color: #596b62; font-size: .62rem; font-weight: 750; text-transform: lowercase; }
.phone-canvas { min-height: 170px; padding: 16px 11px; border-radius: 10px; background-color: #e7dfd6; background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,.55) 0 2px, transparent 2px), radial-gradient(circle at 80% 65%, rgba(120,110,95,.08) 0 2px, transparent 2px); background-size: 34px 34px, 48px 48px; }
.message-bubble { position: relative; margin-left: 9%; padding: 9px 10px 20px; border-radius: 8px 2px 8px 8px; background: #d9fdd3; box-shadow: 0 1px 1px rgba(0,0,0,.08); color: #111b21; font-family: Arial, sans-serif; font-size: .88rem; line-height: 1.48; }
.message-bubble::after { content: ''; position: absolute; top: 0; right: -7px; border-width: 0 0 9px 8px; border-style: solid; border-color: transparent transparent transparent #d9fdd3; }
.message-header { margin-bottom: 7px; font-weight: 700; }
.message-body { overflow-wrap: anywhere; }
.message-footer { margin-top: 7px; color: #667781; font-size: .76rem; }
.message-bubble time { position: absolute; left: 8px; bottom: 4px; color: #667781; font-size: .62rem; direction: ltr; }
.message-bubble time span { color: #53bdeb; }
.message-bubble mark.variable { padding: 1px 3px; border-radius: 3px; background: var(--yellow); color: #3a3212; box-shadow: inset 0 -1px 0 #dfc943; }
.media-preview { display: grid; place-items: center; height: 86px; margin: -4px -5px 8px; border-radius: 6px; background: linear-gradient(135deg, #c4d8cf, #9db8aa); color: #355548; }
.media-preview span { font-size: 1.8rem; }
.media-preview small { margin-top: -18px; font-size: .62rem; font-weight: 750; text-transform: uppercase; }
.wa-buttons { display: grid; margin: 3px 0 0 9%; overflow: hidden; border-radius: 7px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.wa-button { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 5px; padding: 8px 10px; border-bottom: 1px solid #d8e1dd; background: #f7fffb; color: #027eb5; font-family: Arial, sans-serif; font-size: .8rem; text-align: center; }
.wa-button:last-child { border-bottom: 0; }
.wa-button small { color: #718078; font-size: .58rem; font-weight: 700; text-transform: uppercase; }
.traits { display: flex; flex-wrap: wrap; gap: 4px; margin: 9px 0; }
.traits .warning { background: #fff0e8; color: #9b4c27; }
.rating-row { display: grid; grid-template-columns: 67px repeat(3, 1fr); gap: 5px; align-items: center; margin-top: 7px; }
.rating-row > span { color: var(--muted); font-size: .69rem; font-weight: 800; text-transform: uppercase; }
.rating-button { display: flex; justify-content: center; align-items: center; gap: 3px; min-width: 0; padding: 6px 3px; border: 1px solid var(--line); border-radius: 7px; background: white; color: #53645b; font-size: .69rem; font-weight: 750; }
.rating-button i { font-size: .9rem; font-style: normal; }
.rating-button:hover { background: #f5f8f6; }
.rating-button.reject.selected { border-color: #d65c5c; background: #fff0f0; color: #a72f2f; }
.rating-button.like.selected { border-color: #1c9a6d; background: #e8f8f1; color: #087453; }
.rating-button.superlike.selected { border-color: #d3a128; background: #fff8dc; color: #8a6200; }
.note-field { display: grid; grid-template-columns: 67px 1fr; align-items: center; margin-top: 7px; }
.note-field span { color: var(--muted); font-size: .69rem; font-weight: 800; text-transform: uppercase; }
.note-field input { min-height: 32px; padding: 5px 8px; font-size: .75rem; }
.show-more { width: 100%; margin-top: 10px; padding: 10px; border: 1px dashed #b9cbc1; border-radius: 10px; background: transparent; color: var(--green); font-weight: 750; }
.empty-state { place-items: center; gap: 8px; padding: 90px 20px; color: var(--muted); text-align: center; }
.empty-state:not([hidden]) { display: grid; }

.variables-dialog { width: min(720px, calc(100% - 24px)); max-height: 86vh; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
.variables-dialog::backdrop { background: rgba(11,27,20,.5); backdrop-filter: blur(3px); }
.dialog-shell { display: grid; max-height: 86vh; grid-template-rows: auto 1fr auto; }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.1rem; }
.dialog-head p { margin-top: 4px; color: var(--muted); font-size: .82rem; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: 1.3rem; }
.variable-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; overflow: auto; padding: 18px 20px; }
.variable-grid label { display: grid; gap: 5px; }
.variable-grid span { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: capitalize; }
.dialog-actions { border-top: 1px solid var(--line); border-bottom: 0; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 420px; padding: 12px 16px; border-radius: 10px; background: #173d2e; color: white; box-shadow: var(--shadow); transform: translateY(18px); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error { background: #842f2f; }

@media (max-width: 1100px) {
  .topbar { align-items: flex-start; }
  .header-actions { flex-wrap: wrap; justify-content: end; }
  .search-row { grid-template-columns: repeat(3, 1fr); }
  .search-field { grid-column: span 2; }
  .exclude-field { grid-column: span 1; }
  .facet-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { position: static; display: grid; padding: 14px 16px; }
  .header-actions { justify-content: stretch; }
  .reviewer-field { width: 100%; }
  .reviewer-field input { width: 100%; }
  .header-actions .button { flex: 1; }
  main { padding-top: 14px; }
  .search-row { grid-template-columns: 1fr 1fr; }
  .search-field, .exclude-field { grid-column: 1 / -1; }
  .progress-strip { top: 6px; align-items: stretch; flex-direction: column; gap: 7px; }
  .progress-copy { justify-content: space-between; min-width: 0; }
  .progress-copy span { text-align: right; }
  .coverage-head { display: grid; }
  .coverage-totals { justify-content: start; }
  .coverage-inspector { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: 1fr; }
  .variable-grid { grid-template-columns: 1fr; }
}
