:root {
  --ink: #1f2328;
  --muted: #667085;
  --line: #d8dde6;
  --page: #f4f6f8;
  --paper: #ffffff;
  --wine: #5b2b35;
  --teal: #0f766e;
  --gold: #b8892f;
  --danger: #b42318;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--page); font-family: Arial, Helvetica, sans-serif; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.sidebar { background: #262327; color: #f7f3ed; padding: 22px 18px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 52px; height: 52px; border-radius: 8px; background: var(--wine); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand small { color: #d6cdc3; margin-top: 3px; }
.side-nav { display: grid; gap: 6px; }
.side-nav a, .sidebar-footer a { padding: 10px 12px; border-radius: 8px; color: #f7f3ed; }
.side-nav a:hover, .sidebar-footer a:hover { background: rgba(255,255,255,.09); }
.side-nav a.active { background: #f7f3ed; color: #262327; font-weight: 900; }
.sidebar-footer { margin-top: auto; display: grid; gap: 6px; }
.content { min-width: 0; padding: 26px; }
.topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.breadcrumb { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
h1 { margin: 0; font-size: 28px; line-height: 1.2; color: var(--wine); }
h2 { margin: 0 0 12px; font-size: 19px; color: var(--ink); }
.user-chip, .status-badge { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 12px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metrics div, .panel, .tabs-grid div, .report-grid a { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 10px 24px rgba(31,35,40,.04); }
.metrics span { display: block; font-weight: 800; font-size: 22px; color: var(--wine); line-height: 1.2; overflow-wrap: anywhere; }
.metrics small { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.clean-list { margin: 0; padding-left: 18px; color: #394150; line-height: 1.7; }
.toolbar { margin-bottom: 14px; display: flex; justify-content: flex-end; }
.primary-btn, .secondary-btn, .danger-btn { border: 1px solid transparent; border-radius: 8px; padding: 10px 14px; font-weight: 800; display: inline-flex; justify-content: center; align-items: center; min-height: 42px; cursor: pointer; }
.primary-btn { background: var(--wine); color: #fff; }
.secondary-btn { background: #fff; color: var(--ink); border-color: var(--line); }
.danger-btn { background: var(--danger); color: #fff; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: #4b5563; font-size: 13px; text-transform: uppercase; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions a { color: var(--teal); font-weight: 800; }
.record-form, .stack-form { display: grid; gap: 14px; max-width: 1180px; }
.record-form { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.record-form { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
.record-form p, .stack-form p { margin: 0; display: grid; gap: 7px; }
.record-form p:has(textarea), .record-form p:has(input[type=file]), .record-form .form-actions { grid-column: 1 / -1; }
.record-form p:has(input[type=checkbox]) { display: flex; align-items: center; gap: 9px; min-height: 32px; }
.record-form p:has(input[type=checkbox]) label { margin: 0; font-weight: 700; }
.record-form p:has(input[type=checkbox]) input[type=checkbox] { order: -1; flex: 0 0 auto; width: 18px; height: 18px; }
label { font-weight: 800; color: #363d47; }
.gpb-input, .gpb-select, .gpb-textarea, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 42px; font: inherit; background: #fff; }
.gpb-textarea, textarea { min-height: 96px; }
.gpb-check { width: auto; min-height: auto; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.message { padding: 10px 12px; border-radius: 8px; background: #edf7f5; border: 1px solid #b7e4dc; color: #075e54; }
.message.error { background: #fff1f2; border-color: #fecdd3; color: var(--danger); }
.tabs-grid, .report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.tabs-grid h3 { margin: 0 0 6px; color: var(--wine); }
.report-grid a { font-weight: 800; color: var(--wine); }
.auth-body { background: linear-gradient(135deg, #262327 0%, #3d3a35 42%, #f4f6f8 42%); display: grid; place-items: center; padding: 24px; }
.auth-shell { width: min(520px, 100%); }
.auth-panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 26px; box-shadow: 0 24px 70px rgba(31,35,40,.18); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand span { width: 52px; height: 52px; border-radius: 8px; background: var(--wine); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.auth-links a, .portal-link { color: var(--teal); font-weight: 800; }
.portal-link { display: block; margin-top: 20px; text-align: center; }
.list-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 180px auto; gap: 10px; margin-bottom: 14px; align-items: center; }
.inline-hint { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; max-width: 1180px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); }
.inline-hint a, .table-link { color: var(--teal); font-weight: 800; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.table-wrap.compact { box-shadow: none; }
.table-wrap.compact .data-table { min-width: 920px; }
        @media (max-width: 980px) { .app-shell { grid-template-columns: 1fr; } .sidebar { position: static; } .metrics, .tabs-grid, .report-grid, .split, .list-filters { grid-template-columns: 1fr; } .topline { flex-direction: column; } }

.material-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.material-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 10px 24px rgba(31,35,40,.04); }
.material-card h3 { margin: 0 0 8px; color: var(--wine); font-size: 18px; }
.material-card p { color: var(--muted); line-height: 1.5; }
.material-card video { width: 100%; max-height: 320px; border-radius: 8px; background: #111; margin: 10px 0; }
.material-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.material-actions form { margin: 0; }


.side-nav .capacitacao-link { margin-top: 18px; background: #b8892f; color: #211a12; border: 1px solid rgba(255,255,255,.18); font-weight: 900; }
.side-nav .capacitacao-link:hover { background: #d0a04b; color: #211a12; }
.training-admin, .training-module { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 10px 24px rgba(31,35,40,.04); }
.training-module-form, .training-upload-form { display: grid; gap: 12px; }
.training-upload-form { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.training-upload-form p:last-of-type { grid-column: 1 / -1; }
.training-modules { display: grid; gap: 18px; margin-top: 18px; }
.training-module-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.training-module-head h2 { color: var(--wine); margin: 0; }
.training-module-head p { color: var(--muted); margin: 6px 0 0; }
.training-module-head span { color: var(--wine); font-weight: 900; }
.training-lessons { display: grid; gap: 12px; margin-top: 14px; }
.training-lesson { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; }
.training-lesson video { width: 100%; max-height: 320px; border-radius: 8px; background: #111; margin: 10px 0; }
.lesson-meta { display: flex; justify-content: space-between; gap: 12px; }
.lesson-meta span { color: var(--teal); font-weight: 900; }
.training-delete-module { margin-top: 14px; }
.empty-state { color: var(--muted); margin: 0; }
.gpb-input:disabled,
.gpb-select:disabled,
.gpb-textarea:disabled,
input[readonly],
textarea[readonly],
select[readonly],
[data-client-readonly="1"] {
  background: #f3f5f8;
  color: #4b5563;
  border-style: dashed;
}
input[data-auto-field="1"],
textarea[data-auto-field="1"] {
  background: #eef4f7;
  border-style: dashed;
}
input[type=number][readonly]::-webkit-outer-spin-button,
input[type=number][readonly]::-webkit-inner-spin-button,
input[data-auto-field="1"]::-webkit-outer-spin-button,
input[data-auto-field="1"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field-help-button { margin-left: 7px; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--teal); font-weight: 900; cursor: help; }
.auto-summary { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; background: #f8fafc; color: #334155; }
.expense-editor { grid-column: 1 / -1; display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.expense-editor-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.expense-editor-head h2 { margin: 0; }
.expense-rows { display: grid; gap: 10px; }
.expense-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto; gap: 10px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.delete-expense { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; color: var(--danger); font-weight: 800; }
.errorlist { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border: 1px solid #fecdd3; border-radius: 8px; background: #fff1f2; color: var(--danger); list-style-position: inside; }
.team-form p:has(select[multiple]) { grid-column: 1 / -1; }
.team-form select[multiple] { min-height: 150px; }
.team-client-picker { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.team-client-picker summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px; cursor: pointer; font-weight: 900; color: #363d47; }
.team-client-picker summary small { color: var(--muted); font-weight: 700; }
.team-client-picker[open] summary { border-bottom: 1px solid var(--line); background: #f8fafc; }
.team-client-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; padding: 14px; }
.team-client-options > div,
.team-client-options li { display: flex; align-items: center; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.team-client-options label { display: inline-flex; align-items: center; gap: 8px; width: 100%; font-weight: 800; }
.team-client-options input[type=checkbox],
.team-permission-grid input[type=checkbox],
.team-active-row input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 auto; }
.team-permission-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.team-permission-grid label { display: flex; align-items: center; gap: 10px; min-height: 40px; margin: 0; font-weight: 800; }
.team-permission-grid span { overflow-wrap: anywhere; }
.permission-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pill { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 9px; border-radius: 999px; background: #f1f5f9; color: #334155; font-size: 12px; font-weight: 800; }
.pill.ok { background: #ecfdf3; color: #067647; }
.muted { color: var(--muted); }
.inline-form { display: inline; margin: 0; }
.link-button { border: 0; background: transparent; color: var(--danger); font: inherit; font-weight: 800; padding: 0; cursor: pointer; }
.provision-summary { display: grid; gap: 14px; }
.timeline-mini { position: relative; display: grid; gap: 12px; margin-top: 12px; padding-left: 18px; }
.timeline-mini::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline-event { position: relative; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.timeline-event::before { content: ""; position: absolute; left: -18px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px #fff; }
.timeline-event strong { display: block; color: var(--wine); }
.legend-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0; color: var(--muted); font-size: 13px; }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.legend::before { content: ""; width: 18px; height: 4px; border-radius: 999px; background: currentColor; }
.legend.debt { color: var(--wine); }
.legend.bank { color: var(--teal); }
.legend.client { color: var(--gold); }
.line-chart { width: 100%; min-height: 280px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.chart-axis { stroke: #d8dde6; stroke-width: 1; }
.chart-line-debt { fill: none; stroke: var(--wine); stroke-width: 3; }
.chart-line-bank { fill: none; stroke: var(--teal); stroke-width: 3; }
.chart-line-client { fill: none; stroke: var(--gold); stroke-width: 3; }
.chart-point { stroke: #fff; stroke-width: 2; }
.chart-point-debt { fill: var(--wine); }
.chart-point-bank { fill: var(--teal); }
.chart-point-client { fill: var(--gold); }
@media (max-width: 760px) { .training-upload-form, .expense-row, .team-client-options, .team-permission-grid { grid-template-columns: 1fr; } .training-upload-form p:last-of-type { grid-column: auto; } .team-client-picker summary { align-items: flex-start; flex-direction: column; } }
