:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #dbe3ef;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #133d8d;
  --brand-2: #0f2f6e;
  --ok-bg: #eaf8ef;
  --ok-text: #0f6d2f;
  --err-bg: #fdecec;
  --err-text: #8f1d1d;
  --warn-bg: #fff6e5;
  --warn-text: #7d5500;
}

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

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  font-size: 18px;
}

.user-box {
  color: var(--muted);
  font-size: 13px;
}

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 58px);
}

.shell.shell-guest {
  grid-template-columns: 1fr;
}

.menu {
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 14px;
}

.menu a {
  display: block;
  text-decoration: none;
  color: #1e293b;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.menu a:hover {
  background: #f1f5f9;
  border-color: var(--line);
}

.menu a.active {
  background: #e9f0ff;
  border-color: #bfd2ff;
  color: #0b3a88;
  font-weight: 700;
}

.content {
  padding: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

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

h1,
h2,
h3 {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 12px;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-2);
}

.btn-ghost {
  background: #fff;
  color: #1e293b;
  border-color: var(--line);
}

.btn-danger {
  background: #b42318;
  color: #fff;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  margin-bottom: 5px;
  color: #334155;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 14px;
  background: #fff;
}

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

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-top: 1px solid #e2e8f0;
  padding: 10px 8px;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #334155;
  border-top: none;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}

.status-enviado {
  background: #dbeafe;
  color: #1d4ed8;
}

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

.status-recusado {
  background: #fee2e2;
  color: #991b1b;
}

.status-rascunho {
  background: #e2e8f0;
  color: #334155;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .menu {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

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

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

@media (max-width: 620px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

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

  .btn {
    width: 100%;
    text-align: center;
  }
}
