:root {
  color-scheme: light;
  --navy: #101e34;
  --navy-deep: #0b172a;
  --ink: #18273e;
  --muted: #52647d;
  --accent: #ffa55e;
  --accent-strong: #ed7b35;
  --paper: #fff;
  --surface: #f3f5f8;
  --border: #dce3ec;
  --shadow: 0 5px 20px #16274209;
  --radius: 16px;
  --space: 24px;
  --font: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 16px/1.5 var(--font); }
button, input, select, textarea { font: inherit; }
button, .secondary, .primary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; }
:focus-visible { outline: 3px solid #2b70bf; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.65rem); line-height: 1.13; letter-spacing: -.035em; }
h2 { font-size: 1.2rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; margin: 16px 0 9px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .88rem; }
input, select, textarea { background: var(--paper); border: 1px solid #cdd7e3; border-radius: 8px; color: var(--ink); width: 100%; padding: 10px 11px; min-width: 0; }
input[type=file] { font-size: .82rem; }
textarea { min-height: 84px; }
select { min-height: 43px; }
.primary, .secondary {
  display: inline-flex; justify-content: center; align-items: center; padding: 8px 13px; min-height: 41px;
  border-radius: 8px; font-weight: 700; text-decoration: none; font-size: .85rem; white-space: nowrap;
}
.secondary { background: white; border: 1px solid var(--border); color: #2d425f; }
.secondary:hover { background: #eff4fa; }
.primary { background: var(--accent); color: #202034; border: 1px solid var(--accent); }
.primary:hover { background: #ffb77e; }
.brand { display: flex; align-items: center; gap: 12px; line-height: 1.2; }
.brand b { display: block; font-size: 1rem; }
.brand small, .profile small { display: block; color: #9cabc1; margin-top: 3px; font-size: .75rem; }
.logo { width: 41px; height: 41px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: var(--navy-deep); font-weight: 900; letter-spacing: -.07em; }
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(370px, 1.1fr) 1fr; }
.login-story { background: var(--navy-deep); color: white; padding: clamp(25px, 6vw, 84px); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; isolation: isolate; }
.login-story .brand { z-index: 1; }
.login-copy { max-width: 520px; z-index: 1; padding: 62px 0 25px; }
.login-copy h1 { font-size: clamp(2.45rem, 6vw, 5.25rem); margin: 17px 0 16px; line-height: 1; }
.login-copy p { color: #c4cfde; max-width: 340px; }
.facade { position: absolute; inset: 18% -6% 11% 20%; opacity: .55; z-index: -1; transform: skewY(-14deg); background: repeating-linear-gradient(90deg, #182d4c 0 55px, #0b172a 55px 66px), linear-gradient(#233f61,#101e34); mask-image: linear-gradient(135deg, transparent 12%, #000 48%, transparent 95%); }
.facade:before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 34px, #0c172a 34px 43px); border-right: 32px solid #294567; }
.login-side { display: grid; place-items: center; padding: 35px 24px; background: #f8fafc; }
.login-side form { width: min(100%, 365px); display: grid; gap: 17px; }
.login-side h2 { font-size: 1.75rem; margin-bottom: 8px; }
.feedback { color: #9a321c; font-size: .87rem; min-height: 1em; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0,1fr); }
.sidebar { background: var(--navy); color: #f2f5fb; min-height: 100vh; position: sticky; top: 0; max-height: 100vh; display: flex; flex-direction: column; padding: 25px 14px 18px; z-index: 2; }
.sidebar .brand { margin: 0 10px 35px; }
.sidebar nav { display: grid; gap: 6px; overflow: auto; }
.sidebar nav button { display: flex; gap: 12px; align-items: center; color: #c3cfe0; background: transparent; border: 0; padding: 10px 12px; font-size: .84rem; border-radius: 8px; min-height: 45px; text-align: left; }
.sidebar nav button span:first-child { font-size: 1.15rem; width: 17px; color: #a9b8cf; text-align: center; }
.sidebar nav button:hover { background: #203350; }
.sidebar nav button[aria-current] { background: #263a58; color: white; font-weight: 700; }
.sidebar nav button[aria-current] span:first-child { color: var(--accent); }
.sidebar-end { margin: auto 9px 2px; padding-top: 12px; }
.top, .master-top { display: flex; align-items: center; justify-content: flex-end; gap: 18px; min-height: 74px; background: var(--paper); border-bottom: 1px solid var(--border); padding: 10px clamp(14px, 3vw, 38px); }
.top label { display: flex; align-items: center; gap: 9px; margin-right: auto; }
.top select { min-width: 182px; }
.profile { display: flex; gap: 9px; align-items: center; font-size: .86rem; line-height: 1.15; }
.profile small { color: var(--muted); }
.avatar { display: grid; place-items: center; background: #eaf0f8; width: 36px; height: 36px; border-radius: 50%; font-weight: 800; }
.mobile-brand { display: none; }
.workspace { max-width: 1560px; margin: 0 auto; padding: clamp(17px, 3vw, 38px); }
.page-head { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.eyebrow { display: block; color: var(--muted); font-weight: 700; font-size: .85rem; margin-bottom: 5px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 14px; margin-bottom: 17px; }
.metric, .panel { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric { padding: 17px; overflow-wrap: anywhere; }
.metric p { color: var(--muted); font-size: .87rem; font-weight: 650; }
.metric strong { display: block; margin: 5px 0 2px; font-size: clamp(1.1rem,2.2vw,1.65rem); letter-spacing: -.04em; }
.metric small, .chart p { color: var(--muted); font-size: .79rem; }
.panel { padding: clamp(13px, 2vw, 23px); margin-bottom: 16px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 13px; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; }
.chart { background: #f5f8fc; border: 1px solid #e9eef5; border-radius: 11px; padding: 15px; }
.chart-caption, .summary p { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chart-caption { font-size: .86rem; }
.chart-caption strong { font-size: 1.35rem; }
progress { width: 100%; height: 13px; appearance: none; border: 0; border-radius: 20px; margin: 12px 0 6px; overflow: hidden; background: #e1e9f4; }
progress::-webkit-progress-bar { background: #e1e9f4; }
progress::-webkit-progress-value { background: var(--accent-strong); }
progress::-moz-progress-bar { background: var(--accent-strong); }
.summary p { font-size: .88rem; padding: 8px 0; border-bottom: 1px solid #eef1f5; }
.summary p:last-child { border-bottom: 0; }
.summary p span { color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 4px; background: #edf1f7; color: #385371; padding: 4px 9px; border-radius: 16px; font-size: .72rem; font-weight: 750; white-space: nowrap; }
.sidebar .tag, .login .tag, .master-top .tag { background: #302e38; color: #ffc798; }
.tag.approved { background: #daf3e8; color: #116144; }
.tag.pending { background: #fff0d9; color: #855519; }
.tag.rejected, .tag.reversed { background: #f8e3e5; color: #88363f; }
.tag.review { background: #dbefff; color: #125488; }
.tag.reversed { background: #e5e9ee; color: #37516a; }
.receipt-thumb { width: 52px; height: 42px; object-fit: contain; display: block; margin-bottom: 4px; }
.receipt-editor { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-top: 8px; }
.receipt-editor canvas { display: block; max-width: 100%; max-height: 350px; object-fit: contain; touch-action: none; border: 1px solid var(--border); }
.receipt-editor input[type=number] { width: 5em; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .87rem; }
th { color: var(--muted); background: #f3f6fa; white-space: nowrap; font-weight: 700; }
th, td { padding: 9px 12px; border-bottom: 1px solid #edf1f5; }
td:last-child { text-align: right; }
td .secondary, td .primary { min-height: 34px; padding: 5px 9px; }
.empty { padding: 15px 0; color: var(--muted); font-size: .9rem; }
.notice { display: block; background: #fdf0df; padding: 8px 11px; margin: 8px 0; border-radius: 8px; color: #704017; }
.controls, .dialog-actions { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.balance { margin: 17px 0; }
.balance strong { margin-left: 6px; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 13px; }
.work-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.work-card > img, .work-placeholder { width: 100%; height: 135px; object-fit: cover; display: block; }
.work-placeholder { display: grid; place-items: center; background: #eaf0f8; font-size: 2.2rem; color: #3a587e; }
.work-card > div:last-child { padding: 13px; }
.work-card h3 { margin: 8px 0 1px; }
.work-card p { color: var(--muted); font-size: .86rem; margin-bottom: 8px; }
dialog { color: var(--ink); border: 1px solid var(--border); border-radius: var(--radius); width: min(690px,calc(100% - 24px)); max-height: 90vh; overflow: auto; padding: 18px; }
dialog::backdrop { background: #0b172a99; }
.dialog-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.form-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.form-fields p { grid-column: 1 / -1; }
.check { display: flex; align-items: center; }
.check input { width: auto; }
.detail-meta strong { font-size: 1.6rem; margin-right: 8px; }
.detail-meta p { margin-top: 5px; overflow-wrap: anywhere; }
.evidence { list-style: none; padding: 0; }
.evidence li { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 9px; overflow-wrap: anywhere; }
.evidence li span:first-child { margin-right: auto; }
.viewer { display: grid; place-items: center; max-height: 67vh; overflow: auto; background: #edf1f7; }
.viewer img { max-width: 100%; max-height: 61vh; }
.viewer.zoom { display: block; }
.viewer.zoom img { max-width: none; max-height: none; width: 150%; }
.master-top { justify-content: flex-start; background: var(--navy); color: white; }
.master-top span:nth-last-child(2) { margin-left: auto; }
@media (max-width: 850px) {
  .shell { display: block; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .sidebar { position: fixed; top: auto; bottom: 0; width: 100%; min-height: 0; padding: 4px 7px calc(5px + env(safe-area-inset-bottom)); }
  .sidebar .brand, .sidebar-end { display: none; }
  .sidebar nav { display: flex; gap: 2px; overflow-x: auto; }
  .sidebar nav button { flex: 1 0 73px; display: grid; justify-items: center; text-align: center; padding: 4px; gap: 0; font-size: .66rem; line-height: 1.15; min-height: 54px; }
  .sidebar nav button span:first-child { line-height: 1.2; }
  .top { flex-wrap: wrap; gap: 9px; }
  .mobile-brand { display: flex; margin-right: auto; }
  .top label { order: 4; flex: 1 0 100%; }
  .profile { display: none; }
}
@media (max-width: 560px) {
  .login { display: block; }
  .login-story { min-height: 260px; }
  .login-copy { padding: 25px 0 3px; }
  .login-copy h1 { margin: 10px 0; }
  .login-side { padding-top: 25px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .metric { padding: 10px; }
  .dashboard { display: block; }
  .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 14px; }
  .form-fields { grid-template-columns: 1fr; }
  .master-top { flex-wrap: wrap; }
  .payment-table table, .payment-table tbody { display: block; }
  .payment-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .payment-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px;
    border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: #f9fbfd; gap: 4px 8px; }
  .payment-table td { display: block; border: 0; padding: 3px 0; overflow-wrap: anywhere; }
  .payment-table td[data-label="Estado"] { grid-column: 1 / -1; grid-row: 2; }
  .payment-table td[data-label="Importe"] { grid-column: 2; grid-row: 1; text-align: right; }
  .payment-table td[data-label="Inmueble"], .payment-table td[data-label="Importe"] { font-weight: 700; }
  .payment-table td[data-label="Comprobante"] { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
  .payment-table td[data-label="Comprobante"] img { margin-bottom: 0; }
  .payment-table td:empty { display: none; }
  .payment-table td[data-label=""] { text-align: left; }
}
@media print {
  body:has(dialog[open]) #app, dialog button, dialog a { display: none !important; }
  dialog[open] { position: static; border: 0; max-height: none; width: 100%; }
  dialog::backdrop { background: transparent; }
}

.module-form { margin: 10px 0; }
.module-form > button { margin-top: 8px; }
.module-form .form-fields:empty { display: none; }
.module-details { margin: 10px 0; max-width: 100%; }
.module-details summary { cursor: pointer; color: var(--ink); font-weight: 650; padding: 7px 0; white-space: normal; }
.module-details[open] { border-top: 1px solid var(--border); }
.board-card { padding: 14px; border-left: 3px solid var(--accent); border-radius: 9px; background: #f5f8fc; }
.board-card p, .panel > p { margin: 5px 0; }
.permissions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 6px 14px;
  min-width: 0; border: 1px solid var(--border); border-radius: 8px; }
.permissions legend { padding: 0 6px; font-weight: 700; }
