* {
  box-sizing: border-box;
}

:root {
  --bg: #070a0f;
  --panel: #10141d;
  --panel-2: #161b27;
  --panel-3: #1d2433;
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(255,255,255,0.08);
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #22c55e;
  --yellow: #facc15;
  --orange: #f97316;
  --red: #ef4444;
  --purple: #8b5cf6;
  --cyan: #38bdf8;
}

body {
  margin: 0;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  background: #eef2f7;
  color: #0f172a;
  font-weight: 600;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: #0f172a;
  color: white;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 800;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  background: white;
}

textarea {
  min-height: 70px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}

.topbar p {
  margin: 4px 0 0;
  color: #475569;
  font-size: 14px;
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-btn {
  background: #e2e8f0;
  color: #0f172a;
}

.nav-btn.active {
  background: #0f172a;
  color: white;
}

.error-panel {
  margin: 30px;
  padding: 24px;
  border-radius: 20px;
  background: white;
  color: #991b1b;
}

/* TV BOARDS */

.tv-board {
  min-height: calc(100vh - 78px);
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.14), transparent 30%),
    linear-gradient(180deg, #090d14, #05070b);
  color: var(--text);
  padding: 28px;
  overflow: hidden;
}

.tv-board-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.tv-board-header h2 {
  margin: 0;
  font-size: 52px;
  letter-spacing: 0.5px;
  font-weight: 900;
}

.tv-board-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.tv-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.live-pill,
.page-pill {
  background: rgba(255,255,255,0.09);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 900;
}

.live-pill {
  color: #86efac;
}

.tv-date {
  color: #cbd5e1;
  font-size: 18px;
  font-weight: 800;
}

.tv-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.tv-kpis div {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.tv-kpis span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.tv-kpis strong {
  display: block;
  margin-top: 4px;
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
}

.danger-kpi {
  background: rgba(239,68,68,0.18) !important;
  border-color: rgba(239,68,68,0.5) !important;
}

.problem-strip {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(239,68,68,0.16);
  border: 1px solid rgba(239,68,68,0.5);
  color: white;
  border-radius: 18px;
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 18px;
  font-weight: 900;
}

.problem-strip strong {
  color: #fecaca;
}

.split-board {
  display: grid;
  grid-template-columns: 0.88fr 1.12fr;
  gap: 22px;
  height: calc(100vh - 300px);
  min-height: 430px;
}

.split-column {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 18px;
  overflow: hidden;
}

/* NEW ORDERS: fundo dark, somente as linhas em azul forte */

.new-column {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
}

.new-column .column-title h3 {
  color: #f8fafc;
}

.new-column .column-title span {
  background: #2563eb;
  color: white;
}

.new-column .tv-order-row {
  background: linear-gradient(90deg, #1d4ed8, #2563eb);
  color: white;
  border-left-color: #93c5fd;
  box-shadow:
    0 0 0 1px rgba(147, 197, 253, 0.35),
    0 10px 24px rgba(37, 99, 235, 0.28);
}

.new-column .tv-order-row .tv-desc {
  color: #dbeafe;
}

.new-column .tv-order-row .status-badge,
.new-column .tv-order-row .area-badge,
.new-column .tv-order-row .priority-badge {
  background: rgba(255,255,255,0.18);
  color: white;
}

.progress-column {
  background: rgba(255,255,255,0.06);
}

.column-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.column-title h3 {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.column-title span {
  background: white;
  color: #0f172a;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 18px;
  font-weight: 900;
}

.tv-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tv-order-row {
  display: grid;
  grid-template-columns: 150px 1fr 280px;
  gap: 14px;
  align-items: center;
  background: rgba(255,255,255,0.96);
  color: #020617;
  border-radius: 20px;
  padding: 14px 18px;
  min-height: 96px;
  border-left: 8px solid var(--blue);
}

.tv-order-id {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -1px;
}

.tv-customer {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
}

.tv-desc {
  color: #334155;
  margin-top: 6px;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-order-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.empty-state {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: #94a3b8;
  border: 1px dashed rgba(255,255,255,0.22);
  border-radius: 20px;
  font-size: 22px;
  font-weight: 900;
}

/* TV 32 INCH */

.tv-small {
  padding: 18px;
}

.tv-small .tv-board-header h2 {
  font-size: 36px;
}

.tv-small .tv-board-header p,
.tv-small .tv-date {
  font-size: 14px;
}

.tv-small .tv-kpis {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tv-small .tv-kpis div {
  padding: 10px;
}

.tv-small .tv-kpis strong {
  font-size: 26px;
}

.tv-small .split-board {
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  height: calc(100vh - 285px);
}

.tv-small .column-title h3 {
  font-size: 20px;
}

.tv-small .tv-order-row {
  grid-template-columns: 100px 1fr;
  min-height: 82px;
  padding: 12px;
}

.tv-small .tv-order-id {
  font-size: 27px;
  font-weight: 900;
}

.tv-small .tv-customer {
  font-size: 18px;
  font-weight: 800;
}

.tv-small .tv-desc {
  display: none;
}

.tv-small .tv-order-tags {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

/* BADGES */

.status-badge,
.area-badge,
.priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.status-NEW {
  background: #2563eb;
  color: white;
}

.status-INVOICE {
  background: #fef3c7;
  color: #92400e;
}

.status-PICKING {
  background: #fde68a;
  color: #78350f;
}

.status-READY {
  background: #bbf7d0;
  color: #166534;
}

.status-PROBLEM {
  background: #fed7aa;
  color: #9a3412;
}

.status-EM-ROTA {
  background: #ddd6fe;
  color: #5b21b6;
}

.status-ENTREGUE {
  background: #dcfce7;
  color: #166534;
}

.status-VOID {
  background: #e5e7eb;
  color: #374151;
}

.area-badge {
  background: #e2e8f0;
  color: #0f172a;
}

.area-COOLER {
  background: #cffafe;
  color: #155e75;
}

.area-WAREHOUSE {
  background: #ffedd5;
  color: #9a3412;
}

.area-COOLER-WAREHOUSE {
  background: #e0e7ff;
  color: #3730a3;
}

.priority-badge {
  background: #f1f5f9;
  color: #0f172a;
}

/* CONTROL / ADMIN */

.app-page,
.logs-page {
  padding: 24px;
  max-width: 1220px;
  margin: 0 auto;
}

.page-card {
  background: white;
  border-radius: 24px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.page-card h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 900;
}

.page-card p {
  margin: 8px 0 0;
  color: #475569;
}

.operator-panel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.operator-panel label {
  font-weight: 900;
}

.operator-panel input {
  width: 220px;
}

.admin-form {
  background: white;
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr 1fr;
  gap: 10px;
}

.admin-form textarea {
  grid-column: 1 / -1;
}

.admin-form button {
  max-width: 260px;
}

.control-list {
  display: grid;
  gap: 16px;
}

.control-card {
  background: white;
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
}

.control-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.control-card h3 {
  margin: 0;
  font-size: 30px;
  font-weight: 900;
}

.control-card h4 {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 800;
}

.control-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
  color: #475569;
  font-weight: 700;
}

.control-notes {
  font-size: 16px;
  color: #0f172a;
}

.status-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.status-action {
  color: #0f172a;
  background: #e2e8f0;
}

.status-action.selected {
  outline: 3px solid #0f172a;
}

.inline-edit {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 8px;
  margin-top: 14px;
}

.card-footer-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.ghost-btn {
  background: #e2e8f0;
  color: #0f172a;
}

.delete-btn {
  background: #dc2626;
}

.mini-history {
  margin-top: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px;
}

.mini-history h5 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 900;
}

.mini-log-row {
  display: grid;
  grid-template-columns: 110px 140px 100px 1fr 160px;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
  padding: 8px 0;
  font-size: 13px;
}

.mini-log-row:first-of-type {
  border-top: 0;
}

/* LOGS */

.logs-table-wrap {
  background: white;
  border-radius: 24px;
  padding: 14px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
  overflow-x: auto;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.logs-table th,
.logs-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 12px;
  text-align: left;
  white-space: nowrap;
}

.logs-table th {
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 900;
}

.log-action {
  background: #e2e8f0;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 900;
}

/* MOBILE */

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    justify-content: flex-start;
  }

  .page-card {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-form,
  .inline-edit,
  .mini-log-row {
    grid-template-columns: 1fr;
  }

  .operator-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .operator-panel input {
    width: 100%;
  }

  .split-board {
    grid-template-columns: 1fr;
    height: auto;
  }

  .tv-board {
    overflow: auto;
  }

  .tv-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .tv-order-row {
    grid-template-columns: 1fr;
  }

  .tv-order-tags {
    justify-content: flex-start;
  }
}
