/* Hallmark | built: Safety dashboard | redesign: restyle | scope: app | theme: Refract (by request, water/pool) | signature: lavender caustics over clear white surfaces */
/* Hallmark | pre-emit critique: P4 H5 E4 S4 R5 V4 | weakest: S, purple water could read generic; kept the caustic light restrained and tied it to the dashboard */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --paper-raised: #f8f9fc;
  --paper-shade: #f1f2f7;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --ink: #24143f;
  --ink-soft: #51465f;
  --muted: #777184;
  --rule: rgba(76, 29, 149, 0.12);
  --rule-strong: rgba(76, 29, 149, 0.22);
  --primary: #6d28d9;
  --primary-deep: #4c1d95;
  --primary-soft: #ede9fe;
  --primary-wash: rgba(109, 40, 217, 0.08);
  --primary-light: #ddd2fa;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --facebook: #365eaa;
  --instagram: #7650a8;
  --shadow-card: 0 18px 40px -28px rgba(62, 42, 105, 0.35), 0 3px 8px -5px rgba(62, 42, 105, 0.16);
  --shadow-raised: 0 24px 54px -30px rgba(76, 48, 132, 0.34), 0 5px 13px -7px rgba(76, 48, 132, 0.16);
  --shadow-cast: 22px 34px 66px -38px rgba(112, 82, 183, 0.4);
  --edge-light: inset 0 1px 0 rgba(255, 255, 255, 0.96), inset 0 0 0 1px rgba(255, 255, 255, 0.48);
  --button-glint: rgba(255, 255, 255, 0.3);
  --button-shadow: rgba(78, 47, 147, 0.75);
  --modal-scrim: rgba(33, 27, 50, 0.42);
  --light-mask-mid: rgba(33, 27, 50, 0.72);
  --water-ripple: rgba(128, 99, 194, 0.18);
  --water-highlight: rgba(255, 255, 255, 0.56);
  --water-reflection: rgba(180, 157, 229, 0.24);
  --focus: #7853d0;
  --font-display: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --radius-card: 22px;
  --radius-inner: 13px;
  --radius-pill: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: clip;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.08;
  overflow-wrap: break-word;
  min-width: 0;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--paper);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex: 0 0 270px;
  flex-direction: column;
  gap: var(--space-8);
  width: 270px;
  height: 100vh;
  padding: 26px 18px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  background: var(--paper-raised);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-2);
}

.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--primary-light);
  border-radius: 50%;
  background: var(--surface-strong);
  box-shadow: var(--edge-light), var(--shadow-card);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.brand-name {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
}

.beta-pill {
  width: fit-content;
  padding: 3px 9px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--primary-deep);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 46px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.94rem;
  font-weight: 500;
  text-align: left;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.nav-item:hover,
.nav-item.active {
  border-color: var(--rule);
  background: var(--surface-strong);
  box-shadow: var(--edge-light), var(--shadow-card);
  color: var(--primary-deep);
}

.nav-icon {
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar-card {
  margin-top: auto;
  padding: var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--edge-light), var(--shadow-card);
}

.sidebar-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  color: var(--ink);
  font-weight: 500;
}

.dot-purple,
.indicator-dot {
  display: inline-block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
}

.sidebar-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  box-shadow: var(--edge-light), var(--shadow-card);
  color: var(--primary-deep);
  font-weight: 500;
}

.menu-toggle svg {
  width: 18px;
  height: 18px;
}

.main-panel {
  position: relative;
  isolation: isolate;
  flex: 1;
  width: 100%;
  max-width: 1720px;
  min-width: 0;
  margin-inline: auto;
  padding: var(--space-10) clamp(var(--space-5), 2.4vw, var(--space-10)) 56px;
}

.water-light {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  width: min(68%, 980px);
  height: 620px;
  opacity: 0.7;
  pointer-events: none;
  mask-image: linear-gradient(108deg, transparent 48%, var(--light-mask-mid) 70%, var(--ink) 92%, transparent 100%);
}

.main-panel > :not(.water-light) {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: 30px;
}

.eyebrow,
.panel-kicker {
  margin-bottom: var(--space-2);
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

h1 {
  max-width: 24ch;
  font-size: clamp(2.15rem, 3.2vw, 3.15rem);
  line-height: 1.04;
}

h2 {
  font-size: clamp(1.55rem, 2vw, 1.95rem);
}

h3 {
  font-size: 1.35rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.is-loading,
.button:disabled {
  cursor: wait;
  opacity: 0.8;
}

.button.is-loading {
  gap: 0.4rem;
}

.button.is-loading::before {
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin 700ms linear infinite;
  content: "";
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 1px 0 var(--button-glint), 0 12px 25px -17px var(--button-shadow);
  color: var(--paper);
}

.button-primary:hover {
  border-color: var(--primary-deep);
  background: var(--primary-deep);
}

.button-secondary {
  border-color: var(--rule-strong);
  background: var(--surface-strong);
  box-shadow: var(--edge-light), var(--shadow-card);
  color: var(--ink);
}

.button-secondary:hover {
  border-color: var(--primary);
  background: var(--paper);
  color: var(--primary-deep);
}

.button-toggle {
  border-color: var(--primary-light);
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.button-toggle.is-off {
  border-color: var(--rule);
  background: var(--paper-raised);
  color: var(--muted);
}

.compact {
  min-height: 40px;
  padding-inline: 15px;
  font-size: 0.88rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: 22px;
}

.metric-card,
.panel {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--edge-light), var(--shadow-card);
}

.metric-card {
  padding: 19px 19px 17px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.metric-card:hover,
.panel:hover {
  border-color: var(--rule-strong);
  box-shadow: var(--edge-light), var(--shadow-raised);
}

.metric-card:hover {
  transform: translateY(-2px);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.metric-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-2);
}

.metric-label {
  color: var(--ink-soft);
  font-size: 0.87rem;
  font-weight: 500;
  line-height: 1.35;
}

.metric-value {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(2rem, 2.7vw, 2.75rem);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.metric-icon {
  display: inline-flex;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--paper);
  color: var(--primary);
}

.metric-icon svg {
  width: 19px;
  height: 19px;
}

.fb-icon,
.ig-icon,
.warning-icon,
.success-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

.status-badge,
.report-status {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.25;
}

.status-connected {
  border-color: var(--primary-light);
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.status-warning {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}

.status-success {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
}

.metric-alert .metric-value {
  color: var(--danger);
}

.metric-positive .metric-value {
  color: var(--success);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.panel {
  padding: 22px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.inline-header,
.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: 19px;
}

.review-guidance {
  margin: -7px 0 16px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.connected-list,
.account-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.connected-item,
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-inner);
  background: color-mix(in srgb, var(--surface-strong) 72%, var(--primary-soft));
}

.account-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
}

.account-meta div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-1);
}

.account-meta strong,
.connected-item strong {
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: break-word;
}

.account-meta small {
  color: var(--muted);
  font-size: 0.82rem;
}

.platform-badge {
  display: inline-flex;
  min-width: 76px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  color: var(--primary-deep);
  font-size: 0.79rem;
  font-weight: 500;
}

.fb-badge {
  color: var(--facebook);
}

.ig-badge {
  color: var(--instagram);
}

.ai-test-block {
  display: grid;
  gap: var(--space-3);
}

.input-label,
.field span {
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 500;
}

textarea,
input,
select {
  width: 100%;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-inner);
  background: var(--surface-strong);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea::placeholder,
input::placeholder {
  color: var(--muted);
  opacity: 1;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--primary-wash);
  outline: none;
}

select {
  min-height: 44px;
}

.test-controls {
  display: flex;
  gap: var(--space-3);
}

.test-controls select {
  flex: 1;
}

.analysis-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: 17px;
  padding: 14px 15px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-inner);
  background: var(--primary-soft);
}

#use-local-ai-btn {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

.analysis-result.positive {
  border-color: var(--success-soft);
  background: var(--success-soft);
}

.analysis-result.negative {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
}

.analysis-result.error {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
}

.analysis-dot {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.analysis-result strong {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--ink);
  font-weight: 500;
}

.analysis-result p {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.feed-panel {
  padding-bottom: 0;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: 18px;
}

.field {
  display: grid;
  min-width: 0;
  gap: var(--space-2);
}

.search-field {
  min-width: 0;
}

.table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-top: 1px solid var(--rule);
  scrollbar-color: var(--primary-light) transparent;
  scrollbar-width: thin;
}

.comment-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

.comment-table th,
.comment-table td {
  padding: 15px 13px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.comment-table th {
  background: var(--paper-raised);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.comment-table td {
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.comment-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

.avatar {
  display: inline-flex;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--primary-light);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 0.78rem;
  font-weight: 500;
}

.platform-name {
  font-weight: 500;
}

.platform-name.facebook {
  color: var(--facebook);
}

.platform-name.instagram {
  color: var(--instagram);
}

.comment-body {
  max-width: 42ch;
  color: var(--ink-soft);
  line-height: 1.55;
  overflow-wrap: break-word;
}

.tag-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.label-tag {
  display: inline-flex;
  max-width: 220px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 0.79rem;
  font-weight: 500;
  line-height: 1.35;
}

.label-tag.positive {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
}

.label-tag.negative {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}

.label-tag.review {
  border-color: var(--primary-light);
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.review-prediction {
  max-width: 220px;
  color: var(--ink-soft);
  font-size: 0.79rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.report-status {
  border-color: var(--primary-light);
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.confidence-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.confidence-bar {
  width: 68px;
  height: 5px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--paper-shade);
}

.confidence-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.action-cell {
  min-width: 120px;
  vertical-align: middle;
}

.manual-review-actions {
  display: flex;
  max-width: 180px;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 8px;
}

.manual-review-button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--primary-deep);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.manual-review-button[data-manual-classification="positivo"] {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
}

.manual-review-button[data-manual-classification="positivo"]:hover:not(:disabled) {
  border-color: var(--success);
  background: var(--success-soft);
  filter: brightness(0.97);
}

.manual-review-button[data-manual-classification="innecesario"] {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}

.manual-review-button[data-manual-classification="innecesario"]:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-soft);
  filter: brightness(0.97);
}

.manual-review-button:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.manual-review-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.report-button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--danger-soft);
  border-radius: var(--radius-pill);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.83rem;
  font-weight: 500;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.report-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--danger);
}

.report-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.summary-panel {
  margin-top: 22px;
}

.report-history {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-inner);
  background: var(--surface);
}

.report-item-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.report-item-copy strong {
  color: var(--ink);
  font-size: 0.97rem;
  font-weight: 500;
}

.report-item-copy span {
  color: var(--muted);
  font-size: 0.88rem;
}

.report-item-tag {
  padding: 6px 11px;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 0.8rem;
  font-weight: 500;
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  overflow-y: auto;
  background: var(--modal-scrim);
  overscroll-behavior: contain;
}

.demo-welcome-open {
  overflow: hidden;
}

.demo-welcome-backdrop {
  z-index: 40;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(196, 177, 238, 0.2), transparent 58%),
    var(--modal-scrim);
  backdrop-filter: blur(7px);
}

.hidden {
  display: none !important;
}

.modal-card {
  width: min(92vw, 620px);
  max-height: calc(100dvh - 40px);
  padding: var(--space-6);
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: var(--edge-light), var(--shadow-cast);
}

.demo-welcome-card {
  width: min(92vw, 480px);
  padding: clamp(24px, 6vw, 40px);
  text-align: center;
  animation: demo-welcome-in 260ms ease-out both;
}

.demo-welcome-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin: 0 auto 18px;
  border: 1px solid var(--primary-light);
  border-radius: 50%;
  background: var(--primary-soft);
  box-shadow: var(--edge-light), var(--shadow-card);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 1.65rem;
}

.demo-welcome-card .panel-kicker {
  margin-bottom: 8px;
}

.demo-welcome-card h2 {
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 7vw, 2.3rem);
}

.demo-welcome-description {
  max-width: 39ch;
  margin: 0 auto 22px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.55;
}

.demo-network-options {
  display: grid;
  gap: 11px;
}

.demo-network-button {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-inner);
  background: var(--surface-strong);
  box-shadow: var(--shadow-card);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.demo-network-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.facebook-demo-button:hover:not(:disabled) {
  border-color: rgba(54, 94, 170, 0.4);
  background: #f3f6fc;
}

.instagram-demo-button:hover:not(:disabled) {
  border-color: rgba(118, 80, 168, 0.4);
  background: #f8f4fc;
}

.demo-network-button:disabled {
  cursor: wait;
  opacity: 0.76;
}

.demo-network-icon {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #eaf0fb;
  color: var(--facebook);
  font-family: Arial, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
}

.instagram-demo-icon {
  background: #f1eafb;
  color: var(--instagram);
}

.instagram-demo-icon svg {
  width: 20px;
  height: 20px;
}

.demo-network-label {
  flex: 1;
}

.demo-network-loading {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: demo-loading-spin 700ms linear infinite;
}

.demo-welcome-status {
  min-height: 1.4em;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

@keyframes demo-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes demo-welcome-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.api-card,
.report-card {
  width: min(92vw, 560px);
}

.ollama-model-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ollama-model-controls select {
  flex: 1;
}

.ollama-model-controls .button {
  flex: 0 0 auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 18px;
}

.icon-close {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--ink-soft);
  font-size: 1.45rem;
  line-height: 1;
  transition: border-color 160ms ease, color 160ms ease;
}

.icon-close:hover {
  border-color: var(--primary);
  color: var(--primary-deep);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.account-row strong {
  display: block;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: 18px;
}

.mode-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 18px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 0.85rem;
  font-weight: 500;
}

.report-body {
  display: grid;
  gap: var(--space-3);
}

#report-comment-preview {
  padding: 13px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-inner);
  background: var(--paper-raised);
  color: var(--ink-soft);
  line-height: 1.55;
}

.report-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-inner);
  background: var(--surface-strong);
  color: var(--ink-soft);
}

.report-option input {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.demo-description {
  max-width: 52ch;
  color: var(--ink-soft);
  line-height: 1.6;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 22px;
  bottom: 22px;
  max-width: min(92vw, 460px);
  padding: 13px 17px;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-pill);
  background: var(--primary);
  box-shadow: var(--shadow-cast);
  color: var(--paper);
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex-basis: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-5);
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-1);
  }

  .nav-item {
    width: auto;
    min-height: 42px;
    padding: var(--space-2) var(--space-3);
    font-size: 0.85rem;
  }

  .sidebar-card {
    display: none;
  }

  .main-panel {
    max-width: none;
    padding: var(--space-8) var(--space-6) var(--space-10);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .brand-row {
    min-width: 0;
    padding: 0;
  }

  .brand-mark {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }

  .brand-name {
    font-size: 1.4rem;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .side-nav {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .sidebar.is-open .side-nav {
    display: grid;
  }

  .nav-item {
    width: 100%;
    min-height: 46px;
    justify-content: flex-start;
    padding: 9px 11px;
    font-size: 0.86rem;
  }

  .main-panel {
    padding: var(--space-6) var(--space-4) var(--space-10);
  }

  .water-light {
    width: 100%;
    height: 420px;
    opacity: 0.3;
    mask-image: linear-gradient(105deg, transparent 58%, var(--light-mask-mid) 82%, var(--ink) 100%);
  }

  .topbar,
  .inline-header,
  .feed-header {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: 22px;
  }

  h1 {
    max-width: 19ch;
    font-size: clamp(2rem, 8vw, 2.8rem);
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .toolbar-actions .button {
    width: 100%;
  }

  .metrics-grid {
    gap: 11px;
  }

  .metric-card {
    padding: 15px 13px 14px;
    border-radius: 18px;
  }

  .metric-header {
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: 13px;
  }

  .metric-label {
    font-size: 0.82rem;
  }

  .metric-icon {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .metric-icon svg {
    width: 17px;
    height: 17px;
  }

  .metric-value {
    font-size: 1.9rem;
  }

  .status-badge {
    padding: var(--space-1) var(--space-2);
    font-size: 0.72rem;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .panel {
    padding: var(--space-4);
    border-radius: 19px;
  }

  .feed-panel {
    padding-bottom: 0;
  }

  .inline-header,
  .feed-header {
    gap: var(--space-3);
  }

  .feed-header,
  .account-row,
  .row-actions,
  .report-actions,
  .test-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .feed-actions,
  .feed-actions .button,
  .inline-header > .button,
  .row-actions .button,
  .test-controls .button,
  .report-actions .button {
    width: 100%;
  }

  .filter-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-meta {
    align-items: flex-start;
  }

  .account-meta > div {
    overflow-wrap: break-word;
  }

  .report-history li {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: var(--space-3);
  }

  .modal-card,
  .api-card,
  .report-card {
    width: 100%;
    max-width: 560px;
    max-height: calc(100dvh - 24px);
    padding: 19px;
    border-radius: 20px;
  }

  .ollama-model-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .ollama-model-controls .button {
    width: 100%;
  }
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  font-size: 0.78rem;
}

.legal-links a,
.onboarding-legal a {
  color: var(--primary-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

#footer-crtl {
  cursor: help;
  font-weight: 600;
}

.ratio-panel {
  margin: 0 0 20px;
  padding: 18px 22px;
}

.ratio-heading,
.ratio-legend,
.ratio-legend > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ratio-heading {
  margin-bottom: 14px;
}

.ratio-heading h2 {
  font-size: 1.15rem;
}

.ratio-heading > p,
.ratio-legend {
  color: var(--muted);
  font-size: 0.8rem;
}

.ratio-track {
  display: flex;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--paper-shade);
}

.ratio-positive {
  width: 60%;
  background: var(--success);
  transition: width 240ms ease;
}

.ratio-negative {
  width: 40%;
  background: var(--danger);
  transition: width 240ms ease;
}

.ratio-legend {
  justify-content: flex-start;
  gap: 22px;
  margin-top: 10px;
}

.ratio-legend > span {
  justify-content: flex-start;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.positive-dot {
  background: var(--success);
}

.negative-dot {
  background: var(--danger);
}

.quick-connect-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.quick-connect-actions .button {
  flex: 1 1 190px;
}

.connected-item {
  justify-content: flex-start;
}

.account-meta-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.account-meta-copy small {
  color: var(--muted);
  line-height: 1.4;
}

.startup-backdrop {
  z-index: 40;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(196, 177, 238, 0.2), transparent 58%),
    var(--modal-scrim);
  backdrop-filter: blur(7px);
}

.onboarding-card {
  width: min(92vw, 490px);
  padding: clamp(24px, 6vw, 40px);
  text-align: center;
  animation: demo-welcome-in 260ms ease-out both;
}

.demo-welcome-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid var(--primary-light);
  border-radius: 50%;
  background: var(--primary-soft);
  box-shadow: var(--edge-light), var(--shadow-card);
  color: var(--primary);
  font-size: 1.6rem;
}

.onboarding-card h2 {
  margin: 8px 0 12px;
  font-size: clamp(1.7rem, 6vw, 2.2rem);
}

.demo-welcome-description {
  max-width: 40ch;
  margin: 0 auto 20px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.demo-network-options {
  display: grid;
  gap: 10px;
}

.demo-network-button {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-inner);
  background: var(--surface-strong);
  box-shadow: var(--shadow-card);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease;
}

.demo-network-button:hover {
  transform: translateY(-1px);
  border-color: var(--primary-light);
}

.demo-network-label {
  flex: 1;
}

.demo-network-icon {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #eaf0fb;
  color: var(--facebook);
  font: 700 1.45rem Arial, sans-serif;
}

.instagram-demo-icon {
  background: #f1eafb;
  color: var(--instagram);
  font-size: 1.6rem;
}

.demo-start-link {
  margin-top: 18px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--primary-deep);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.demo-user-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  text-align: left;
}

.demo-welcome-status,
.onboarding-legal {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.developer-card {
  width: min(92vw, 540px);
}

.developer-card .api-setup-copy {
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--warning-soft);
  border-radius: var(--radius-inner);
  background: var(--warning-soft);
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.empty-state {
  padding: 32px !important;
  color: var(--muted);
  text-align: center;
}

.manual-review-button[data-manual-classification="positivo"] {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
}

.manual-review-button[data-manual-classification="positivo"]:hover:not(:disabled) {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.manual-review-button[data-manual-classification="innecesario"] {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}

.manual-review-button[data-manual-classification="innecesario"]:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
@keyframes demo-welcome-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 760px) {
  .ratio-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .ratio-legend {
    justify-content: space-between;
    gap: 8px;
  }
}

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

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
    text-align: center;
  }
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 18px 4px 8px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8rem;
}

.app-footer #footer-crtl {
  color: var(--primary-deep);
  font-weight: 700;
}

.app-footer .legal-links {
  flex: 0 0 auto;
  margin: 0;
}

.legal-page {
  min-height: 100vh;
  padding: clamp(20px, 5vw, 56px);
  background:
    radial-gradient(ellipse at 85% 0, rgba(237, 233, 254, 0.8), transparent 38%),
    var(--paper-raised);
}

.legal-document {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: clamp(24px, 6vw, 60px);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: var(--shadow-card);
}

.legal-back {
  display: inline-block;
  margin-bottom: 30px;
  color: var(--primary-deep);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.legal-document h1 {
  margin: 10px 0;
  font-size: clamp(2rem, 6vw, 3rem);
}

.legal-document h2 {
  margin: 30px 0 10px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.legal-document p,
.legal-document li {
  color: var(--ink-soft);
  font-size: 0.96rem;
  line-height: 1.75;
}

.legal-document p + p {
  margin-top: 14px;
}

.legal-document ul,
.legal-document ol {
  display: grid;
  gap: 10px;
  padding-left: 24px;
}

.legal-document a:not(.legal-back) {
  color: var(--primary-deep);
  text-underline-offset: 3px;
}

.legal-updated {
  margin-bottom: 28px;
  color: var(--muted) !important;
  font-size: 0.85rem !important;
}

.legal-footer {
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-footer .legal-links {
    margin-top: 0;
  }

  .legal-page {
    padding: 12px;
  }
}

@media (max-width: 420px) {
  .sidebar {
    padding-inline: var(--space-3);
  }

  .main-panel {
    padding-right: var(--space-3);
    padding-left: var(--space-3);
  }

  .metrics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-card {
    padding: var(--space-4);
  }

  .side-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-meta {
    flex-wrap: wrap;
  }
}

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