:root {
  --nav: #213445;
  --top: #328eba;
  --accent: #00aeef;
  --accent-dark: #006da8;
  --line: #dfe7f3;
  --soft: #f4f7fb;
  --text: #14233b;
  --muted: #718096;
  --danger: #dc3545;
  --ok: #009a6c;
  --warn: #f39c12;
}

@font-face {
  font-family: 'NotoSansApp';
  src: url('../../fontes/NotoSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NotoSansApp';
  src: url('../../fontes/NotoSans-SemiBold.ttf') format('truetype');
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NotoSansApp';
  src: url('../../fontes/NotoSans-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'NotoSansApp', Arial, Helvetica, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: #edf1f6;
}
a { color: inherit; text-decoration: none; }
button, .btn, input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-family: 'NotoSansApp', Arial, Helvetica, sans-serif;
}
button, .btn {
  width: auto;
  min-width: 34px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  color: #fff;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  grid-auto-flow: column;
  gap: 6px;
  line-height: 1;
}
button:disabled,
input[type="submit"]:disabled {
  opacity: .65;
  cursor: not-allowed;
}
input, select, textarea {
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
}
textarea { min-height: 76px; resize: vertical; }
label { position: relative; display: grid; gap: 5px; font-weight: 700; color: #41516a; }
.field-error {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  width: 18px;
  height: 18px;
  color: #fff;
  background: var(--danger);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  cursor: help;
}
.field-error:empty {
  display: none;
}
.field-error[data-state="info"] {
  background: var(--accent-dark);
}
.field-error::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  display: none;
  width: max-content;
  max-width: 240px;
  padding: 7px 9px;
  color: #fff;
  background: #1f2937;
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}
.modal-box .field-error::after {
  left: auto;
  right: 0;
  transform: none;
  max-width: min(240px, calc(100vw - 72px));
}
.field-error:hover::after,
.field-error:focus::after {
  display: block;
}
h1, h2 { margin: 0 0 14px; letter-spacing: 0; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }
strong, b, th, legend, .brand, .tabs button, .tabs a { font-weight: 600; }
em, i { font-style: italic; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(135deg, #213445 0%, #328eba 100%);
}
.login-alert {
  position: fixed;
  top: 18px;
  width: min(380px, calc(100% - 36px));
}
.login-card {
  width: min(380px, 100%);
  display: grid;
  gap: 14px;
  padding: 26px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
}
.login-card small { color: var(--muted); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 54px;
  background: var(--nav);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 2px 0 8px rgba(0,0,0,.12);
}
.brand {
  width: 100%;
  height: 40px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #1a2a38;
}
.sidebar a {
  width: 100%;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: #d7e5ef;
}
.sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar a img,
.topbar button img,
.icon-img {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
}
.sidebar a img {
  width: 19px;
  height: 19px;
}
.topbar {
  position: fixed;
  inset: 0 0 auto 54px;
  z-index: 10;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--top);
  color: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.12);
}
.topbar span { margin-left: auto; font-size: 12px; }
.topbar form { margin: 0; }
.topbar button, .menu-btn {
  min-width: 28px;
  min-height: 28px;
  padding: 4px 8px;
  background: rgba(0,0,0,.18);
  border: 0;
}
.menu-btn { display: none; }
.content {
  margin-left: 54px;
  padding: 58px 18px 24px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(8, minmax(80px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.card {
  position: relative;
  min-height: 72px;
  padding: 12px;
  border-radius: 7px;
  color: #fff;
  box-shadow: 0 5px 14px rgba(28,41,64,.18);
  background: linear-gradient(180deg, #00bdd8, #008cc7);
}
.card:nth-child(2) { background: linear-gradient(180deg, #00a966, #008b53); }
.card:nth-child(3) { background: linear-gradient(180deg, #ff9f1c, #df8100); }
.card:nth-child(4) { background: linear-gradient(180deg, #6961bd, #51499d); }
.card strong { display: block; margin-bottom: 7px; font-size: 18px; }
.card span { font-size: 11px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.chart-card {
  min-height: 156px;
  grid-column: span 2;
}
.chart-card-column-chart {
  grid-column: span 3;
}
.chart-card strong {
  font-size: 14px;
  line-height: 1.25;
}
.card-chart {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}
.chart-row {
  display: grid;
  grid-template-columns: minmax(72px, .8fr) 1.4fr minmax(70px, auto);
  gap: 7px;
  align-items: center;
}
.chart-label,
.chart-value {
  color: rgba(255,255,255,.94);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}
.chart-value {
  text-align: right;
}
.chart-track {
  height: 8px;
  overflow: hidden;
  background: rgba(255,255,255,.24);
  border-radius: 999px;
}
.chart-track i {
  display: block;
  height: 100%;
  min-width: 2px;
  background: #fff;
  border-radius: inherit;
}
.column-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 116px;
  margin-top: 10px;
}
.column-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  align-items: end;
}
.column-track {
  display: flex;
  align-items: end;
  justify-content: center;
  height: 58px;
  padding: 0 6px;
  background: rgba(255,255,255,.18);
  border-radius: 6px;
}
.column-track i {
  width: 100%;
  min-height: 4px;
  background: #fff;
  border-radius: 5px 5px 0 0;
}
.column-item .chart-label,
.column-item .chart-value {
  overflow: visible;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: normal;
}
.fluctuation-chart {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.fluctuation-row {
  display: grid;
  grid-template-columns: minmax(64px, .7fr) 1.2fr minmax(96px, auto);
  gap: 8px;
  align-items: center;
}
.chart-percent {
  margin: 0;
  font-size: 22px;
}
.fluctuation-row .chart-percent {
  display: block;
  font-size: 12px;
}
.chart-percent.gain {
  color: #d8fff0;
}
.chart-track i.gain {
  background: #d8fff0;
}
.chart-percent.loss {
  color: #ffe3e3;
}
.chart-track i.loss {
  background: #ffe3e3;
}
.fluctuation-track {
  position: relative;
}
.fluctuation-track b {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: rgba(255,255,255,.95);
  border-radius: 999px;
}
[data-dashboard-cards] .card {
  cursor: move;
}
[data-dashboard-cards] .card.dragging {
  opacity: .55;
}
.logistics-cards {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.logistics-cards .card {
  min-height: 58px;
  padding: 10px 12px;
}
.logistics-cards .card strong {
  margin-bottom: 4px;
  font-size: 18px;
}
.card-hide {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  background: rgba(0,0,0,.18);
  border: 0;
}

.panel {
  margin-bottom: 18px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(31,45,61,.08);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filters label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filters-spaced { margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 150px; }
.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-weight: 700;
}
.switch-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-label span {
  position: relative;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: #b7c3d0;
  transition: background .2s ease;
}
.switch-label span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.switch-label input:checked + span {
  background: var(--accent-dark);
}
.switch-label input:checked + span::after {
  transform: translateX(18px);
}
.inactive-row td {
  background: #fff1f1;
}
.overdue-row td {
  background: #fff1f1;
}
.review-row td {
  background: #fff8d8;
}
.toolbar-info {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: #41516a;
}
.overdue-info {
  color: var(--danger);
}
.toolbar form { flex: 1; }
.toolbar input, .toolbar select { max-width: 360px; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  max-height: 62vh;
  overflow-y: auto;
}
.finance-table-wrap,
.contracts-table-wrap,
.logistics-table-wrap {
  max-height: none;
}
table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  padding: 5px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.cell-highlight {
  background: #eaf6ff;
  color: var(--accent-dark);
  font-weight: 800;
}
th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 11px;
  color: #53657d;
  text-transform: uppercase;
  background: #eef5fc;
}
tbody tr:hover { background: #f8fbff; }
.detail-row { display: none; background: #f7faff; }
.detail-row.open { display: table-row; }
.icon {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 4px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent-dark);
  border: 0;
}
.icon img,
button img,
.btn img {
  pointer-events: none;
}
.row-actions {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.row-actions .inline {
  margin: 0;
}
.row-actions .inline button,
.row-actions .icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
}
.form-actions {
  gap: 8px;
}
.form-actions button,
.form-actions .btn {
  width: auto;
  min-width: 86px;
  padding: 0 12px;
}
.align-end > button {
  align-self: end;
  justify-self: start;
  width: auto;
  min-width: 86px;
  padding: 0 12px;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
}
.pagination .btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
}
.search-select {
  position: relative;
  max-width: 420px;
}
.search-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: start;
}
.search-with-action .search-select {
  max-width: none;
}
.search-options {
  position: absolute;
  z-index: 30;
  display: none;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(31,45,61,.14);
}
.search-select.open .search-options { display: grid; }
.search-options button {
  justify-content: start;
  width: 100%;
  height: auto;
  min-height: 30px;
  color: var(--text);
  background: #fff;
  border: 0;
}
.search-options button[hidden] { display: none; }
.search-options button:hover { background: #eef5fc; }
.search-options small { color: var(--muted); }
.badge {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 999px;
  color: #fff;
  background: #607d8b;
  font-size: 11px;
  text-transform: capitalize;
}
.badge-success { background: #2e7d5b; }
.badge-warning { background: #9a6b16; }
.badge-danger { background: #9b3f46; }
.badge-info { background: #2f6f8f; }
.badge-muted { background: #607d8b; }
.empty-state {
  display: grid;
  place-items: center;
  min-height: 96px;
  color: var(--muted);
  background: #f8fbff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.audit-value {
  max-width: 260px;
  white-space: normal;
  font-size: 11px;
  color: var(--muted);
}
.audit-value-button {
  width: 100%;
  height: auto;
  min-height: 28px;
  justify-content: flex-start;
  padding: 4px 6px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  text-align: left;
  white-space: normal;
}
.audit-full-value {
  max-height: 70vh;
  overflow: auto;
  padding: 12px;
  color: var(--text);
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.stage-badge {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 999px;
  color: #fff;
  background: #607d8b;
  font-size: 11px;
  white-space: nowrap;
}
.stage-requested { background: #607d8b; }
.stage-waiting { background: #7b6d3a; }
.stage-separated { background: #2f6f8f; }
.stage-sent { background: #5b6fb0; }
.stage-review { background: #b35b22; }
.stage-done { background: #2e7d5b; }
.stage-stopped { background: #9b3f46; }
.alert {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #fff;
  background: var(--ok);
  transition: opacity .25s ease, transform .25s ease;
}
.alert.danger { background: var(--danger); }
.alert.warn { background: var(--warn); }
.alert.flash-hide {
  opacity: 0;
  transform: translateY(-4px);
}
.muted { color: var(--muted); }

.sheet {
  min-width: 1040px;
  border: 1px solid #dbe5fb;
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
}
.sheet th, .sheet td {
  text-align: center;
  border: 1px solid #dfe6fb;
  background: #f7faff;
}
.sheet thead th {
  color: #5f6591;
  background: #edf4ff;
}
.sheet thead tr:nth-child(2) th {
  top: 24px;
}
.sheet tbody th {
  color: #10223e;
  background: #fff;
}
.metrics {
  margin: 14px 0 0;
  font-weight: 700;
  color: #40506a;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}
.align-end {
  align-items: end;
}
.form-stack {
  display: grid;
  gap: 10px;
}
.compact-form {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}
.full { grid-column: 1 / -1; }
.items-form {
  display: grid;
  gap: 10px;
}
.items-form div {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
}
.contract-items {
  display: grid;
  gap: 8px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.attachment-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.attachment-link {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}
.attachment-link:hover {
  border-color: var(--accent);
}
.history-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.contract-overview-modal {
  width: min(1180px, 100%);
}
.overview-section {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.overview-section h3 {
  margin: 0;
  font-size: 14px;
}
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.overview-grid > span {
  display: grid;
  gap: 2px;
  padding: 8px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.overview-grid .badge {
  color: #fff;
  width: fit-content;
}
.overview-grid > .wide {
  grid-column: span 2;
}
.overview-grid > span > strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}
.history-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}
.history-item span {
  color: var(--muted);
  font-size: 12px;
}
.history-item p {
  margin: 0;
  line-height: 1.4;
}
.import-preview {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}
.import-preview table input {
  min-width: 120px;
  min-height: 30px;
  padding: 5px 7px;
}
.import-preview-actions {
  margin-top: 10px;
}
.contract-item-entry {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(220px, 2fr) minmax(80px, .7fr) minmax(110px, 1fr) minmax(110px, 1fr) 34px;
  gap: 8px;
  align-items: center;
}
.contract-items-table-wrap {
  margin-top: 4px;
}
.contract-items-table th,
.contract-items-table td {
  text-align: center;
}
.contract-items-table th:first-child,
.contract-items-table td:first-child {
  text-align: left;
}
.contract-items-table td {
  padding: 5px;
}
.contract-items-table .table-number-input,
.contract-items-table .table-money-input {
  width: 100%;
  min-width: 92px;
  height: 30px;
  padding: 4px 6px;
  text-align: center;
}
.contract-item-entry > button,
.section-title > button,
.search-with-action > button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.contract-item-entry > button .icon-img,
.section-title > button .icon-img,
.search-with-action > button .icon-img {
  margin: auto;
}
.contract-item-entry [readonly] {
  color: #40506a;
  background: #f7faff;
}
.request-item-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(100px, 160px) 34px;
  gap: 8px;
  align-items: center;
}
.request-item-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.cadastro-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
  align-items: start;
}
.subpanel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}
.subpanel h2 {
  margin: 0;
}
.compact-table {
  min-width: 0;
}
.compact-table th,
.compact-table td {
  white-space: normal;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.subsection-head h3 {
  margin: 0;
  font-size: 14px;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.tabs button, .tabs a {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
  font-weight: 800;
}
.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}
.tabs button.active, .tabs a.active {
  color: #fff;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(20,35,59,.55);
}
.modal.open { display: flex; }
.modal-box {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
}
.modal-box .form-actions {
  position: sticky;
  bottom: -18px;
  z-index: 3;
  margin: 14px -18px -18px;
  padding: 10px 18px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.modal-box h2 {
  padding-right: 36px;
}
.modal-box .section-title {
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.modal-box-small {
  width: min(520px, 100%);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  background: var(--danger);
  border-color: var(--danger);
}
.checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.checks[hidden],
.permission-items[hidden] {
  display: none !important;
}
.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.checks input { width: auto; min-height: auto; }
.permission-groups {
  display: grid;
  gap: 2px;
  margin: 14px 0;
}
.permission-group {
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 0 0 0 12px;
}
.permission-group legend {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  font-weight: 700;
}
.permission-expand {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}
.permission-folder {
  width: 16px;
  height: 12px;
  border: 1px solid #d79b18;
  border-radius: 2px;
  background: #f4b63d;
  display: inline-block;
  position: relative;
}
.permission-folder::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 1px;
  width: 8px;
  height: 4px;
  border: 1px solid #d79b18;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: #f4b63d;
}
.permission-items {
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 2px 0 8px 28px;
  padding-left: 12px;
  border-left: 1px dotted var(--line);
}
.permission-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
.permission-toggle input { width: auto; min-height: auto; }
.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px;
}
.inline input, .inline select { width: 110px; }
.review-form input { width: 76px; }
.actions { min-width: 240px; }

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(4, minmax(80px, 1fr)); }
  .chart-card { grid-column: span 2; }
  .form-grid, .grid-2, .cadastro-split { grid-template-columns: 1fr; }
  .items-form div, .contract-item-entry, .request-item-row { grid-template-columns: 1fr 1fr; }
  .contract-item-head, .request-item-head { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 12px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .topbar {
    left: 0;
    height: 44px;
  }
  .menu-btn { display: inline-grid; }
  .content {
    margin-left: 0;
    padding: 58px 10px 18px;
  }
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .chart-card { grid-column: span 1; }
  .panel { padding: 12px; }
  .toolbar { align-items: stretch; }
  .topbar span { display: none; }
  .items-form div, .contract-item-entry, .request-item-row { grid-template-columns: 1fr; }
}
