/* ==========================================================================
   E-Bayad interface enhancements
   Loaded after app.css. Keeps the original maroon / rose / gold palette and
   square form surfaces; improves layout grids, responsiveness, notifications,
   dialogs and the print preview.
   ========================================================================== */
:root {
    --gap: 24px;
    --gap-sm: 16px;
    --ring: 0 0 0 3px #721c3526;
    --shadow-sm: 0 1px 2px #19213b0a, 0 2px 8px #19213b06;
    --shadow-md: 0 8px 24px #2a0d1a14;
    --shadow-lg: 0 24px 70px #1e0c2840;
    --danger: #ab2943;
    --success: #34805a;
    --topbar-h: 72px;
}
@media (max-width: 700px) { :root { --gap: 16px; --topbar-h: 64px; } }

/* ---------- Base & accessibility ---------- */
::selection { background: #721c3526; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--wine); color: #fff; padding: 10px 16px; font-weight: 600; transition: top .15s; }
.skip-link:focus { top: 12px; }
body.no-scroll { overflow: hidden; }
img { height: auto; }
.material-icons { user-select: none; }

/* ---------- Sidebar ---------- */
html:not(.sidebar-ready) .sidebar, html:not(.sidebar-ready) .workspace { transition: none !important; }
.sidebar { scrollbar-width: thin; scrollbar-color: #ffffff30 transparent; }
.filters .field.is-required > span::after { content: none; }
.nav-link { position: relative; transition: background .15s, color .15s; }
.nav-link:hover { color: #fff; }
.nav-link.active:hover { color: var(--wine); }
.nav-link:focus-visible { outline: 2px solid #f0d3dc; outline-offset: 1px; }
.sidebar-collapsed .nav-link:hover::after {
    content: attr(title); position: fixed; left: 84px; transform: translateY(0);
    background: var(--ink); color: #fff; padding: 6px 10px; font-size: 11px; white-space: nowrap; z-index: 60; box-shadow: var(--shadow-md);
}
.sidebar-close { display: none; position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; border: 0; background: #ffffff14; color: #fff; align-items: center; justify-content: center; }
.sidebar-close:hover { background: #ffffff26; }
.sidebar-backdrop { display: none; }

/* Tablets and phones: the sidebar becomes a slide-in drawer. */
@media (max-width: 900px) {
    .app-layout .workspace, .sidebar-collapsed .app-layout .workspace, .app-layout.sidebar-collapsed .workspace { margin-left: 0 !important; }
    html .app-layout .sidebar {
        width: min(300px, 86vw) !important; padding: 28px 16px 20px !important;
        transform: translateX(-105%); transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s;
        z-index: 45; box-shadow: none;
    }
    html.sidebar-open .app-layout .sidebar { transform: none; box-shadow: 12px 0 40px #2108124d; }
    .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 44; background: #1a102966; backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .25s; }
    html.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .sidebar-close { display: inline-flex; }
    .app-layout .sidebar .brand { padding-right: 40px; }
    .app-layout .sidebar .brand-copy, .app-layout .sidebar .nav-text, .app-layout .sidebar .nav-label { display: initial; }
    .app-layout .sidebar .nav-label { display: block; }
    .app-layout .sidebar .nav-link { justify-content: flex-start; padding: 12px 15px; }
    .app-layout .sidebar .sidebar-bottom { justify-content: flex-start; padding: 24px 15px 0; }
}

/* ---------- Top bar ---------- */
.app-layout .topbar { min-height: var(--topbar-h); height: var(--topbar-h); padding-top: 0; padding-bottom: 0; transition: box-shadow .2s; }
.app-layout .topbar.is-raised { box-shadow: 0 4px 18px #19213b10; }
.top-user { gap: 10px; }
.top-user .avatar { width: 36px; height: 36px; }
.top-user form { margin: 0; }
#menu-toggle { width: 40px; height: 40px; }
@media (max-width: 900px) {
    .app-layout .topbar { padding-inline: 14px; flex-wrap: nowrap; }
    .app-layout .top-identity { width: auto; flex: 1; }
    .workspace-context { display: inline; }
}
@media (max-width: 600px) {
    .app-layout .topbar { padding-inline: 10px; }
    .app-layout .top-user > div { display: none; }
    .app-layout .top-user .avatar { display: grid; width: 34px; height: 34px; }
    .workspace-context { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
}

/* ---------- Page container & heading ---------- */
.app-layout .main-content { padding: 28px clamp(14px, 2.4vw, 32px); }
.app-layout .page-heading { gap: 16px; flex-wrap: wrap; margin-bottom: var(--gap); border-left: 3px solid var(--wine); box-shadow: var(--shadow-sm); }
.page-heading-copy { min-width: 0; flex: 1 1 260px; }
.page-heading-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.date-chip { display: inline-flex; align-items: center; gap: 7px; border-radius: 0; }
.date-chip .material-icons { font-size: 15px; color: var(--wine); }
@media (max-width: 600px) {
    .app-layout .main-content { padding: 16px 12px; }
    .page-heading-actions { width: 100%; }
    .page-heading-actions .btn { flex: 1; }
    .app-layout .page-heading h1 { font-size: 22px; }
}

/* ---------- Panels ---------- */
.app-layout .panel { margin-bottom: var(--gap); box-shadow: var(--shadow-sm); }
.panel > h2:first-child { margin-bottom: 6px; }
.panel > h2 + .muted { margin-bottom: 18px; }
.panel-heading { flex-wrap: wrap; }
.panel-title-group { display: flex; align-items: flex-start; gap: 14px; min-width: 0; flex: 1 1 280px; }
.panel-title-group > div { min-width: 0; }
.panel-icon { color: var(--wine); background: var(--rose); padding: 10px; font-size: 22px; flex-shrink: 0; }
.count-chip { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 9px; font-size: 11px; font-weight: 700; color: var(--wine); background: var(--rose); border: 1px solid #ecd6dd; letter-spacing: 0; }
@media (max-width: 600px) {
    .panel-heading > .btn, .panel-heading > a.btn { width: 100%; }
}

/* ---------- Buttons ---------- */
.btn { min-height: 42px; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:focus-visible { box-shadow: var(--ring); outline: none; }
.btn.secondary:hover { border-color: #c9b1b9; color: var(--wine); }
.btn.danger:hover { background: #fde3e8; border-color: #e7aab8; }
.btn.danger-solid, .swal2-confirm.btn.danger-solid { background: var(--danger) !important; border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover, .swal2-confirm.btn.danger-solid:hover { background: #8e1f36 !important; }
.btn.small { min-height: 34px; }
.btn.ghost:hover { background: var(--rose); }
.btn[disabled] { opacity: .7; cursor: progress; }
.btn.is-busy { gap: 10px; }
.btn-spinner { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: eb-spin .7s linear infinite; flex-shrink: 0; }
@keyframes eb-spin { to { transform: rotate(360deg); } }
.btn.action-icon { min-height: 38px; }
.btn.action-icon:hover { color: var(--wine); }
.btn.danger.action-icon:hover { color: var(--danger); }
.text-link { display: inline-flex; align-items: center; gap: 4px; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.print-toolbar { flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
.field > span { display: inline-flex; align-items: center; gap: 4px; }
.field.is-required > span::after { content: '*'; color: var(--danger); font-weight: 700; }
.field.is-muted { opacity: .55; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]):hover, select:hover, textarea:hover { border-color: #b8bdc8 !important; }
input:focus, select:focus, textarea:focus { box-shadow: var(--ring); outline: none !important; border-color: var(--wine) !important; }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--danger) !important; background: #fffafb; }
input[type=radio] { accent-color: var(--wine); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.panel .form-actions { justify-content: flex-start; }
dialog .form-actions { justify-content: flex-end; position: sticky; bottom: -28px; background: #fff; margin: 4px -28px -28px; padding: 16px 28px; z-index: 2; }
.form-hint { display: flex; gap: 8px; align-items: flex-start; grid-column: 1 / -1; background: #f7f8fa; border: 1px solid var(--line); padding: 10px 12px; margin: 0; line-height: 1.6; }
.form-hint .material-icons { font-size: 17px; color: var(--wine); margin-top: 1px; }
.check-row { line-height: 1.5; align-items: flex-start; }
.check-row input { margin-top: 3px; flex-shrink: 0; }
@media (max-width: 600px) {
    .form-actions .btn { flex: 1 1 140px; }
    dialog .form-actions { margin: 4px -18px -18px; padding: 14px 18px; bottom: -18px; }
}

/* Search box with icon */
.search-row { max-width: 560px; align-items: stretch; flex-wrap: wrap; }
.search-input { position: relative; flex: 1 1 220px; display: block; }
.search-input .material-icons { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 19px; color: var(--muted); pointer-events: none; }
.search-input input { padding-left: 38px !important; }

/* Filter bar: a tidy responsive grid */
.page-content > .filters, .panel .filters {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end;
    gap: 14px; background: #fff; border: 1px solid var(--line); padding: 16px 18px; box-shadow: var(--shadow-sm); margin: 0 0 var(--gap);
}
.panel .filters { box-shadow: none; background: #fbfafb; }
.filters .field { max-width: none; min-width: 0; }
.filters > .btn { min-height: 43px; }
@media (min-width: 1100px) {
    .page-content > .filters { grid-template-columns: repeat(3, minmax(160px, 260px)) auto; justify-content: start; }
    .panel .filters { grid-template-columns: repeat(auto-fit, minmax(170px, 260px)); }
}

/* ---------- Statistic cards & grids ---------- */
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--gap-sm); margin-bottom: var(--gap); }
.stats-grid.compact { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat-card { position: relative; border-radius: 0; overflow: hidden; transition: box-shadow .2s, transform .2s; }
.stat-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--wine); }
.stat-card:nth-child(2)::before { background: var(--gold); }
.stat-card:nth-child(3)::before { background: #963d56; }
.stat-card:nth-child(4)::before { background: var(--deep); }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card .material-icons { border-radius: 0; }
.stat-card small { font-size: 11px; }
.chart-grid { gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.chart-grid > .panel { margin-bottom: var(--gap); }
.office-grid { gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.detail-grid { gap: var(--gap); align-items: start; }
@media (min-width: 1201px) { .detail-grid > aside { position: sticky; top: calc(var(--topbar-h) + 16px); } }
.info-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 18px 24px; }
.info-grid > div { padding-bottom: 12px; border-bottom: 1px solid #f0f0f3; min-width: 0; }
@media (max-width: 600px) { .stats-grid, .stats-grid.compact { grid-template-columns: 1fr 1fr; } .stat-card > strong { font-size: 20px; } }
@media (max-width: 380px) { .stats-grid, .stats-grid.compact { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table-wrap { position: relative; border: 1px solid var(--line); border-top: 0; }
.table-wrap.is-scrollable { box-shadow: inset -14px 0 12px -12px #19213b26; }
.table-wrap table th { position: sticky; top: 0; z-index: 1; }
tbody tr { transition: background .12s; }
tbody tr:nth-child(even) { background: #fcfcfd; }
tbody tr:hover { background: #fbf5f7; }
td.col-actions, th.col-actions { width: 1%; white-space: nowrap; text-align: right; }
td.col-actions .actions { justify-content: flex-end; flex-wrap: nowrap; }
.empty .material-icons { display: block; margin: 0 auto 8px; font-size: 32px; color: #c9b1b9; }
.text-right { text-align: right !important; }
.pagination { padding: 14px 4px 0; }
.pagination .btn.small { min-width: 36px; padding-inline: 10px; }
.pagination .btn .material-icons { font-size: 18px; }

/* Phones: each row becomes a labelled card. */
@media screen and (max-width: 700px) {
    .app-layout .table-wrap { border: 0; overflow: visible; box-shadow: none; }
    .app-layout .table-wrap table.stack-mobile { min-width: 0 !important; border: 0; }
    .app-layout table.stack-mobile thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .app-layout table.stack-mobile, .app-layout table.stack-mobile tbody, .app-layout table.stack-mobile tr, .app-layout table.stack-mobile td { display: block; width: 100%; }
    .app-layout table.stack-mobile tr { border: 1px solid var(--line); border-left: 3px solid var(--wine); background: #fff !important; margin-bottom: 12px; padding: 4px 14px; box-shadow: var(--shadow-sm); }
    .app-layout table.stack-mobile td { position: relative; padding: 10px 0 10px 40%; border-bottom: 1px dashed #ececf0; min-height: 40px; overflow-wrap: anywhere; }
    .app-layout table.stack-mobile td:last-child { border-bottom: 0; }
    .app-layout table.stack-mobile td::before { content: attr(data-label); position: absolute; left: 0; top: 11px; width: 36%; font-size: 10px; font-weight: 650; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); line-height: 1.4; }
    .app-layout table.stack-mobile td:first-child { padding-left: 0; padding-top: 12px; }
    .app-layout table.stack-mobile td:first-child::before { position: static; display: block; width: auto; margin-bottom: 4px; }
    .app-layout table.stack-mobile td.col-actions { padding-left: 0; text-align: left; }
    .app-layout table.stack-mobile td.col-actions::before { content: none; }
    .app-layout table.stack-mobile td.col-actions .actions { justify-content: flex-start; flex-wrap: wrap; }
    .app-layout table.stack-mobile td:not([data-label])::before { content: none; }
    .app-layout table.stack-mobile td:not([data-label]) { padding-left: 0; }
    .app-layout table.stack-mobile tr.empty-row { border-left-color: var(--line); }
    .app-layout table.stack-mobile tr.empty-row td { padding: 24px 0 !important; text-align: center; }
    .pagination { flex-direction: column; align-items: stretch; }
    .pagination .page-buttons { justify-content: center; }
    .pagination .page-word { display: none; }
}

/* ---------- Badges & notices ---------- */
.badge { border-radius: 0; letter-spacing: .2px; }
.notice { border-radius: 0; line-height: 1.6; }
.notice > .material-icons { flex-shrink: 0; }

/* ---------- Dialogs (add / edit forms, previews) ---------- */
dialog { padding: 28px; overscroll-behavior: contain; }
dialog[open] { animation: eb-fade-in .18s ease-out; }
dialog[open]::backdrop { animation: eb-fade-in .18s ease-out; }
@keyframes eb-fade-in { from { opacity: 0; } to { opacity: 1; } }
.form-dialog { width: min(760px, calc(100vw - 24px)); }
.form-dialog .dialog-heading { gap: 14px; align-items: flex-start; position: sticky; top: -28px; background: #fff; z-index: 3; margin: -28px -28px 0; padding: 22px 28px 18px; }
.form-dialog .dialog-heading > div { flex: 1; min-width: 0; }
.form-dialog .dialog-heading .small-note { margin: 4px 0 0; }
.dialog-icon { color: var(--wine); background: var(--rose); padding: 10px; font-size: 22px; flex-shrink: 0; }
.dialog-heading .icon-button .material-icons { font-size: 22px; }
dialog .swal2-container { position: fixed !important; inset: 0 !important; }
@media (max-width: 600px) {
    dialog { padding: 18px; width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
    .form-dialog .dialog-heading { margin: -18px -18px 0; padding: 16px 18px 14px; top: -18px; }
    .dialog-icon { display: none; }
}

/* ---------- SweetAlert2 notifications ---------- */
.swal2-container { z-index: 2000 !important; }
.swal2-popup.eb-swal { width: min(440px, calc(100vw - 32px)); padding: 28px 26px 24px; border-top: 4px solid var(--wine); box-shadow: var(--shadow-lg); font-family: inherit; }
.swal2-popup.eb-swal-danger { border-top-color: var(--danger); }
.swal2-popup.eb-swal-warning { border-top-color: var(--gold); }
.eb-swal .swal2-icon { margin: 4px auto 14px; transform: scale(.82); }
.eb-swal-title { font-size: 20px !important; font-weight: 700 !important; color: var(--ink) !important; padding: 0 !important; letter-spacing: -.3px; }
.eb-swal-text { font-size: 14px !important; color: #5d6370 !important; line-height: 1.65 !important; margin: 10px 0 0 !important; }
.eb-swal-text p { margin: 0; }
.eb-swal-actions { gap: 10px; margin-top: 22px !important; width: 100%; flex-wrap: wrap; }
.eb-swal-actions .btn { margin: 0; min-width: 120px; }
.eb-swal-loading .swal2-loader { border-color: var(--wine) transparent var(--wine) transparent; }
.eb-swal-loading .swal2-actions { margin-top: 18px !important; }
.eb-swal-progress { background: #721c3566 !important; }
.swal2-popup.eb-toast { border-radius: 0 !important; border-left: 4px solid var(--wine); box-shadow: var(--shadow-md) !important; padding: 12px 14px !important; font-family: inherit; width: min(380px, calc(100vw - 24px)) !important; }
.swal2-popup.eb-toast .swal2-title { font-size: 14px !important; color: var(--ink); }
.swal2-popup.eb-toast .swal2-html-container { font-size: 12.5px !important; color: #5d6370; margin: 2px 0 0 !important; }
.swal2-popup.eb-toast.swal2-icon-error { border-left-color: var(--danger); }
.swal2-popup.eb-toast.swal2-icon-warning { border-left-color: var(--gold); }
.flash-fallback { border-left: 4px solid var(--wine); border-radius: 0; }

/* ---------- Request details ---------- */
.timeline li:last-child { padding-bottom: 4px; }
.payment-entry .panel-heading { margin-bottom: 8px; }
.requirements li::marker { color: var(--wine); }

/* ---------- Receipt sheet on screen ---------- */
@media screen {
    .app-layout .page-content > .receipt-sheet { max-width: 880px !important; margin: 0 auto var(--gap); box-shadow: var(--shadow-md); border-top: 4px solid var(--wine); }
    .page-receipt .print-toolbar { max-width: 880px; margin-inline: auto; }
}
.receipt-sheet table { margin-top: 10px; }
.receipt-header .notice { display: inline-block; margin-top: 10px; }
@media (max-width: 600px) {
    .receipt-sheet { padding: 22px 16px; }
    .receipt-sheet .info-grid { grid-template-columns: 1fr; }
}

/* ---------- Public pages ---------- */
.public-document-card { transition: box-shadow .2s; }
.public-document-card:hover { box-shadow: var(--shadow-md); }
.auth-shell { border-radius: 0; box-shadow: var(--shadow-md); }

/* ==========================================================================
   Print preview overlay
   ========================================================================== */
.pp-overlay { position: fixed; inset: 0; z-index: 1500; background: #1a1029b8; backdrop-filter: blur(3px); display: flex; padding: 20px; opacity: 0; transition: opacity .18s; }
.pp-overlay.is-open { opacity: 1; }
.pp-overlay[hidden] { display: none; }
.pp-shell { background: #fff; width: 100%; max-width: 1480px; margin: auto; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; box-shadow: var(--shadow-lg); border-top: 4px solid var(--wine); }
.pp-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.pp-header-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pp-header-title > .material-icons { color: var(--wine); background: var(--rose); padding: 9px; }
.pp-header h2 { margin: 0; font-size: 18px; }
.pp-header p { margin: 0; font-size: 12px; color: var(--muted); }
.pp-body { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 0; }
.pp-options { overflow: auto; border-right: 1px solid var(--line); background: #fcfafb; padding: 6px 18px 18px; }
.pp-group { border-bottom: 1px solid var(--line); padding: 12px 0; }
.pp-group:last-child { border-bottom: 0; }
.pp-group > summary { cursor: pointer; font-size: 10px; font-weight: 750; letter-spacing: 1.6px; text-transform: uppercase; color: var(--wine); list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 2px 0 10px; }
.pp-group > summary::-webkit-details-marker { display: none; }
.pp-group > summary::after { content: 'expand_more'; font-family: 'Material Icons'; font-size: 18px; letter-spacing: 0; transition: transform .15s; color: var(--muted); }
.pp-group[open] > summary::after { transform: rotate(180deg); }
.pp-group .field { margin-bottom: 10px; }
.pp-group .field input, .pp-group .field select { min-height: 40px; font-size: 13px; }
.pp-sections { display: grid; gap: 6px; }
.pp-check, .pp-choice { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; line-height: 1.4; margin-bottom: 6px; transition: border-color .15s, background .15s; }
.pp-check:hover, .pp-choice:hover { border-color: #d6bcc5; }
.pp-check:has(input:checked), .pp-choice:has(input:checked) { border-color: #b67b8e; background: #fbf2f5; }
.pp-check input, .pp-choice input { margin-top: 2px; flex-shrink: 0; }
.pp-check small, .pp-choice small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.pp-segment { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); }
.pp-segment label { cursor: pointer; }
.pp-segment input { position: absolute; opacity: 0; pointer-events: none; }
.pp-segment label > span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 8px; font-size: 12.5px; font-weight: 600; color: #5d6370; background: #fff; }
.pp-segment label + label > span { border-left: 1px solid var(--line); }
.pp-segment input:checked + span { background: var(--wine); color: #fff; }
.pp-segment input:focus-visible + span { box-shadow: inset var(--ring); }
.pp-segment .material-icons { font-size: 18px; }
.pp-rows-help p { display: flex; gap: 8px; font-size: 12px; color: #5d6370; line-height: 1.55; margin: 0 0 10px; }
.pp-rows-help .material-icons { font-size: 18px; color: var(--wine); }
.pp-stage { position: relative; overflow: auto; background: #e8e4e6; padding: 24px 16px 40px; display: flex; justify-content: center; align-items: flex-start; }
.pp-paper-outer { position: relative; flex-shrink: 0; background: #fff; box-shadow: 0 2px 4px #0000001a, 0 14px 40px #2a0d1a33; overflow: hidden; }
.pp-paper-scale { transform-origin: top left; }
.pp-frame { display: block; border: 0; background: #fff; }
.pp-loading { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 9px 16px; font-size: 12px; box-shadow: var(--shadow-md); }
.pp-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--line); background: #fff; }
.pp-summary { margin: 0; font-size: 12px; color: var(--muted); }
.pp-footer-actions { display: flex; gap: 10px; }
.pp-footer-actions .btn { min-width: 120px; }
@media (max-width: 900px) {
    .pp-overlay { padding: 0; }
    .pp-shell { border-top-width: 3px; }
    .pp-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
    .pp-options { max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--line); }
    .pp-stage { padding: 14px 8px 24px; }
}
@media (max-width: 600px) {
    .pp-header { padding: 10px 12px; }
    .pp-header p { display: none; }
    .pp-footer { flex-direction: column; align-items: stretch; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
    .pp-footer-actions .btn { flex: 1; min-width: 0; }
    .pp-summary { text-align: center; }
}

/* ==========================================================================
   Printable document (rendered inside the preview frame)
   ========================================================================== */
html:has(> body.print-doc) { background: #fff; }
body.print-doc { margin: 0; background: #fff; color: #1f2430; font-size: 11.5px; line-height: 1.5; min-width: 0; }
.print-doc .pp-page { box-sizing: border-box; background: #fff; }
.print-doc .pp-letterhead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 3px double var(--wine); }
.print-doc .pp-letterhead .brand-logos { gap: 6px; }
.print-doc .pp-letterhead .brand-logo { width: 62px; height: 62px; padding: 0; }
.print-doc .pp-letterhead .seal { color: var(--wine); border-color: var(--wine); width: 58px; height: 58px; font-size: 32px; }
.print-doc .pp-letterhead-copy p { margin: 0; font-size: 9px; letter-spacing: 2px; color: #5d6370; }
.print-doc .pp-letterhead-copy strong { display: block; font-size: 17px; line-height: 1.25; color: var(--wine); margin: 2px 0; }
.print-doc .pp-letterhead-copy span { font-size: 10.5px; color: #5d6370; }
.print-doc .pp-letterhead-system { text-align: right; border-left: 1px solid var(--line); padding-left: 14px; }
.print-doc .pp-letterhead-system strong { display: block; font-size: 15px; color: var(--ink); }
.print-doc .pp-letterhead-system span { display: block; font-size: 9px; color: var(--muted); max-width: 170px; line-height: 1.4; }
.print-doc .pp-doc-title { text-align: center; margin: 14px 0 16px; }
.print-doc .pp-doc-title h1 { font-size: 17px; letter-spacing: 1.2px; text-transform: uppercase; margin: 0 0 4px; color: var(--ink); }
.print-doc .pp-doc-filters { font-size: 10.5px; color: #3c4250; margin: 0 0 2px; }
.print-doc .pp-doc-meta { font-size: 9.5px; color: var(--muted); margin: 0; }
.print-doc .pp-section { margin-bottom: 16px; }
.print-doc .pp-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--wine); margin: 0 0 8px; }
.print-doc .panel { border: 0 !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; background: none; }
.print-doc .panel h2 { font-size: 13.5px; color: var(--wine); margin: 0 0 4px; }
.print-doc .panel h3 { font-size: 12px; margin: 10px 0 6px; }
.print-doc .panel .muted, .print-doc .panel > p { font-size: 10.5px; margin-bottom: 8px; }
.print-doc .panel-heading { margin-bottom: 8px; }
.print-doc .count-chip { font-size: 9px; padding: 0 6px; }
.print-doc .table-wrap { overflow: visible !important; border: 0; box-shadow: none; }
.print-doc table { min-width: 0 !important; width: 100%; font-size: 10.5px; border: 1px solid #d5d7de; }
.print-doc thead { display: table-header-group; }
.print-doc th { position: static; background: #f3ecef !important; color: #4b2a35; padding: 7px 8px; font-size: 9px; border-color: #d5d7de; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-doc td { padding: 6px 8px; border-bottom: 1px solid #e3e4e8; vertical-align: top; }
.print-doc td small { font-size: 9px; margin-top: 2px; }
.print-doc tr { break-inside: avoid; page-break-inside: avoid; }
.print-doc tbody tr:nth-child(even) { background: #fafafb; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-doc .badge { background: none !important; border: 1px solid currentColor; padding: 0 6px; font-size: 9px; }
.print-doc .empty { padding: 14px !important; }
.print-doc .stats-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 0; }
.print-doc .stat-card { padding: 10px 12px; border: 1px solid #d5d7de; box-shadow: none; break-inside: avoid; }
.print-doc .stat-card::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-doc .stat-card > div { margin-bottom: 4px; }
.print-doc .stat-card .material-icons { display: none; }
.print-doc .stat-card > strong { font-size: 17px; margin-bottom: 2px; }
.print-doc .stat-card small { font-size: 9px; }
.print-doc .info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; margin: 12px 0; }
.print-doc .info-grid > div { padding-bottom: 6px; }
.print-doc dt { font-size: 8.5px; }
.print-doc dd { font-size: 11.5px; }
.print-doc .fee { font-size: 14px; }
.print-doc .notice { padding: 8px 10px; font-size: 10.5px; margin: 8px 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-doc .requirements { margin: 6px 0 10px; font-size: 10.5px; }
.print-doc .timeline { margin-top: 8px; }
.print-doc .timeline li { padding-bottom: 10px; break-inside: avoid; }
.print-doc .timeline li::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-doc .payment-entry { padding: 8px 0; break-inside: avoid; }
.print-doc .pp-chart { display: block; width: 100%; max-height: 240px; object-fit: contain; }
.print-doc .chart-empty { text-align: left; }
.print-doc .receipt-sheet { border: 0 !important; padding: 0 !important; max-width: none !important; box-shadow: none !important; margin: 0; }
.print-doc .receipt-total { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-doc .receipt-signature { margin: 34px 0 20px; }
.print-doc .pp-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; margin-top: 40px; break-inside: avoid; page-break-inside: avoid; }
.print-doc .pp-signatures > div { display: flex; flex-direction: column; }
.print-doc .pp-signatures span { font-size: 10px; color: var(--muted); margin-bottom: 36px; }
.print-doc .pp-signatures strong { border-top: 1px solid #2b2f3a; padding-top: 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.print-doc .pp-signatures small { font-size: 9.5px; color: var(--muted); }
.print-doc .pp-doc-footer { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 8px; font-size: 9px; color: var(--muted); }
.print-doc .pp-empty { text-align: center; color: var(--muted); padding: 60px 0; }
.print-doc .pp-empty p { font-size: 14px; color: var(--ink); margin-bottom: 4px; }
.print-doc.landscape .info-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media screen {
    .print-doc tbody tr[data-pp-key] { cursor: pointer; }
    .print-doc tbody tr[data-pp-key]:hover td { background: #fbeff3; box-shadow: inset 0 1px 0 #e8c9d3, inset 0 -1px 0 #e8c9d3; }
    .print-doc tr.pp-excluded td { opacity: .4; text-decoration: line-through; background: repeating-linear-gradient(-45deg, #fff, #fff 6px, #f6eef1 6px, #f6eef1 12px) !important; }
    .print-doc tr.pp-excluded td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
}
@media print {
    .print-doc .pp-page { padding: 0 !important; min-height: 0 !important; }
    .print-doc tr.pp-excluded { display: none !important; }
    html:has(> body.print-doc), body.print-doc { width: auto !important; }
}

/* Direct browser printing (Ctrl+P) from a normal page: print only the content. */
@media print {
    .pp-overlay, .sidebar-backdrop, .page-heading-actions, .skip-link, .search-row, .col-actions, dialog { display: none !important; }
    .app-layout .table-wrap { border: 0; }
    .stack-mobile td::before { content: none !important; }
}

/* Phone refinements */
@media (max-width: 600px) {
    .panel-title-group { flex-basis: auto; }
    .print-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .print-toolbar .btn { width: 100%; white-space: normal; }
    .print-toolbar .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Fixes: radios are not text inputs; icon ligatures in option headings; idle loader */
input[type=radio] { width: auto !important; min-height: 0 !important; height: auto; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: none; margin: 0; }
input[type=radio]:not(.pp-segment input) { width: 16px !important; height: 16px; flex: 0 0 16px; }
.pp-group > summary::after { text-transform: none; letter-spacing: normal; font-feature-settings: 'liga'; -webkit-font-feature-settings: 'liga'; line-height: 1; }
.pp-loading[hidden] { display: none; }

.pp-restore[hidden] { display: none; }
.panel-heading > .badge { align-self: flex-start; }

/* ==========================================================================
   Public pages: frozen header & footer, motion, municipal logo
   ========================================================================== */
@keyframes eb-rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes eb-slide-left { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
@keyframes eb-slide-right { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes eb-pop { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }
@keyframes eb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes eb-spin-slow { to { transform: rotate(360deg); } }
@keyframes eb-kenburns { from { transform: scale(1); } to { transform: scale(1.09) translate(-1%, -1%); } }
@keyframes eb-sheen { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes eb-drift { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(30px, -24px); } }
@keyframes eb-underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.public-layout { animation: eb-fade-in .35s ease-out both; }
html:has(.public-layout) { scroll-behavior: smooth; }

/* Frozen header */
.public-layout > .public-header { position: sticky; top: 0; z-index: 60; transition: box-shadow .25s, background .25s; background: #fff; }
.public-layout > .public-header.is-scrolled { box-shadow: 0 6px 22px #2a0d1a14; }
.public-header-inner { transition: min-height .25s, padding .25s; }
.public-header.is-scrolled .public-header-inner { min-height: 70px; padding-block: 10px; }
.public-brand-logo { transition: width .25s, height .25s, transform .3s; }
.public-header.is-scrolled .public-brand-logo { width: 42px; height: 42px; }
.public-brand:hover .public-brand-logo { transform: rotate(-6deg) scale(1.05); }
.public-header { animation: eb-rise .5s ease-out both; }
.public-navigation > a:not(.btn) { position: relative; transition: color .2s; }
.public-navigation > a:not(.btn)::after { content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--wine); transform: scaleX(0); transform-origin: left; transition: transform .25s; }
.public-navigation > a:not(.btn):hover { color: var(--wine); }
.public-navigation > a:not(.btn):hover::after { transform: scaleX(1); }
.public-navigation > a[aria-current=page]:not(.btn) { text-decoration: none !important; }
.public-navigation > a[aria-current=page]:not(.btn)::after { transform: scaleX(1); }
.public-navigation .btn { transition: transform .2s, box-shadow .2s, background .2s; }
.public-navigation .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px #721c3533; }
.available-documents { scroll-margin-top: 90px; }

/* Frozen footer */
.public-layout > .public-footer {
    position: sticky; bottom: 0; z-index: 55; display: flex; justify-content: space-between; align-items: center; gap: 8px 24px;
    flex-wrap: wrap; padding: 12px clamp(18px, 5vw, 96px); background: #fff;
    box-shadow: 0 -6px 22px #2a0d1a0f; text-align: left; line-height: 1.5;
}
.public-footer-name { font-weight: 650; color: var(--wine); }
.public-footer-contact { color: var(--muted); }
@media (max-width: 760px) {
    .public-layout > .public-footer { padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); font-size: 10.5px; flex-direction: column; align-items: flex-start; gap: 0; }
    .public-footer-name, .public-footer-contact { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Workspace footer also stays at the bottom of the screen */
@media screen {
    .app-layout .footer {
        position: sticky; bottom: 0; z-index: 15; background: #fffffff2; backdrop-filter: blur(6px);
        margin: 32px calc(-1 * clamp(14px, 2.4vw, 32px)) -28px; padding: 12px clamp(14px, 2.4vw, 32px);
        box-shadow: 0 -4px 16px #19213b0d; align-items: center;
    }
}
@media screen and (max-width: 600px) {
    .app-layout .footer { margin: 24px -12px -16px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
}

/* Landing hero */
.landing-hero { position: relative; isolation: isolate; overflow: hidden; }
.landing-hero::before { content: ''; position: absolute; inset: 0; z-index: -1; background: inherit; animation: eb-kenburns 22s ease-in-out infinite alternate; will-change: transform; }
.landing-hero .hero-copy > * { animation: eb-rise .7s cubic-bezier(.2,.7,.2,1) both; }
.landing-hero .hero-copy > :nth-child(1) { animation-delay: .1s; }
.landing-hero .hero-copy > :nth-child(2) { animation-delay: .22s; }
.landing-hero .hero-copy > :nth-child(3) { animation-delay: .36s; }
.landing-hero .hero-copy > :nth-child(4) { animation-delay: .5s; }
.landing-hero .hero-copy > :nth-child(5) { animation-delay: .64s; }
.landing-hero h1 em { background: linear-gradient(90deg, #e0bb8a, #f6dcb3, #c49d67, #e0bb8a); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: eb-sheen 6s linear infinite alternate; }
.municipal-identity { animation: eb-pop .9s .35s cubic-bezier(.2,.7,.2,1) both; }
.municipal-seal-frame { position: relative; animation: eb-float 6s 1.3s ease-in-out infinite; }
.municipal-seal-frame::before { content: ''; position: absolute; inset: -14px; border-radius: 50%; border: 1px dashed #e0bb8a80; animation: eb-spin-slow 40s linear infinite; }
.municipal-seal-frame::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; box-shadow: 0 0 0 0 #e0bb8a55; animation: eb-pulse 3.2s ease-out infinite; }
@keyframes eb-pulse { 0% { box-shadow: 0 0 0 0 #e0bb8a55; } 80%, 100% { box-shadow: 0 0 0 26px #e0bb8a00; } }
.hero-actions .btn.white { transition: transform .2s, box-shadow .2s; }
.hero-actions .btn.white:hover { transform: translateY(-2px); box-shadow: 0 10px 24px #1a050f55; }
.hero-actions .btn .material-icons { transition: transform .2s; }
.hero-actions .btn:hover .material-icons { transform: translateX(4px); }
.hero-actions a.text-white { color: #fff; border-bottom: 1px solid #ffffff55; padding-bottom: 2px; transition: border-color .2s; }
.hero-actions a.text-white:hover { border-color: #fff; }

/* Scroll reveal (only when JavaScript is running) */
.motion-ready .reveal { opacity: 0; transform: translateY(28px); transition: opacity .6s ease-out, transform .6s cubic-bezier(.2,.7,.2,1); }
.motion-ready .reveal.is-visible { opacity: 1; transform: none; }
.public-document-card { transition: box-shadow .25s, transform .25s, border-color .25s, opacity .6s ease-out; }
.motion-ready .public-document-card.reveal.is-visible { transition: box-shadow .25s, transform .25s, opacity .6s ease-out; }
.public-document-card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px #2a0d1a1f; }
.public-document-card .feature-icon { transition: transform .3s, background .3s, color .3s; }
.public-document-card:hover .feature-icon { transform: rotate(-8deg) scale(1.08); background: var(--wine); color: #fff; }
.document-card-bottom .btn { transition: background .2s, transform .2s; }
.document-card-bottom .btn:hover { transform: translateY(-1px); }
.notice-band > .material-icons { animation: eb-float 3.5s ease-in-out infinite; }

/* Sign-in / register */
.public-layout > main:has(.auth-shell) { display: flex; align-items: center; justify-content: center; padding: 28px 18px; }
.public-layout .auth-shell { margin: 0 auto; width: 100%; animation: eb-rise .6s cubic-bezier(.2,.7,.2,1) both; overflow: hidden; }
.auth-story { position: relative; overflow: hidden; isolation: isolate; background: linear-gradient(145deg, #7a1f3b, #471124, #6b1a33, #3d0d1e) !important; background-size: 300% 300% !important; animation: eb-slide-left .7s .1s cubic-bezier(.2,.7,.2,1) both, eb-sheen 14s ease-in-out infinite alternate; }
.auth-story::before, .auth-story::after { content: ''; position: absolute; z-index: -1; border-radius: 50%; filter: blur(2px); }
.auth-story::before { width: 320px; height: 320px; right: -110px; top: -90px; background: radial-gradient(circle, #e0bb8a2e, transparent 70%); animation: eb-drift 12s ease-in-out infinite; }
.auth-story::after { width: 260px; height: 260px; left: -90px; bottom: -80px; background: radial-gradient(circle, #ffffff1c, transparent 70%); animation: eb-drift 15s ease-in-out infinite reverse; }
.auth-story > * { animation: eb-rise .6s cubic-bezier(.2,.7,.2,1) both; }
.auth-story > :nth-child(1) { animation-delay: .25s; }
.auth-story > :nth-child(2) { animation-delay: .35s; }
.auth-story > :nth-child(3) { animation-delay: .45s; }
.auth-story > .auth-seal { animation: eb-pop .8s .55s cubic-bezier(.2,.7,.2,1) both; }
.auth-story > :last-child { animation-delay: .7s; }
.auth-seal { position: relative; width: 168px; height: 168px; margin: 40px 0 28px; display: grid; place-items: center; }
.auth-seal::before { content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 1px dashed #e0bb8a8c; animation: eb-spin-slow 36s linear infinite; }
.auth-seal::after { content: ''; position: absolute; inset: 0; border-radius: 50%; animation: eb-pulse 3.2s 1.4s ease-out infinite; }
.auth-seal img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; background: #fff; padding: 6px; box-shadow: 0 14px 34px #1a050f66; animation: eb-float 6s 1.4s ease-in-out infinite; }
.auth-seal .auth-building { margin: 0; }
.auth-form { animation: eb-slide-right .7s .15s cubic-bezier(.2,.7,.2,1) both; }
.auth-form > * { animation: eb-rise .55s cubic-bezier(.2,.7,.2,1) both; animation-delay: .3s; }
.auth-form > .eyebrow { animation-delay: .3s; }
.auth-form > h2 { animation-delay: .38s; }
.auth-form > .muted { animation-delay: .46s; }
.auth-form > form { animation: none; }
.auth-form .form-grid > * { animation: eb-rise .5s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(.5s + var(--i, 0) * 55ms); }
.auth-form > .auth-switch, .auth-form > .small-note { animation-delay: 1s; }
.auth-form .form-actions .btn { transition: transform .2s, box-shadow .2s, background .2s; }
.auth-form .form-actions .btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px #721c3533; }
.auth-form input:focus { transform: translateY(-1px); transition: transform .15s, box-shadow .15s; }
.auth-form-logo { display: none; }
.auth-switch a { position: relative; }
.auth-switch a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .25s; }
.auth-switch a:hover::after { transform: scaleX(1); }
@media (max-width: 760px) {
    .public-layout > main:has(.auth-shell) { padding: 18px 12px; }
    .public-layout .auth-shell { margin: 0; }
    .auth-form-logo { display: block; width: 76px; height: 76px; object-fit: contain; border-radius: 50%; margin: 0 0 16px; box-shadow: 0 8px 20px #2a0d1a26; animation: eb-pop .7s .2s cubic-bezier(.2,.7,.2,1) both, eb-float 6s 1s ease-in-out infinite !important; }
}

@media (prefers-reduced-motion: reduce) {
    .landing-hero::before, .municipal-seal-frame, .municipal-seal-frame::before, .municipal-seal-frame::after,
    .auth-seal::before, .auth-seal::after, .auth-seal img, .auth-story, .auth-story::before, .auth-story::after,
    .notice-band > .material-icons, .landing-hero h1 em { animation: none !important; }
    .motion-ready .reveal { opacity: 1; transform: none; }
}
@media (max-width: 760px) {
    .public-header.is-scrolled .public-header-inner { gap: 6px; padding-block: 8px; min-height: 0; }
    .public-header.is-scrolled .public-brand-copy small { display: none; }
    .public-header.is-scrolled .public-brand-copy strong { font-size: 18px; }
    .public-header.is-scrolled .public-brand-logo { width: 32px; height: 32px; }
    .public-header.is-scrolled .public-navigation > a { min-height: 36px; }
    .public-header.is-scrolled .public-navigation .btn { padding-block: 8px; }
}
