/* ═══════════════════════════════════════════════════
   CONTROLE DE PRAZOS PROCESSUAIS — Design Premium
   Ezequiel Silva Advogados
═══════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:          #080e1a;
  --bg2:         #0d1526;
  --bg3:         #131f35;
  --bg4:         #1a2840;
  --line:        rgba(255,255,255,.07);
  --line2:       rgba(255,255,255,.13);
  --text:        #dce6f5;
  --muted:       #6e87ab;
  --muted2:      #3d5070;
  --gold:        #c8a84b;
  --gold2:       #e8c87a;
  --gold-bg:     rgba(200,168,75,.10);
  --gold-border: rgba(200,168,75,.22);
  --accent:      #5b8fe8;
  --accent-bg:   rgba(91,143,232,.12);
  --danger:      #e05470;
  --danger-bg:   rgba(224,84,112,.12);
  --danger-brd:  rgba(224,84,112,.25);
  --success:     #3faa78;
  --success-bg:  rgba(63,170,120,.12);
  --warn:        #e09040;
  --warn-bg:     rgba(224,144,64,.12);
  --wpp:         #25D366;
  --wpp-bg:      rgba(37,211,102,.10);
  --wpp-brd:     rgba(37,211,102,.20);
  --radius:      10px;
  --radius2:     16px;
  --shadow:      0 6px 32px rgba(0,0,0,.45);
  --shadow2:     0 12px 56px rgba(0,0,0,.55);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13.5px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Radial glow background */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 900px 500px at 10% 0%, rgba(91,143,232,.10) 0%, transparent 60%),
    radial-gradient(ellipse 700px 400px at 90% 20%, rgba(224,84,112,.08) 0%, transparent 55%),
    radial-gradient(ellipse 500px 300px at 50% 100%, rgba(200,168,75,.06) 0%, transparent 60%);
}

* { position: relative; z-index: 1; }

/* ── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }

/* ── TOPBAR ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(8,14,26,.82);
  gap: 16px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 13px; }

.logo {
  font-size: 22px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(200,168,75,.25), rgba(200,168,75,.06));
  border: 1px solid var(--gold-border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(200,168,75,.15);
  flex-shrink: 0;
}

.titles h1 {
  font-family: 'Lora', serif;
  font-size: 17px; font-weight: 600;
  letter-spacing: .01em;
  color: var(--text);
  margin: 0;
}
.titles p { margin: 1px 0 0; color: var(--muted); font-size: 11.5px; }

.actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }

/* ── BOTÕES BASE ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line2);
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,.10); border-color: var(--line2); }
.btn.primary {
  background: linear-gradient(135deg, rgba(200,168,75,.22), rgba(200,168,75,.10));
  border-color: var(--gold-border);
  color: var(--gold2);
  box-shadow: 0 3px 14px rgba(200,168,75,.18);
}
.btn.primary:hover { background: linear-gradient(135deg, rgba(200,168,75,.32), rgba(200,168,75,.16)); box-shadow: 0 4px 20px rgba(200,168,75,.26); }
.btn.danger { background: var(--danger-bg); border-color: var(--danger-brd); color: var(--danger); }
.btn.danger:hover { background: rgba(224,84,112,.22); }
.btn.wpp-btn { background: var(--wpp-bg); border-color: var(--wpp-brd); color: var(--wpp); }
.btn.wpp-btn:hover { background: rgba(37,211,102,.20); }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ── WPP BANNER ─── */
.wpp-banner {
  margin: 14px 24px 0;
  padding: 11px 16px;
  background: var(--wpp-bg);
  border: 1px solid var(--wpp-brd);
  border-radius: var(--radius2);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.wpp-banner-left { display: flex; align-items: center; gap: 10px; }
.wpp-banner-icon { font-size: 1.3rem; }
.wpp-banner-text strong { font-size: 13px; color: var(--wpp); display: block; }
.wpp-banner-text small { font-size: 11px; color: var(--muted); }
.wpp-cnt {
  background: var(--wpp); color: #fff;
  padding: 2px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
}

/* ── GRID PRINCIPAL ─── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 14px 24px 28px;
}

/* ── CARD ─── */
.card {
  background: rgba(13,21,38,.82);
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  padding: 16px;
  box-shadow: 0 6px 28px rgba(0,0,0,.25);
}
.card h2 {
  font-family: 'Lora', serif;
  font-size: 14px; font-weight: 600;
  color: var(--text); margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.card h2::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.card h3 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.span2 { grid-column: 1 / span 2; }

/* ── FILTROS ─── */
.filters {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1.5fr .7fr;
  gap: 10px; align-items: end;
}

.field label {
  display: block; font-size: 11px; font-weight: 500;
  color: var(--muted); margin: 0 0 5px;
  text-transform: uppercase; letter-spacing: .05em;
}

.field input, .field select, .field textarea {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 11px;
  border-radius: var(--radius);
  outline: none;
  font-family: inherit; font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,168,75,.10);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted2); }
select option { background: var(--bg2); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.5); cursor: pointer; }

.row { display: flex; gap: 8px; align-items: center; }
.sep { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  transition: .2s; border-radius: 999px;
}
.slider:before {
  content: ""; position: absolute;
  height: 16px; width: 16px; left: 2px; top: 2px;
  background: rgba(255,255,255,.7); transition: .2s; border-radius: 50%;
}
.switch input:checked + .slider { background: var(--gold-bg); border-color: var(--gold-border); }
.switch input:checked + .slider:before { transform: translateX(18px); background: var(--gold); }

/* ── KPIs ─── */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px; margin-bottom: 14px;
}
.kpi {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  padding: 11px 12px;
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.kpi:nth-child(1)::before { background: linear-gradient(90deg, var(--accent), transparent); }
.kpi:nth-child(2)::before { background: linear-gradient(90deg, var(--gold), transparent); }
.kpi:nth-child(3)::before { background: linear-gradient(90deg, var(--danger), transparent); }
.kpi:nth-child(4)::before { background: linear-gradient(90deg, var(--success), transparent); }
.kpi:nth-child(5)::before { background: linear-gradient(90deg, var(--warn), transparent); }

.kpi .n {
  font-family: 'Lora', serif;
  font-size: 26px; font-weight: 400;
  line-height: 1; color: var(--text);
}
.kpi .t { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* ── CHARTS ─── */
.charts { display: grid; grid-template-columns: 1fr 1.8fr; gap: 12px; }
.chartBox {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: var(--radius2); padding: 12px;
}

/* ── SECTION HEADER ─── */
.sectionHeader {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.sectionHeader p { margin: 0; }

/* ── DATATABLES CUSTOM ─── */
table.dataTable { border-collapse: collapse !important; width: 100% !important; }

table.dataTable thead th {
  background: rgba(255,255,255,.04) !important;
  color: var(--muted) !important;
  font-size: 11px !important; font-weight: 600 !important;
  text-transform: uppercase !important; letter-spacing: .06em !important;
  border-bottom: 1px solid var(--line) !important;
  border-top: none !important;
  padding: 10px 12px !important;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s;
}
table.dataTable thead th:hover { color: var(--text) !important; }

table.dataTable tbody tr {
  border-bottom: 1px solid var(--line) !important;
  transition: background .15s;
  cursor: pointer;
}
table.dataTable tbody tr:hover { background: rgba(255,255,255,.04) !important; }
table.dataTable tbody td {
  color: var(--text) !important;
  font-size: 12.5px !important;
  padding: 10px 12px !important;
  border: none !important;
  max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Linha urgente */
table.dataTable tbody tr.row-urgente td:first-child { border-left: 3px solid var(--danger) !important; }
table.dataTable tbody tr.row-hoje td:first-child { border-left: 3px solid var(--warn) !important; }

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { color: var(--muted) !important; font-size: 12px !important; }

.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--muted) !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 4px 10px !important;
  margin: 0 2px !important;
  transition: all .15s !important;
}
.dataTables_wrapper .paginate_button.current,
.dataTables_wrapper .paginate_button.current:hover {
  background: var(--gold-bg) !important;
  border: 1px solid var(--gold-border) !important;
  color: var(--gold2) !important;
}
.dataTables_wrapper .paginate_button:hover {
  background: rgba(255,255,255,.08) !important;
  color: var(--text) !important;
}

/* ── BADGES STATUS / PRIORIDADE ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}
.badge-pendente  { background: var(--gold-bg);   color: var(--gold2);   border: 1px solid var(--gold-border); }
.badge-atrasado  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-brd); }
.badge-concluido { background: var(--success-bg); color: var(--success); border: 1px solid rgba(63,170,120,.22); }
.badge-alta   { background: var(--danger-bg);  color: var(--danger); }
.badge-media  { background: var(--warn-bg);    color: var(--warn); }
.badge-baixa  { background: var(--accent-bg);  color: var(--accent); }

/* ── COUNTDOWN ─── */
.cd { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cd-ok      { color: var(--success); }
.cd-warn    { color: var(--warn); }
.cd-hot     { color: var(--danger); }
.cd-done    { color: var(--muted); }

/* ── WPP QUICK BTN ─── */
.wpp-quick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--wpp-bg); border: 1px solid var(--wpp-brd);
  color: var(--wpp); cursor: pointer; font-size: 13px;
  transition: all .15s;
}
.wpp-quick:hover { background: rgba(37,211,102,.22); transform: scale(1.1); }

/* ── FULLCALENDAR CUSTOM ─── */
#calendar { padding: 4px; }
.fc { color: var(--text) !important; }
.fc .fc-toolbar-title { font-family: 'Lora', serif; font-size: 15px !important; }
.fc .fc-button {
  background: rgba(255,255,255,.06) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  transition: all .15s !important;
}
.fc .fc-button:hover { background: rgba(255,255,255,.12) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--gold-bg) !important;
  border-color: var(--gold-border) !important;
  color: var(--gold2) !important;
}
.fc .fc-daygrid-day:hover { background: rgba(255,255,255,.03) !important; }
.fc .fc-daygrid-day-number { color: var(--muted) !important; font-size: 12px !important; }
.fc .fc-day-today .fc-daygrid-day-number {
  background: var(--gold) !important;
  color: #fff !important;
  border-radius: 50% !important;
  width: 24px; height: 24px;
  display: flex !important; align-items: center; justify-content: center;
}
.fc .fc-col-header-cell-cushion { color: var(--muted) !important; font-size: 11px !important; font-weight: 600 !important; text-transform: uppercase !important; }
.fc-event { border-radius: 4px !important; font-size: 11px !important; font-weight: 500 !important; border: none !important; padding: 1px 5px !important; }
.fc-event.ev-pendente  { background: var(--gold-bg) !important;   color: var(--gold2) !important;   border-left: 2px solid var(--gold) !important; }
.fc-event.ev-atrasado  { background: var(--danger-bg) !important;  color: var(--danger) !important;  border-left: 2px solid var(--danger) !important; }
.fc-event.ev-concluido { background: var(--success-bg) !important; color: var(--success) !important; border-left: 2px solid var(--success) !important; }
.fc .fc-daygrid-event-dot { display: none !important; }
.fc th { border-color: var(--line) !important; }
.fc td { border-color: var(--line) !important; }

/* ── DIALOG / MODAL ─── */
dialog {
  border: none;
  border-radius: var(--radius2);
  width: min(900px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(13,21,38,.97);
  color: var(--text);
  box-shadow: var(--shadow2);
  border: 1px solid var(--line2);
}
dialog::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(6px); }

.modalHeader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(13,21,38,.98); z-index: 2;
}
.modalHeader h2 {
  font-family: 'Lora', serif;
  font-size: 16px; font-weight: 600; margin: 0;
}
.icon {
  border: 1px solid var(--line2);
  background: rgba(255,255,255,.05);
  color: var(--text);
  border-radius: var(--radius);
  padding: 5px 10px; cursor: pointer;
  font-size: 14px; transition: all .15s;
}
.icon:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-brd); }

.modalGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px; padding: 14px 20px;
}
.modalGrid .span2 { grid-column: 1 / span 2; }

.modalActions {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  position: sticky; bottom: 0;
  background: rgba(13,21,38,.98); z-index: 2;
}
.spacer { flex: 1; }

/* WPP Preview no modal */
.wpp-preview {
  background: rgba(37,211,102,.05);
  border: 1px solid var(--wpp-brd);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px; color: var(--muted);
  white-space: pre-line; line-height: 1.8;
  font-family: monospace;
}

/* ── TOAST ─── */
#toast-area {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius2);
  background: var(--bg2);
  border: 1px solid var(--line2);
  box-shadow: var(--shadow2);
  min-width: 270px; max-width: 340px;
  pointer-events: all;
  animation: toastIn .3s ease;
  transition: opacity .25s, transform .25s;
}
.toast.hiding { opacity: 0; transform: translateY(6px); }
.toast-icon { font-size: 1rem; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; font-size: 13px; margin-bottom: 1px; }
.toast-msg { font-size: 12px; color: var(--muted); }
.toast-close { background: none; border: none; color: var(--muted2); cursor: pointer; font-size: 13px; padding: 0; transition: color .15s; }
.toast-close:hover { color: var(--text); }
.toast-success { border-left: 3px solid var(--success); }
.toast-warn    { border-left: 3px solid var(--warn); }
.toast-info    { border-left: 3px solid var(--accent); }
.toast-wpp     { border-left: 3px solid var(--wpp); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── TEXTAREA PUBLICAÇÃO DJe ── */
#tagsField {
  font-family: 'DM Sans', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  resize: vertical;
  min-height: 140px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(200,168,75,.18);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  outline: none;
}
#tagsField:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,168,75,.10);
}
#tagsField::placeholder {
  color: var(--muted2);
  font-style: italic;
  font-size: 12px;
  line-height: 1.6;
}

/* Coluna tags na tabela — preview truncado com tooltip */
.tags-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11.5px;
  cursor: help;
}

/* ── CONFIRM DIALOG ─── */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.confirm-box {
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: var(--radius2);
  padding: 28px 28px 22px;
  max-width: 380px; width: 100%;
  box-shadow: var(--shadow2);
  text-align: center;
}
.confirm-box h3 { font-family: 'Lora', serif; font-size: 16px; margin: 0 0 8px; }
.confirm-box p  { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.confirm-btns   { display: flex; gap: 10px; justify-content: center; }

/* ── RESPONSIVE ─── */
@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .filters { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .modalGrid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .grid { padding: 10px 16px 22px; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr; }
  .actions .btn span { display: none; }
}
