@font-face {
  font-family: "BX Apple Numerals";
  src: local("Apple SD Gothic Neo Medium"), local("AppleSDGothicNeo-Medium");
  font-style: normal;
  font-weight: 100 900;
  unicode-range: U+002B-003A, U+00A5;
}

:root {
  color-scheme: light;
  --ink: #1f2937;
  --muted: #667085;
  --line: #e5e7eb;
  --paper: #ffffff;
  --canvas: #f5f7fa;
  --green: #356ae6;
  --green-light: #eef4ff;
  --success: #22a06b;
  --success-light: #eaf7f0;
  --amber: #d99000;
  --amber-light: #fff6e5;
  --red: #d64545;
  --red-light: #fff0f0;
  --shadow: 0 18px 50px rgba(31, 41, 55, 0.08);
  font-family: "BX Apple Numerals", -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(53, 106, 230, 0.1), transparent 30rem),
    radial-gradient(circle at 92% 8%, rgba(34, 160, 107, 0.055), transparent 24rem),
    var(--canvas);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px max(24px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
}

.brand { display: flex; min-width: 0; align-items: center; gap: 12px; }
.brand-mark { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: white; background: linear-gradient(145deg, #356ae6, #5d84e8); box-shadow: 0 8px 20px rgba(53, 106, 230, .2); font-size: 13px; font-weight: 800; letter-spacing: .04em; }
.brand-home-link { text-decoration: none; transition: transform 150ms ease, box-shadow 150ms ease; }
.brand-home-link:hover { transform: translateY(-1px); box-shadow: 0 11px 25px rgba(53, 106, 230, .26); }
.brand-home-link:focus-visible { outline: 3px solid rgba(53, 106, 230, .28); outline-offset: 3px; }
.brand-copy { display: grid; min-width: 0; gap: 3px; }
.brand-copy strong { overflow: hidden; font-size: 15px; font-weight: 780; letter-spacing: .01em; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy small { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .11em; line-height: 1.2; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.role-badge { display: inline-flex; align-items: center; min-height: 42px; border-radius: 12px; padding: 0 14px; color: var(--green); background: var(--green-light); font-weight: 750; }
.person-input { width: 116px; min-height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 0 13px; color: var(--ink); outline: 0; background: var(--paper); }
.person-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(53, 106, 230, 0.14); }
.person-input:disabled { color: var(--ink); opacity: .72; }
.person-chip { display: inline-flex; align-items: center; min-height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; color: var(--ink); background: rgba(255, 255, 255, .82); font-weight: 700; }

.main { width: min(calc(100% - 40px), 1120px); margin: 0 auto; padding: 56px 0 96px; }
.narrow { width: min(100%, 760px); margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.owner-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: -8px 0 28px; border: 1px solid rgba(229, 231, 235, .92); border-radius: 18px; padding: 12px 14px 12px 18px; background: rgba(255, 255, 255, .82); box-shadow: 0 10px 32px rgba(31, 41, 55, .055); backdrop-filter: blur(14px); }
.owner-identity { display: flex; min-width: 0; align-items: center; gap: 18px; }
.owner-identity-copy { display: grid; gap: 3px; }
.owner-identity-copy strong { font-size: 14px; }
.owner-identity-copy small { color: var(--muted); font-size: 12px; }
.owner-identity .person-input { width: 190px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 13px; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: clamp(30px, 4vw, 46px); line-height: 1.08; letter-spacing: -0.045em; }
h2 { margin-bottom: 8px; font-size: 24px; letter-spacing: -0.025em; }
.subtitle { margin-bottom: 0; color: var(--muted); line-height: 1.65; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border: 1px solid transparent; border-radius: 13px; padding: 0 18px; font-weight: 700; text-decoration: none; transition: transform 120ms ease, opacity 120ms ease, background 120ms ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }
.button.primary { color: #ffffff; background: linear-gradient(135deg, #356ae6, #4f7be7); box-shadow: 0 9px 22px rgba(53, 106, 230, .2); }
.button.secondary { color: var(--ink); border-color: var(--line); background: var(--paper); }
.button.danger { color: var(--red); border-color: rgba(214, 69, 69, .24); background: var(--red-light); }
.button.ghost { color: var(--muted); background: transparent; }
.button.small { min-height: 38px; padding: 0 13px; border-radius: 10px; font-size: 14px; }

.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.project-card { position: relative; display: flex; min-height: 220px; flex-direction: column; border: 1px solid var(--line); border-radius: 22px; padding: 22px; background: var(--paper); box-shadow: 0 8px 28px rgba(31, 41, 55, 0.045); transition: transform 150ms ease, box-shadow 150ms ease; }
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.project-card button.card-link { position: absolute; inset: 0; width: 100%; border: 0; border-radius: inherit; background: transparent; }
.project-card-top, .project-card-bottom { position: relative; z-index: 1; pointer-events: none; }
.project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-card h3 { margin: 30px 0 9px; font-size: 21px; letter-spacing: -0.025em; }
.project-card > .subtitle { margin-bottom: 0; line-height: 1.55; }
.project-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: auto; border-top: 1px solid rgba(229, 231, 235, .9); padding-top: 17px; color: var(--muted); font-size: 14px; }
.project-card-bottom span:last-child { flex: 0 0 auto; }

.pill { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 750; }
.pill.draft { color: #667085; background: #f2f4f7; }
.pill.submitted { color: var(--amber); background: var(--amber-light); }
.pill.returned { color: var(--red); background: var(--red-light); }
.pill.archived { color: var(--success); background: var(--success-light); }
.project-card-top > .pill:first-child { color: var(--green); background: var(--green-light); }
.project-card-top > .pill:last-child.archived { color: var(--success); background: var(--success-light); }

.empty { display: grid; place-items: center; min-height: 330px; border: 1px dashed #d5dbe5; border-radius: 22px; padding: 42px; text-align: center; background: rgba(255,255,255,0.68); }
.empty-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 18px; border-radius: 18px; color: var(--green); background: var(--green-light); font-size: 28px; }

.back { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 28px; border: 0; padding: 0; color: var(--muted); background: none; }
.panel { border: 1px solid var(--line); border-radius: 24px; padding: clamp(22px, 4vw, 38px); background: var(--paper); box-shadow: var(--shadow); }
.step { display: grid; grid-template-columns: 32px 1fr; gap: 15px; padding-bottom: 30px; }
.step:last-child { padding-bottom: 0; }
.step-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: var(--green); background: var(--green-light); font-size: 13px; font-weight: 800; }
.step-content label.title { display: block; margin: 3px 0 13px; font-weight: 750; }
.text-input { width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 13px; padding: 0 15px; outline: 0; background: #fafbfc; }
.text-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(53, 106, 230, 0.14); }
.type-dropdown { position: relative; z-index: 6; }
.type-select-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 54px; border: 1px solid rgba(53, 106, 230, .38); border-radius: 15px; padding: 0 18px; color: var(--ink); background: rgba(250, 252, 255, .84); box-shadow: 0 0 0 6px rgba(53, 106, 230, .045), inset 0 1px 0 rgba(255, 255, 255, .9); backdrop-filter: blur(12px) saturate(125%); -webkit-backdrop-filter: blur(12px) saturate(125%); transition: transform 220ms cubic-bezier(.22, 1, .36, 1), border-color 220ms ease, background 220ms ease, box-shadow 220ms ease; }
.type-select-trigger:hover { border-color: rgba(53, 106, 230, .62); background: rgba(245, 248, 255, .94); }
.type-select-trigger:focus-visible { outline: 0; border-color: rgba(53, 106, 230, .8); box-shadow: 0 0 0 6px rgba(53, 106, 230, .1), 0 10px 28px rgba(31, 41, 55, .08); }
.type-select-trigger:disabled { cursor: default; opacity: .66; }
.type-chevron { width: 10px; height: 10px; margin: -5px 3px 0 16px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(45deg); transition: transform 240ms cubic-bezier(.22, 1, .36, 1), margin 240ms ease; }
.type-dropdown.open .type-select-trigger { border-color: rgba(53, 106, 230, .72); background: rgba(238, 244, 255, .9); transform: translateY(-1px); animation: type-breathe 2.4s ease-in-out infinite; }
.type-dropdown.open .type-chevron { margin-top: 5px; transform: rotate(225deg); }
.type-menu { position: absolute; top: calc(100% + 11px); right: 0; left: 0; z-index: 12; display: grid; gap: 4px; max-height: 330px; overflow-y: auto; border: 1px solid rgba(229, 231, 235, .94); border-radius: 17px; padding: 8px; background: rgba(255, 255, 255, .9); box-shadow: 0 22px 55px rgba(31, 41, 55, .13), inset 0 1px 0 rgba(255, 255, 255, .96); opacity: 0; visibility: hidden; transform: translateY(-10px) scale(.985); transform-origin: top center; pointer-events: none; backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%); transition: opacity 190ms ease, transform 240ms cubic-bezier(.22, 1, .36, 1), visibility 0s linear 240ms; }
.type-dropdown.open .type-menu { opacity: 1; visibility: visible; transform: translateY(0) scale(1); pointer-events: auto; transition-delay: 0s; }
.type-menu-option { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 45px; border: 0; border-radius: 11px; padding: 0 13px; color: var(--ink); text-align: left; background: transparent; transition: color 150ms ease, background 150ms ease, transform 180ms cubic-bezier(.22, 1, .36, 1); }
.type-menu-option:hover, .type-menu-option:focus-visible { outline: 0; color: var(--green); background: rgba(53, 106, 230, .08); transform: translateX(2px); }
.type-menu-option.selected { color: var(--green); font-weight: 750; background: rgba(53, 106, 230, .12); }
.type-menu-option.selected::after { content: '✓'; opacity: .7; }
@keyframes type-breathe { 0%, 100% { box-shadow: 0 0 0 6px rgba(53, 106, 230, .06), 0 9px 24px rgba(31, 41, 55, .055); } 50% { box-shadow: 0 0 0 10px rgba(53, 106, 230, .12), 0 15px 34px rgba(31, 41, 55, .09); } }
.advance-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 320px; }
.advance-option { min-height: 48px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: white; }
.advance-option.active { border-color: var(--green); color: var(--green); background: var(--green-light); font-weight: 750; }
.advance-amount { display: grid; grid-template-columns: auto minmax(0, 210px) auto; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); }
.field-hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.upload-box { display: grid; place-items: center; min-height: 142px; border: 1.5px dashed #b9c7e8; border-radius: 16px; padding: 20px; text-align: center; color: var(--muted); background: #fafbfc; cursor: pointer; transition: border-color 180ms ease, background 180ms ease, box-shadow 220ms ease, transform 220ms cubic-bezier(.22, 1, .36, 1); }
.upload-box strong { display: block; margin-bottom: 5px; color: var(--ink); }
.upload-box input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-box.drag-over { border-color: var(--green); background: #eef4ff; box-shadow: 0 0 0 7px rgba(53, 106, 230, .11), 0 18px 40px rgba(31, 41, 55, .09); transform: translateY(-2px); }
.upload-box.drag-over strong { color: var(--green); }
.upload-box.uploading { opacity: 0.55; pointer-events: none; }

.invoice-list { display: grid; gap: 12px; margin-top: 16px; }
.invoice-item { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(112px, .65fr) minmax(150px, 1fr) minmax(120px, .75fr) auto; align-items: end; gap: 10px; border: 1px solid var(--line); border-radius: 15px; padding: 14px; background: #fafbfc; }
.invoice-file { min-width: 0; align-self: center; }
.invoice-file a { display: block; overflow: hidden; color: var(--ink); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.invoice-file span { color: var(--muted); font-size: 12px; }
.duplicate-badge { display: inline-flex; align-items: center; min-height: 22px; margin-left: 8px; border-radius: 999px; padding: 2px 8px; color: var(--red); font-size: 12px; font-weight: 750; line-height: 1; background: var(--red-light); }
.downloaded-badge { display: inline-flex; align-items: center; min-height: 22px; margin-left: 8px; border-radius: 999px; padding: 2px 8px; color: var(--success); font-size: 12px; font-weight: 750; line-height: 1; background: var(--success-light); }
.finance-title .downloaded-badge { display: flex; width: fit-content; margin: 9px 0 0; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.field input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; outline: 0; background: white; }
.field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(53, 106, 230, .1); }
.remove { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: white; }

.summary-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; border-radius: 16px; padding: 18px 20px; background: var(--green-light); }
.summary-bar strong { font-size: 22px; }
.reconcile-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 18px; overflow: hidden; border-radius: 16px; background: #dbe5fb; }
.reconcile-mini > div { padding: 16px; background: var(--green-light); }
.reconcile-mini span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.reconcile-mini strong { display: block; }
.editor-actions { position: sticky; bottom: 18px; z-index: 10; display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; border: 1px solid rgba(229,231,235,.94); border-radius: 17px; padding: 12px; background: rgba(255,255,255,.92); box-shadow: 0 14px 38px rgba(31, 41, 55, .1); backdrop-filter: blur(14px); }

.return-note { margin-bottom: 20px; border-radius: 14px; padding: 14px 16px; color: var(--red); background: var(--red-light); }
.readonly-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; border-radius: 14px; padding: 14px 16px; color: var(--green); background: var(--green-light); }

.finance-list { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); }
.finance-row { display: grid; grid-template-columns: minmax(250px, 1.7fr) .7fr .7fr .7fr auto; align-items: center; gap: 14px; min-height: 82px; border: 0; border-bottom: 1px solid var(--line); padding: 14px 18px; width: 100%; text-align: left; color: var(--ink); background: transparent; }
.finance-row:last-child { border-bottom: 0; }
.finance-row:hover { background: #f8faff; }
.finance-title strong { display: block; margin-bottom: 5px; }
.finance-title span, .finance-cell small { color: var(--muted); }
.finance-cell strong { display: block; }
.finance-filters { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; }
.filter { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; color: var(--muted); background: var(--paper); }
.filter.active { border-color: var(--green); color: var(--green); background: var(--green-light); font-weight: 700; }
.owner-export-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 17px; padding: 15px 17px; background: rgba(255, 255, 255, .82); }
.owner-export-bar > div:first-child { display: grid; gap: 4px; }
.owner-export-bar > div:first-child span { color: var(--muted); font-size: 12px; }
.owner-export-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.owner-export-link { will-change: opacity; }
.owner-export-link.downloaded-fade { pointer-events: none; animation: owner-export-fade-out 560ms cubic-bezier(.4, 0, .2, 1) forwards; }

@keyframes owner-export-fade-out {
  0% { opacity: 1; }
  45% { opacity: .62; }
  100% { opacity: 0; }
}

.detail-list { display: grid; gap: 1px; margin: 24px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--line); }
.detail-item { display: grid; grid-template-columns: minmax(0, 1.2fr) .55fr 1fr; gap: 15px; padding: 16px; background: white; }
.detail-invoice { min-width: 0; }
.detail-invoice a { display: block; overflow: hidden; color: var(--green); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.detail-invoice small { display: block; margin-top: 5px; color: var(--muted); }
.detail-invoice .duplicate-badge { display: inline-flex; color: var(--red); }
.finance-title .duplicate-badge { display: inline-flex; margin-left: 7px; color: var(--red); }
.detail-item span:nth-child(2) { font-variant-numeric: tabular-nums; font-weight: 700; }
.meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; }
.meta { border-radius: 14px; padding: 15px; background: #f8fafc; }
.meta span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.meta strong { display: block; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.download-status { margin: 12px 0 0; color: var(--success); font-size: 13px; font-weight: 700; }
#archiveProject { transition: color 260ms ease, border-color 260ms ease, background 260ms ease, box-shadow 320ms ease, transform 260ms ease, opacity 180ms ease; }
#archiveProject.completed:disabled { color: var(--success); border-color: rgba(34, 160, 107, .24); background: rgba(234, 247, 240, .94); box-shadow: 0 0 0 8px rgba(34, 160, 107, .09); opacity: 1; transform: translateY(-1px); }
.panel.completion-success { animation: completion-breathe 850ms cubic-bezier(.22, .75, .26, 1) both; }

@keyframes completion-breathe {
  0% { box-shadow: var(--shadow); }
  46% { border-color: rgba(34, 160, 107, .35); box-shadow: 0 24px 70px rgba(34, 160, 107, .12); }
  100% { box-shadow: var(--shadow); }
}

.dialog-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 22px; background: rgba(29, 38, 56, .34); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dialog-card { width: min(100%, 470px); border: 1px solid rgba(229, 231, 235, .96); border-radius: 22px; padding: 26px; background: rgba(255, 255, 255, .98); box-shadow: 0 24px 80px rgba(31, 41, 55, .18); }
.dialog-card h2 { margin-bottom: 9px; }
.dialog-field { display: block; margin-top: 22px; }
.dialog-field span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.dialog-field textarea { display: block; width: 100%; resize: vertical; min-height: 112px; border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; color: var(--ink); outline: 0; background: #fafbfc; line-height: 1.6; }
.dialog-field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(53, 106, 230, .14); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.settlement-card { margin: 26px 0; border: 1px solid var(--line); border-radius: 18px; padding: 20px; background: #f8fafc; }
.settlement-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.settlement-head h3 { margin-bottom: 0; font-size: 21px; }
.difference-value { color: var(--green); font-size: 19px; }
.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.money-grid > label, .money-grid > div { border-radius: 13px; padding: 14px; background: white; }
.money-grid span, .settlement-form label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.money-grid input { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; outline: 0; }
.money-grid strong { display: block; padding-top: 10px; }
.settlement-form { display: grid; gap: 12px; }
.settlement-form select, .settlement-form input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; color: var(--ink); outline: 0; background: white; }
.settlement-form .button { width: fit-content; }
#saveSettlement { display: grid; }
#saveSettlement .save-label { grid-area: 1 / 1; white-space: nowrap; transition: opacity 260ms cubic-bezier(.37, 0, .63, 1); }
#saveSettlement .save-label-default { opacity: 1; }
#saveSettlement .save-label-success { color: var(--success); opacity: 0; }
#saveSettlement.saved:disabled { opacity: 1; animation: settlement-save-breathe 1100ms cubic-bezier(.37, 0, .63, 1) both; }
#saveSettlement.saved .save-label-default { opacity: 0; }
#saveSettlement.saved .save-label-success { opacity: 1; }

@keyframes settlement-save-breathe {
  0%, 100% { border-color: var(--line); background: var(--paper); box-shadow: 0 0 0 0 rgba(34, 160, 107, 0); }
  50% { border-color: rgba(34, 160, 107, .3); background: rgba(234, 247, 240, .9); box-shadow: 0 0 0 7px rgba(34, 160, 107, .09); }
}

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(circle at 50% 10%, rgba(53, 106, 230, .16), transparent 28rem), radial-gradient(circle at 84% 76%, rgba(34, 160, 107, .07), transparent 24rem), var(--canvas); }
.login-card { width: min(100%, 430px); border: 1px solid var(--line); border-radius: 26px; padding: 34px; background: var(--paper); box-shadow: var(--shadow); }
.login-brand { margin-bottom: 42px; }
.login-brand .brand-mark { width: 48px; height: 48px; border-radius: 16px; }
.login-brand .brand-copy strong { font-size: 17px; }
.login-brand .brand-copy small { font-size: 9px; }
.login-card h1 { font-size: 34px; }
.login-form { display: grid; gap: 15px; margin-top: 28px; }
.login-form label { color: var(--muted); font-size: 13px; }
.login-form .text-input { display: block; margin-top: 7px; color: var(--ink); }
.login-form .button { margin-top: 4px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(360px, calc(100vw - 44px)); border-radius: 13px; padding: 13px 16px; color: white; background: var(--success); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: 160ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

.submit-amount-feedback { position: fixed; inset: 0; z-index: 120; display: grid; place-content: center; justify-items: center; gap: 10px; overflow: hidden; padding: 24px; text-align: center; pointer-events: none; animation: submit-reward-layer 2.3s ease both; }
.submit-amount-feedback::before { position: absolute; top: 50%; left: 50%; width: min(560px, 96vw); aspect-ratio: 1.6; border-radius: 50%; background: radial-gradient(ellipse, rgba(217, 144, 0, .28) 0%, rgba(53, 106, 230, .22) 38%, rgba(245, 247, 250, 0) 73%); content: ''; transform: translate(-50%, -50%); animation: submit-reward-glow 1.15s ease-out both; }
.submit-reward-label, .submit-reward-amount { position: relative; z-index: 2; }
.submit-reward-label { color: var(--amber); font-size: clamp(15px, 2.4vw, 20px); font-weight: 850; letter-spacing: .12em; animation: submit-reward-label-pop 720ms cubic-bezier(.2, .9, .3, 1.25) both; }
.submit-reward-amount { color: var(--green); font-size: clamp(42px, 9vw, 82px); font-variant-numeric: tabular-nums; letter-spacing: -.05em; line-height: 1; text-shadow: 0 12px 34px rgba(53, 106, 230, .2), 0 2px 0 rgba(255, 255, 255, .9); animation: submit-reward-amount-pop 940ms cubic-bezier(.2, .9, .3, 1.25) both; }
.submit-reward-spark { position: absolute; top: 50%; left: 50%; z-index: 1; color: var(--amber); font-size: clamp(20px, 4vw, 34px); font-style: normal; font-weight: 900; opacity: 0; animation: submit-reward-spark 1.15s var(--spark-delay) cubic-bezier(.2, .75, .3, 1) both; }
.submit-reward-spark.spark-wave-2 { color: var(--green); font-size: clamp(16px, 3.2vw, 27px); animation-duration: 1s; }

@keyframes submit-reward-layer {
  0%, 8% { opacity: 0; }
  18%, 72% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes submit-reward-glow {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.55); }
  58% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: .72; transform: translate(-50%, -50%) scale(1); }
}
@keyframes submit-reward-label-pop {
  0% { opacity: 0; transform: translateY(16px) rotate(-3deg) scale(.7); }
  65% { opacity: 1; transform: translateY(-3px) rotate(1deg) scale(1.08); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
@keyframes submit-reward-amount-pop {
  0% { opacity: 0; transform: translateY(22px) rotate(-2deg) scale(.45); }
  58% { opacity: 1; transform: translateY(-5px) rotate(1deg) scale(1.12); }
  76% { transform: translateY(2px) rotate(-.4deg) scale(.97); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
@keyframes submit-reward-spark {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--spark-angle)) translateX(34px) rotate(calc(0deg - var(--spark-angle))) scale(.45); }
  34% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--spark-angle)) translateX(clamp(105px, 20vw, 190px)) rotate(calc(0deg - var(--spark-angle))) scale(1.08); }
}
@media (max-width: 800px) {
  .topbar { min-height: 64px; padding: 10px 16px; }
  .brand { gap: 9px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 12px; font-size: 11px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { max-width: 170px; font-size: 7.5px; letter-spacing: .06em; white-space: normal; }
  .main { width: min(calc(100% - 28px), 760px); padding-top: 34px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .owner-toolbar { align-items: stretch; flex-direction: column; padding: 14px; }
  .owner-identity { justify-content: space-between; }
  .owner-toolbar .button { width: 100%; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 210px; }
  .invoice-item { grid-template-columns: 1fr 1fr auto; }
  .invoice-file { grid-column: 1 / -1; }
  .invoice-category-field { grid-column: 1 / 3; }
  .invoice-item .remove { grid-column: 3; grid-row: 2; }
  .finance-row { grid-template-columns: 1fr auto; }
  .owner-export-bar { align-items: stretch; flex-direction: column; }
  .owner-export-actions { justify-content: stretch; }
  .owner-export-actions .button { width: 100%; }
  .finance-row .finance-cell:nth-of-type(2), .finance-row .finance-cell:nth-of-type(3) { display: none; }
  .meta-grid { grid-template-columns: 1fr; }
  .reconcile-mini { grid-template-columns: 1fr; }
  .money-grid { grid-template-columns: 1fr; }
  .settlement-head { flex-direction: column; }
  .editor-actions { bottom: 10px; }
}

@media (max-width: 520px) {
  .person-input { width: 82px; padding-inline: 9px; }
  .role-badge { display: none; }
  .person-chip { min-height: 38px; padding-inline: 11px; font-size: 13px; }
  .brand-copy strong { max-width: 145px; font-size: 12px; }
  .brand-copy small { max-width: 145px; font-size: 7px; letter-spacing: .035em; }
  .login-card .brand-copy strong, .login-card .brand-copy small { max-width: none; }
  .login-card .brand-copy strong { font-size: 15px; }
  .owner-identity { align-items: stretch; flex-direction: column; gap: 10px; }
  .owner-identity .person-input { width: 100%; }
  .panel { padding: 20px 16px; border-radius: 20px; }
  .step { grid-template-columns: 1fr; gap: 8px; }
  .step-number { display: none; }
  .invoice-item { grid-template-columns: 1fr auto; }
  .invoice-file, .invoice-item .field { grid-column: 1 / -1; }
  .remove { grid-column: 2; grid-row: 1; }
  .editor-actions .button { flex: 1; padding-inline: 10px; }
  .login-card { padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .type-select-trigger, .type-chevron, .type-menu, .type-menu-option { transition-duration: 0.01ms; }
  .type-dropdown.open .type-select-trigger { animation: none; }
  #archiveProject { transition-duration: 0.01ms; }
  #saveSettlement, #saveSettlement .save-label { transition-duration: 0.01ms; }
  #saveSettlement.saved:disabled { animation: none; }
  .owner-export-link.downloaded-fade { animation-duration: 0.01ms; }
  .submit-amount-feedback { animation-duration: 1.3s; }
  .submit-amount-feedback::before, .submit-reward-label, .submit-reward-amount, .submit-reward-spark { animation: none; }
  .panel.completion-success { animation: none; }
}
