@charset "UTF-8";
:root {
  --ink: #1e2330;
  --muted: #677086;
  --paper: #f6f8fb;
  --line: #e3e7f0;
  --accent: #3b5bdb;
  --accent-dark: #2f49b5;
  --accent-soft: #edf2ff;
  --white: #ffffff;
  --green: #15803d;
  --green-bg: #dcfce7;
  --green-border: #bbf7d0;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --red-border: #fecaca;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --amber-border: #fde68a;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  --blue-border: #bfdbfe;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  background: var(--accent);
  color: var(--white);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

button:hover, .btn:hover {
  background: var(--accent-dark);
  color: var(--white);
}

.btn-secondary, button.btn-secondary {
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover, button.btn-secondary:hover {
  background: #f1f4f9;
  color: var(--ink);
}

.btn-danger, button.btn-danger {
  background: #fff5f5;
  border-color: var(--red-border);
  color: var(--red);
}

.btn-danger:hover, button.btn-danger:hover {
  background: var(--red-bg);
  color: var(--red);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 6px;
}

/* Navbar / Top Layout */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.navbar-inner {
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.brand-logo {
  font-family: "Bahnschrift", "Segoe UI", sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1.5px;
  color: var(--ink);
}

.brand-logo span {
  color: var(--accent);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.nav-links a:hover {
  background: var(--paper);
  color: var(--ink);
}

.nav-links a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

.role-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  background: #e2e8f0;
  color: #475569;
}

.role-tag.master {
  background: var(--accent);
  color: var(--white);
}

.container {
  max-width: 1680px;
  margin: 0 auto;
  padding: 26px 28px 60px;
}

/* Header & Alerts */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.flash-msg {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  color: var(--blue);
}

.flash-msg.success {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

.flash-msg.error {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red);
}

/* Rule Legend Banner */
.rules-banner {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.rules-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

.rule-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 500;
}

.rule-du {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.rule-arrow {
  color: #94a3b8;
  font-weight: bold;
}

/* KPI Summary Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(30, 35, 48, 0.06);
}

.kpi-card.active-filter {
  outline: 2px solid var(--accent);
}

.kpi-card.kpi-overdue {
  border-left: 4px solid var(--red);
}

.kpi-card.kpi-warning {
  border-left: 4px solid var(--amber);
}

.kpi-card.kpi-ontrack {
  border-left: 4px solid var(--accent);
}

.kpi-card.kpi-done {
  border-left: 4px solid var(--green);
}

.kpi-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  margin: 6px 0 2px;
  letter-spacing: -1px;
}

.kpi-overdue .kpi-value { color: var(--red); }
.kpi-warning .kpi-value { color: var(--amber); }
.kpi-done .kpi-value { color: var(--green); }

.kpi-sub {
  font-size: 11px;
  color: var(--muted);
}

/* Overdue Alert Box */
.alert-box {
  background: #fff8f8;
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.alert-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.alert-box-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.alert-chip {
  background: var(--white);
  border: 1px solid #fbd5d5;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.alert-chip:hover {
  border-color: var(--red);
}

.alert-chip strong {
  display: block;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.alert-chip small {
  color: var(--red);
  font-weight: 600;
}

/* Filters Bar */
.filters-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.filters-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 160px;
}

.filter-group.search-group {
  flex: 2;
  min-width: 240px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

input, select, textarea {
  background: var(--white);
  color: var(--ink);
  border: 1px solid #cfd6e4;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid #93c5fd;
  border-color: var(--accent);
}

/* Process Table */
.table-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

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

table.proc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.proc-table th {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  padding: 12px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

table.proc-table th .th-du {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

table.proc-table td {
  padding: 12px 12px;
  border-bottom: 1px solid #eef1f6;
  vertical-align: middle;
}

table.proc-table tbody tr:hover {
  background: #f9fbff;
}

table.proc-table tbody tr.row-overdue {
  background: #fffafa;
}

table.proc-table tbody tr.row-overdue:hover {
  background: #fff2f2;
}

table.proc-table tbody tr.row-concluido {
  background: #f9fefb;
}

.cota-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

.client-name {
  font-weight: 600;
  color: var(--ink);
  display: block;
  max-width: 220px;
}

.client-doc {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-concluido {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.status-atrasado {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.status-atencao {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.status-andamento {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}

/* Stage Cell inside Table */
.stage-cell {
  min-width: 120px;
}

.stage-pill {
  display: flex;
  flex-direction: column;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 11.5px;
  line-height: 1.3;
}

.stage-pill.done {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.stage-pill.overdue {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.stage-pill.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.stage-pill.on_track {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #334155;
}

.stage-pill.waiting, .stage-pill.skipped {
  background: #fafafa;
  border-color: #f1f5f9;
  color: #94a3b8;
}

.stage-pill-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-weight: 700;
}

.stage-pill-sub {
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.9;
}

.assembleia-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
}

.assembleia-tag.disp {
  background: #ecfdf5;
  color: #047857;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* Forms & Panels */
.panel-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}

.form-section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 22px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.form-section-title:first-child {
  margin-top: 0;
}

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

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

.field-box label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.field-box small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.errorlist {
  color: var(--red);
  font-size: 12px;
  margin: 4px 0 0;
  padding-left: 16px;
}

/* Visual Stepper in Edit View */
.stepper-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stepper-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--white);
}

.stepper-item.done { border-left: 4px solid var(--green); background: #f9fefb; }
.stepper-item.overdue { border-left: 4px solid var(--red); background: #fff9f9; }
.stepper-item.warning { border-left: 4px solid var(--amber); background: #fffdf7; }
.stepper-item.on_track { border-left: 4px solid var(--accent); }

/* Audit History Cards */
.history-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: var(--white);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.changes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--paper);
  border-radius: 8px;
  overflow: hidden;
}

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

/* Dialog */
dialog.modal {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  width: min(620px, calc(100vw - 28px));
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.2);
}

dialog.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

/* Login Page */
.login-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
}

.login-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 38px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 16px 40px rgba(30, 35, 48, 0.07);
}

.login-card h1 {
  font-size: 22px;
  margin: 14px 0 6px;
}

.login-card p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 24px;
}

@media (max-width: 1100px) {
  .kpi-grid, .stepper-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .navbar-inner {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .container {
    padding: 18px 14px 40px;
  }
  .kpi-grid, .stepper-grid, .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }
}
