:root {
  color-scheme: light;
  --paper: #fff8ed;
  --surface: #fffcf6;
  --ink: #2e211d;
  --muted: #6e514b;
  --line: #eadbd0;
  --red: #b82531;
  --red-hot: #c72836;
  --red-deep: #8d1725;
  --cream: #ffefd3;
  --shadow: 0 12px 34px #753e2810;
  font-family: 'Aptos', 'Segoe UI', system-ui, sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #156c63; outline-offset: 4px; }
.wrap { width: min(100% - 3rem, 73rem); margin-inline: auto; }
.loading { min-height: 80vh; display: grid; align-content: center; justify-items: center; gap: 1rem; text-align: center; padding: 1.5rem; }
.skip-link { position: fixed; z-index: 10; top: .75rem; left: .75rem; transform: translateY(-150%); padding: .7rem 1rem; border-radius: .5rem; background: var(--surface); }
.skip-link:focus { transform: none; }

.brand { display: inline-flex; align-items: center; gap: .72rem; flex-shrink: 0; font-size: 1.1rem; font-weight: 850; letter-spacing: -.04em; }
.brand-last { color: var(--red); }
.brand-mark { position: relative; display: grid; place-items: center; width: 2.23rem; height: 2.23rem; border-radius: .72rem; background: var(--red-hot); color: #fff8e8; transform: rotate(-6deg); }
.brand-mark i { position: relative; width: 1.23rem; height: 1.23rem; border: 2px solid currentColor; border-radius: 50%; }
.brand-mark i::before, .brand-mark i::after { content: ''; position: absolute; background: currentColor; }
.brand-mark i::before { width: 100%; height: 2px; top: 45%; }
.brand-mark i::after { width: 2px; height: 52%; top: 46%; left: calc(50% - 1px); }
.topbar { background: #fff9f0; border-bottom: 1px solid #f0e3d7; }
.topbar-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 4.75rem; }
.topbar nav { display: flex; align-items: center; gap: .35rem; }
.topbar nav a { padding: .55rem .9rem; border-radius: 2rem; font-weight: 690; font-size: .9rem; text-decoration: none; color: var(--muted); }
.topbar nav a:first-child, .topbar nav a:hover { background: #fae6de; color: var(--red-deep); }
.account { justify-self: end; position: relative; }
.account summary { display: flex; align-items: center; gap: .58rem; cursor: pointer; padding: .25rem .4rem; border-radius: .6rem; list-style: none; }
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: #f6ede3; }
.account-avatar { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: #f9d58f; color: #633513; font-weight: 800; }
.account-name { font-size: .89rem; font-weight: 750; line-height: 1.1; }
.account-name small { display: block; color: var(--muted); font-weight: 550; margin-top: .22rem; font-size: .75rem; }
.chevron { width: .45rem; height: .45rem; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: -.18rem .2rem 0 .2rem; }
.account-popover { position: absolute; z-index: 3; right: 0; top: calc(100% + .5rem); min-width: 11.5rem; padding: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; box-shadow: var(--shadow); }
.account-popover button { width: 100%; border: 0; border-radius: .45rem; background: transparent; text-align: left; padding: .55rem .7rem; color: var(--ink); font-size: .9rem; }
.account-popover button:hover { background: #fae6de; }

.dashboard { padding-block: 1.75rem 2.5rem; }
.hero { position: relative; isolation: isolate; overflow: hidden; display: grid; align-items: center; grid-template-columns: 1fr 1.24fr; min-height: 22rem; border-radius: 1.65rem; background: #fbe1cc; border: 1px solid #f5d5bf; box-shadow: var(--shadow); }
.hero-copy { position: relative; z-index: 1; padding: 2.15rem 0 2.25rem 2.55rem; }
.model-label { display: inline-flex; align-items: center; gap: .43rem; color: #792e27; font-size: .815rem; font-weight: 800; letter-spacing: .105em; }
.model-label > span { width: .68rem; height: .68rem; background: conic-gradient(#8d1725 0 25%, #fff9e7 0 50%, #8d1725 0 75%, #fff9e7 0); transform: rotate(-7deg); border-radius: .08rem; }
.hero h1, .gate h1 { font-size: clamp(3.25rem, 7.4vw, 5.3rem); line-height: .93; letter-spacing: -.08em; font-weight: 900; color: #3b201c; margin: .7rem 0 .95rem; }
.hero h1 > span, .gate h1 > span { color: var(--red-hot); }
.hero-copy > p:not(.model-label) { color: #62403a; font-size: 1rem; }
.hero-copy .button { margin-top: 1.2rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.8rem; border-radius: .67rem; border: 1px solid transparent; padding: .57rem 1rem; font-weight: 750; line-height: 1.3; }
.button.primary { color: #fff9f5; background: var(--red); border-color: var(--red); box-shadow: 0 3px 0 var(--red-deep); }
.button.primary:hover { background: #a71f2b; }
.button.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--red-deep); }
.button.primary > span { font-size: 1.4rem; font-weight: 600; line-height: .8; }
.button.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.button.secondary:hover { background: #f9eee4; border-color: #d5b6a7; }
.button.danger-quiet { color: var(--red-deep); background: transparent; }
.button.danger-quiet:hover { background: #fae6de; }
.button.compact { min-height: 2.35rem; font-size: .875rem; padding: .45rem .75rem; }
.car-art { position: relative; min-width: 0; height: 100%; isolation: isolate; }
.car-art img { position: absolute; z-index: 1; inset: 0; margin: auto; width: 106%; height: 112%; left: -6%; object-fit: contain; }
.sun-disc { position: absolute; background: #ffc879; width: 16.7rem; aspect-ratio: 1; top: 11%; left: 38%; border-radius: 50%; box-shadow: inset 0 0 0 1px #f4a96366; }
.track { position: absolute; width: 120%; border: 1px solid #b74e4277; height: 39%; border-radius: 50%; left: 2%; bottom: 5%; transform: rotate(-12deg); }
.track-two { bottom: 8%; left: 7%; width: 114%; border-style: dashed; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; margin-top: 1rem; }
.metric { min-width: 0; display: flex; align-items: center; gap: .8rem; padding: .95rem 1rem; border: 1px solid var(--line); border-radius: 1.05rem; background: var(--surface); }
.metric-icon { flex: none; display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border-radius: .7rem; font-weight: 850; font-size: 1.15rem; }
.metric-paid .metric-icon { background: #c9ebe0; color: #165a4e; }
.metric-left .metric-icon { background: #fae1dc; color: #a62c31; }
.metric-month .metric-icon { background: #efdcf8; color: #733b88; }
.metric p { color: var(--muted); font-size: .9rem; font-weight: 640; }
.metric strong, .share-balance strong, .payment-amount { font-variant-numeric: tabular-nums; }
.metric strong { font-size: clamp(1.18rem, 3vw, 1.74rem); line-height: 1.15; letter-spacing: -.045em; }

.shares, .log-section { margin-top: 1.9rem; }
.shares h2, .log-heading h2, .dialog-content h2, .gate-form h2 { font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -.062em; line-height: 1.08; font-weight: 850; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.section-description { margin-top: .25rem; color: var(--muted); }
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; margin-top: .8rem; }
.saravana { --share-border: #bcddcf; --share-bg: #e3f3ea; --avatar-bg: #b0e0cf; --share-ink: #174e43; --share-track: #c9e6d9; --share-bar: #2c8170; }
.nesa { --share-border: #dfccec; --share-bg: #f2e8f8; --avatar-bg: #e2c9ef; --share-ink: #623973; --share-track: #e8d9f1; --share-bar: #8e56a8; }
.share-card { min-width: 0; padding: 1.05rem 1.15rem; border: 1px solid var(--share-border); border-radius: 1.15rem; background: var(--share-bg); }
.share-top { display: flex; align-items: center; gap: .65rem; }
.avatar, .mini-avatar { display: grid; flex: none; place-items: center; border-radius: 50%; background: var(--avatar-bg); color: var(--share-ink); font-weight: 850; }
.avatar { width: 2.72rem; height: 2.72rem; font-size: 1.13rem; }
.mini-avatar { width: 2.25rem; height: 2.25rem; }
.share-top h3 { font-size: 1.145rem; line-height: 1.15; letter-spacing: -.028em; }
.share-top p, .share-status, .share-foot { font-size: .89rem; color: var(--share-ink); }
.share-status { margin-left: auto; border: 1px solid var(--share-border); border-radius: 2rem; background: #fff8; padding: .22rem .57rem; text-align: center; font-weight: 650; }
.share-balance { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .45rem; margin-top: .9rem; }
.share-balance strong { font-size: clamp(1.72rem, 4.6vw, 2.35rem); line-height: .95; letter-spacing: -.063em; }
.share-balance > span { color: var(--share-ink); font-size: .92rem; }
.share-progress { display: flex; align-items: center; gap: .6rem; margin-top: .7rem; }
.share-progress span { min-width: 2.1rem; font-size: .85rem; font-weight: 750; color: var(--share-ink); text-align: right; }
progress { appearance: none; width: 100%; height: .57rem; border: 0; overflow: hidden; border-radius: 2rem; background: var(--share-track); }
progress::-webkit-progress-bar { background: var(--share-track); }
progress::-webkit-progress-value { border-radius: 2rem; background: var(--share-bar); }
progress::-moz-progress-bar { border-radius: 2rem; background: var(--share-bar); }
.share-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .6rem; margin-top: .45rem; }

.log-section { scroll-margin-top: 1.25rem; }
.log-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.log-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 1.15rem; }
.log-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.segmented { display: flex; padding: .2rem; background: #f5e8db; border-radius: .7rem; }
.segmented button { background: transparent; color: var(--muted); border: 0; padding: .45rem .7rem; border-radius: .5rem; font-weight: 700; font-size: .9rem; }
.segmented button[aria-pressed='true'] { color: var(--red-deep); background: var(--surface); box-shadow: 0 1px 3px #59322220; }
.month-control { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); }
.month-control input { width: auto; padding: .32rem .5rem; min-height: 2.22rem; font-size: .9rem; }
.month-summary { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .8rem; padding: .65rem 1rem; border-bottom: 1px solid var(--line); background: #fff4e4; color: var(--muted); }
.text-button { background: none; border: 0; color: var(--red-deep); text-decoration: underline; font-size: .875rem; padding: .2rem; margin-left: auto; }
.log-list { list-style: none; margin: 0; padding: 0; }
.payment-row { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(4rem, auto) minmax(8rem, auto) auto; gap: .55rem .85rem; padding: .8rem 1rem; align-items: center; }
.payment-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .25rem; }
.payment-row + .payment-row, .activity-list > li + li { border-top: 1px solid var(--line); }
.payment-person { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.payment-person > div { min-width: 0; }
.payment-person p, .payment-state time, .activity-list time { color: var(--muted); font-size: .875rem; }
.payment-reference, .review-detail { overflow-wrap: anywhere; }
.payment-state time { display: block; }
.status { display: inline-block; padding: .16rem .45rem; border-radius: .35rem; font-size: .875rem; font-weight: 650; }
.status.pending { background: #fae7c1; color: #664416; }
.status.confirmed { background: #dbefe4; color: #225943; }
.status.rejected { background: #f9e2df; color: #8d3033; }
.activity-list li { display: flex; gap: .7rem; align-items: baseline; padding: .75rem 1rem; }
.activity-dot { flex: 0 0 .6rem; height: .6rem; border-radius: 100%; background: #a66b2d; }
.activity-dot.confirmed { background: #268268; }
.activity-dot.rejected, .activity-dot.removed { background: var(--red); }
.activity-dot.updated, .activity-dot.share_updated { background: #8752a0; }
.activity-details { color: var(--muted); font-size: .925rem; }
.log-empty { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1rem; }
.log-empty h3 { font-size: 1rem; }
.log-empty p { font-size: .92rem; color: var(--muted); }
.empty-icon { display: grid; place-content: center; flex: 0 0 2.55rem; height: 2.55rem; border-radius: .75rem; background: #faebde; color: var(--red-deep); font-size: 1.1rem; font-weight: 900; }

.gate { display: grid; grid-template-columns: 1fr .85fr; min-height: min(42rem, calc(100vh - 4rem)); padding-block: 2rem; }
.gate-cover { position: relative; display: flex; flex-direction: column; isolation: isolate; overflow: hidden; min-height: 36rem; padding: 1.65rem 2rem; background: #fbe1cc; border: 1px solid #f4d1b9; border-radius: 1.55rem 0 0 1.55rem; }
.gate-copy { position: relative; z-index: 2; margin: 2.15rem 0 0; }
.gate-copy > p:not(.model-label) { color: #62403a; font-weight: 600; }
.gate-cover .car-art { flex: 1; min-height: 14rem; margin-inline: -2rem; }
.gate-cover .car-art img { width: 104%; height: 118%; top: 0; left: -2%; }
.gate-cover .sun-disc { top: 2%; width: min(41%, 14rem); }
.gate-form { display: grid; place-items: center; border: 1px solid var(--line); border-left: 0; border-radius: 0 1.55rem 1.55rem 0; background: var(--surface); }
.gate-form-inner { width: min(100%, 27rem); padding: 2rem; }
.gate-form h2 { margin-bottom: .5rem; }
.gate-form h2 + p, .dialog-content h2 + p { color: var(--muted); }
.stacked-form { display: grid; gap: .85rem; margin-top: 1.15rem; }
.stacked-form label { display: block; font-size: .95rem; font-weight: 730; }
input, select { display: block; width: 100%; min-height: 2.75rem; padding: .55rem .65rem; border: 1px solid #d9c3b8; border-radius: .52rem; color: var(--ink); background: #fffdf9; font-weight: 500; }
.stacked-form label input, .stacked-form label select { margin-top: .28rem; }
select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, #6e514b 50%), linear-gradient(135deg, #6e514b 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.field-note { color: var(--muted); font-size: .85rem; font-weight: 550; margin-left: .22rem; }
.field-help { color: var(--muted); font-size: .875rem; }
.form-error { color: #a01f2c; font-size: .92rem; }
.form-error:empty { display: none; }

dialog { max-height: calc(100dvh - 2rem); width: min(30rem, 100% - 2rem); padding: 0; border: 1px solid var(--line); border-radius: 1.15rem; background: var(--surface); color: var(--ink); box-shadow: 0 14px 65px #37202055; }
dialog::backdrop { background: #30201db3; }
.dialog-content { position: relative; padding: 1.4rem; }
.dialog-content h2 { margin: 0 2rem .45rem 0; }
.dialog-fields { display: grid; gap: .8rem; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
.close-button { position: absolute; right: .8rem; top: .8rem; background: #f5e6df; border: 0; border-radius: 50%; width: 2rem; height: 2rem; color: #562c26; font-size: 1.3rem; line-height: 1; }
.close-button:hover { background: #edd5ca; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.field-row label { min-width: 0; }
.review-detail { padding: .65rem .85rem; border-radius: .55rem; background: #f7eee6; color: var(--muted); }
.toast { position: fixed; z-index: 20; right: 1.2rem; bottom: 1.2rem; max-width: min(24rem, calc(100% - 2.4rem)); padding: .7rem .9rem; border-radius: .65rem; background: #244d43; color: #fff; box-shadow: var(--shadow); }

@media (max-width: 760px) {
  .wrap { width: calc(100% - 1.6rem); }
  .topbar-inner { grid-template-columns: 1fr auto; gap: .15rem; padding-top: .55rem; }
  .topbar nav { grid-row: 2; grid-column: 1 / -1; padding-bottom: .35rem; }
  .topbar nav a { padding: .3rem .68rem; }
  .account { grid-area: 1 / 2; }
  .dashboard { padding-top: .85rem; }
  .hero-copy { padding: 1.45rem 0 1.45rem 1.25rem; }
  .hero { min-height: 19.5rem; border-radius: 1.15rem; }
  .hero h1 { font-size: clamp(2.6rem, 8vw, 4.1rem); }
  .hero-copy > p:not(.model-label) { font-size: .95rem; }
  .sun-disc { width: 68%; top: 24%; left: 28%; }
  .metrics { gap: .5rem; }
  .metric { flex-direction: column; align-items: flex-start; padding: .6rem; gap: .4rem; }
  .metric-icon { width: 2rem; height: 2rem; }
  .metric p { line-height: 1.2; margin-bottom: .25rem; }
  .share-grid { grid-template-columns: 1fr; gap: .65rem; }
  .payment-row { grid-template-columns: 1fr auto; align-items: start; }
  .payment-state { padding-left: 2.85rem; }
  .payment-actions { justify-self: end; }
  .gate { padding-block: .8rem; grid-template-columns: 1fr; }
  .gate-cover { min-height: 20rem; border-radius: 1.05rem 1.05rem 0 0; padding: .9rem 1.15rem 0; }
  .gate-copy { margin-top: 1.15rem; }
  .gate h1 { font-size: clamp(2.6rem, 10vw, 4.35rem); }
  .gate-cover .car-art { min-height: 9rem; margin-inline: -1rem; }
  .gate-cover .car-art img { height: 135%; top: 0; left: 0; }
  .gate-cover .sun-disc { width: min(32%, 10rem); top: 0; }
  .gate-form { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 1.05rem 1.05rem; }
  .gate-form-inner { padding: 1.2rem; }
}

@media (max-width: 485px) {
  .hero { grid-template-columns: 1fr; grid-template-rows: auto 9.7rem; }
  .hero-copy { padding: 1.1rem 1rem .2rem; }
  .hero h1 { margin-block: .4rem .6rem; }
  .hero-copy .button { margin-top: .75rem; }
  .hero .car-art img { width: 100%; height: 156%; left: 0; top: -25%; }
  .hero .sun-disc { width: 35%; top: -3%; left: 45%; }
  .hero .track { width: 100%; left: 5%; }
  .metric p { font-size: .875rem; }
  .share-card { padding-inline: .85rem; }
  .share-status { font-size: .875rem; }
  .payment-state { grid-column: 1 / -1; }
  .payment-actions { grid-column: 1 / -1; }
  .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
