:root {
  --ink: #171d33;
  --muted: #6f778d;
  --paper: rgba(255, 255, 255, .86);
  --line: #e4e7ef;
  --accent: #6757e8;
  --accent-dark: #5040ce;
  --mint: #19a474;
  --amber: #c87916;
  --red: #cf4d57;
  --shadow: 0 24px 70px rgba(31, 36, 65, .11);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f5f6fb; }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
a { color: inherit; }
.ambient { position: fixed; z-index: -1; width: 420px; height: 420px; border-radius: 50%; filter: blur(2px); opacity: .35; }
.ambient-one { top: -220px; right: -90px; background: radial-gradient(circle, #c4bdfc, transparent 68%); }
.ambient-two { bottom: -280px; left: -180px; background: radial-gradient(circle, #bde9de, transparent 68%); }
.shell { width: min(1180px, calc(100% - 40px)); margin: auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; color: white; border-radius: 10px; background: var(--ink); }
main { flex: 1; }
footer { padding: 36px 0 28px; color: #969caf; text-align: center; font-size: 12px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(34px, 5vw, 62px); line-height: 1.02; letter-spacing: -.055em; }
h2 { margin-bottom: 6px; font-size: 21px; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.eyebrow { display: inline-block; margin-bottom: 18px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.panel { background: var(--paper); border: 1px solid rgba(255,255,255,.8); border-radius: 26px; box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.auth-layout { min-height: calc(100vh - 150px); display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(40px, 8vw, 110px); align-items: center; padding: 30px 6% 80px; }
.hero-copy h1 span { color: var(--accent); }
.hero-copy > p { max-width: 570px; color: var(--muted); font-size: 18px; }
.steps { display: flex; gap: 26px; margin-top: 42px; }
.steps div { display: grid; gap: 3px; }
.steps b { color: var(--accent); font-size: 12px; }
.steps span { font-size: 13px; font-weight: 700; }
.auth-card { max-width: 430px; width: 100%; justify-self: end; padding: 34px; }
.panel-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 24px; border-radius: 15px; color: white; background: linear-gradient(145deg, var(--accent), #8477f0); font-size: 21px; font-weight: 800; box-shadow: 0 12px 25px rgba(103,87,232,.28); }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 750; letter-spacing: .02em; }
input { width: 100%; min-width: 0; padding: 13px 14px; color: var(--ink); background: #fbfbfd; border: 1px solid #dfe2ea; border-radius: 11px; outline: none; transition: border .15s, box-shadow .15s; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(103,87,232,.11); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 46px; padding: 0 18px; border: 0; border-radius: 11px; cursor: pointer; font-weight: 750; text-decoration: none; }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 10px 22px rgba(103,87,232,.2); }
.button-primary:hover { background: var(--accent-dark); }
.button-ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.button-danger { color: var(--red); background: #fff5f5; border: 1px solid #f2c9cd; }
.button-danger:hover { color: #fff; background: var(--red); }
.button-small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.fineprint { margin: 18px 0 0; color: #9298a8; font-size: 11px; text-align: center; }
.field-error, .flash { padding: 12px 14px; border-radius: 11px; font-size: 13px; }
.field-error, .flash-error { color: #a73340; background: #fff0f1; border: 1px solid #f7cdd1; }
.flash { margin: 6px 0 20px; }
.flash-success { color: #08724f; background: #e9faf4; border: 1px solid #bcebdc; }
.flash-info { color: #44506c; background: #eef1f7; border: 1px solid #d9deea; }
.import-skipped { margin-top: 9px; }
.import-skipped summary { width: fit-content; cursor: pointer; font-weight: 800; }
.import-skipped ul { max-height: 220px; margin: 9px 0 0; padding: 9px 12px 9px 30px; overflow-y: auto; background: rgba(255,255,255,.55); border-radius: 9px; }
.import-skipped li + li { margin-top: 4px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding: 54px 0 36px; }
.page-head h1 { font-size: clamp(30px, 4vw, 48px); }
.summary-pill { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-radius: 15px; background: var(--ink); color: white; }
.summary-pill b { font-size: 22px; }
.summary-pill span { max-width: 60px; font-size: 10px; line-height: 1.15; text-transform: uppercase; letter-spacing: .07em; opacity: .72; }
.section-block { margin-bottom: 36px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.section-title h2 { margin: 0; }
.section-title > span { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; color: var(--muted); background: #e9ebf2; border-radius: 8px; font-size: 11px; font-weight: 800; }
.invoice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.invoice-card { padding: 22px; background: var(--paper); border: 1px solid white; border-radius: 20px; box-shadow: 0 12px 35px rgba(31,36,65,.07); }
.invoice-top { display: flex; justify-content: space-between; gap: 16px; }
.invoice-top > div { display: grid; }
.caption, .invoice-date span, .admin-invoice span { color: var(--muted); font-size: 11px; }
.invoice-top strong { margin-top: 2px; font-size: 25px; letter-spacing: -.035em; }
.status { display: inline-flex; align-items: center; width: fit-content; height: 25px; padding: 0 9px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.status-pending { color: #9a5a0a; background: #fff1d8; }
.status-closed { color: #08724f; background: #dff7ee; }
.invoice-date { display: flex; justify-content: space-between; margin: 19px 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.receipt-form input { font-size: 12px; }
.closed-list { overflow: hidden; background: var(--paper); border: 1px solid white; border-radius: 18px; }
.closed-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 15px 18px; text-decoration: none; border-bottom: 1px solid var(--line); }
.closed-row:last-child { border: 0; }
.closed-row > span:nth-child(2) { display: grid; }
.closed-row small { color: var(--muted); }
.checkmark { display: grid; place-items: center; width: 30px; height: 30px; color: var(--mint); background: #e2f8f0; border-radius: 50%; font-weight: 900; }
.empty-state { padding: 55px 20px; text-align: center; background: var(--paper); border-radius: 20px; }
.empty-state > span { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 15px; color: white; background: var(--mint); border-radius: 50%; font-size: 20px; }
.empty-state p { margin: 0; color: var(--muted); }
.admin-head { align-items: center; }
.admin-head-actions { display: grid; gap: 10px; justify-items: end; }
.admin-list-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.manual-person-card { margin: -12px 0 28px; padding: 16px 18px; border-radius: 16px; box-shadow: 0 10px 30px rgba(31,36,65,.05); }
.manual-person-card summary { display: flex; align-items: center; width: fit-content; gap: 10px; cursor: pointer; list-style: none; }
.manual-person-card summary::-webkit-details-marker { display: none; }
.manual-person-card summary > span:nth-child(2) { display: grid; }
.manual-person-card summary small { color: var(--muted); font-weight: 500; }
.manual-person-icon { display: grid; place-items: center; width: 34px; height: 34px; color: var(--accent); background: #eeebff; border-radius: 10px; font-size: 20px; font-weight: 800; }
.manual-person-form { display: grid; grid-template-columns: 1.5fr .8fr 1fr auto; align-items: end; gap: 12px; margin-top: 16px; }
.manual-person-form label { color: var(--muted); }
.manual-person-form label small { font-weight: 500; }
.manual-person-card > details > p { margin: 10px 0 0 44px; color: var(--muted); font-size: 11px; }
.upload-card { display: flex; align-items: center; gap: 12px; padding: 12px; background: white; border-radius: 15px; box-shadow: 0 10px 30px rgba(31,36,65,.08); }
.file-label { display: flex; align-items: center; gap: 10px; min-width: 230px; cursor: pointer; }
.file-label > span:first-child { display: grid; place-items: center; width: 38px; height: 38px; color: var(--accent); background: #eeebff; border-radius: 10px; font-size: 18px; }
.file-label > span:nth-child(2) { display: grid; }
.file-label small { color: var(--muted); font-weight: 500; }
.file-label input { display: none; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 36px; }
.metrics > div { display: grid; padding: 18px 20px; background: var(--paper); border: 1px solid white; border-radius: 16px; }
.metrics span { color: var(--muted); font-size: 11px; }
.metrics b { font-size: 28px; letter-spacing: -.04em; }
.amber { color: var(--amber); }.green { color: var(--mint); }.red { color: var(--red); }
.date-filter-card { padding: 16px 18px; margin: -12px 0 30px; background: var(--paper); border: 1px solid white; border-radius: 16px; box-shadow: 0 10px 30px rgba(31,36,65,.05); }
.date-filter-form { display: flex; align-items: end; gap: 12px; }
.date-filter-title { display: grid; min-width: 150px; margin-right: auto; }
.date-filter-title .eyebrow { margin: 0 0 2px; font-size: 9px; }
.date-filter-form label { min-width: 135px; color: var(--muted); }
.date-filter-form input { height: 40px; padding: 8px 11px; background: white; cursor: pointer; }
.date-filter-error { margin: 12px 0 0; color: #a73340; font-size: 12px; }
.people-table { overflow: hidden; background: var(--paper); border: 1px solid white; border-radius: 18px; }
.people-header, .person-row summary { display: grid; grid-template-columns: 1.8fr .9fr .7fr .4fr .55fr; gap: 15px; align-items: center; }
.people-header { padding: 11px 18px; color: var(--muted); background: #f0f1f6; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.person-row { border-bottom: 1px solid var(--line); }
.person-row:last-child { border: 0; }
.person-row summary { padding: 14px 18px; cursor: pointer; list-style: none; }
.person-row summary::-webkit-details-marker { display: none; }
.person-row summary:hover { background: rgba(246,247,251,.75); }
.person-name { display: flex; align-items: center; gap: 11px; }
.person-name i { display: grid; flex: 0 0 auto; place-items: center; width: 32px; height: 32px; color: var(--accent); background: #eeebff; border-radius: 10px; font-style: normal; font-weight: 850; }
.person-name b { overflow: hidden; text-overflow: ellipsis; }
.mono { color: var(--muted); font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.person-details { padding: 6px 18px 18px 61px; background: #fafafd; }
.admin-invoice { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr auto; gap: 18px; padding: 14px; margin-top: 8px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.admin-invoice > div { display: grid; align-content: start; }
.admin-invoice b, .admin-invoice a { font-size: 12px; }
.admin-invoice a { color: var(--accent); font-weight: 750; }
.admin-invoice > .admin-invoice-actions { display: flex; align-items: center; gap: 8px; }
.upload-history > div:not(.section-title) { padding: 10px 0; border-bottom: 1px solid var(--line); }
.upload-history-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; }
.upload-history small { color: var(--muted); }
.import-skipped-history { grid-column: 1 / -1; margin-top: 2px; color: var(--muted); font-size: 12px; }
.unmatched-people { display: grid; gap: 8px; margin-top: 10px; }
.unmatched-person-form { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(130px, .65fr) minmax(150px, .8fr) auto; align-items: center; gap: 8px; padding: 9px; color: var(--ink); background: rgba(255,255,255,.72); border: 1px solid var(--line); border-radius: 11px; }
.unmatched-person-form b { overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.unmatched-person-form input { padding: 9px 10px; background: white; font-size: 12px; }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; padding-left: 0; padding-right: 0; }
  .auth-card { justify-self: start; }
  .steps { display: none; }
  .invoice-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-head { align-items: flex-start; flex-direction: column; }
  .admin-head-actions { width: 100%; justify-items: stretch; }
  .admin-list-actions { justify-content: flex-start; }
  .manual-person-form { grid-template-columns: repeat(2, 1fr); }
  .unmatched-person-form { grid-template-columns: 1fr 1fr; }
  .unmatched-person-form b { grid-column: 1 / -1; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .date-filter-form { flex-wrap: wrap; }
  .date-filter-title { width: 100%; }
  .people-header { display: none; }
  .person-row summary { grid-template-columns: 1.5fr .7fr .5fr .55fr; }
  .person-row summary > .mono { display: none; }
  .admin-invoice { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
  .shell { width: min(100% - 24px, 1180px); }
  .topbar { height: 68px; }
  .auth-layout { min-height: auto; gap: 28px; padding: 34px 0; }
  .hero-copy > p { font-size: 15px; }
  .auth-card { padding: 24px; }
  .page-head { align-items: flex-start; flex-direction: column; padding-top: 30px; }
  .summary-pill { align-self: stretch; justify-content: center; }
  .invoice-grid { grid-template-columns: 1fr; }
  .upload-card { width: 100%; align-items: stretch; flex-direction: column; }
  .admin-list-actions { display: grid; }
  .manual-person-card { margin-top: -18px; padding: 14px; }
  .manual-person-form { grid-template-columns: 1fr; }
  .manual-person-card > details > p { margin-left: 0; }
  .unmatched-person-form { grid-template-columns: 1fr; }
  .unmatched-person-form b { grid-column: auto; }
  .metrics { gap: 8px; }
  .metrics > div { padding: 14px; }
  .date-filter-card { margin-top: -18px; padding: 14px; }
  .date-filter-form { align-items: stretch; }
  .date-filter-form label { flex: 1 1 calc(50% - 6px); min-width: 130px; }
  .date-filter-form .button { flex: 1 1 auto; }
  .person-row summary { grid-template-columns: 1fr auto; }
  .person-row summary > span:nth-child(2), .person-row summary > span:nth-child(3), .person-row summary > span:nth-child(4) { display: none; }
  .person-name b { font-size: 12px; }
  .person-details { padding: 6px 10px 14px; }
  .admin-invoice { grid-template-columns: 1fr; gap: 10px; }
  .upload-history-row { grid-template-columns: 1fr; }
  .import-skipped-history { grid-column: auto; }
}
