@import url('cairo.css');

:root {
  --background: #faf5eb;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --text: #44403b;
  --text-strong: #3d3935;
  --muted: #9c958d;
  --border: #eee5d8;
  --gold: #9b7c2b;
  --gold-dark: #80631e;
  --gold-soft: #faf2dc;
  --green: #23755d;
  --green-soft: #e8f4ed;
  --red: #a54337;
  --red-soft: #fcebe7;
  --radius: 16px;
  --shadow: 0 11px 29px rgba(91, 70, 29, 0.08), inset 0 1px rgba(255, 255, 255, 0.92);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body {
  min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(70% 50% at 50% 0%, rgba(255,255,255,.75), transparent 72%), var(--background);
  font-family: Cairo, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .65; }

.site-header {
  width: min(1450px, calc(100% - 48px)); min-height: 86px; margin: 20px auto 0; padding: 10px 18px; display: flex; align-items: center; gap: 26px;
  background: rgba(255,255,255,.72); border: 1px solid rgba(238,229,216,.9); border-radius: var(--radius); box-shadow: 0 8px 23px rgba(106,79,27,.04); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 300px; }
.brand img { width: 70px; max-height: 58px; object-fit: contain; mix-blend-mode: multiply; filter: drop-shadow(0 7px 9px rgba(122,90,17,.10)); }
.brand-copy { display: grid; line-height: 1.25; }
.brand-copy small { max-width: 215px; color: #a69c8f; font-size: 9px; font-weight: 700; }
.brand-copy strong { margin-top: 4px; color: var(--text-strong); font-size: 18px; font-weight: 800; letter-spacing: -.04em; }
.main-nav { display: flex; align-items: center; gap: 4px; margin-inline: auto; }
.main-nav a, .text-action { border-radius: 9px; padding: 9px 12px; color: #756f68; font-size: 12px; font-weight: 700; transition: .18s ease; }
.main-nav a:hover, .main-nav a.active, .text-action:hover { color: var(--gold-dark); background: var(--gold-soft); }
.main-nav .nav-action { color: var(--gold-dark); background: #f8eed5; }
.user-actions { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.user-actions form { margin: 0; }
.user-actions .text-action { border: 0; background: transparent; }
.user-name { margin-inline-end: 6px; color: #716a63; font-size: 11px; font-weight: 800; }

.page-shell { width: min(1280px, calc(100% - 48px)); margin: 38px auto 56px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 23px; }
.page-heading h1 { margin: 0; color: var(--text-strong); font-size: clamp(25px, 3vw, 36px); line-height: 1.2; letter-spacing: -.055em; font-weight: 800; }
.page-heading p:not(.eyebrow) { max-width: 680px; margin: 8px 0 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.compact-heading h1 { font-size: clamp(23px, 2.5vw, 31px); }
.eyebrow { margin: 0 0 6px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .02em; }

.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; border: 1px solid transparent; border-radius: 10px; padding: 9px 15px; font-size: 12px; font-weight: 800; transition: transform .18s cubic-bezier(.23,1,.32,1), background .18s, box-shadow .18s; }
.primary-button { color: #fff; background: linear-gradient(145deg, #b49336, #937423); box-shadow: 0 9px 18px rgba(154,120,35,.20); }
.primary-button:hover { transform: translateY(-2px); background: linear-gradient(145deg, #bd9b3e, #8a6b20); box-shadow: 0 13px 22px rgba(154,120,35,.28); }
.secondary-button { color: var(--gold-dark); background: var(--surface-solid); border-color: #decf9e; }
.secondary-button:hover { border-color: #bfa75d; background: #fffdf8; }
.full-button { width: 100%; }
.text-link { color: #927426; font-size: 12px; font-weight: 800; }
.text-link:hover { color: var(--gold-dark); text-decoration: underline; text-underline-offset: 4px; }

.date-filter, .transaction-filter { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.date-filter { margin-bottom: 20px; padding: 13px 15px; width: fit-content; background: rgba(255,255,255,.62); border: 1px solid var(--border); border-radius: 12px; }
.date-filter label, .transaction-filter label { display: grid; gap: 5px; color: #766f67; font-size: 10px; font-weight: 800; }
input, select, textarea { width: 100%; color: var(--text); background: #fffefa; border: 1px solid #e5dacb; border-radius: 9px; outline: none; transition: border .18s, box-shadow .18s; }
input, select { min-height: 39px; padding: 7px 10px; }
textarea { padding: 9px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #b99d50; box-shadow: 0 0 0 3px rgba(185,157,80,.14); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; margin-bottom: 21px; }
.metric-card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric-card { display: flex; flex-direction: column; min-height: 150px; padding: 22px; overflow: hidden; position: relative; }
.metric-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: #d2bd7a; }
.metric-card.income-card::before { background: #3e9b79; }.metric-card.expense-card::before { background: #c6695d; }.metric-card.balance-card::before { background: var(--gold); }.metric-card.count-card::before { background: #79746d; }
.metric-label { color: #827a71; font-size: 11px; font-weight: 800; }
.metric-card strong { margin-top: 11px; color: var(--text-strong); font-size: clamp(19px, 2vw, 25px); font-weight: 800; letter-spacing: -.04em; direction: ltr; text-align: right; }
.metric-detail { margin-top: auto; color: #a59e96; font-size: 9px; font-weight: 600; line-height: 1.7; }

.panel { padding: 22px; }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 15px; }
.panel-heading h2 { margin: 0; color: var(--text-strong); font-size: 20px; letter-spacing: -.04em; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; text-align: right; min-width: 730px; }
th { padding: 10px; color: #9a938c; border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 800; white-space: nowrap; }
td { padding: 13px 10px; color: #716b64; border-bottom: 1px solid #f2ede4; font-size: 11px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(250,245,235,.5); }
td strong { display: block; color: #4e4943; font-size: 11px; } td small { display: block; max-width: 230px; overflow: hidden; color: #a39c94; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.amount-cell { direction: ltr; text-align: right; white-space: nowrap; font-weight: 800; }.income-amount { color: var(--green); }.expense-amount { color: var(--red); }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; padding: 4px 7px; border-radius: 6px; font-size: 9px; font-weight: 800; white-space: nowrap; }.status-pill.income { color: var(--green); background: var(--green-soft); }.status-pill.expense { color: var(--red); background: var(--red-soft); }.status-pill.active-status { color: #786227; background: var(--gold-soft); }.status-pill.voided { color: #79736c; background: #efeeeb; }
.table-link { color: #927426; font-size: 10px; font-weight: 800; }.table-link:hover { text-decoration: underline; }

.filter-panel { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 17px; padding: 15px; }.transaction-filter { flex: 1; }.transaction-filter label { min-width: 115px; }.transaction-filter .search-field { min-width: min(100%, 210px); flex: 1; }.filter-actions { display: flex; align-items: center; gap: 10px; }.export-link { flex: none; padding: 9px 11px; color: #716b63; background: #f8f5ef; border: 1px solid #e6dece; border-radius: 9px; font-size: 10px; font-weight: 800; white-space: nowrap; }.export-link:hover { color: var(--gold-dark); background: var(--gold-soft); }
.voided-row { opacity: .67; background: #fafafa; }.actions-cell { min-width: 110px; }.void-control { margin-top: 5px; }.void-control summary { color: #9b4e44; font-size: 10px; font-weight: 800; cursor: pointer; }.void-control form { display: grid; gap: 5px; width: 175px; margin-top: 6px; }.void-control input { min-height: 30px; font-size: 9px; }.void-control button { min-height: 30px; color: #fff; background: #a54337; border: 0; border-radius: 7px; font-size: 9px; font-weight: 800; }

.form-panel { max-width: 910px; margin-inline: auto; padding: clamp(18px, 3vw, 31px); }.type-switch { display: flex; gap: 8px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }.type-switch label { cursor: pointer; }.type-switch input { position: absolute; opacity: 0; pointer-events: none; }.type-switch span { display: inline-flex; min-width: 107px; justify-content: center; align-items: center; padding: 10px; color: #817a72; background: #f8f5ef; border: 1px solid #e8dfd2; border-radius: 9px; font-size: 12px; font-weight: 800; }.type-switch input:checked + span { color: var(--gold-dark); background: var(--gold-soft); border-color: #ccb36b; box-shadow: 0 0 0 3px rgba(204,179,107,.14); }.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-top: 21px; }.form-grid label { display: grid; gap: 6px; color: #716b63; font-size: 11px; font-weight: 800; }.full-width { grid-column: 1 / -1; }.amount-input { display: flex; direction: ltr; }.amount-input input { border-radius: 0 9px 9px 0; }.amount-input span { display: flex; align-items: center; padding: 0 12px; color: #817968; background: #f4eee2; border: 1px solid #e5dacb; border-right: 0; border-radius: 9px 0 0 9px; font-size: 11px; font-weight: 800; }.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 23px; padding-top: 18px; border-top: 1px solid var(--border); color: #a39b91; font-size: 10px; font-weight: 600; }.form-footer > div { display: flex; align-items: center; gap: 15px; }
.password-panel { display: grid; max-width: 550px; gap: 16px; margin-inline: auto; }.password-panel label { display: grid; gap: 6px; color: #716b63; font-size: 11px; font-weight: 800; }.password-panel .primary-button { justify-self: start; margin-top: 5px; }

.empty-state { display: grid; justify-items: start; gap: 7px; padding: 32px 9px 12px; color: #9a938b; font-size: 11px; }.empty-state strong { color: #635e57; font-size: 15px; }.empty-state .primary-button { margin-top: 8px; }
.flash-stack { display: grid; gap: 8px; margin-bottom: 16px; }.flash { padding: 10px 13px; border-radius: 10px; font-size: 11px; font-weight: 700; }.flash-success { color: #22624d; background: var(--green-soft); border: 1px solid #c9e7d7; }.flash-error { color: #8c3930; background: var(--red-soft); border: 1px solid #f1cfc7; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 35px 16px; }.login-card { width: min(100%, 435px); padding: clamp(26px,5vw,43px); background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 44px rgba(83,61,21,.12), inset 0 1px #fff; }.login-brand { text-align: center; }.login-brand img { width: 142px; max-height: 120px; object-fit: contain; mix-blend-mode: multiply; filter: drop-shadow(0 8px 11px rgba(122,90,17,.12)); }.login-brand p { margin: 11px 0 2px; color: #a69c8f; font-size: 9px; font-weight: 700; }.login-brand h1 { margin: 0; color: var(--text-strong); font-size: 28px; letter-spacing: -.06em; }.login-brand span { color: #9b948c; font-size: 10px; font-weight: 600; }.auth-form { display: grid; gap: 15px; margin-top: 29px; }.auth-form label { display: grid; gap: 6px; color: #716b63; font-size: 11px; font-weight: 800; }.login-note { margin: 21px 0 0; color: #aaa39a; font-size: 9px; line-height: 1.9; text-align: center; }.error-card { max-width: 620px; margin: 90px auto; padding: 36px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }.error-card h1 { margin: 0; color: var(--text-strong); font-size: 27px; }.error-card p:not(.eyebrow) { color: var(--muted); }.error-card .primary-button { margin-top: 10px; }

@media (max-width: 1020px) { .site-header { flex-wrap: wrap; gap: 10px; }.brand { min-width: unset; }.main-nav { order: 3; width: 100%; margin: 0; }.user-actions { margin-inline-start: auto; }.metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }.metric-card { min-height: 130px; } }
@media (max-width: 680px) { .site-header, .page-shell { width: min(100% - 24px, 1280px); }.site-header { margin-top: 12px; padding: 10px 12px; }.brand img { width: 53px; }.brand-copy small { max-width: 185px; font-size: 7px; }.brand-copy strong { font-size: 16px; }.user-name, .user-actions .text-action:first-of-type { display: none; }.main-nav { overflow-x: auto; padding-bottom: 2px; }.main-nav a { flex: none; }.page-shell { margin-top: 28px; }.page-heading { align-items: flex-start; flex-direction: column; gap: 14px; }.page-heading > .primary-button, .page-heading > .secondary-button { width: 100%; }.date-filter { width: 100%; }.date-filter label { flex: 1; }.metrics { grid-template-columns: 1fr; gap: 11px; }.metric-card { min-height: 110px; }.panel { padding: 15px; }.panel-heading { align-items: flex-start; flex-direction: column; gap: 7px; }.filter-panel { align-items: stretch; flex-direction: column; }.transaction-filter { display: grid; grid-template-columns: 1fr 1fr; }.transaction-filter .search-field, .filter-actions { grid-column: 1 / -1; }.export-link { text-align: center; }.form-grid { grid-template-columns: 1fr; gap: 13px; }.form-footer { align-items: flex-start; flex-direction: column; }.form-footer > div { width: 100%; justify-content: space-between; }.login-card { border-radius: 16px; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* Keep visually hidden radios inside their local container, without page overflow. */
.type-switch { position: relative; }
.type-switch input { width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; inset-inline-start: 0; top: 0; overflow: hidden; clip-path: inset(50%); }
.type-switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 3px; }

/* Private transaction attachments, matching the existing accounting identity. */
.attachment-upload { margin-top: 24px; padding: 20px; background: #fffcf5; border: 1px dashed #d3bd80; border-radius: 12px; min-width: 0; }
.attachment-upload h2, .attachment-existing h2 { font-size: 18px; }
.attachment-file-label { display: grid; gap: 8px; color: #716b63; font-size: 11px; font-weight: 800; }
.attachment-file-label input { min-width: 0; max-width: 100%; padding: 10px; background: #fff; }
input[type="file"]::file-selector-button { margin-inline-end: 12px; padding: 8px 12px; color: var(--gold-dark); background: var(--gold-soft); border: 1px solid #d5bd7a; border-radius: 7px; font: inherit; cursor: pointer; }
.attachment-help { color: #8b8377; font-size: 10px; line-height: 1.9; overflow-wrap: anywhere; }
.attachment-count { padding: 4px 9px; color: var(--gold-dark); background: var(--gold-soft); border-radius: 7px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.selected-files { display: grid; gap: 5px; margin: 10px 0; color: #776e5d; font-size: 11px; overflow-wrap: anywhere; }
.selected-files.has-error { color: var(--red); }
.attachment-existing { margin-top: 20px; }
.attachment-list { list-style: none; margin: 0; padding: 0; }
.attachment-list li { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.attachment-list li:last-child { border-bottom: 0; }
.attachment-file-info { min-width: 0; display: grid; gap: 3px; }
.attachment-file-info strong { font-size: 12px; color: var(--text-strong); overflow-wrap: anywhere; }
.attachment-file-info small { font-size: 9px; color: var(--muted); }
.attachment-list .secondary-button { flex: none; min-height: 34px; font-size: 10px; }
.attachment-summary h2 { margin: 14px 0 0; font-size: 21px; overflow-wrap: anywhere; }
.attachment-summary > p { color: var(--gold-dark); font-weight: 800; }
.storage-folder { display: grid; gap: 6px; padding: 13px; margin-top: 14px; background: #faf7ef; border-radius: 9px; font-size: 10px; }
.storage-folder span { color: var(--muted); }
.storage-folder bdi { color: #716646; overflow-wrap: anywhere; }
.attachment-table-link { white-space: nowrap; }
@media (max-width: 680px) { .attachment-upload { padding: 14px; } .attachment-file-label input { font-size: 10px; } .attachment-list li { gap: 8px; } }
