:root {
  color-scheme: light;
  --ink: #16211f;
  --muted: #62706c;
  --subtle: #7e8a86;
  --paper: #f5f8f7;
  --surface: #ffffff;
  --line: #d8e1de;
  --line-strong: #bccac6;
  --teal: #177d74;
  --teal-soft: #dff4f1;
  --red: #e34035;
  --red-soft: #ffe7e4;
  --amber: #a86600;
  --amber-soft: #fff1d7;
  --blue: #2f62d6;
  --blue-soft: #e6edff;
  --shadow: 0 18px 46px rgba(28, 46, 42, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(23, 125, 116, 0.08), transparent 28rem),
    var(--paper);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.05;
}

h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.ghost-button,
.wide-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 750;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.ghost-button {
  border-color: var(--line);
}

.ghost-button.compact {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.9rem;
}

.wide-button {
  width: 100%;
  border-color: var(--line);
  background: var(--ink);
  color: #fff;
}

.wide-button.secondary {
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  width: 38px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface);
}

.primary-button:hover,
.ghost-button:hover,
.wide-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.dashboard {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.filters-panel,
.detail-panel,
.review-lane,
.monitor-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.filters-panel {
  position: sticky;
  top: 16px;
  padding: 16px;
}

.field-label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.text-input,
.select-input,
.form-input,
.form-textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.form-textarea {
  min-height: 96px;
  resize: vertical;
}

.text-input:focus,
.select-input:focus,
.form-input:focus,
.form-textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 125, 116, 0.14);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 14px 0 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf3f1;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 780;
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(28, 46, 42, 0.08);
}

.brief-panel,
.automation-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.brief-panel p,
.automation-panel p {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.automation-panel .wide-button + .wide-button {
  margin-top: 8px;
}

.workspace {
  display: grid;
  gap: 16px;
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.metric-card strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1.05;
}

.metric-card span {
  display: block;
  margin-top: 8px;
  color: var(--subtle);
  font-size: 0.82rem;
}

.review-lane,
.monitor-table-wrap,
.detail-panel {
  padding: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.queue-list {
  display: grid;
  gap: 10px;
}

.queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.queue-item strong {
  display: block;
  margin-bottom: 3px;
}

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

.queue-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.count-pill,
.status-pill,
.priority-pill,
.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 820;
}

.count-pill {
  background: #edf3f1;
  color: var(--muted);
}

.status-pill.due,
.priority-pill.alta {
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.soon,
.priority-pill.media {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.ok,
.priority-pill.baixa {
  background: var(--teal-soft);
  color: var(--teal);
}

.status-pill.paused {
  background: #eceff2;
  color: #5f6871;
}

.type-pill {
  background: var(--blue-soft);
  color: var(--blue);
}

.table-scroll {
  overflow-x: auto;
}

.monitor-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.monitor-table th,
.monitor-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.monitor-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 820;
  text-transform: uppercase;
}

.monitor-table tr {
  transition: background 150ms ease;
}

.monitor-table tbody tr:hover,
.monitor-table tbody tr.is-selected {
  background: #f4faf8;
}

.name-cell {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.row-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.thumb {
  width: 46px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(227, 64, 53, 0.12), rgba(23, 125, 116, 0.12)),
    #fff;
  object-fit: cover;
}

.name-cell strong {
  display: block;
  margin-bottom: 2px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.detail-panel {
  position: sticky;
  top: 16px;
  min-height: 520px;
}

.detail-empty {
  display: grid;
  min-height: 420px;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.detail-header {
  display: grid;
  gap: 12px;
}

.detail-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.detail-link {
  color: var(--teal);
  font-weight: 760;
  text-decoration: none;
}

.detail-link:hover {
  text-decoration: underline;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.mini-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.mini-stat strong {
  display: block;
  margin-top: 5px;
  font-size: 1.1rem;
}

.sparkline {
  width: 100%;
  height: 90px;
  margin: 6px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.history-item strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.notes-box {
  margin-top: 16px;
  border-left: 3px solid var(--teal);
  padding: 10px 0 10px 12px;
  color: var(--muted);
  line-height: 1.45;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 18, 17, 0.42);
}

.modal-root[hidden] {
  display: none !important;
  pointer-events: none;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(8, 17, 15, 0.28);
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-body {
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-help {
  margin: 6px 0 0;
  color: var(--subtle);
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100% - 36px));
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: 0 16px 50px rgba(8, 17, 15, 0.25);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

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

@media (max-width: 1180px) {
  .dashboard {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .detail-panel {
    position: static;
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .top-actions button {
    flex: 1 1 150px;
  }

  .dashboard,
  .metrics-strip {
    grid-template-columns: 1fr;
  }

  .filters-panel {
    position: static;
  }

  .queue-item {
    grid-template-columns: 1fr;
  }

  .queue-actions {
    justify-content: stretch;
  }

  .queue-actions button {
    flex: 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-actions,
  .mini-grid {
    grid-template-columns: 1fr;
  }
}

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