:root {
  color-scheme: light;
  --ink: #12110f;
  --muted: #45433e;
  --line: #aaa69e;
  --panel: #d3d0c9;
  --panel-soft: #c8c5be;
  --bg: #b7b2a7;
  --accent: #606470;
  --accent-2: #606470;
  --accent-contrast: #ffffff;
  --sidebar-bg: #b7b2a7;
  --sidebar-panel: rgba(255, 255, 255, 0.22);
  --sidebar-text: #12110f;
  --sidebar-muted: #45433e;
  --control-bg: #dedbd4;
  --hover-bg: rgba(18, 17, 15, 0.08);
  --accent-wash: #e2dfd8;
  --accent-border: #98948b;
  --shadow: 0 18px 50px rgba(27, 26, 23, 0.12);
}

body.dark-theme {
  color-scheme: dark;
  --ink: #ffffff;
  --muted: #b7bcc5;
  --line: #3d4857;
  --panel: #212933;
  --panel-soft: #2c3440;
  --bg: #0d1b2a;
  --accent: #ff8700;
  --accent-2: #ff8700;
  --accent-contrast: #111111;
  --sidebar-bg: #091725;
  --sidebar-panel: rgba(255, 255, 255, 0.06);
  --sidebar-text: #ffffff;
  --sidebar-muted: #b7bcc5;
  --control-bg: #182331;
  --hover-bg: rgba(255, 255, 255, 0.08);
  --accent-wash: #333d4b;
  --accent-border: #ff8700;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

body.dark-theme .main,
body.dark-theme .detail-pane,
body.dark-theme .list-pane { background: var(--bg); }
body.dark-theme .metric,
body.dark-theme .summary-card,
body.dark-theme .info-strip,
body.dark-theme .report-card,
body.dark-theme .settings-card,
body.dark-theme .receipt-card,
body.dark-theme .filters,
body.dark-theme .expense-bulk-actions { background: var(--panel); color: var(--ink); }
body.dark-theme input,
body.dark-theme select,
body.dark-theme .inline-input,
body.dark-theme .inline-select { background: var(--control-bg); color: var(--ink); border-color: var(--line); }
body.dark-theme .expense-row.header { background: #2c3440; }
body.dark-theme .expense-row { background: #182331; }
body.dark-theme .insight-kpi,
body.dark-theme .insight-panel,
body.dark-theme .ranking-row {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}
body.dark-theme .insight-kpi:hover,
body.dark-theme .ranking-row:hover {
  background: #333d4b;
  border-color: #ff8700;
}
body.dark-theme .insight-kpi.warn {
  background: #49331f;
  border-color: #ff8700;
}
body.dark-theme .bar-track { background: #3d4857; }
body.dark-theme .bar-track > div { background: linear-gradient(90deg, #ff8700, #ffd700); }
body.dark-theme .ranking-meta,
body.dark-theme .insights-head p { color: var(--muted); }
body.dark-theme .category-hoteles { color: #dfb9ff; background: #4b3065; }
body.dark-theme .category-comida { color: #ffd19a; background: #684116; }
body.dark-theme .category-transporte { color: #a9dcff; background: #164b6e; }
body.dark-theme .category-resto { color: #d2dcdf; background: #3b464b; }
body.dark-theme .detail-total {
  background: #212933;
  border: 1px solid #3d4857;
  color: var(--ink);
}
body.dark-theme .detail-total-personal {
  background: #49331f;
  border-color: #ff8700;
}
body.dark-theme .detail-total-company {
  background: #173e54;
  border-color: #35b8e5;
}
body.dark-theme .detail-total-company span { color: #a9dcf2; }
body.dark-theme .detail-total span { color: var(--muted); }
body.dark-theme .detail-total strong { color: #ffffff; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  padding: 24px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  transition: padding 180ms ease;
}

body.sidebar-collapsed .sidebar {
  gap: 14px;
  padding: 18px 14px;
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  min-width: 0;
}

.brand-copy {
  min-width: 0;
}

.sidebar-toggle {
  display: inline-grid;
  width: 34px;
  height: 34px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sidebar-panel);
  color: var(--sidebar-text);
}

.sidebar-toggle:hover {
  background: var(--hover-bg);
}

body.sidebar-collapsed .brand {
  justify-content: center;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .login-panel,
body.sidebar-collapsed .sync-card,
body.sidebar-collapsed .nav-item span {
  display: none;
}

body.sidebar-collapsed .brand-mark {
  width: 40px;
  height: 40px;
}

body.sidebar-collapsed .sidebar-toggle {
  position: fixed;
  top: 76px;
  left: 21px;
  z-index: 5;
  margin-left: 0;
}

body.sidebar-collapsed .nav-list {
  margin-top: 54px;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 24px;
  font-weight: 800;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle,
.session-label,
.sync-card code {
  color: var(--sidebar-muted);
  font-size: 12px;
}

.login-panel {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sidebar-panel);
}

.login-panel label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.login-panel #email { grid-column: 1 / -1; }
.login-panel #password { grid-column: 1; }
.login-panel .field-row button { grid-column: 2; }

.field-row input,
.filters input,
.filters select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--ink);
  outline: none;
}

.field-row input {
  height: 42px;
  padding: 0 11px;
}

.icon-button,
.tool-button,
.nav-item {
  border: 0;
  border-radius: 8px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-wash);
}

.icon-button.primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.nav-list {
  display: grid;
  gap: 8px;
}

.sidebar-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sidebar-panel);
  color: var(--sidebar-text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.sidebar-theme-toggle:hover {
  background: var(--hover-bg);
}

.sidebar-theme-switch {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
}

.sidebar-theme-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

body.dark-theme .sidebar-theme-switch span { transform: translateX(18px); }

body.sidebar-collapsed .sidebar-theme-toggle {
  justify-content: center;
  padding: 8px;
}

body.sidebar-collapsed .sidebar-theme-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  color: var(--sidebar-muted);
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: var(--hover-bg);
  color: var(--sidebar-text);
}

.sync-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  background: var(--sidebar-panel);
}

.sync-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.05;
}

.topbar p {
  margin-top: 7px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.tool-button.accent {
  border-color: transparent;
  background: var(--accent-2);
  color: var(--accent-contrast);
}

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

.metric {
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(27, 26, 23, 0.06);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 25px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 182px);
  margin-top: 16px;
}

.list-pane,
.detail-pane {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.list-pane {
  display: flex;
  flex-direction: column;
}

.filters {
  display: grid;
  gap: 9px;
  padding: 13px;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid transparent;
}

.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
}

.filters input,
.filters select {
  height: 40px;
  padding: 0 11px;
}

.filters input {
  padding-left: 38px;
}

.reports-list {
  overflow: auto;
  padding: 8px;
}

.report-row {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.report-row:hover,
.report-row.active {
  border-color: var(--line);
  background: var(--panel-soft);
}

.report-row-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.report-row h3 {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.report-row .amount {
  white-space: nowrap;
  font-weight: 800;
}

.report-row-meta,
.detail-meta,
.chip-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e9efeb;
  color: #34413d;
}

.chip.status-open {
  background: #e7f5ed;
  color: #14633f;
}

.chip.status-closed {
  background: #eef1f5;
  color: #4b5964;
}

.detail-pane {
  min-width: 0;
  overflow: auto;
}

.empty-state {
  display: grid;
  min-height: 100%;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--accent);
}

.report-detail {
  padding: 18px;
}

.insights-view {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.settings-view {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.hours-view {
  min-height: 100%;
  padding: 22px;
  overflow: auto;
}
.hours-content { display: grid; gap: 18px; max-width: 1100px; margin: 0 auto; }
.hours-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hours-heading h2 { margin: 5px 0; }
.hours-heading p, .hours-note { margin: 0; color: var(--muted); }
.hours-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hours-totals article, .hours-table-card, .hours-image { background: var(--panel-soft); border: 1px solid var(--line); border-radius: 12px; }
.hours-totals article { display: grid; gap: 7px; padding: 16px; }
.hours-totals span { color: var(--muted); }
.hours-totals strong { font-size: 1.5rem; }
.hours-table-scroll { overflow-x: auto; }
.hours-table-card table { width: 100%; border-collapse: collapse; }
.hours-table-card th, .hours-table-card td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.hours-table-card th { color: var(--muted); font-size: .82rem; font-weight: 650; }
.hours-table-card tr:last-child td { border-bottom: 0; }
.hours-empty { text-align: center !important; color: var(--muted); }
.hours-image { overflow: hidden; padding: 16px; }
.hours-image h3 { margin: 0 0 12px; }
.hours-image img { display: block; max-width: 100%; max-height: 70vh; margin: auto; object-fit: contain; border-radius: 8px; }
.hours-state { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; color: var(--muted); }
.hours-state svg { width: 38px; height: 38px; color: var(--accent); }
.hours-state h2, .hours-state p { margin: 0; }
.hours-note { text-align: center; font-size: .82rem; }
.hours-warning, .hours-success { padding: 10px 14px; border-radius: 10px; background: var(--panel); }
.hours-warning { border-left: 3px solid #d88b00; }
.hours-success { border-left: 3px solid #42a66b; }
@media (max-width: 760px) {
  .hours-view { padding: 14px; }
  .hours-heading { align-items: flex-start; }
  .hours-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hours-totals { gap: 8px; }
  .hours-totals article { padding: 12px 10px; }
  .hours-totals strong { font-size: 1.2rem; }
}

.hidden {
  display: none !important;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.edit-field {
  display: grid;
  gap: 6px;
  min-width: 132px;
}

.edit-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.edit-field select,
.inline-select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--ink);
  outline: none;
}

.edit-field select {
  height: 40px;
  padding: 0 10px;
}

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

.detail-head h2 {
  font-size: 24px;
  overflow-wrap: anywhere;
}

.detail-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
}

.detail-total {
  min-width: 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel-soft);
  text-align: right;
}

.detail-total-personal {
  border: 1px solid var(--accent-border);
}

.detail-total-company {
  border: 1px solid #2187a8;
  background: #e5f2f7;
}

.detail-total-company span {
  color: #24566a;
}

.theme-setting {
  grid-column: 1 / -1;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.theme-switch-control {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 178px;
  justify-content: space-between;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.theme-switch-control .theme-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
}

.theme-switch-control .theme-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

body.dark-theme .theme-switch-control .theme-switch span { transform: translateX(18px); }

.detail-total span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-total strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(15px, 1.35vw, 24px);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

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

.info-strip span {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  min-width: 0;
}

.info-strip b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.summary-card {
  min-height: 72px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.summary-card.wide {
  grid-column: span 1;
}

.summary-card.wide strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.principal-types {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.principal-type {
  display: block;
  width: max-content;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.25;
}

.category-hoteles { color: #6d3fa0; background: #f0e6fb; }
.category-comida { color: #a95700; background: #fff0dc; }
.category-transporte { color: #0866a8; background: #e2f2ff; }
.category-resto { color: #4f5b64; background: #edf0f2; }

.summary-card.warn {
  border-color: #e8c2a4;
  background: #fff7ef;
}

.insights-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 240px;
  justify-content: center;
  color: var(--muted);
}

.insights-loading svg {
  animation: spin 1s linear infinite;
}

.insights-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.insights-head h2 {
  font-size: 25px;
}

.insights-head p {
  margin-top: 6px;
  color: var(--muted);
}

.settings-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.settings-head h2 {
  font-size: 25px;
}

.settings-head p {
  margin-top: 6px;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(280px, 1fr);
  gap: 14px;
}

.settings-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.settings-panel.primary-setting { background: var(--panel-soft); border-color: var(--line); }

.release-admin { grid-column: 1 / -1; }
.release-upload { display: grid; gap: 10px; max-width: 760px; }
.release-file-label { font-size: 13px; font-weight: 700; }
.release-upload input[type="file"],
.release-upload textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  font: inherit;
}
.release-upload textarea { resize: vertical; }
.release-upload button { justify-self: start; }
.release-upload button:disabled { opacity: .6; cursor: progress; }
.release-status, .muted { color: var(--muted); font-size: 13px; }
.release-status.error { color: #e34b4b; }
.release-list { display: grid; gap: 8px; }
.release-list h3 { margin: 0 0 2px; }
.release-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.release-row > div { min-width: 0; }
.release-row strong span, .release-row small { color: var(--muted); }
.release-row small { display: block; margin-top: 4px; }
.release-row p { margin: 8px 0 0; white-space: pre-wrap; }
.release-row .release-activity { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.release-row .release-activity strong { color: var(--ink); }
.release-row .tool-button { flex: 0 0 auto; }

.settings-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.settings-title > svg {
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 8px;
  background: var(--accent-wash);
  color: var(--accent);
}

.settings-title h3 {
  font-size: 19px;
}

.settings-title p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.setting-current {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  padding: 16px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.setting-current span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.setting-current strong {
  font-size: 38px;
  line-height: 1;
}

.setting-current em {
  align-self: end;
  color: var(--accent);
  font-style: normal;
  font-weight: 800;
}

.setting-form {
  display: grid;
  gap: 8px;
}

.setting-form label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.setting-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.setting-input-row input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.setting-hint,
.setting-message,
.settings-facts {
  color: var(--muted);
  font-size: 13px;
}

.expense-row.category-row-hoteles { border-left-color: #9b62c7; }
.expense-row.category-row-comida { border-left-color: #f29a3f; }
.expense-row.category-row-transporte { border-left-color: #3b9bd6; }
.expense-row.category-row-resto { border-left-color: #83919a; }

.setting-message {
  display: none;
  padding: 10px 12px;
  border-radius: 8px;
  background: #e8f6ef;
  color: #176244;
  font-weight: 800;
}

.setting-message.visible {
  display: block;
}

.settings-facts {
  display: grid;
  gap: 10px;
}

.settings-facts span {
  display: grid;
  gap: 3px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow-wrap: anywhere;
}

.settings-facts b {
  color: var(--ink);
}

.insight-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.insight-kpi {
  display: grid;
  gap: 9px;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
  color: var(--ink);
  text-align: left;
}

.insight-kpi:hover,
.ranking-row:hover {
  border-color: #b9cbc2;
  background: #eef6f2;
}

.insight-kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.insight-kpi strong {
  font-size: 22px;
  overflow-wrap: anywhere;
}

.insight-kpi.warn {
  border-color: #e8c2a4;
  background: #fff7ef;
}

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

.insight-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.ranking-list {
  display: grid;
  gap: 8px;
}

.ranking-row {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.ranking-top,
.ranking-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ranking-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-top span {
  white-space: nowrap;
  font-weight: 800;
}

.ranking-meta {
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3eae6;
}

.bar-track div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-title h3 {
  font-size: 18px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.expenses-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.expense-row {
  display: grid;
  grid-template-columns: 34px 122px 48px minmax(220px, 1fr) minmax(112px, 120px) 118px 100px 82px;
  align-items: start;
  column-gap: 6px;
  row-gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid transparent;
  font-size: 13px;
}

.expense-row > span {
  min-width: 0;
}

.expense-row:last-child {
  border-bottom: 0;
}

.expense-row.header {
  min-height: 38px;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
  background: #f1f4f0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.expense-row .concept {
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.expense-row .type {
  justify-self: start;
  align-self: stretch;
  display: flex;
  justify-content: flex-start;
  width: 100%;
  margin: 0;
  padding: 0;
  max-width: 100%;
  white-space: nowrap;
  text-align: left;
  box-sizing: border-box;
}

.expense-row .type-chip {
  display: flex;
  align-items: center;
  width: 100%;
  height: 34px;
  min-height: 34px;
  max-width: none;
  padding: 3px 9px;
  border: 1px solid currentColor;
  border-radius: 7px;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

.expense-row.header > span:nth-child(5),
.expense-row > span:nth-child(5) {
  justify-self: stretch;
  align-self: start;
  text-align: left !important;
  justify-content: flex-start !important;
  align-items: flex-start;
  padding-left: 0 !important;
}

.expense-row .payment {
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-select,
.inline-input {
  height: 34px;
  min-width: 104px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-bg);
  font-size: 12px;
}

.inline-input.date-input {
  width: 118px;
  min-width: 118px;
}

.inline-input.concept-input {
  width: 100%;
  min-width: 170px;
}

.expense-row .money {
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.expense-row .money .amount-input {
  width: 92px;
  min-width: 92px;
  text-align: right;
  font-weight: 800;
}

.amount-editor {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.amount-editor small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.expense-row .actions {
  justify-self: end;
}

.expense-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
  font-size: 13px;
}

.expense-bulk-actions label,
.receipt-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bulk-hint {
  color: var(--muted);
  font-size: 12px;
}

.danger-link,
.small-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #f0b5ad;
  border-radius: 7px;
  background: #fff1ef;
  color: #a33a30;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.small-action {
  border-color: #b8d6cb;
  background: #eefaf6;
  color: #176b55;
}

.danger-link:hover {
  background: #ffe2de;
  border-color: #df7c70;
}

.small-action:hover {
  background: #dcf4ec;
  border-color: #73baa4;
}

.danger-link:disabled,
.small-action:disabled {
  cursor: default;
  opacity: 0.55;
}

.line-receipts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.line-receipt-thumb {
  width: 32px;
  height: 32px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e7ece8;
  cursor: pointer;
}

.line-receipt-thumb:disabled {
  cursor: default;
  opacity: 0.55;
}

.line-receipt-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.line-receipt-thumb span {
  display: block;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(135deg, #dbe3dd 0 6px, #eef2ef 6px 12px);
}

.receipt-extra,
.no-receipt {
  color: var(--muted);
  font-size: 12px;
}

.expense-row .money {
  text-align: right;
  font-weight: 800;
}

.receipt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.receipt-card {
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.receipt-card button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.receipt-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
}

.receipt-card footer {
  display: grid;
  gap: 3px;
  padding: 9px;
  font-size: 12px;
}

.receipt-card footer strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-card footer .receipt-select {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.image-dialog {
  width: min(1120px, calc(100vw - 38px));
  max-height: calc(100vh - 38px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #111;
  color: white;
}

.image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 92px);
  object-fit: contain;
}

.image-dialog img.receipt-filter-enhanced {
  filter: grayscale(0.18) contrast(1.45) brightness(1.08) saturate(0.85);
}

.image-dialog img.receipt-filter-contrast {
  filter: grayscale(1) contrast(2.15) brightness(1.18);
}

.receipt-enhance-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 70px);
}

.receipt-enhance-controls button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.66);
  color: #eef7f3;
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(6px);
}

.receipt-enhance-controls button:hover,
.receipt-enhance-controls button.active {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-contrast);
}

.receipt-enhance-controls button.save-enhanced {
  background: var(--accent-2);
  color: var(--accent-contrast);
}

.receipt-enhance-controls button:disabled {
  cursor: default;
  opacity: 0.5;
}

.dialog-close {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.65);
}

.dialog-caption {
  padding: 12px 14px;
  color: #d7e0dc;
  font-size: 13px;
}

.empty-list,
.error-box {
  padding: 16px;
  color: var(--muted);
}

.error-box {
  color: #8b2d1b;
}

svg {
  width: 18px;
  height: 18px;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1300px) and (min-width: 1101px) {
  .app-shell { grid-template-columns: 230px minmax(0, 1fr); }
  .sidebar { padding: 18px; }
  .main { padding: 18px; }
  .workbench { grid-template-columns: minmax(270px, 320px) minmax(0, 1fr); }
  .expense-row {
    grid-template-columns: 28px 104px 40px minmax(150px, 1fr) minmax(96px, 110px) 104px 88px 70px;
    font-size: 12px;
  }
}

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

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(260px, 1fr);
  }

  .nav-list,
  .sync-card {
    grid-column: span 2;
  }

  .workbench {
    grid-template-columns: 1fr;
    height: auto;
  }

  .list-pane,
  .detail-pane {
    min-height: 430px;
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .sidebar,
  .metrics-grid,
  .info-strip,
  .summary-panel {
    grid-template-columns: 1fr;
  }

  .nav-list,
  .sync-card {
    grid-column: auto;
  }

  .topbar,
  .detail-head,
  .insights-head,
  .settings-head {
    flex-direction: column;
  }

  .detail-totals {
    width: 100%;
  }

  .detail-total {
    flex: 1;
    min-width: 0;
  }

  .toolbar,
  .insight-actions {
    justify-content: flex-start;
  }

  .insight-kpis,
  .insights-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .setting-input-row {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    gap: 8px;
  }

  .expense-row {
    grid-template-columns: 76px minmax(0, 1fr) 76px 86px;
    min-height: 58px;
    gap: 10px;
    padding: 10px 12px;
  }

  .expense-row.header {
    display: none;
  }

  .expense-row .type,
  .expense-row .payment {
    display: none;
  }

  .line-receipts {
    justify-content: flex-start;
  }

  .line-receipt-thumb {
    width: 30px;
    height: 30px;
  }
}
.control-user-form { display: grid; gap: 10px; }
.control-user-form input:not([type="checkbox"]), .control-user-form select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
.control-user-form input[readonly] { opacity: .7; }
.control-user-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.control-user-list { display: grid; gap: 8px; }
.control-active { display: flex; align-items: center; gap: 8px; }
.control-user-form button:disabled { opacity: .6; }
