:root {
  --bg: #f6f3ee;
  --panel: #fffdf8;
  --ink: #201b17;
  --muted: #736960;
  --line: #ded5ca;
  --brand: #b8391f;
  --brand-dark: #812716;
  --accent: #23705f;
  --danger: #b21f2d;
  --ok: #1f6f45;
  --shadow: 0 18px 55px rgba(32, 27, 23, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

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

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  background: #251b16;
  color: #fff8f0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px 18px;
  position: sticky;
  top: 0;
}

.brand {
  display: block;
  margin-bottom: 26px;
  max-width: 100%;
  overflow: hidden;
  text-align: center;
}

.nav-toggle {
  display: none;
}

.brand img {
  background: #fff;
  border-radius: 8px;
  display: block;
  height: 118px;
  margin: 0 auto;
  max-width: 100%;
  object-fit: contain;
  padding: 8px;
  width: 194px;
}

.auth-logo {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  height: 142px;
  margin: 0 auto 20px;
  max-width: 100%;
  object-fit: contain;
  padding: 10px;
  width: 240px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a {
  border-radius: 6px;
  color: #efe3d8;
  padding: 10px 12px;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.12);
}

.nav-section {
  color: #bca99a;
  font-size: 10px;
  font-weight: 800;
  margin: 14px 12px 4px;
  text-transform: uppercase;
}

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

.nav .logout-link {
  border-top: 1px solid rgba(255, 255, 255, .12);
  margin-top: 12px;
  padding-top: 14px;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
  color: var(--muted);
}

.user-chip {
  align-items: flex-end;
  display: grid;
  line-height: 1.2;
  text-align: right;
}

.user-chip strong {
  color: var(--ink);
  font-size: 13px;
}

.user-chip small {
  font-size: 11px;
}

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

.page-title h1,
.auth-panel h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.muted,
.empty,
small {
  color: var(--muted);
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 18px;
}

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(32, 27, 23, 0.06);
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  transition: border-color .15s ease, transform .15s ease;
}

.metric-card:hover {
  border-color: #bbaea2;
  transform: translateY(-1px);
}

.metric-card span {
  color: var(--muted);
  font-size: 14px;
}

.metric-card strong {
  font-size: 34px;
}

.split-grid,
.content-grid {
  display: grid;
  gap: 18px;
}

.split-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-grid {
  align-items: start;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
}

.content-grid > .form-stack {
  align-self: start;
}

.form-column {
  align-self: start;
  display: grid;
  gap: 12px;
}

.inline-management-form {
  display: grid;
  gap: 10px;
}

.inventory-top-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
}

.inventory-top-grid > .form-stack {
  align-self: start;
}

.inline-category-create {
  background: #f4eee7;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.inline-category-create[hidden] {
  display: none;
}

.inventory-list-panel {
  min-width: 0;
}

.inventory-summary {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.inventory-summary > div {
  display: grid;
  gap: 4px;
  padding: 15px 18px;
}

.inventory-summary > div + div {
  border-left: 1px solid var(--line);
}

.inventory-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.inventory-summary strong {
  font-size: 21px;
}

.inventory-summary .summary-danger {
  color: var(--danger);
}

.inventory-summary .summary-warning {
  color: #9a5b13;
}

.inventory-editor {
  border-top: 4px solid var(--accent);
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.inventory-editor.is-editing {
  border-top-color: var(--brand);
}

.inventory-editor-header {
  align-items: center;
  background: #faf7f2;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px 20px;
}

.inventory-editor-header h2,
.panel-header h2 {
  margin: 2px 0 0;
}

.form-mode {
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.inventory-form-section {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
}

.inventory-form-section + .inventory-form-section {
  border-top: 1px solid var(--line);
}

.form-section-heading {
  align-items: center;
  display: flex;
  gap: 10px;
}

.form-section-heading > span {
  align-items: center;
  background: #e5eee9;
  border-radius: 50%;
  color: var(--accent);
  display: inline-flex;
  flex: 0 0 28px;
  font-size: 12px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
}

.form-section-heading h3 {
  font-size: 15px;
  margin: 0;
}

.form-section-heading small,
.inventory-item-name small,
.inventory-edit-summary small {
  color: var(--muted);
  display: block;
  font-size: 11px;
}

.inventory-edit-summary {
  align-items: end;
  background: #f0f5f2;
  border-left: 3px solid var(--accent);
  display: grid;
  gap: 2px;
  padding: 11px 12px;
}

.inventory-edit-summary span {
  color: var(--muted);
  font-size: 12px;
}

.inventory-edit-summary strong {
  font-size: 18px;
}

.inventory-editor-actions {
  border-top: 1px solid var(--line);
  padding: 16px 20px 20px;
}

.inventory-editor-actions > * {
  flex: 1;
}

.inventory-item-name {
  min-width: 150px;
}

.inventory-list-panel tbody tr {
  transition: background-color .15s ease;
}

.inventory-list-panel tbody tr:hover {
  background: #faf7f2;
}

.inventory-list-panel .action-edit {
  font-weight: 800;
}

.inventory-filters {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(170px, 1.4fr) minmax(150px, 1fr) minmax(120px, .7fr) auto;
  margin-bottom: 12px;
  padding-bottom: 14px;
}

.utensil-filters {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(170px, 1.4fr) repeat(3, minmax(125px, .8fr));
  margin-bottom: 12px;
  padding-bottom: 14px;
}

.menu-filters {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(170px, 1.4fr) repeat(2, minmax(130px, .8fr)) auto;
  margin-bottom: 12px;
  padding-bottom: 14px;
}

.utensil-filters .filter-actions {
  grid-column: 1 / -1;
}

.filter-actions,
.table-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.table-actions {
  flex-wrap: wrap;
}

.bulk-actions {
  align-items: center;
  background: #f4eee7;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
  min-height: 50px;
  padding: 7px 10px;
}

.bulk-actions > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bulk-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.danger-button:disabled,
.bulk-actions button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.selection-column {
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
  width: 38px;
}

.row-select {
  accent-color: var(--brand);
  cursor: pointer;
  min-height: 17px;
  width: 17px;
}

.result-count {
  color: var(--muted);
  font-size: 13px;
}

.table-action-button,
.link-button {
  background: transparent;
  color: var(--brand);
  min-height: 0;
  padding: 0;
}

.is-inactive,
.inactive-row {
  opacity: 0.62;
}

.danger-link {
  color: #b42318;
}

.inactive-row {
  opacity: .62;
}

.recipe-layout {
  display: grid;
  gap: 18px;
}

.recipe-form {
  border-top: 4px solid var(--accent);
  max-width: none;
}

.recipe-summary {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.recipe-summary > div {
  display: grid;
  gap: 4px;
  padding: 15px 18px;
}

.recipe-summary > div + div {
  border-left: 1px solid var(--line);
}

.recipe-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.recipe-summary strong {
  font-size: 21px;
}

.recipe-form-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin: -4px -20px 2px;
  padding: 18px 20px;
}

.recipe-form-header h2 {
  margin: 2px 0 0;
}

.recipe-list-panel tbody tr {
  transition: background-color .15s ease;
}

.recipe-list-panel tbody tr:hover {
  background: #faf7f2;
}

.migration-panel {
  max-width: 620px;
}

.panel {
  padding: 20px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

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

.panel-header h2 {
  margin: 0;
}

.panel-header a {
  color: var(--brand);
  font-weight: 700;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-actions form {
  margin: 0;
}

.table-actions .table-action-button,
.table-actions .link-button {
  background: transparent;
  border-radius: 0;
  color: var(--brand);
  font-weight: 700;
  min-height: 0;
  padding: 0;
  width: auto;
}

.table-actions .danger-link {
  color: #b42318;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.check-control {
  align-items: center;
  display: flex;
  gap: 9px;
}

.check-control input {
  min-height: 18px;
  width: 18px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  border-color: var(--accent);
  outline: 3px solid rgba(35, 112, 95, .18);
  outline-offset: 1px;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: .55;
}

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

button,
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
}

button,
.primary-button,
.secondary-button,
.nav a {
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

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

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: #eaded1;
  color: var(--ink);
}

.two-cols,
.three-cols {
  display: grid;
  gap: 12px;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.list {
  display: grid;
  gap: 10px;
}

.list-row,
.task-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-top: 10px;
}

.ingredient-builder {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

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

.builder-header h3 {
  font-size: 16px;
  margin: 0;
}

.builder-title {
  display: grid;
  gap: 3px;
}

.ingredient-count {
  color: var(--muted);
  font-size: 12px;
}

.ingredient-column-headings,
.ingredient-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1fr) 100px 135px 100px 38px;
}

.ingredient-column-headings {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 0 8px 7px;
  text-transform: uppercase;
}

.ingredient-scroll {
  overflow: visible;
}

.ingredient-rows {
  display: grid;
  gap: 4px;
}

.ingredient-row {
  align-items: start;
  border-top: 1px solid var(--line);
  padding: 6px 4px;
}

.ingredient-row:first-child {
  border-top: 0;
}

.ingredient-picker {
  display: grid;
  gap: 4px;
  min-width: 0;
  position: relative;
}

.ingredient-picker:focus-within {
  z-index: 30;
}

.ingredient-picker .ingredient-search {
  background: #fff;
}

.ingredient-picker.has-selection .ingredient-search {
  background: #f0f5f2;
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 700;
}

.ingredient-native-select {
  height: 1px;
  left: -10000px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.ingredient-results {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(32, 27, 23, .14);
  display: grid;
  left: 0;
  overflow: visible;
  padding: 4px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
}

.ingredient-results.open-above {
  bottom: calc(100% + 4px);
  top: auto;
}

.ingredient-results[hidden] {
  display: none;
}

.ingredient-result {
  align-items: center;
  background: transparent;
  border-bottom: 1px solid #eee7df;
  border-radius: 4px;
  color: var(--ink);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: stretch;
  line-height: 1.25;
  min-height: 40px;
  padding: 6px 9px;
  text-align: left;
  width: 100%;
}

.ingredient-result:last-of-type {
  border-bottom: 0;
}

.ingredient-result:hover,
.ingredient-result:focus {
  background: #f0f5f2;
  outline: none;
}

.ingredient-result span {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.ingredient-result small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
}

.ingredient-result-empty,
.ingredient-result-more {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  padding: 10px;
}

.recipe-ingredient-builder .ingredient-row input,
.recipe-ingredient-builder .ingredient-row select {
  min-height: 38px;
  padding: 7px 9px;
}

.recipe-ingredient-builder .remove-row:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.purchase-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(140px, 1fr) minmax(130px, 1fr) 70px 58px 100px 105px 34px;
}

.row-cost {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.icon-button {
  align-items: center;
  background: #eaded1;
  color: var(--ink);
  display: inline-flex;
  min-height: 34px;
  padding: 0;
  width: 38px;
}

.cost-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cost-summary.single {
  grid-template-columns: minmax(0, 1fr);
}

.cost-summary div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.cost-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cost-summary strong {
  font-size: 17px;
}

.pricing-helper {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.pricing-helper h3 {
  font-size: 16px;
  margin: 0 0 12px;
}

.pricing-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: 180px minmax(0, 1fr);
}

.pricing-result {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.pricing-result span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pricing-result strong {
  font-size: 22px;
}

.task-row div {
  display: grid;
  gap: 3px;
}

.badge {
  background: #eaded1;
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
  white-space: nowrap;
}

.badge.danger {
  background: #f7d8dc;
  color: var(--danger);
}

.badge.ok {
  background: #d8efe2;
  color: var(--ok);
}

.alert {
  border-radius: 6px;
  font-weight: 700;
  padding: 12px 14px;
}

.alert.error {
  background: #f7d8dc;
  color: var(--danger);
}

.alert.success {
  background: #d8efe2;
  color: var(--ok);
}

.alert.warning {
  background: #f7e5c5;
  color: #8a540e;
}

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

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

th,
td {
  border-top: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  position: sticky;
  top: 0;
  text-transform: uppercase;
  z-index: 2;
}

td small {
  display: block;
  margin-top: 4px;
}

.table-action {
  color: var(--brand);
  font-weight: 800;
}

.page-subtitle {
  color: var(--muted);
  margin: 8px 0 0;
}

.finance-title {
  align-items: end;
}

.finance-title > div:first-child {
  max-width: 680px;
}

.finance-title-actions {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.quick-action {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
}

.quick-action.income {
  background: #e4f2eb;
  border-color: #bedfce;
  color: #17633a;
}

.quick-action.expense {
  background: #f9e7e3;
  border-color: #ecc7bf;
  color: #a72f20;
}

.period-picker {
  min-width: 210px;
  position: relative;
}

.period-picker-trigger {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 2px 12px;
  grid-template-columns: minmax(0, 1fr) 20px;
  min-height: 48px;
  padding: 7px 10px 7px 12px;
  text-align: left;
  width: 100%;
}

.period-picker-trigger:hover,
.period-picker.is-open .period-picker-trigger {
  border-color: var(--brand);
}

.period-picker-trigger:focus-visible {
  box-shadow: 0 0 0 3px rgba(197, 39, 45, .14);
  outline: 0;
}

.period-picker-trigger span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  grid-column: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.period-picker-trigger strong {
  font-size: 13px;
  grid-column: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-picker-trigger i {
  border: 1.5px solid currentColor;
  border-radius: 3px;
  grid-column: 2;
  grid-row: 1 / 3;
  height: 17px;
  opacity: .7;
  position: relative;
  width: 17px;
}

.period-picker-trigger i::before {
  border-top: 1.5px solid currentColor;
  content: '';
  left: 2px;
  position: absolute;
  right: 2px;
  top: 4px;
}

.period-picker-trigger i::after {
  background: currentColor;
  border-radius: 50%;
  box-shadow: 4px 0 currentColor, 8px 0 currentColor, 0 4px currentColor, 4px 4px currentColor, 8px 4px currentColor;
  content: '';
  height: 2px;
  left: 3px;
  opacity: .65;
  position: absolute;
  top: 8px;
  width: 2px;
}

.period-picker-popover {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 16px 40px rgba(30, 25, 22, .18);
  min-width: 320px;
  padding: 14px;
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  z-index: 80;
}

.period-picker-popover[hidden] {
  display: none !important;
}

.period-picker-heading {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
}

.period-picker-heading span {
  font-size: 13px;
  font-weight: 900;
}

.period-picker-heading small {
  color: var(--muted);
  font-size: 10px;
}

.period-mode-tabs {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 12px;
  padding: 3px;
}

.period-mode-tabs button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  min-height: 34px;
}

.period-mode-tabs button:hover {
  color: var(--ink);
}

.period-mode-tabs button.active {
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(30, 25, 22, .12);
  color: var(--brand);
}

.period-picker-fields label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 4px;
  line-height: 1.2;
}

.period-picker-fields input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

.period-picker-fields input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(197, 39, 45, .14);
  outline: 0;
}

.period-picker-fields [hidden] {
  display: none !important;
}

.period-picker-actions {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr 1.35fr;
  margin-top: 13px;
  padding-top: 12px;
}

.period-picker-actions button {
  min-height: 38px;
}

.section-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.section-tabs a {
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 10px 14px;
  white-space: nowrap;
}

.section-tabs a:hover {
  border-bottom-color: var(--brand);
  color: var(--ink);
}

.section-tabs a.active {
  border-bottom-color: var(--brand);
  color: var(--ink);
}

.finance-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  margin-bottom: 18px;
}

.finance-metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid #9a8e83;
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 15px 16px;
}

.finance-metric.income,
.finance-metric.balance-positive {
  border-top-color: var(--ok);
}

.finance-metric.expense,
.finance-metric.balance-negative {
  border-top-color: var(--danger);
}

.finance-metric.pending {
  border-top-color: #b8791b;
}

.finance-metric span,
.dashboard-finance-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.finance-metric strong {
  font-size: 23px;
}

.finance-metric small {
  font-size: 11px;
}

.text-income {
  color: var(--ok);
}

.text-expense {
  color: var(--danger);
}

.finance-insights {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(340px, 1.35fr) repeat(2, minmax(220px, .8fr));
  margin-bottom: 18px;
}

.finance-performance-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.finance-chart-panel {
  min-width: 0;
  overflow: hidden;
}

.chart-hint {
  color: var(--muted);
  font-size: 11px;
}

.vertical-chart {
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 5px;
  height: 220px;
  padding: 8px 2px 0;
}

.monthly-chart {
  grid-template-columns: repeat(12, minmax(22px, 1fr));
}

.daily-chart {
  gap: 2px;
  grid-template-columns: repeat(31, minmax(7px, 1fr));
  overflow-x: auto;
  overflow-y: hidden;
}

.chart-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 28px;
  min-width: 0;
}

.chart-bars-vertical {
  align-items: end;
  display: flex;
  gap: 2px;
  justify-content: center;
  min-height: 0;
}

.chart-bar-vertical {
  border-radius: 3px 3px 0 0;
  display: block;
  max-width: 18px;
  min-height: 0;
  transition: filter .15s ease, opacity .15s ease;
  width: 42%;
}

.chart-column:hover .chart-bar-vertical {
  filter: saturate(1.25);
  opacity: .82;
}

.chart-column > span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  padding-top: 5px;
  text-align: center;
}

.chart-column > span small {
  display: block;
  font-size: 9px;
}

.daily-chart .chart-column > span {
  font-size: 9px;
}

.weekday-performance {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-top: 18px;
  padding-top: 13px;
}

.weekday-performance > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.weekday-performance span,
.weekday-performance strong {
  font-size: 9px;
}

.weekday-performance span {
  color: var(--muted);
  text-transform: uppercase;
}

.weekday-performance strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weekday-performance i {
  background: #e8ecea;
  border-radius: 2px;
  display: block;
  height: 4px;
  overflow: hidden;
}

.weekday-performance i b {
  background: var(--accent);
  display: block;
  height: 100%;
}

.best-days-list > div {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
}

.ranking-position {
  align-items: center;
  background: #eee7df;
  border-radius: 50%;
  color: var(--ink);
  display: flex !important;
  font-size: 11px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.cash-flow-panel,
.finance-breakdown {
  min-width: 0;
}

.chart-legend {
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 12px;
}

.chart-legend span::before {
  border-radius: 50%;
  content: '';
  display: inline-block;
  height: 8px;
  margin-right: 5px;
  width: 8px;
}

.income-dot::before,
.income-bar {
  background: #2f8062;
}

.expense-dot::before,
.expense-bar {
  background: #c84b3a;
}

.cash-chart {
  display: grid;
  gap: 8px;
}

.cash-chart-row {
  align-items: center;
  display: grid;
  gap: 9px;
  grid-template-columns: 42px minmax(0, 1fr);
}

.cash-chart-row time {
  color: var(--muted);
  font-size: 11px;
}

.cash-bars {
  display: grid;
  gap: 3px;
}

.cash-bar {
  border-radius: 2px;
  display: block;
  height: 5px;
  min-width: 2px;
}

.ranked-list,
.settings-list,
.recurring-list,
.due-list {
  display: grid;
}

.ranked-list > div,
.settings-list > div {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 0;
}

.ranked-list span,
.settings-list span {
  display: grid;
}

.ranked-list strong,
.settings-list strong {
  font-size: 13px;
}

.ranked-list b {
  font-size: 13px;
  white-space: nowrap;
}

.finance-workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  margin-bottom: 18px;
  scroll-margin-top: 20px;
}

.finance-entry-form {
  border-top: 4px solid var(--accent);
}

.expense-nature-panel {
  background: #f5f1eb;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 9px;
  padding: 12px;
}

.expense-nature-panel[hidden] {
  display: none;
}

.expense-nature-panel > strong {
  font-size: 13px;
}

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

.expense-nature-options label {
  cursor: pointer;
  display: block;
  position: relative;
}

.expense-nature-options input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.expense-nature-options span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  gap: 3px;
  min-height: 68px;
  padding: 10px;
}

.expense-nature-options input:checked + span {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.expense-nature-options b {
  font-size: 13px;
}

.expense-nature-options small {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}

.finance-payment-pair label > small {
  color: var(--muted);
  font-weight: 600;
}

.finance-fee-preview {
  background: #f5f1eb;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 11px 12px;
}

.finance-fee-preview span {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 3px;
}

.finance-fee-preview strong {
  color: var(--ink);
  font-size: 14px;
}

.finance-fee-preview.has-error {
  border-color: #c73922;
}

.finance-advanced {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
}

.finance-advanced summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 11px 0;
}

.finance-advanced[open] {
  display: grid;
  gap: 12px;
  padding-bottom: 12px;
}

.transaction-type-control {
  background: #eee7df;
  border-radius: 6px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
}

.transaction-type-control label {
  cursor: pointer;
  display: block;
}

.transaction-type-control input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.transaction-type-control span {
  border-radius: 4px;
  color: var(--muted);
  display: block;
  padding: 9px;
  text-align: center;
}

.transaction-type-control input:checked + span {
  background: #fff;
  box-shadow: 0 2px 8px rgba(32, 27, 23, .08);
  color: var(--ink);
}

.due-item {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 58px minmax(150px, 1fr) auto auto;
  padding: 11px 0;
}

.due-item > time {
  color: var(--ink);
  display: grid;
  font-size: 15px;
  font-weight: 800;
}

.due-item > span {
  display: grid;
}

.due-item.overdue time,
.due-item.overdue time small {
  color: var(--danger);
}

.compact-button {
  min-height: 34px;
  padding: 7px 10px;
}

.finance-ledger {
  margin-bottom: 18px;
  scroll-margin-top: 20px;
}

.finance-filters {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(120px, .8fr)) auto;
  margin-bottom: 10px;
  padding-bottom: 14px;
}

.finance-type-tabs {
  background: #f1ece6;
  border-radius: 6px;
  display: inline-grid;
  gap: 3px;
  grid-template-columns: repeat(3, auto);
  margin-bottom: 14px;
  padding: 4px;
}

.finance-type-tabs a {
  border-radius: 4px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 800;
  padding: 9px 14px;
  text-decoration: none;
}

.finance-type-tabs a.active {
  background: #fff;
  box-shadow: 0 1px 5px rgba(48, 34, 25, .12);
  color: var(--ink);
}

.finance-type-tabs a.active.income {
  color: #17633a;
}

.finance-type-tabs a.active.expense {
  color: #a72f20;
}

.inline-selector-panel {
  background: #f8f3ed;
  border: 1px solid #dfd2c5;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.inline-selector-panel[hidden] {
  display: none;
}

.inline-selector-panel > small {
  color: var(--muted);
}

.amount-column {
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.badge.warning {
  background: #f7e5c5;
  color: #8a540e;
}

.finance-secondary-workspace {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.recurring-item {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 34px minmax(160px, 1fr) auto auto;
  padding: 12px 0;
}

.recurring-item > span:nth-child(2) {
  display: grid;
}

.recurring-icon {
  align-items: center;
  background: #eee7df;
  border-radius: 50%;
  display: flex;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.finance-settings {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 18px;
  scroll-margin-top: 20px;
}

.finance-settings .inactive-row {
  display: none;
}

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

.archive-intro p {
  color: var(--muted);
  margin: 5px 0 0;
  max-width: 760px;
}

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

.finance-archive-grid .archive-wide {
  grid-column: 1 / -1;
}

.archive-list {
  display: grid;
}

.archive-list > div {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 11px 0;
}

.archive-list > div > span {
  display: grid;
}

.archive-list small {
  color: var(--muted);
}

.content-grid.archive-view {
  grid-template-columns: 1fr;
}

.content-grid.archive-view > form {
  display: none;
}

.recipe-layout.archive-view {
  grid-template-columns: 1fr;
}

.recipe-layout.archive-view .recipe-form,
.recipe-layout.archive-view + .recipe-metrics {
  display: none;
}

.inline-create-form {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(130px, 1fr) 120px auto;
  margin-bottom: 12px;
}

.payment-create-form {
  background: #f4f7f5;
  border: 1px solid #d7e2dc;
  border-radius: 6px;
  grid-template-columns: minmax(180px, 1fr) 130px auto;
  padding: 12px;
}

.payment-settings-list > div {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 13px 0;
}

.fee-edit-form,
.payment-edit-form,
.manager-edit-form {
  align-items: end;
  display: flex;
  gap: 7px;
}

.fee-edit-form label,
.payment-edit-form label {
  font-size: .72rem;
}

.fee-edit-form input,
.payment-edit-form input,
.manager-edit-form input {
  min-height: 34px;
  padding: 6px 8px;
}

.payment-edit-form label:first-of-type {
  min-width: 180px;
}

.payment-edit-form label:last-of-type {
  width: 120px;
}

.payment-method-manager .page-subtitle { max-width: 620px; }

.payment-method-manager .payment-edit-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) 120px auto;
  width: 100%;
}

.payment-method-manager .payment-edit-form label,
.payment-method-manager .payment-create-form label {
  color: #4d4944;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 5px;
}

.payment-method-manager .payment-edit-form input,
.payment-method-manager .payment-create-form input {
  background: #fff;
  font-size: 14px;
  min-height: 40px;
}

.payment-manager-heading {
  color: var(--muted);
  display: grid;
  font-size: 10px;
  font-weight: 900;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) 120px 160px;
  padding: 4px 95px 7px 0;
  text-transform: uppercase;
}

.percent-input { display: block; position: relative; }
.percent-input input { padding-right: 28px; width: 100%; }
.percent-input b {
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.payment-history-note {
  background: #edf5f1;
  border-left: 3px solid #18794e;
  border-radius: 4px;
  color: #405149;
  line-height: 1.5;
  margin: 14px 0 0;
  padding: 10px 12px;
}

.compact-manager {
  margin: 12px 0 0;
  padding: 0;
}

.compact-manager > summary {
  cursor: pointer;
  font-weight: 800;
  list-style-position: inside;
  padding: 14px 16px;
}

.compact-manager[open] > summary {
  border-bottom: 1px solid var(--line);
}

.compact-manager > :not(summary) {
  margin-left: 16px;
  margin-right: 16px;
}

.compact-manager > :last-child {
  margin-bottom: 16px;
}

.manager-help {
  color: var(--muted);
  font-size: .82rem;
}

.manager-create-form {
  margin-top: 14px;
}

.category-settings-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.manager-edit-form input {
  width: min(100%, 280px);
}

.inventory-editor-column {
  align-self: start;
  min-width: 0;
}

@media (max-width: 720px) {
  .finance-type-tabs {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .finance-type-tabs a {
    text-align: center;
  }

  .payment-settings-list > div {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .payment-method-manager .payment-edit-form,
  .payment-create-form {
    grid-template-columns: 1fr;
  }

  .payment-manager-heading { display: none; }

  .fee-edit-form {
    align-items: end;
  }

  .payment-edit-form,
  .manager-edit-form {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .payment-edit-form label:first-of-type,
  .payment-edit-form label:last-of-type {
    flex: 1 1 120px;
    min-width: 0;
    width: auto;
  }
}

.dashboard-finance-strip {
  align-items: center;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.dashboard-finance-strip > div {
  display: grid;
  gap: 2px;
}

.dashboard-finance-strip strong {
  font-size: 18px;
}

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

  .sidebar {
    height: auto;
    padding: 12px 16px;
    position: static;
  }

  .sidebar-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
  }

  .brand {
    margin: 0;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-section,
  .nav .logout-link {
    grid-column: 1 / -1;
  }

  .split-grid,
  .content-grid,
  .inventory-top-grid {
    grid-template-columns: 1fr;
  }

  .inventory-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-summary > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .inventory-summary > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .utensil-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand img {
    height: 64px;
    margin: 0;
    width: 132px;
  }

  .nav-toggle {
    align-items: center;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    display: inline-flex;
    font-size: 22px;
    height: 42px;
    padding: 0;
    width: 42px;
  }

  .nav {
    display: none;
    margin-top: 12px;
  }

  .nav.is-open {
    display: grid;
  }

  .cost-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipe-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipe-summary > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .recipe-summary > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .ingredient-row {
    grid-template-columns: minmax(180px, 1fr) 90px 120px 90px 38px;
  }

  .ingredient-column-headings {
    grid-template-columns: minmax(180px, 1fr) 90px 120px 90px 38px;
  }

  .purchase-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .main {
    padding: 20px;
  }

  .finance-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-insights,
  .finance-workspace,
  .finance-settings {
    grid-template-columns: 1fr;
  }

  .finance-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-finance-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .inventory-filters {
    grid-template-columns: 1fr;
  }

  .inventory-summary {
    grid-template-columns: 1fr;
  }

  .inventory-summary > div + div,
  .inventory-summary > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .utensil-filters {
    grid-template-columns: 1fr;
  }

  .menu-filters {
    grid-template-columns: 1fr;
  }

  .bulk-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .page-title {
    align-items: stretch;
    flex-direction: column;
  }

  .two-cols,
  .three-cols,
  .purchase-row,
  .cost-summary {
    grid-template-columns: 1fr;
  }

  .finance-fee-preview {
    grid-template-columns: 1fr;
  }

  .expense-nature-options {
    grid-template-columns: 1fr;
  }

  .recipe-summary {
    grid-template-columns: 1fr;
  }

  .recipe-summary > div + div,
  .recipe-summary > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .builder-header {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .ingredient-column-headings {
    display: none;
  }

  .recipe-ingredient-builder .ingredient-row {
    grid-template-areas:
      "ingredient ingredient ingredient ingredient"
      "quantity unit cost remove";
    grid-template-columns: minmax(72px, 1fr) minmax(105px, 1.3fr) auto 38px;
  }

  .recipe-ingredient-builder .ingredient-picker {
    grid-area: ingredient;
  }

  .recipe-ingredient-builder .ingredient-quantity {
    grid-area: quantity;
  }

  .recipe-ingredient-builder .ingredient-unit {
    grid-area: unit;
  }

  .recipe-ingredient-builder .row-cost {
    grid-area: cost;
  }

  .recipe-ingredient-builder .remove-row {
    grid-area: remove;
  }

  .row-cost {
    text-align: left;
  }

  .finance-metrics,
  .finance-filters,
  .finance-settings,
  .dashboard-finance-strip {
    grid-template-columns: 1fr;
  }

  .finance-title {
    align-items: stretch;
  }

  .period-picker {
    min-width: 0;
  }

  .finance-title-actions,
  .finance-title-actions .period-picker {
    width: 100%;
  }

  .finance-title-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-title-actions .period-picker {
    grid-column: 1 / -1;
  }

  .section-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .section-tabs a {
    text-align: center;
  }

  .vertical-chart {
    height: 190px;
  }

  .daily-chart .chart-column:nth-child(even) > span {
    visibility: hidden;
  }

  .due-item {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .due-item > b,
  .due-item > form {
    grid-column: 2;
  }

  .recurring-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .recurring-item > b,
  .recurring-item > .table-actions {
    grid-column: 2;
  }

  .inline-create-form,
  .payment-create-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .finance-performance-grid,
  .finance-archive-grid {
    grid-template-columns: 1fr;
  }

  .finance-archive-grid .archive-wide {
    grid-column: auto;
  }
}

/* Identidade visual operacional Steak & Burger */
:root {
  --bg: #f2f3f3;
  --panel: #ffffff;
  --ink: #191b1b;
  --muted: #66706d;
  --line: #dfe3e1;
  --border: #dfe3e1;
  --brand: #b9272e;
  --brand-dark: #8f1f25;
  --accent: #1f7258;
  --danger: #b4232d;
  --ok: #1f7258;
  --warning: #a86712;
  --gold: #c58b2d;
  --sidebar: #171a19;
  --sidebar-soft: #242826;
  --shadow: 0 18px 45px rgba(17, 25, 22, .08);
}

html {
  background: var(--bg);
  color-scheme: light;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

::selection {
  background: rgba(185, 39, 46, .18);
}

.shell {
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 10px 0 30px rgba(13, 18, 16, .06);
  color: #f7f8f7;
  padding: 20px 16px;
}

.sidebar-header {
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  margin: 0 2px 18px;
  padding-bottom: 18px;
}

.brand {
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 6px;
  margin: 0;
  padding: 10px;
}

.brand img {
  background: transparent;
  border-radius: 0;
  height: 86px;
  margin: 0 auto;
  object-fit: contain;
  padding: 0;
  width: 190px;
}

.nav {
  gap: 3px;
}

.nav-section {
  color: #89928e;
  font-size: 10px;
  letter-spacing: 0;
  margin: 18px 12px 6px;
}

.nav a {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #d6dcda;
  display: flex;
  font-size: 14px;
  font-weight: 600;
  min-height: 42px;
  padding: 9px 12px 9px 15px;
  position: relative;
}

.nav a::before {
  background: transparent;
  border-radius: 0 3px 3px 0;
  bottom: 8px;
  content: '';
  left: -16px;
  position: absolute;
  top: 8px;
  width: 3px;
}

.nav a:hover {
  background: var(--sidebar-soft);
  border-color: rgba(255, 255, 255, .06);
  color: #fff;
}

.nav a.active {
  background: #2c302e;
  border-color: rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px rgba(255, 255, 255, .03);
  color: #fff;
}

.nav a.active::before {
  background: var(--brand);
}

.nav .logout-link {
  border-color: rgba(255, 255, 255, .09) transparent transparent;
  color: #bdc5c1;
  margin-top: 18px;
}

.main {
  min-width: 0;
  padding: 0 32px 40px;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin: 0 -32px 30px;
  min-height: 68px;
  padding: 10px 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-context,
.user-chip {
  display: grid;
  gap: 2px;
  line-height: 1.2;
}

.topbar-context small,
.user-chip small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-context strong {
  font-size: 14px;
  font-weight: 750;
}

.user-chip {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.user-chip strong {
  font-size: 13px;
}

.page-title {
  margin-bottom: 24px;
}

.page-title h1,
.auth-panel h1 {
  font-size: 32px;
  font-weight: 760;
  line-height: 1.15;
}

.eyebrow {
  color: var(--brand);
  font-size: 10px;
  letter-spacing: .08em;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 14px;
  max-width: 720px;
}

.metric-card,
.panel,
.finance-metric,
.inventory-summary,
.recipe-summary,
.dashboard-finance-strip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(20, 29, 25, .045);
}

.panel {
  padding: 22px;
}

.panel h2,
.panel-header h2 {
  font-size: 18px;
  font-weight: 750;
}

.panel-header {
  border-bottom: 1px solid var(--line);
  margin: -2px 0 16px;
  padding-bottom: 13px;
}

.panel-header a,
.table-action,
.table-actions .table-action-button,
.table-actions .link-button {
  font-size: 13px;
}

.metric-grid {
  gap: 12px;
}

.metric-card {
  border-top: 3px solid #bdc5c1;
  gap: 5px;
  min-height: 112px;
  padding: 18px 20px;
}

.metric-card:nth-child(4n+1) { border-top-color: var(--brand); }
.metric-card:nth-child(4n+2) { border-top-color: var(--accent); }
.metric-card:nth-child(4n+3) { border-top-color: var(--gold); }
.metric-card:nth-child(4n+4) { border-top-color: #4d5b67; }

.metric-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(20, 29, 25, .08);
  transform: translateY(-2px);
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.metric-card strong {
  font-size: 31px;
  font-weight: 760;
}

.dashboard-finance-strip {
  background: #1c211f;
  border-color: #1c211f;
  color: #fff;
  margin-bottom: 16px;
  overflow: hidden;
}

.dashboard-finance-strip > div {
  border-color: rgba(255, 255, 255, .1);
}

.dashboard-finance-strip span,
.dashboard-finance-strip small {
  color: #aeb8b3;
}

.dashboard-finance-strip .primary-button {
  background: var(--gold);
  color: #171a19;
}

label {
  color: #4f5955;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  border-color: #d5dbd8;
  border-radius: 5px;
  min-height: 44px;
  padding: 10px 12px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aeb9b4;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  outline: 3px solid rgba(31, 114, 88, .12);
  outline-offset: 1px;
}

button,
.primary-button,
.secondary-button {
  border-radius: 5px;
  font-size: 13px;
  min-height: 42px;
}

.primary-button {
  background: var(--brand);
  box-shadow: 0 4px 12px rgba(185, 39, 46, .16);
}

.secondary-button,
.icon-button {
  background: #e7ece9;
  color: #26302c;
}

.secondary-button:hover,
.icon-button:hover {
  background: #d9e2dd;
}

.danger-button {
  background: var(--danger);
}

.alert {
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: 5px;
}

.alert.success { background: #e3f3eb; border-color: var(--ok); color: #185940; }
.alert.error { background: #fae7e9; border-color: var(--danger); color: #8f1f28; }
.alert.warning { background: #fbf0dc; border-color: var(--warning); color: #7d500f; }

.flash-notice {
  align-items: flex-start;
  background: #fff;
  border: 1px solid #d8dfdb;
  border-left: 5px solid var(--ok);
  box-shadow: 0 16px 42px rgba(18, 27, 23, .18);
  display: flex;
  gap: 12px;
  margin: 0;
  max-width: min(440px, calc(100vw - 32px));
  padding: 15px 14px;
  position: fixed;
  right: 24px;
  top: 20px;
  width: max-content;
  z-index: 1200;
  animation: flash-notice-enter .22s ease-out;
}

.flash-notice.success { background: #fff; border-color: #cfe2d8; border-left-color: var(--ok); color: #185940; }
.flash-notice.error { background: #fff; border-color: #eed0d3; border-left-color: var(--danger); color: #8f1f28; }
.flash-notice.warning { background: #fff; border-color: #ead9ba; border-left-color: var(--warning); color: #7d500f; }

.flash-notice-mark {
  background: currentColor;
  border-radius: 50%;
  flex: 0 0 10px;
  height: 10px;
  margin-top: 5px;
  width: 10px;
}

.flash-notice-copy { display: grid; gap: 3px; line-height: 1.35; min-width: 0; }
.flash-notice-copy strong { color: #17201c; font-size: 14px; }
.flash-notice-copy > span { font-size: 14px; }

.flash-notice-close {
  background: transparent;
  border: 0;
  color: #65706b;
  cursor: pointer;
  flex: 0 0 28px;
  font-size: 22px;
  height: 28px;
  line-height: 24px;
  margin: -5px -5px 0 4px;
  padding: 0;
  width: 28px;
}

.flash-notice.is-leaving { animation: flash-notice-leave .18s ease-in forwards; }

@keyframes flash-notice-enter {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes flash-notice-leave {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

@media (max-width: 640px) {
  .flash-notice { left: 16px; right: 16px; top: 12px; width: auto; }
}

.badge {
  border: 1px solid #d6ded9;
  border-radius: 999px;
  padding: 3px 8px;
}

.badge.ok { background: #e1f2e9; border-color: #c6e7d6; color: #176342; }
.badge.danger { background: #fae6e8; border-color: #f2cdd1; color: #9e1f2a; }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 5px;
}

table {
  background: #fff;
}

th,
td {
  border-color: #e3e7e5;
  padding: 12px 11px;
}

th {
  background: #f3f5f4;
  color: #5e6965;
  font-size: 10px;
  letter-spacing: .04em;
}

tbody tr:hover td {
  background: #f8faf9;
}

.inventory-editor,
.recipe-form {
  border-top-color: var(--accent);
}

.inventory-editor-header,
.recipe-form-header {
  background: #f5f7f6;
}

.inventory-form-section + .inventory-form-section {
  border-color: var(--line);
}

.form-section-heading > span {
  background: #deeee7;
  color: #1c674f;
}

.inventory-edit-summary,
.ingredient-picker.has-selection .ingredient-search {
  background: #edf5f1;
}

.inventory-summary,
.recipe-summary {
  box-shadow: none;
}

.inventory-filters,
.utensil-filters,
.menu-filters {
  background: #f7f8f8;
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-bottom: 14px;
  padding: 12px;
}

.bulk-actions {
  background: #f5f7f6;
  border-color: var(--line);
}

.inline-category-create,
.transaction-type-control,
.recurring-icon {
  background: #eef1f0;
}

.transaction-type-control {
  border: 1px solid var(--line);
}

.ingredient-builder,
.pricing-helper,
.cost-summary div,
.pricing-result {
  border-radius: 5px;
}

.ingredient-results {
  border-color: #b9c3be;
  box-shadow: 0 16px 36px rgba(20, 29, 25, .16);
}

.ingredient-result:hover,
.ingredient-result:focus {
  background: #edf5f1;
}

.finance-metric {
  border-top-width: 3px;
  padding: 16px;
}

.finance-metric strong {
  font-size: 22px;
}

.section-tabs {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  gap: 0;
  padding: 0 8px;
}

.section-tabs a {
  padding: 12px 14px 9px;
}

.section-tabs a:hover {
  color: var(--brand);
}

.auth-page {
  background: #171a19;
  min-height: 100vh;
  padding: 34px 20px;
  position: relative;
}

.auth-page::before {
  background: var(--brand);
  content: '';
  height: 4px;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
}

.auth-panel {
  background: #fff;
  border: 0;
  border-radius: 7px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .28);
  display: grid;
  gap: 22px;
  padding: 34px;
  width: min(440px, 100%);
}

.auth-logo {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  height: 128px;
  margin: 0 auto 22px;
  padding: 4px 10px 18px;
  width: 230px;
}

.auth-panel .muted {
  font-size: 14px;
  margin-bottom: 0;
}

.auth-panel .primary-button {
  min-height: 46px;
  width: 100%;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .main {
    padding-left: 24px;
    padding-right: 24px;
  }

  .topbar {
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
  }

  .brand img {
    width: 168px;
  }
}

@media (max-width: 920px) {
  .shell {
    display: block;
  }

  .sidebar {
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    height: auto;
    padding: 12px 16px;
    position: relative;
  }

  .sidebar-header {
    border: 0;
    margin: 0;
    padding: 0;
  }

  .brand {
    padding: 5px 8px;
  }

  .brand img {
    height: 52px;
    margin: 0;
    width: 116px;
  }

  .nav-toggle {
    align-items: center;
    background: #2b302e;
    color: #fff;
    display: inline-flex;
    height: 40px;
    min-height: 40px;
    width: 40px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
  }

  .nav a::before {
    left: 0;
  }

  .main {
    padding: 0 20px 30px;
  }

  .topbar {
    margin: 0 -20px 24px;
    min-height: 58px;
    padding: 8px 20px;
    position: relative;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .main {
    padding: 0 14px 24px;
  }

  .topbar {
    margin: 0 -14px 20px;
    padding: 8px 14px;
  }

  .topbar-context small {
    display: none;
  }

  .page-title h1,
  .auth-panel h1 {
    font-size: 26px;
  }

  .panel {
    padding: 16px;
  }

  .metric-card {
    min-height: 98px;
  }

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

  .inventory-filters,
  .utensil-filters,
  .menu-filters {
    padding: 10px;
  }

  .auth-page {
    align-items: start;
    padding: 18px 12px;
  }

  .auth-panel {
    padding: 24px 20px;
  }
}

.consumption-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.consumption-workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(430px, 520px) minmax(0, 1fr);
  scroll-margin-top: 18px;
}

.consumption-editor {
  align-self: start;
  border-top: 3px solid var(--accent);
  position: static;
}

.consumption-items-box {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 12px;
}

.consumption-item-headings,
.consumption-item-row {
  align-items: center;
  display: grid;
  gap: 7px;
}

.consumption-item-headings {
  display: none;
}

.consumption-item-row {
  border-top: 1px solid var(--line);
  grid-template-areas: "name name name remove" "quantity price total total";
  grid-template-columns: 82px 118px minmax(100px, 1fr) 36px;
  padding: 10px 0;
}

.consumption-item-row > div { grid-area: name; }
.consumption-quantity { grid-area: quantity; }
.consumption-price { grid-area: price; }
.consumption-line-total { grid-area: total; }
.remove-consumption-item { grid-area: remove; }

.consumption-item-row input {
  min-height: 38px;
  padding: 7px 8px;
}

.consumption-line-total {
  font-size: 12px;
  padding-right: 4px;
  text-align: right;
  white-space: nowrap;
}

.consumption-total {
  align-items: end;
  background: #eef4f1;
  border-left: 3px solid var(--accent);
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding: 10px 12px;
}

.consumption-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.consumption-total strong {
  font-size: 19px;
}

.consumption-filters {
  align-items: end;
  background: #f7f8f8;
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(190px, 1.4fr) 145px minmax(150px, 1fr) 135px;
  margin-bottom: 14px;
  padding: 12px;
}

.consumption-filters .filter-actions {
  grid-column: 1 / -1;
}

.consumption-items-summary {
  color: #4f5955;
  font-size: 12px;
  max-width: 340px;
}

.consumption-detail {
  border-top: 3px solid var(--gold);
  margin-bottom: 18px;
}

.detail-facts {
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.detail-facts > div {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
}

.detail-facts > div + div {
  border-left: 1px solid var(--line);
}

.detail-facts span,
.detail-facts small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

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

.detail-columns h3,
.employee-management h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

.timeline {
  display: grid;
  gap: 9px;
}

.timeline > div {
  display: grid;
  gap: 9px;
  grid-template-columns: 12px minmax(0, 1fr);
}

.timeline > div > span {
  background: var(--accent);
  border: 3px solid #dcece5;
  border-radius: 50%;
  height: 11px;
  margin-top: 4px;
  width: 11px;
}

.timeline p {
  display: grid;
  font-size: 12px;
  gap: 2px;
  margin: 0;
}

.timeline small {
  color: var(--muted);
  font-size: 10px;
}

.detail-note {
  background: #f7f8f8;
  border-left: 3px solid #aab5b0;
  font-size: 13px;
  padding: 10px 12px;
}

.settlement-bar {
  align-items: end;
  background: #f0f5f2;
  border: 1px solid #cfe1d8;
  border-radius: 5px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.3fr) auto;
  margin-top: 16px;
  padding: 12px;
}

.employee-management {
  border-top: 3px solid var(--accent);
  margin-bottom: 18px;
  scroll-margin-top: 18px;
}

.employee-management-grid {
  align-items: start;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
}

.employee-editor {
  background: #f7f8f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
}

.employee-roster {
  min-width: 0;
}

.employee-roster-header {
  display: grid;
  margin-bottom: 10px;
}

.employee-roster-header small,
.panel-description {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.page-actions,
.report-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.consumption-tabs a.active {
  background: var(--ink);
  color: #fff;
}

.consumption-tab-panel[hidden] {
  display: none !important;
}

.consumption-report {
  border-top: 3px solid var(--gold);
  margin-bottom: 18px;
  scroll-margin-top: 18px;
}

.report-period-form label {
  font-size: 10px;
}

.report-period-form input {
  min-height: 34px;
  padding: 6px 8px;
  width: 145px;
}

.report-totals {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 14px 0 16px;
}

.report-totals > div {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
}

.report-totals > div + div {
  border-left: 1px solid var(--line);
}

.report-totals span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.report-totals strong {
  font-size: 17px;
}

.consumption-list-panel table {
  min-width: 900px;
}

@media (max-width: 1260px) {
  .consumption-workspace {
    grid-template-columns: 1fr;
  }

  .consumption-editor {
    position: static;
  }

  .consumption-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .consumption-metrics,
  .detail-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-facts > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .detail-facts > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .employee-management-grid {
    grid-template-columns: 1fr;
  }

  .report-actions {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .consumption-metrics,
  .consumption-filters,
  .detail-facts,
  .detail-columns,
  .settlement-bar,
  .report-totals {
    grid-template-columns: 1fr;
  }

  .detail-facts > div + div,
  .detail-facts > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .report-totals > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .consumption-item-row {
    grid-template-areas: "name name name remove" "quantity price total total";
    grid-template-columns: 70px 100px minmax(85px, 1fr) 34px;
  }

  .consumption-item-row > div { grid-area: name; }
  .consumption-quantity { grid-area: quantity; }
  .consumption-price { grid-area: price; }
  .consumption-line-total { grid-area: total; }
  .remove-consumption-item { grid-area: remove; }

  .page-actions,
  .report-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions > *,
  .report-actions > * {
    justify-content: center;
    width: 100%;
  }

  .report-period-form input {
    width: 100%;
  }
}

@media print {
  .sidebar,
  .topbar,
  .page-title,
  .consumption-metrics,
  .consumption-tabs,
  .consumption-detail,
  .employee-management,
  .consumption-workspace,
  .report-actions {
    display: none !important;
  }

  .shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .consumption-report {
    border: 0;
    box-shadow: none;
    display: block !important;
    margin: 0;
  }
}

.health-overview {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.health-score {
  background: #1c211f;
  border: 1px solid #1c211f;
  border-top: 3px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  display: grid;
  gap: 4px;
  padding: 16px;
}

.health-score.attention {
  border-top-color: var(--gold);
}

.health-score span,
.health-score small {
  color: #b9c3bf;
  font-size: 12px;
}

.health-score strong {
  font-size: 28px;
}

.health-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, .65fr);
  margin-top: 16px;
}

.health-side {
  display: grid;
  gap: 18px;
}

.health-group-title {
  color: var(--muted);
  font-size: 11px;
  margin: 22px 0 8px;
  text-transform: uppercase;
}

.health-group-title:first-of-type {
  margin-top: 0;
}

.health-check-list {
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.health-check {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.health-check + .health-check {
  border-top: 1px solid var(--line);
}

.health-check > div {
  display: grid;
  gap: 1px;
}

.health-check strong,
.health-check b {
  font-size: 12px;
}

.health-check small {
  font-size: 10px;
}

.health-indicator {
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.health-indicator.ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px #dceee6;
}

.health-indicator.error {
  background: var(--danger);
  box-shadow: 0 0 0 3px #f7dfe2;
}

.activity-panel {
  margin-top: 18px;
}

.daily-checklist-page { min-width: 0; }
.daily-checklist-page h2 { font-size: 18px; margin: 0 0 10px; }
.daily-checklist-page h3 { font-size: 16px; margin: 0 0 6px; }
.daily-checklist-page p { margin: 6px 0; }
.daily-checklist-page textarea { min-height: 64px; resize: vertical; }
.check-date-picker, .check-eventual, .check-report-tools, .check-report-tools form {
  display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
}
.check-date-picker label, .check-eventual label, .check-report-tools label { display: grid; gap: 5px; }
.check-tabs { display: flex; gap: 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.check-tabs a { padding: 12px 0; border-bottom: 3px solid transparent; font-weight: 600; }
.check-tabs a[aria-current="page"] { border-color: var(--accent); }
.check-period-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; background: #e8ecea; border-radius: 6px; }
.check-period-tabs a { min-width: 92px; padding: 8px 14px; text-align: center; font-weight: 700; font-size: 13px; border-radius: 4px; }
.check-period-tabs a[aria-current="page"] { background: var(--panel); color: var(--accent); box-shadow: 0 1px 3px rgba(32, 27, 23, .12); }
.check-stage-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.check-stage-tabs a { border: 1px solid var(--line); border-left: 4px solid transparent; background: rgba(255, 255, 255, .45); padding: 12px 14px; }
.check-stage-tabs a span, .check-stage-tabs a strong { display: block; }
.check-stage-tabs a span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.check-stage-tabs a strong { font-size: 14px; }
.check-stage-tabs a[aria-current="page"] { background: var(--panel); border-left-color: var(--brand); box-shadow: 0 3px 12px rgba(32, 27, 23, .08); }
.check-period-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.check-period-heading span { display: block; color: var(--muted); font-size: 13px; }
.check-period-heading strong { display: block; font-size: 19px; }
.check-period-heading p { color: var(--muted); font-size: 13px; }
.check-template-grid { align-items: start; }
.check-template-grid > * { min-width: 0; }
.check-template-grid > form { align-self: start; }
.check-template { border-bottom: 1px solid var(--line); padding: 18px 0; overflow-wrap: anywhere; }
.check-template small { display: block; margin: 10px 0; }
.check-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); padding: 16px 0; gap: 16px; }
.check-summary span { display: block; color: var(--muted); font-size: 13px; }
.check-summary strong { display: block; font-size: 26px; }
.check-run-meta { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 20px 0; border-bottom: 1px solid var(--line); }
.check-run-meta p { font-size: 13px; }
.check-daily-item { padding: 22px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.check-item-heading { display: flex; gap: 16px; align-items: start; justify-content: space-between; }
.check-item-heading p { font-size: 13px; }
.check-notes { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.check-status { flex-shrink: 0; font-size: 12px; font-weight: 700; border-radius: 4px; padding: 5px 9px; background: #e9edef; color: #3c484e; }
.check-status.is-done { background: #dceee6; color: #176348; }
.check-status.is-late { background: #fae1e3; color: #98252d; }
.check-confirm-form { display: flex; align-items: end; gap: 12px; margin-top: 14px; }
.check-confirm-form label { flex: 1; min-width: 0; display: grid; gap: 6px; }
.check-confirm-form button { flex-shrink: 0; }
.check-reopen { margin-top: 12px; }
.check-reopen summary { cursor: pointer; font-size: 13px; font-weight: 600; width: fit-content; }
.check-eventual, .check-report-tools { margin: 20px 0; }
.check-eventual label { flex: 1; }
.check-report-table { table-layout: fixed; width: 100%; }
.check-report-table th, .check-report-table td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.check-history-title { margin-top: 28px !important; }
.check-day-links { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
@media (max-width: 760px) {
  .check-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .check-template-grid { grid-template-columns: minmax(0, 1fr); }
  .check-confirm-form { flex-direction: column; align-items: stretch; }
  .check-item-heading { flex-wrap: wrap; }
  .check-date-picker { width: 100%; }
  .check-date-picker label { flex: 1; min-width: 0; }
  .check-report-table { min-width: 580px; }
  .check-period-tabs { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .check-period-tabs a { min-width: 0; }
  .check-stage-tabs { grid-template-columns: 1fr; }
  .check-period-heading { align-items: start; flex-direction: column; gap: 4px; }
  .check-period-heading p { text-align: left; }
}
@media print {
  .daily-checklist-page .page-title { display: block !important; }
  .daily-checklist-page form, .daily-checklist-page button,
  .check-tabs, .check-period-tabs, .check-stage-tabs, .check-report-tools, .check-day-links, .check-reopen { display: none !important; }
  .daily-checklist-page .table-wrap { overflow: visible; }
  .check-report-table { min-width: 0; font-size: 10pt; }
  .check-report-table tr, .check-daily-item { break-inside: avoid; }
}

@media (max-width: 1080px) {
  .health-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .health-overview {
    grid-template-columns: 1fr;
  }
}

/* Vendas e baixa integrada de estoque */
.sales-page { min-width: 0; }
.sales-title > div:first-child > p:last-child { color: var(--muted); margin: 7px 0 0; }
.view-tabs { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 22px; }
.view-tabs a { border-bottom: 3px solid transparent; font-size: 14px; font-weight: 800; padding: 11px 1px; }
.view-tabs a[aria-current="page"] { border-bottom-color: var(--brand); color: var(--brand); }
.sales-workspace { align-items: start; display: grid; gap: 18px; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); }
.sales-entry-panel, .sale-preview-panel { padding: 22px; }
.sale-preview-panel { position: sticky; top: 18px; }
.sales-meta-grid, .sales-cost-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sales-meta-grid label, .sales-cost-grid label, .sale-product-row label, .sale-cancel-form label { display: grid; gap: 6px; }
.sale-product-heading { align-items: end; border-top: 1px solid var(--line); display: flex; justify-content: space-between; margin-top: 22px; padding-top: 20px; }
.sale-product-heading h3, .sale-preview-panel h3 { font-size: 16px; margin: 0; }
.sale-product-heading p { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.sale-product-list { display: grid; gap: 8px; margin: 12px 0 18px; }
.sale-product-row { align-items: end; display: grid; gap: 9px; grid-template-columns: minmax(0, 1fr) 105px 42px; }
.sale-row-remove { font-size: 24px; padding: 0; }
.sale-cost-details { border-block: 1px solid var(--line); margin: 16px 0; padding: 14px 0; }
.sale-cost-details summary, .sale-settings summary { cursor: pointer; font-size: 14px; font-weight: 800; }
.sales-cost-grid { margin-top: 14px; }
.sale-preview-empty { color: var(--muted); padding: 48px 12px; text-align: center; }
.sale-preview-empty strong { color: var(--ink); display: block; }
.sale-summary-grid { display: grid; gap: 1px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 22px; overflow: hidden; }
.sale-summary-grid > div { background: #f1f3f2; display: grid; gap: 4px; min-height: 82px; padding: 13px; }
.sale-summary-grid span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.sale-summary-grid strong { font-size: 19px; }
.sale-summary-grid .positive strong { color: var(--ok); }
.sale-summary-grid .negative strong { color: var(--danger); }
.sale-stock-list { border-block: 1px solid var(--line); margin: 10px 0 16px; max-height: 310px; overflow: auto; }
.sale-stock-list > div { align-items: center; display: flex; gap: 14px; justify-content: space-between; padding: 11px 4px; }
.sale-stock-list > div + div { border-top: 1px solid var(--line); }
.sale-stock-list span { display: grid; gap: 2px; }
.sale-stock-list .stock-balance { text-align: right; }
.sale-stock-list .is-short { background: #fff0f1; color: var(--danger); }
.force-negative { align-items: stretch; background: #fff4dc; border: 1px solid #ebcf91; display: grid; gap: 9px; margin: 12px 0; padding: 11px; }
.force-negative label { align-items: center; display: flex; gap: 8px; }
.force-negative input, .toggle-line input { min-height: 0; width: auto; }
.confirm-sale-button { width: 100%; }
.confirmation-note { color: var(--muted); font-size: 11px; margin: 8px 0 0; text-align: center; }
.sale-settings { margin-top: 18px; padding: 17px 20px; }
.sale-settings form { align-items: center; display: flex; gap: 14px; justify-content: space-between; margin-top: 14px; }
.toggle-line { align-items: center; display: flex; gap: 9px; }
.sales-filters { align-items: end; display: grid; gap: 10px; grid-template-columns: 145px 145px 180px minmax(180px, 1fr) auto; margin-bottom: 18px; }
.sales-filters label { display: grid; gap: 6px; }
.sale-detail { margin-bottom: 18px; padding: 22px; }
.sale-detail-meta { border-block: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 12px 0 18px; }
.sale-detail-meta > span { display: grid; gap: 4px; padding: 13px; }
.sale-detail-meta > span + span { border-left: 1px solid var(--line); }
.sale-cancel-form { align-items: end; border-top: 1px solid var(--line); display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto; margin-top: 18px; padding-top: 18px; }

@media (max-width: 1100px) {
  .sales-workspace { grid-template-columns: 1fr; }
  .sale-preview-panel { position: static; }
  .sales-cost-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-filters .filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .sales-title { align-items: stretch; flex-direction: column; }
  .view-tabs { width: 100%; }
  .sales-entry-panel, .sale-preview-panel, .sale-detail { padding: 16px; }
  .sales-meta-grid, .sales-cost-grid, .sale-detail-meta { grid-template-columns: 1fr; }
  .sale-product-heading { align-items: stretch; flex-direction: column; gap: 10px; }
  .sale-product-row { grid-template-columns: minmax(0, 1fr) 84px 42px; }
  .sale-detail-meta > span + span { border-left: 0; border-top: 1px solid var(--line); }
  .sale-cancel-form, .sales-filters { grid-template-columns: 1fr; }
  .sales-filters .filter-actions { grid-column: auto; }
}

.movement-layout { align-items: start; display: grid; gap: 18px; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); }
.movement-form, .movement-history { padding: 22px; }
.movement-form { align-self: start; }
.movement-filters { align-items: end; display: grid; gap: 9px; grid-template-columns: 130px 130px minmax(170px, 1fr) 170px auto; margin-bottom: 18px; }
.movement-filters label { display: grid; gap: 5px; }
.inline-reversal summary { color: var(--danger); cursor: pointer; font-weight: 700; }
.inline-reversal form { display: grid; gap: 6px; margin-top: 7px; min-width: 180px; }
.movement-history td small { display: block; margin-top: 3px; }
.auth-secondary-link { color: var(--brand); display: block; font-size: 13px; font-weight: 800; margin-top: 14px; text-align: center; }
.auth-logo-link { display: block; }
.recovery-panel .primary-button { width: 100%; }
.password-request-panel { margin-bottom: 18px; padding: 20px; }
.password-request-list { border-top: 1px solid var(--line); margin-top: 14px; }
.password-request-list > div { align-items: center; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) auto auto; padding: 12px 0; }
.password-request-list > div + div { border-top: 1px solid var(--line); }
.password-request-list span:first-child { display: grid; gap: 3px; }

/* Pesquisa e comparação de preços */
.price-research-title .page-subtitle { max-width: 720px; }
.price-research-summary {
  border-block: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}
.price-research-summary > div { padding: 15px 18px; }
.price-research-summary > div + div { border-left: 1px solid var(--line); }
.price-research-summary span { color: var(--muted); display: block; font-size: 12px; }
.price-research-summary strong { display: block; font-size: 25px; margin-top: 3px; }
.price-entry-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, .7fr) minmax(520px, 1.3fr);
  margin-bottom: 18px;
}
.price-product-form, .price-offer-form { align-self: start; min-width: 0; padding: 22px; }
.price-product-form textarea, .price-offer-form textarea { min-height: 70px; }
.price-comparison-panel, .price-products-panel { margin-bottom: 18px; padding: 22px; }
.price-filters {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 1fr) minmax(190px, 1fr) auto;
  margin-bottom: 18px;
}
.price-filters label { display: grid; gap: 6px; }
.price-comparison-table td { vertical-align: middle; }
.price-comparison-table td small { display: block; margin-top: 4px; }
.price-comparison-table .best-price-row { background: #eef8f3; }
.best-price-label {
  background: #d6eee2;
  color: #176348;
  display: block;
  font-size: 10px;
  font-weight: 800;
  margin-top: 4px;
  padding: 3px 5px;
  text-align: center;
  text-transform: uppercase;
  width: fit-content;
}
.price-products-panel td small { display: block; margin-top: 4px; max-width: 440px; }

@media (max-width: 1100px) {
  .price-entry-grid { grid-template-columns: 1fr; }
  .price-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price-filters .filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 650px) {
  .price-research-summary { grid-template-columns: 1fr; }
  .price-research-summary > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .price-product-form, .price-offer-form, .price-comparison-panel, .price-products-panel { padding: 16px; }
  .price-filters { grid-template-columns: 1fr; }
  .price-filters .filter-actions { grid-column: auto; }
}
.dashboard-sales { margin-bottom: 18px; padding: 22px; }
.dashboard-sales .panel-header { align-items: flex-start; overflow: visible; }
.dashboard-sales .period-picker { flex: 0 0 auto; }
.dashboard-sales .period-picker-popover { left: auto; right: 0; }
.dashboard-sales-kpis { display: grid; gap: 1px; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 15px 0 22px; }
.dashboard-sales-kpis > div { background: #f0f2f1; display: grid; gap: 4px; min-height: 102px; padding: 15px; }
.dashboard-sales-kpis span { color: var(--muted); font-size: 12px; }
.dashboard-sales-kpis strong { font-size: 21px; }
.dashboard-ranking-grid { display: grid; gap: 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-ranking-grid h3 { border-bottom: 1px solid var(--line); font-size: 15px; margin: 0; padding-bottom: 10px; }
@media (max-width: 1200px) {
  .movement-layout { grid-template-columns: 1fr; }
  .movement-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .movement-filters .filter-actions { grid-column: 1 / -1; }
  .dashboard-sales-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .movement-form, .movement-history { padding: 16px; }
  .movement-filters { grid-template-columns: 1fr; }
  .movement-filters .filter-actions { grid-column: auto; }
  .dashboard-sales { padding: 16px; }
  .dashboard-sales .panel-header { align-items: stretch; flex-direction: column; }
  .dashboard-sales .period-picker { width: 100%; }
  .dashboard-sales .period-picker-trigger { width: 100%; }
  .dashboard-sales-kpis, .dashboard-ranking-grid { grid-template-columns: 1fr; }
  .password-request-list > div { align-items: start; grid-template-columns: 1fr; }
}

/* Caderno de anotações e proporções */
.notebook-page-title .page-subtitle { max-width: 760px; }
.notebook-summary {
  border-block: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}
.notebook-summary > div { padding: 15px 18px; }
.notebook-summary > div + div { border-left: 1px solid var(--line); }
.notebook-summary span { color: var(--muted); display: block; font-size: 12px; }
.notebook-summary strong { display: block; font-size: 25px; margin-top: 3px; }
.notebook-workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 300px;
  margin-bottom: 18px;
}
.notebook-form, .notebook-guide, .notebook-preview, .notebook-library { padding: 22px; }
.notebook-form { min-width: 0; }
.notebook-guide { position: sticky; top: 24px; }
.notebook-guide h2 { font-size: 20px; margin: 5px 0 8px; }
.notebook-guide > p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.notebook-example {
  background: #f3eee7;
  border-left: 3px solid var(--brand);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}
.notebook-example strong { grid-column: 1 / -1; }
.notebook-example span, .notebook-example b { font-size: 12px; }
.notebook-items {
  border: 1px solid var(--line);
  border-radius: 7px;
  margin: 4px 0;
  min-width: 0;
  padding: 14px;
}
.notebook-items legend { font-size: 14px; font-weight: 800; padding: 0 7px; }
.notebook-items legend small { font-size: 10px; font-weight: 600; margin-left: 5px; }
.notebook-item-head, .notebook-item-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(170px, 1.4fr) 105px 105px minmax(150px, 1fr) 36px;
}
.notebook-item-head { color: var(--muted); font-size: 10px; font-weight: 800; padding: 0 3px 6px; text-transform: uppercase; }
.notebook-item-row + .notebook-item-row { margin-top: 8px; }
.notebook-item-row input, .notebook-item-row select { min-width: 0; width: 100%; }
.notebook-item-row .icon-button { height: 38px; min-width: 36px; padding: 0; width: 36px; }
.notebook-add-item { margin-top: 10px; }
.notebook-preview { margin-bottom: 18px; }
.notebook-preview-meta {
  background: #f3eee7;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 14px 0 18px;
}
.notebook-preview-meta span { color: var(--muted); font-size: 12px; padding: 12px 14px; }
.notebook-preview-meta span + span { border-left: 1px solid var(--line); }
.notebook-preview-meta b { color: var(--ink); display: block; margin-bottom: 3px; }
.notebook-proportion-list { border-block: 1px solid var(--line); margin-bottom: 20px; }
.notebook-proportion-list > div { align-items: center; display: flex; gap: 20px; justify-content: space-between; padding: 10px 4px; }
.notebook-proportion-list > div + div { border-top: 1px solid var(--line); }
.notebook-proportion-list span { font-weight: 700; }
.notebook-proportion-list small { display: block; font-weight: 400; }
.notebook-proportion-list strong { white-space: nowrap; }
.notebook-text + .notebook-text { margin-top: 18px; }
.notebook-text h3 { font-size: 14px; margin: 0 0 6px; }
.notebook-text p { margin: 0; white-space: normal; }
.notebook-observations { background: #fff7dc; border-left: 3px solid #c28a16; padding: 12px 14px; }
.notebook-library { margin-bottom: 18px; }
.notebook-filters { align-items: end; display: grid; gap: 10px; grid-template-columns: minmax(240px, 1fr) 220px auto; margin-bottom: 18px; }
.notebook-filters label { display: grid; gap: 6px; }
.notebook-card-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.notebook-card { border: 1px solid var(--line); border-radius: 7px; display: flex; flex-direction: column; gap: 13px; justify-content: space-between; min-height: 175px; padding: 16px; }
.notebook-card:hover { border-color: #bbaea2; }
.notebook-card h3 { font-size: 17px; margin: 10px 0 3px; }
.notebook-card p { color: var(--muted); font-size: 12px; margin: 0; }
.notebook-card > small { border-top: 1px solid var(--line); padding-top: 10px; }

@media (max-width: 1100px) {
  .notebook-workspace { grid-template-columns: 1fr; }
  .notebook-guide { position: static; }
}

@media (max-width: 760px) {
  .notebook-item-head { display: none; }
  .notebook-item-row { border-top: 1px solid var(--line); grid-template-columns: minmax(0, 1fr) 92px 76px 36px; padding-top: 9px; }
  .notebook-item-row input[name="item_product[]"] { grid-column: 1 / 3; }
  .notebook-item-row input[name="item_notes[]"] { grid-column: 1 / 4; grid-row: 2; }
  .notebook-item-row .icon-button { grid-column: 4; grid-row: 1 / 3; }
  .notebook-preview-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notebook-preview-meta span:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .notebook-preview-meta span:nth-child(4) { border-top: 1px solid var(--line); }
  .notebook-filters { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .notebook-summary { grid-template-columns: 1fr; }
  .notebook-summary > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .notebook-form, .notebook-guide, .notebook-preview, .notebook-library { padding: 16px; }
  .notebook-preview-meta { grid-template-columns: 1fr; }
  .notebook-preview-meta span + span { border-left: 0; border-top: 1px solid var(--line); }
  .notebook-card-grid { grid-template-columns: 1fr; }
}

@media print {
  body:has(.notebook-preview) .sidebar,
  body:has(.notebook-preview) .topbar,
  body:has(.notebook-preview) .page-title,
  body:has(.notebook-preview) .alert,
  body:has(.notebook-preview) .notebook-summary,
  body:has(.notebook-preview) .notebook-workspace,
  body:has(.notebook-preview) .notebook-library,
  body:has(.notebook-preview) .print-hidden { display: none !important; }
  body:has(.notebook-preview) .shell { display: block; }
  body:has(.notebook-preview) .main { padding: 0; }
  body:has(.notebook-preview) .notebook-preview { border: 0; box-shadow: none; padding: 0; }
}

/* Controle profissional de gastos */
.expense-title { align-items: end; }
.expense-title > div:first-child { max-width: 720px; }
.expense-title-actions { align-items: end; display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }
.expense-kpis { display: grid; gap: 12px; grid-template-columns: repeat(6, minmax(145px, 1fr)); margin-bottom: 18px; }
.expense-kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid #756c65;
  border-radius: 7px;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 15px;
}
.expense-kpi.danger { border-top-color: var(--danger); }
.expense-kpi.warning { border-top-color: #b8791b; }
.expense-kpi.ok { border-top-color: var(--ok); }
.expense-kpi.budget { border-top-color: var(--accent); }
.expense-kpi span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.expense-kpi strong { font-size: clamp(18px, 1.65vw, 25px); overflow-wrap: anywhere; }
.expense-kpi small { font-size: 10px; }
.expense-alert {
  align-items: center;
  background: #fff2df;
  border: 1px solid #e5bd80;
  border-left: 4px solid #b8791b;
  border-radius: 6px;
  display: grid;
  gap: 3px 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-bottom: 18px;
  padding: 12px 14px;
}
.expense-alert span { color: #6c5941; font-size: 12px; }
.expense-alert a { color: var(--brand); font-size: 12px; font-weight: 800; }
.expense-dashboard-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr); margin-bottom: 14px; }
.expense-dashboard-grid.lower { grid-template-columns: minmax(300px, 1.1fr) minmax(250px, .8fr) minmax(290px, .9fr); }
.expense-dashboard-grid > .panel { min-width: 0; padding: 20px; }
.expense-trend-panel .panel-header > strong, .expense-budget-overview .panel-header > strong { font-size: 13px; }
.expense-trend-chart {
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(12, minmax(18px, 1fr));
  height: 225px;
  margin-top: 6px;
  padding-top: 8px;
}
.expense-trend-column { display: grid; grid-template-rows: minmax(0, 1fr) 24px; min-width: 0; }
.expense-trend-column > span { align-items: end; display: flex; justify-content: center; }
.expense-trend-column i { background: var(--brand); border-radius: 3px 3px 0 0; display: block; max-width: 28px; min-height: 0; transition: filter .15s ease; width: 70%; }
.expense-trend-column:hover i { filter: brightness(.8); }
.expense-trend-column small { font-size: 9px; padding-top: 5px; text-align: center; }
.expense-nature-total { display: grid; gap: 1px; grid-template-columns: 1fr; }
.expense-nature-total > div { background: #f2eee9; display: grid; gap: 5px; padding: 18px; }
.expense-nature-total > div:first-child { border-left: 4px solid var(--accent); }
.expense-nature-total > div:last-child { border-left: 4px solid #b8791b; }
.expense-nature-total span { color: var(--muted); font-size: 12px; font-weight: 800; }
.expense-nature-total strong { font-size: 24px; }
.expense-nature-total small { font-size: 10px; }
.expense-bar-list, .expense-supplier-list, .expense-upcoming > div { display: grid; }
.expense-bar-list > div { align-items: center; border-top: 1px solid var(--line); display: grid; gap: 8px; grid-template-columns: minmax(130px, 1fr) minmax(80px, .7fr) auto; padding: 10px 0; }
.expense-bar-list span { display: grid; }
.expense-bar-list span strong { font-size: 12px; }
.expense-bar-list span small { font-size: 9px; }
.expense-bar-list i, .budget-row > i { background: #e9e3dc; border-radius: 3px; display: block; height: 6px; overflow: hidden; }
.expense-bar-list i b, .budget-row > i b { background: var(--brand); display: block; height: 100%; }
.expense-bar-list em, .expense-supplier-list em { font-size: 11px; font-style: normal; font-weight: 800; white-space: nowrap; }
.expense-supplier-list > div { align-items: center; border-top: 1px solid var(--line); display: grid; gap: 9px; grid-template-columns: 24px minmax(0, 1fr) auto; padding: 10px 0; }
.expense-supplier-list > div > b { align-items: center; background: #ede6de; border-radius: 50%; display: flex; font-size: 10px; height: 23px; justify-content: center; width: 23px; }
.expense-supplier-list span { display: grid; }
.expense-supplier-list span strong { font-size: 12px; }
.expense-supplier-list span small { font-size: 9px; }
.expense-upcoming > div > span { align-items: center; border-top: 1px solid var(--line); display: grid; gap: 9px; grid-template-columns: 72px minmax(0, 1fr) auto; padding: 10px 0; }
.expense-upcoming time { font-size: 10px; font-weight: 800; }
.expense-upcoming b { display: grid; font-size: 11px; }
.expense-upcoming strong { font-size: 11px; white-space: nowrap; }
.expense-upcoming .late time, .expense-upcoming .late > strong { color: var(--danger); }
.expense-upcoming .overdue time, .expense-upcoming .overdue > strong { color: var(--danger); }
.expense-upcoming .due-today time, .expense-upcoming .due-today > strong { color: #9a5a00; }
.expense-upcoming time small { display: block; font-size: 9px; margin-top: 2px; }

.deadline-alert {
  align-items: center;
  background: #fff8e9;
  border: 1px solid #e9c878;
  border-left: 5px solid #c47a00;
  border-radius: 5px;
  color: #704500;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 0 16px;
  padding: 14px 16px;
}

.deadline-alert > span { display: grid; gap: 3px; }
.deadline-alert strong { color: #542f00; font-size: 15px; }
.deadline-alert small { font-size: 13px; }
.deadline-alert a { color: #8a300f; font-size: 13px; font-weight: 800; white-space: nowrap; }

.deadline-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  margin-top: 5px;
}

.deadline-label.overdue { color: var(--danger); }
.deadline-label.due-today { color: #9a5a00; }
.deadline-label.due-soon { color: #8a6100; }
.deadline-label.scheduled { color: var(--muted); }
.deadline-label.no-deadline { color: #7a6351; }

.due-item.due-today {
  background: #fff8e9;
  border-color: #e9c878;
}

.due-item.due-today time,
.due-item.due-today time small { color: #9a5a00; }

.field-help { color: var(--muted); display: block; font-size: 11px; font-weight: 500; margin-top: 5px; }

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

.expense-upload-field {
  background: #f7f9f8;
  border: 1px dashed #aebbb4;
  border-radius: 5px;
  cursor: pointer;
  display: grid;
  gap: 5px;
  padding: 14px;
}

.expense-upload-field:hover { background: #f0f5f2; border-color: #73867c; }
.expense-upload-field strong { color: #1e2924; font-size: 13px; }
.expense-upload-field span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.expense-upload-field input { background: #fff; cursor: pointer; margin-top: 5px; min-width: 0; width: 100%; }

.expense-attachment-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.expense-attachment-links a {
  background: #eef3f0;
  border: 1px solid #d5dfda;
  border-radius: 4px;
  color: #29463a;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 6px;
  text-decoration: none;
}
.expense-attachment-links a:hover { background: #dfeae4; }

.expense-edit-attachments { display: grid; gap: 8px; margin: 12px 0; }
.expense-edit-attachments > div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 0;
}
.expense-edit-attachments > div > span { display: grid; gap: 2px; min-width: 0; }
.expense-edit-attachments strong { font-size: 12px; }
.expense-edit-attachments small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  .deadline-alert { align-items: flex-start; flex-direction: column; gap: 9px; }
  .expense-upload-grid { grid-template-columns: 1fr; }
}
.expense-workspace { align-items: start; display: grid; gap: 16px; grid-template-columns: minmax(0, 980px) minmax(240px, 280px); justify-content: start; margin-bottom: 18px; scroll-margin-top: 18px; }
.expense-modal-backdrop { align-items: flex-start; background: rgba(18, 22, 20, .68); display: flex; inset: 0; justify-content: center; overflow: auto; padding: 3vh 20px; position: fixed; z-index: 1200; }
.expense-modal-shell { background: var(--panel); border-radius: 7px; box-shadow: 0 24px 70px rgba(0, 0, 0, .28); color: #211c18; font-family: "Segoe UI", Arial, Helvetica, sans-serif; max-height: 94vh; max-width: 1240px; overflow: auto; width: 100%; }
.expense-modal-content { align-items: start; display: grid; grid-template-columns: minmax(0, 1fr) 260px; }
.expense-modal-content .expense-form { border-radius: 0; border-top: 4px solid var(--brand); box-shadow: none; margin: 0; }
.expense-modal-content .expense-period-snapshot { border-bottom: 0; border-radius: 0; border-right: 0; border-top: 0; box-shadow: none; margin: 18px 18px 18px 0; top: 18px; }
.expense-modal-header { background: var(--panel); position: sticky; top: 0; z-index: 4; }
.expense-modal-header h2 { font-size: 24px; line-height: 1.2; }
.expense-modal-header .form-mode { font-size: 12px; letter-spacing: .02em; }
.expense-modal-close { align-items: center; background: #f1ece7; border: 1px solid var(--line); border-radius: 50%; color: var(--ink) !important; display: inline-flex; font-size: 19px !important; height: 32px; justify-content: center; line-height: 1; width: 32px; }
.expense-modal-close:hover { background: #eadeda; color: var(--brand) !important; }
body.expense-modal-open { overflow: hidden; }
.finance-entry-modal-content { display: block; }
.finance-entry-modal-content .finance-workspace {
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr) 290px;
  margin: 0;
}
.finance-entry-modal-content .finance-entry-form {
  border-radius: 0;
  box-shadow: none;
  gap: 14px;
  margin: 0;
  min-width: 0;
  padding: 18px 20px 20px;
}
.finance-entry-modal-content .upcoming-panel {
  border-bottom: 0;
  border-radius: 0;
  border-right: 0;
  border-top: 0;
  box-shadow: none;
  margin: 18px 18px 18px 0;
  max-height: calc(94vh - 36px);
  overflow: auto;
  position: sticky;
  top: 18px;
}
.finance-entry-modal-content .finance-entry-form label {
  color: #403a35;
  font-size: 13px;
  gap: 6px;
  line-height: 1.35;
}
.finance-entry-modal-content .finance-entry-form input,
.finance-entry-modal-content .finance-entry-form select {
  font-size: 14px;
  line-height: 1.4;
  min-height: 44px;
  padding-bottom: 10px;
  padding-top: 10px;
}
.finance-entry-modal-content .finance-entry-form textarea {
  font-size: 14px;
  line-height: 1.5;
  min-height: 88px;
}
.finance-entry-primary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(260px, 1.5fr) minmax(140px, .6fr) minmax(200px, .85fr);
}
.finance-entry-date-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.finance-entry-date-grid [hidden] { display: none; }
.finance-entry-status input:checked + span {
  border-color: #18794e;
  box-shadow: inset 0 0 0 1px #18794e;
  color: #17633a;
}
.finance-entry-details { margin-top: 0; }
.finance-list-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.finance-list-actions .primary-button { color: #fff; }
.expense-view-tabs { border-bottom: 1px solid var(--line); display: grid; gap: 0; grid-template-columns: repeat(2, minmax(0, 250px)); margin: 0 0 16px; }
.expense-view-tabs a { border-bottom: 3px solid transparent; color: var(--muted); display: grid; gap: 2px; padding: 10px 14px; }
.expense-view-tabs a strong { color: inherit; font-size: 12px; }
.expense-view-tabs a small { font-size: 9px; }
.expense-view-tabs a[aria-current="page"] { border-bottom-color: var(--brand); color: var(--brand); }
.expense-form, .expense-period-snapshot, .expense-ledger, .expense-budget-form, .expense-budget-overview, .expense-archive { padding: 22px; }
.expense-form { border-top: 4px solid var(--brand); gap: 14px; min-width: 0; padding: 18px 20px 20px; }
.expense-form-links { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.expense-form-links a { font-size: 13px; font-weight: 800; }
.expense-primary-grid { display: grid; gap: 10px; grid-template-columns: minmax(250px, 1.5fr) minmax(130px, .55fr) minmax(190px, .85fr); }
.expense-form-block { border-top: 1px solid var(--line); display: grid; gap: 11px; padding-top: 13px; }
.expense-block-heading { align-items: center; display: flex; gap: 9px; }
.expense-block-heading > span { align-items: center; background: var(--ink); border-radius: 50%; color: #fff; display: flex; flex: 0 0 27px; font-size: 12px; font-weight: 900; height: 27px; justify-content: center; }
.expense-block-heading > div { display: grid; gap: 1px; }
.expense-block-heading strong { font-size: 15px; line-height: 1.3; }
.expense-block-heading small { color: #625950; font-size: 12px; line-height: 1.4; }
.expense-classification-grid { align-items: end; display: grid; gap: 10px; grid-template-columns: minmax(320px, 1.4fr) minmax(220px, .8fr); }
.expense-payment-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.expense-status-switch { background: #f3eee8; border: 1px solid var(--line); border-radius: 6px; display: grid; gap: 6px; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px; }
.expense-status-switch label { cursor: pointer; display: block; position: relative; }
.expense-status-switch input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.expense-status-switch span { background: var(--panel); border: 1px solid transparent; border-radius: 5px; display: grid; font-size: 14px; font-weight: 900; gap: 2px; min-height: 54px; padding: 9px 12px; }
.expense-status-switch span small { color: #625950; font-size: 11px; font-weight: 500; }
.expense-status-switch input:checked + span { background: #fff; border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); color: var(--brand); }
.expense-more-details { border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); display: grid; gap: 11px; padding: 14px 0; }
.expense-details-heading { align-items: center; display: flex; gap: 12px; justify-content: space-between; }
.expense-details-heading > div { display: grid; gap: 2px; }
.expense-details-heading strong { font-size: 15px; }
.expense-details-heading small { color: #625950; font-size: 12px; }
.expense-details-heading > span { background: #e7ece9; border-radius: 4px; color: #4e5953; font-size: 11px; font-weight: 800; padding: 5px 8px; text-transform: uppercase; }
.expense-list-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.expense-list-actions .primary-button { color: #fff; min-width: 132px; }
.expense-list-actions .secondary-button { color: var(--brand); }
.expense-ledger .table-wrap { margin-top: 4px; }
.expense-ledger .expense-table { min-width: 1020px; table-layout: auto; }
.expense-modal-content .expense-form label { color: #403a35; font-size: 13px; gap: 6px; line-height: 1.35; }
.expense-modal-content .expense-upload-field strong { font-size: 14px; }
.expense-modal-content .expense-upload-field span { color: #625950; font-size: 12px; line-height: 1.45; }
.expense-modal-content .inline-selector-panel { font-size: 13px; }
.expense-modal-content .primary-button { font-size: 14px; font-weight: 800; }
.expense-form input,
.expense-form select { font-size: 14px; line-height: 1.4; min-height: 44px; padding-bottom: 10px; padding-top: 10px; }
.expense-form textarea { font-size: 14px; line-height: 1.5; min-height: 88px; padding-bottom: 10px; padding-top: 10px; }
.expense-form .field-help { color: #625950; font-size: 12px; line-height: 1.4; margin-top: 0; }
.expense-period-snapshot { position: sticky; top: 24px; }
.expense-period-snapshot h2 { font-size: 20px; margin: 5px 0 14px; }
.expense-period-snapshot > div { border-block: 1px solid var(--line); display: grid; }
.expense-period-snapshot > div span { color: #625950; display: grid; font-size: 12px; gap: 3px; padding: 11px 0; }
.expense-period-snapshot > div span + span { border-top: 1px solid var(--line); }
.expense-period-snapshot > div strong { color: var(--ink); font-size: 17px; }
.expense-period-snapshot p { color: #625950; font-size: 12px; line-height: 1.5; margin: 14px 0 0; }
.expense-choice-group { background: #f3eee8; border: 1px solid var(--line); border-radius: 6px; display: grid; gap: 6px; padding: 8px 10px; }
.expense-choice-group > strong { font-size: 13px; }
.expense-choice-group > div { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.expense-choice-group label { cursor: pointer; display: block; position: relative; }
.expense-choice-group input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.expense-choice-group span { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; display: grid; gap: 2px; min-height: 52px; padding: 8px 10px; }
.expense-choice-group input:checked + span { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.expense-choice-group b { font-size: 14px; }
.expense-choice-group small { color: #625950; font-size: 11px; font-weight: 500; line-height: 1.4; }
.expense-ledger { margin-bottom: 18px; }
.expense-filters { align-items: end; border-bottom: 1px solid var(--line); display: grid; gap: 9px; grid-template-columns: minmax(200px, 1.4fr) repeat(4, minmax(125px, .75fr)) auto; margin-bottom: 12px; padding-bottom: 14px; }
.expense-filters label { display: grid; gap: 5px; }
.expense-table td { vertical-align: middle; }
.expense-budget-layout { align-items: start; display: grid; gap: 18px; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); margin-bottom: 18px; }
.expense-budget-form { align-self: start; border-top: 4px solid var(--accent); }

/* Executive dashboard and guided financial workflows */
.dashboard-title {
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.dashboard-title-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.dashboard-finance-strip {
  align-items: stretch;
  background: var(--panel);
  border-color: var(--line);
  border-left: 0;
  color: var(--ink);
  display: grid;
  gap: 0;
  grid-template-columns: repeat(6, minmax(125px, 1fr));
  padding: 0;
}

.dashboard-finance-strip > div {
  border-left: 1px solid var(--line);
  min-height: 104px;
  padding: 16px;
}

.dashboard-finance-strip > div:first-child {
  border-left: 4px solid var(--accent);
}

.dashboard-finance-strip strong {
  color: var(--ink);
  font-size: clamp(17px, 1.5vw, 23px);
  overflow-wrap: anywhere;
}

.dashboard-finance-strip strong.text-income {
  color: var(--ok);
}

.dashboard-finance-strip strong.text-expense {
  color: var(--danger);
}

.dashboard-finance-strip span {
  color: var(--muted);
}

.dashboard-finance-strip small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.dashboard-finance-links {
  align-items: stretch;
  border-left: 0 !important;
  display: grid !important;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, 1fr);
  min-height: 0 !important;
  padding: 0 !important;
}

.dashboard-finance-links a {
  background: #f3eee8;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  padding: 10px 16px;
  text-align: center;
}

.dashboard-finance-links a + a {
  border-left: 1px solid var(--line);
}

.dashboard-finance-links a:hover {
  background: #e9dfd4;
  color: var(--brand);
}

.deadline-alert.overdue {
  background: #f9e3df;
  border-color: #e9b8ae;
}

.deadline-alert.overdue strong,
.deadline-alert.overdue a {
  color: #9d291c;
}

.form-section-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  margin-top: 5px;
  padding: 4px 0 9px;
}

.form-section-heading > span {
  align-items: center;
  background: var(--ink);
  border-radius: 50%;
  color: #fff;
  display: flex;
  flex: 0 0 25px;
  font-size: 11px;
  font-weight: 800;
  height: 25px;
  justify-content: center;
}

.form-section-heading > div {
  display: grid;
  gap: 1px;
}

.form-section-heading strong {
  font-size: 13px;
}

.form-section-heading small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.expense-form .form-section-heading {
  margin-top: 1px;
  padding: 2px 0 6px;
}

.expense-form .form-section-heading > span {
  flex-basis: 21px;
  height: 21px;
}

.expense-form .form-section-heading strong {
  font-size: 12px;
}

.expense-form .finance-advanced summary {
  padding-bottom: 8px;
  padding-top: 8px;
}

.finance-entry-form > .primary-button,
.expense-form > .primary-button {
  box-shadow: 0 5px 14px rgba(126, 31, 18, .14);
  min-height: 46px;
}

.finance-metric,
.expense-kpi,
.dashboard-sales-kpis > div {
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.finance-metric:hover,
.expense-kpi:hover,
.dashboard-sales-kpis > div:hover {
  box-shadow: 0 8px 20px rgba(35, 29, 24, .07);
  transform: translateY(-1px);
}

.finance-breakdowns-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .dashboard-finance-strip {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .finance-breakdowns-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-title {
    align-items: stretch;
  }

  .dashboard-title-actions,
  .dashboard-title-actions a {
    justify-content: center;
    width: 100%;
  }

  .dashboard-finance-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-finance-strip > div {
    border-bottom: 1px solid var(--line);
    min-height: 92px;
    padding: 13px;
  }

  .dashboard-finance-strip > div:nth-child(odd) {
    border-left: 0;
  }

  .dashboard-finance-strip > div:first-child {
    border-left: 4px solid var(--accent);
  }

  .finance-breakdowns-grid {
    grid-template-columns: 1fr;
  }

  .form-section-heading small {
    display: none;
  }
}
.budget-list { display: grid; }
.budget-row { align-items: center; border-top: 1px solid var(--line); display: grid; gap: 10px; grid-template-columns: minmax(180px, 1fr) minmax(110px, .8fr) 150px auto; padding: 13px 0; }
.budget-row > span { display: grid; }
.budget-row > span strong { font-size: 13px; }
.budget-row > span small { font-size: 10px; }
.budget-row > em { font-size: 11px; font-style: normal; font-weight: 800; text-align: right; }
.budget-row.over-budget > i b { background: var(--danger); }
.budget-row.over-budget > em { color: var(--danger); }

@media (max-width: 1280px) {
  .expense-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .expense-dashboard-grid.lower { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expense-dashboard-grid.lower > :last-child { grid-column: 1 / -1; }
  .expense-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .expense-filters .filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 920px) {
  .expense-dashboard-grid, .expense-dashboard-grid.lower, .expense-workspace, .expense-budget-layout { grid-template-columns: 1fr; }
  .expense-modal-content { grid-template-columns: 1fr; }
  .finance-entry-modal-content .finance-workspace { grid-template-columns: 1fr; }
  .finance-entry-modal-content .upcoming-panel { margin: 0 16px 16px; max-height: none; position: static; }
  .finance-entry-primary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-entry-primary-grid > label:first-child { grid-column: 1 / -1; }
  .expense-modal-content .expense-period-snapshot { margin: 0 16px 16px; position: static; }
  .expense-primary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expense-classification-grid { grid-template-columns: 1fr; }
  .expense-payment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expense-description-field { grid-column: 1 / -1; }
  .expense-dashboard-grid.lower > :last-child { grid-column: auto; }
  .expense-period-snapshot { position: static; }
  .budget-row { grid-template-columns: minmax(160px, 1fr) minmax(100px, .7fr) auto; }
  .budget-row > .table-actions { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .period-picker-popover {
    min-width: 0;
    width: min(320px, calc(100vw - 24px));
  }

  .expense-title { align-items: stretch; flex-direction: column; }
  .expense-modal-backdrop { padding: 0; }
  .expense-modal-shell { border-radius: 0; max-height: 100vh; min-height: 100vh; }
  .expense-modal-content .expense-form { padding: 14px; }
  .finance-entry-modal-content .finance-entry-form { padding: 14px; }
  .expense-title-actions { align-items: stretch; flex-direction: column; }
  .expense-title-actions .period-picker { width: 100%; }
  .expense-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expense-alert { align-items: start; grid-template-columns: 1fr; }
  .expense-dashboard-grid > .panel, .expense-form, .expense-period-snapshot, .expense-ledger, .expense-budget-form, .expense-budget-overview, .expense-archive { padding: 16px; }
  .expense-trend-chart { gap: 3px; height: 190px; }
  .expense-primary-grid, .expense-payment-grid, .expense-status-switch, .expense-choice-group > div, .expense-filters { grid-template-columns: 1fr; }
  .finance-entry-primary-grid, .finance-entry-date-grid { grid-template-columns: 1fr; }
  .finance-entry-primary-grid > label:first-child { grid-column: auto; }
  .finance-list-actions, .finance-list-actions a { justify-content: center; width: 100%; }
  .expense-description-field { grid-column: auto; }
  .expense-block-heading small, .expense-details-heading small { display: none; }
  .expense-view-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expense-view-tabs a { padding-inline: 8px; }
  .expense-list-actions, .expense-list-actions a { justify-content: center; width: 100%; }
  .expense-filters .filter-actions { grid-column: auto; }
  .expense-bar-list > div { grid-template-columns: minmax(0, 1fr) auto; }
  .expense-bar-list i { grid-column: 1 / -1; grid-row: 2; }
  .expense-upcoming > div > span { grid-template-columns: 62px minmax(0, 1fr); }
  .expense-upcoming > div > span > strong { grid-column: 2; }
  .budget-row { grid-template-columns: 1fr; }
  .budget-row > em { text-align: left; }
}

.expense-settings-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}

/* Central profissional de auditoria */
.audit-title { align-items: end; }
.audit-security-seal { background: #e8f2ee; border: 1px solid #bdd8cd; border-left: 4px solid var(--accent); border-radius: 6px; display: grid; gap: 1px; min-width: 220px; padding: 10px 13px; }
.audit-security-seal strong { color: #185747; font-size: 12px; }
.audit-security-seal small { font-size: 10px; }
.audit-metrics { display: grid; gap: 10px; grid-template-columns: repeat(5, minmax(140px, 1fr)); margin-bottom: 16px; }
.audit-metrics article { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid #756c65; border-radius: 6px; display: grid; gap: 3px; min-width: 0; padding: 13px; }
.audit-metrics article.ok { border-top-color: var(--ok); }
.audit-metrics article.danger { border-top-color: var(--danger); }
.audit-metrics span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.audit-metrics strong { font-size: 24px; }
.audit-metrics small { font-size: 9px; }
.audit-workspace, .audit-recovery { padding: 18px; }
.audit-heading-actions { align-items: center; display: flex; gap: 8px; }
.audit-filters { align-items: end; border-bottom: 1px solid var(--line); display: grid; gap: 8px; grid-template-columns: repeat(6, minmax(115px, 1fr)); margin-bottom: 14px; padding-bottom: 14px; }
.audit-filters label { display: grid; font-size: 10px; font-weight: 800; gap: 4px; }
.audit-filters input, .audit-filters select { min-height: 38px; }
.audit-filters .audit-search { grid-column: span 2; }
.audit-filters .filter-actions { justify-content: flex-end; }
.audit-table td { vertical-align: top; }
.audit-table td > strong, .audit-table td > small { display: block; }
.audit-event { border-radius: 999px; display: inline-flex; font-size: 9px; font-weight: 900; padding: 4px 7px; text-transform: uppercase; }
.audit-event.acao { background: #ece8e3; color: #4d453f; }
.audit-event.criacao, .audit-event.restauracao { background: #dcefe5; color: #17633a; }
.audit-event.alteracao { background: #e8edf4; color: #34506d; }
.audit-event.exclusao, .audit-event.erro { background: #f8dfe2; color: #9f2634; }
.audit-event.seguranca { background: #fff0d8; color: #8a5712; }
.audit-details { min-width: 105px; }
.audit-details summary { color: var(--brand); cursor: pointer; font-size: 11px; font-weight: 800; }
.audit-details dl { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; display: grid; gap: 5px; margin: 8px 0; max-width: 360px; padding: 9px; }
.audit-details dl div { display: grid; gap: 1px; }
.audit-details dt { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.audit-details dd { font-size: 11px; margin: 0; overflow-wrap: anywhere; }
.audit-details pre { font: 10px/1.45 Consolas, monospace; margin: 0; max-height: 240px; overflow: auto; white-space: pre-wrap; }
.audit-recovery .alert { margin-bottom: 14px; }

@media (max-width: 1200px) {
  .audit-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .audit-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .audit-title { align-items: stretch; }
  .audit-security-seal { min-width: 0; }
  .audit-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-filters { grid-template-columns: 1fr; }
  .audit-filters .audit-search { grid-column: auto; }
}

.expense-settings-grid > .panel {
  min-width: 0;
  padding: 22px;
}

.expense-manager-list {
  margin-top: 14px;
}

.expense-manager-list > div {
  align-items: end;
}

.expense-manager-list .manager-edit-form {
  flex: 1;
}

.expense-manager-list .inactive-row {
  opacity: .62;
}

@media (max-width: 920px) {
  .expense-settings-grid {
    grid-template-columns: 1fr;
  }
}

/* Planejamento profissional */
.planning-summary {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
}

.planning-summary > div {
  border-left: 1px solid var(--line);
  display: grid;
  gap: 3px;
  min-height: 92px;
  padding: 15px 18px;
}

.planning-summary > div:first-child { border-left: 4px solid var(--accent); }
.planning-summary > div.has-alert { border-top: 3px solid var(--danger); }
.planning-summary span { color: var(--muted); font-size: 11px; font-weight: 750; }
.planning-summary strong { color: var(--ink); font-size: 25px; line-height: 1.1; }
.planning-summary .has-alert strong { color: var(--danger); }
.planning-summary small { font-size: 10px; }

.planning-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(350px, 420px) minmax(0, 1fr);
}

.planning-form {
  align-self: start;
  border-top: 4px solid var(--accent);
  min-width: 0;
  position: sticky;
  top: 86px;
}

.planning-panel-heading {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 2px;
  padding-bottom: 13px;
}

.planning-panel-heading h2 { margin: 2px 0 0; }
.planning-panel-heading .panel-description { margin: 4px 0 0; }

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

.planning-full-field { grid-column: 1 / -1; }
.planning-submit { min-height: 44px; width: 100%; }
.planning-list-panel { min-width: 0; }

.planning-filters {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(125px, .75fr));
  margin: 14px 0 4px;
  padding-bottom: 15px;
}

.planning-filters .filter-actions { grid-column: 1 / -1; }
.planning-filters .filter-actions .primary-button,
.planning-filters .filter-actions .secondary-button { min-height: 38px; padding: 8px 14px; }

.planning-task-list { display: grid; }
.planning-task {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 18px 4px;
}

.planning-task:last-child { border-bottom: 0; }
.planning-task.is-overdue { border-left: 3px solid var(--danger); padding-left: 13px; }
.planning-task.is-complete { opacity: .68; }
.planning-task-main { min-width: 0; }
.planning-task-title { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; }
.planning-task-title > strong { font-size: 15px; overflow-wrap: anywhere; }
.planning-task-main > p { color: #5c625f; line-height: 1.5; margin: 8px 0; overflow-wrap: anywhere; }

.planning-priority,
.planning-status {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 9px;
  white-space: nowrap;
}

.planning-priority.priority-alta { background: #fae6e8; border-color: #efc8cd; color: #9e1f2a; }
.planning-priority.priority-media { background: #fff3dd; border-color: #efd7a8; color: #8b5a0b; }
.planning-priority.priority-baixa { background: #edf1f0; border-color: #d7dfdc; color: #53605b; }
.planning-status.status-pendente { background: #fff3dd; border-color: #efd7a8; color: #8b5a0b; }
.planning-status.status-em_andamento { background: #e8f0f7; border-color: #cadceb; color: #245f86; }
.planning-status.status-concluida { background: #e4f2eb; border-color: #bedfce; color: #17633a; }

.planning-task-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.planning-task-meta > span { color: var(--muted); font-size: 11px; }
.planning-task-meta .deadline-overdue { color: var(--danger); font-weight: 800; }
.planning-task-side { align-items: flex-end; display: grid; gap: 13px; justify-items: end; }
.planning-task-actions { justify-content: flex-end; }
.planning-task-actions a,
.planning-task-actions button { font-size: 11px; }
.planning-task-actions .task-complete-action { color: #17633a; }

.planning-empty {
  align-items: center;
  background: #f7f8f7;
  border: 1px dashed #ccd3cf;
  border-radius: 6px;
  display: grid;
  justify-items: center;
  margin-top: 16px;
  padding: 40px 20px;
  text-align: center;
}

.planning-empty strong { font-size: 15px; }
.planning-empty p { color: var(--muted); margin: 6px 0 0; }

/* Semântica financeira: entradas verdes e saídas vermelhas */
.primary-button.income-button,
.income-button {
  background: #18794e;
  border-color: #18794e;
  color: #fff;
}

.primary-button.income-button:hover,
.income-button:hover { background: #11613d; border-color: #11613d; color: #fff; }

.primary-button.expense-button,
.expense-button {
  background: #bd2832;
  border-color: #bd2832;
  color: #fff;
}

.primary-button.expense-button:hover,
.expense-button:hover { background: #971f28; border-color: #971f28; color: #fff; }
.finance-entry-form { border-top-color: #18794e; }
.expense-form { border-top-color: #bd2832; }
.finance-metric.income strong { color: #18794e; }
.finance-metric.expense strong,
.finance-metric.balance-negative strong { color: #bd2832; }
.dashboard-finance-links .income-link { background: #e4f2eb; color: #17633a; }
.dashboard-finance-links .income-link:hover { background: #d4eadf; color: #105b35; }
.dashboard-finance-links .expense-link { background: #f9e7e3; color: #a72f20; }
.dashboard-finance-links .expense-link:hover { background: #f2d6d0; color: #842317; }
.dashboard-finance-strip .finance-flow.income strong { color: #18794e; }
.dashboard-finance-strip .finance-flow.expense strong { color: #bd2832; }

@media (max-width: 1180px) {
  .planning-layout { grid-template-columns: minmax(330px, 380px) minmax(0, 1fr); }
  .planning-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planning-search { grid-column: 1 / -1; }
}

@media (max-width: 920px) {
  .planning-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planning-summary > div { border-bottom: 1px solid var(--line); }
  .planning-layout { grid-template-columns: 1fr; }
  .planning-form { position: static; }
}

@media (max-width: 620px) {
  .planning-summary { grid-template-columns: 1fr; }
  .planning-summary > div { border-left: 0; min-height: 76px; }
  .planning-summary > div:first-child { border-left: 0; border-top: 4px solid var(--accent); }
  .planning-form-grid,
  .planning-filters { grid-template-columns: 1fr; }
  .planning-search,
  .planning-full-field,
  .planning-filters .filter-actions { grid-column: auto; }
  .planning-task { grid-template-columns: 1fr; }
  .planning-task-side { align-items: flex-start; justify-items: start; }
  .planning-task-actions { justify-content: flex-start; }
}

/* Dashboard integrado com entradas financeiras */
.integrated-dashboard-section {
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding-top: 24px;
}

.integrated-section-heading {
  align-items: flex-end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.integrated-section-heading h2 { font-size: 21px; margin: 3px 0 0; }
.integrated-section-heading p { color: var(--muted); margin: 5px 0 0; }

.integrated-performance-strip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
}

.integrated-performance-strip > div {
  border-left: 1px solid var(--line);
  display: grid;
  gap: 4px;
  min-height: 102px;
  padding: 15px;
}

.integrated-performance-strip > div:first-child { border-left: 4px solid #18794e; }
.integrated-performance-strip span { color: var(--muted); font-size: 11px; font-weight: 750; }
.integrated-performance-strip strong { color: var(--ink); font-size: clamp(17px, 1.5vw, 22px); overflow-wrap: anywhere; }
.integrated-performance-strip small { font-size: 10px; line-height: 1.35; }
.integrated-performance-strip .income strong { color: #18794e; }
.integrated-performance-strip .expense strong { color: #bd2832; }

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

.integrated-list-panel { min-width: 0; }
.integrated-list-panel .list { gap: 0; }
.integrated-list-panel .list-row { min-height: 48px; padding: 10px 0; }
.integrated-list-panel .list-row:first-child { border-top: 0; }
.integrated-list-panel .list-row > span { display: grid; gap: 3px; min-width: 0; }
.integrated-list-panel .list-row strong { overflow-wrap: anywhere; }
.integrated-list-panel .list-row b { font-size: 12px; white-space: nowrap; }

@media (max-width: 1180px) {
  .integrated-performance-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .integrated-performance-strip > div:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .integrated-performance-strip > div:nth-child(n+5) { border-top: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .integrated-section-heading { align-items: stretch; flex-direction: column; }
  .integrated-section-heading .secondary-button { text-align: center; width: 100%; }
  .integrated-performance-strip,
  .integrated-operation-grid { grid-template-columns: 1fr; }
  .integrated-performance-strip > div { border-left: 0; border-top: 1px solid var(--line); min-height: 84px; }
  .integrated-performance-strip > div:first-child { border-left: 0; border-top: 4px solid #18794e; }
}
