:root {
  color-scheme: dark;
  --ink: #f5f0e5;
    --muted: #d1c7b1;
  --line: rgb(215 182 109 / 22%);
  --paper: rgb(27 27 27 / 85%);
  --canvas: #090909;
  --green: #e0bd64;
  --green-dark: #f8db95;
  --gold: #eec971;
  --gold-pale: rgb(217 182 95 / 15%);
  --error: #e19a90;
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

@property --gold-frame-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

body {
  margin: 0;
  min-height: 100vh;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 82% 8%, rgb(217 182 95 / 12%), transparent 34%),
    radial-gradient(ellipse at 14% 78%, rgb(255 255 255 / 4%), transparent 42%),
    var(--canvas);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  background-image:
    linear-gradient(to right, rgb(217 182 95 / 2.5%) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(217 182 95 / 2.5%) 1px, transparent 1px);
  background-size: 56px 56px;
  content: "";
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, #000 26%, transparent 100%);
}

.ambient-effects { position: fixed; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.liquid-frame {
  position: absolute;
  inset: 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background:
    linear-gradient(transparent, transparent) padding-box,
    conic-gradient(from var(--gold-frame-angle), rgb(217 182 95 / 12%), rgb(245 218 145 / 56%), rgb(217 182 95 / 8%) 24%, rgb(255 238 184 / 48%), rgb(217 182 95 / 10%) 62%, rgb(245 218 145 / 50%), rgb(217 182 95 / 12%)) border-box;
  opacity: .62;
  filter: drop-shadow(0 0 4px rgb(217 182 95 / 12%));
  animation: gold-frame-flow 34s linear infinite;
}
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(226 190 99 / 3%) 0%, rgb(226 190 99 / 1.2%) 32%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease-out;
  will-change: transform, opacity;
}
.cursor-glow.is-visible { opacity: 1; }
.ripple-layer { position: absolute; inset: 0; overflow: hidden; }
.click-ripple {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid rgb(240 207 113 / 70%);
  border-radius: 50%;
  background: radial-gradient(circle, rgb(217 182 95 / 15%), transparent 72%);
  box-shadow: 0 0 12px rgb(217 182 95 / 16%);
  animation: click-ripple-expand .58s cubic-bezier(.16,.65,.3,1) forwards;
}

@keyframes gold-frame-flow { to { --gold-frame-angle: 360deg; } }
@keyframes click-ripple-expand {
  from { opacity: .58; transform: scale(.5); }
  to { opacity: 0; transform: scale(15); }
}

button, input, select { font: inherit; }

.topbar {
  height: 76px;
  padding: 0 max(5.5vw, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
  background: rgb(10 10 10 / 76%);
  border-bottom: 1px solid rgb(215 182 109 / 14%);
  backdrop-filter: blur(14px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-logo { position: relative; width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; padding: 0; color: var(--gold); background: #171410; border: 1px solid var(--gold); border-radius: 50%; font-size: 25px; font-weight: 600; cursor: pointer; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.brand-logo img[hidden] { display: none; }
.brand-logo span[hidden] { display: none; }
.brand-logo:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.brand-copy { display: grid; line-height: 1.35; }
.brand-copy strong { color: var(--gold); font-size: 17px; font-weight: 700; }
.brand-copy small { color: var(--muted); font-size: 12px; }
.topbar-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 15px; }
.admin-open { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; color: var(--gold); background: transparent; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.admin-open svg { width: 19px; height: 19px; }
.admin-open:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

.page-shell { position: relative; z-index: 1; width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.intro { display: flex; justify-content: space-between; align-items: end; padding: 48px 0 28px; }
.eyebrow { margin: 0 0 6px; color: var(--gold); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.intro h1 { margin: 0; font-size: clamp(28px, 3.5vw, 40px); line-height: 1.3; font-weight: 700; }
.intro h1 span { color: var(--green); }
.intro-copy { margin: 10px 0 0; color: var(--muted); font-size: 16px; max-width: 600px; }
.project-count { display: grid; justify-items: center; gap: 2px; padding: 0 20px 2px; border-right: 2px solid var(--line); }
.project-count strong { color: var(--green); font-size: 28px; line-height: 1.1; }
.project-count span { color: var(--muted); font-size: 12px; font-weight: 500; }

.search-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; position: relative; padding: 20px 22px 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 5px; }
.search-panel.has-open-unit-options { z-index: 4; }
.field-group { min-width: 0; display: grid; gap: 7px; }
.field-group label { color: #eec971; font-size: 13.5px; font-weight: 600; }
.field-group input, .field-group select { width: 100%; height: 52px; padding: 0 13px; color: var(--ink); background: rgb(8 8 8 / 68%); border: 1px solid rgb(215 182 109 / 30%); border-radius: 4px; outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px; }
.field-group input:focus, .field-group select:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgb(217 182 95 / 15%); }
.field-group input::placeholder { color: #817763; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-left: 38px; cursor: pointer; }
.select-chevron { position: absolute; left: 15px; top: 18px; width: 8px; height: 8px; border-left: 1.5px solid var(--gold); border-bottom: 1.5px solid var(--gold); transform: rotate(-45deg); pointer-events: none; }
.unit-picker { position: relative; }
.unit-picker input { padding-left: 47px; }
.unit-picker-toggle { position: absolute; left: 2px; top: 2px; width: 40px; height: 41px; display: grid; place-items: center; padding: 0; color: var(--gold); background: transparent; border: 0; cursor: pointer; }
.unit-picker-toggle span { width: 8px; height: 8px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(-45deg); }
.unit-picker-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: -5px; }
.unit-options { position: absolute; z-index: 20; top: calc(100% + 5px); right: 0; left: 0; max-height: 240px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; background: rgb(22 22 22 / 92%); border: 1px solid rgb(215 182 109 / 30%); border-radius: 3px; box-shadow: 0 12px 24px rgb(0 0 0 / 40%); backdrop-filter: blur(12px); }
.unit-options[hidden] { display: none; }
.unit-option { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 13px; color: var(--ink); text-align: right; background: transparent; border: 0; border-bottom: 1px solid #332d23; cursor: pointer; }
.unit-option:last-child { border-bottom: 0; }
.unit-option:hover, .unit-option[aria-selected="true"] { color: #f3d995; background: #302719; }
.unit-option strong { font-size: 13px; font-weight: 600; }
.unit-option span { color: var(--muted); font-size: 10px; }
.search-hint { position: absolute; bottom: 2px; right: 22px; margin: 0; color: var(--muted); font-size: 10px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .9fr); gap: 24px; align-items: start; margin-top: 30px; }
.content-grid { position: relative; z-index: 1; }
.section-heading { min-height: 55px; display: flex; align-items: start; justify-content: space-between; }
.section-heading .eyebrow { margin-bottom: 1px; }
.section-heading h2, .calculator-heading h2 { margin: 0; font-size: 18px; font-weight: 600; }
.unit-list-back { min-height: 34px; padding: 0 10px; color: var(--gold); background: transparent; border: 1px solid var(--line); border-radius: 3px; font-size: 11px; cursor: pointer; }
.unit-list-back[hidden] { display: none; }
.unit-catalog-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.unit-catalog-toolbar[hidden] { display: none; }
.unit-catalog-toolbar label { color: var(--muted); font-size: 12px; }
.unit-catalog-toolbar .select-wrap { width: min(100%, 260px); }
.unit-catalog-toolbar select { width: 100%; height: 40px; padding: 0 12px 0 34px; appearance: none; color: var(--ink); background: rgb(8 8 8 / 68%); border: 1px solid rgb(215 182 109 / 30%); border-radius: 4px; font: inherit; font-size: 12px; cursor: pointer; }
.unit-catalog-toolbar select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgb(217 182 95 / 15%); }
.unit-catalog { max-height: 620px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow-y: auto; padding: 0 2px 8px; }
.unit-catalog[hidden] { display: none; }
.unit-catalog-item { min-width: 0; display: grid; align-content: start; gap: 8px; padding: 10px 12px; color: var(--ink); text-align: right; background: rgb(25 25 25 / 70%); border: 1px solid rgb(215 182 109 / 16%); border-radius: 4px; font: inherit; cursor: pointer; backdrop-filter: blur(10px); }
.unit-catalog-item:hover, .unit-catalog-item:focus-visible { background: rgb(37 34 28 / 82%); border-color: rgb(215 182 109 / 44%); outline: none; }
.unit-catalog-heading { min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.unit-catalog-heading strong { overflow-wrap: anywhere; font-size: 14px; font-weight: 700; color: var(--gold); }
.unit-catalog-heading small { color: var(--muted); font-size: 11px; font-weight: 500; text-align: left; }
.unit-catalog-values { min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.unit-catalog-values small { color: var(--muted); font-size: 10.5px; }
.unit-catalog-values strong { overflow-wrap: anywhere; color: var(--green-dark); font-size: 13px; font-weight: 700; }
.unit-card { overflow: hidden; background: #181613; border: 1px solid #51432b; border-radius: 5px; animation: reveal .25s ease-out; }
.unit-card[hidden] { display: none; }
.unit-card-top { display: flex; align-items: center; justify-content: space-between; padding: 21px 22px 18px; border-bottom: 1px solid var(--line); }
.unit-header-meta { display: flex; align-items: center; gap: 10px; }
.status-pill { padding: 4px 9px; border-radius: 3px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.status-pill { font-size: 11px; }
.status-available { color: #c8e0c8; background: #233628; }
.status-reserved { color: #f1d88f; background: #403519; }
.status-hold { color: #f1d88f; background: #4a3f16; }
.status-sold { color: #efb2a8; background: #462522; }
.status-unknown { color: #c8baa0; background: #302b23; }
.project-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.unit-card-top h3 { margin: 2px 0 0; font-size: 27px; font-weight: 700; }
.unit-icon, .calculator-icon { display: grid; place-items: center; color: var(--gold); background: #302719; border: 1px solid #51432b; border-radius: 4px; }
.unit-icon { width: 43px; height: 43px; }
.unit-icon svg, .calculator-icon svg, .empty-icon svg { width: 23px; height: 23px; }
.calculator-add:focus-visible, .icon-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.unit-specs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 17px 22px; border-bottom: 1px solid var(--line); }
.spec { display: grid; gap: 2px; padding-right: 15px; border-right: 1px solid var(--line); }
.spec:first-child { padding-right: 0; border: 0; }
.spec span, .price-line > span, .payment-summary > div > span { color: var(--muted); font-size: 13px; font-weight: 500; }
.spec strong { font-size: 20px; font-weight: 700; color: var(--gold); }
.spec small { font-size: 13px; font-weight: 600; color: var(--muted); }
.unit-extra { display: flex; justify-content: space-between; gap: 14px; padding: 11px 22px; border-bottom: 1px solid var(--line); }
.unit-extra span { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.unit-extra strong { text-align: left; font-size: 15px; font-weight: 600; }
.price-block { padding: 15px 22px 14px; }
.price-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price-line[hidden] { display: none; }
.price-line strong { font-size: 18px; font-weight: 700; }
.meter-price-line { margin-top: 5px; }
.meter-price-line strong { color: #f3e5c2; font-size: 14px; }
.old-price { color: var(--ink); font-weight: 700; text-decoration: none; }
.final-price-line { position: relative; isolation: isolate; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(100%, 420px); min-height: 82px; margin: 15px 0 7px auto; padding: 13px 16px; overflow: hidden; border: 1px solid rgb(238 201 113 / 42%); border-radius: 5px; background: linear-gradient(115deg, #211d15, #342a18 52%, #211d15); box-shadow: 0 10px 26px rgb(0 0 0 / 22%), 0 0 18px rgb(238 201 113 / 10%); }
.final-price-line::before { position: absolute; z-index: 0; top: -20%; bottom: -20%; left: -45%; width: 34%; background: linear-gradient(90deg, transparent, rgb(255 255 255 / 24%), transparent); content: ""; pointer-events: none; transform: skewX(-18deg); animation: price-spotlight-shimmer 5.5s ease-in-out infinite; }
.final-price-line > * { position: relative; z-index: 1; }
.final-price-line > span { color: #f1d88f; font-size: 13px; font-weight: 600; }
.final-price { color: #ffe39a; font-size: 28px !important; font-weight: 800; text-shadow: 0 0 14px rgb(224 189 100 / 35%); }
@keyframes price-spotlight-shimmer { 0%, 58% { transform: translateX(-250%) skewX(-18deg); } 88%, 100% { transform: translateX(430%) skewX(-18deg); } }
.payment-summary { display: grid; grid-template-columns: 1fr 1fr; background: #211e19; border-top: 1px solid var(--line); }
.payment-summary > div { display: grid; gap: 4px; padding: 14px 22px 16px; }
.payment-summary > div + div { border-right: 1px solid var(--line); }
.payment-summary strong { color: var(--green-dark); font-size: 22px; font-weight: 700; }

.empty-state { min-height: 300px; display: grid; justify-items: center; align-content: center; padding: 32px; text-align: center; background: #171512; border: 1px dashed #59472b; border-radius: 5px; }
.empty-state[hidden] { display: none; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 12px; color: var(--gold); background: #302719; border: 1px solid #51432b; border-radius: 50%; }
.empty-state strong { font-size: 14px; font-weight: 600; }
.empty-state p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.empty-state.is-error .empty-icon { color: var(--error); background: #462522; }

.calculator { padding: 21px 22px 0; background: #181613; border: 1px solid #51432b; border-top: 3px solid var(--gold); border-radius: 5px; }
.calculator-heading { display: flex; align-items: center; gap: 11px; }
.calculator-icon { width: 42px; height: 42px; flex: 0 0 auto; color: var(--gold); background: var(--gold-pale); }
.calculator-heading-copy { min-width: 0; flex: 1; }
.calculator-heading .eyebrow { margin-bottom: 0; }
.calculator-heading h2 { font-size: 17px; }
.calculator-add, .icon-button { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; color: var(--gold); background: #302719; border: 1px solid #51432b; border-radius: 4px; cursor: pointer; }
.calculator-add svg, .icon-button svg { width: 20px; height: 20px; }
.calculator-copy { margin: 13px 0 19px; color: var(--muted); font-size: 12px; }
.calculator-fields { display: grid; gap: 14px; }
.down-payment-mode { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px; background: #211e19; border: 1px solid var(--line); border-radius: 3px; }
.down-payment-mode button { min-height: 31px; padding: 0 10px; color: var(--muted); background: transparent; border: 0; border-radius: 2px; font: inherit; font-size: 11px; cursor: pointer; }
.down-payment-mode button[aria-pressed="true"] { color: var(--gold); background: #342d1f; font-weight: 600; }
.down-payment-mode button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.number-wrap { height: 48px; display: flex; align-items: center; border: 1px solid rgb(215 182 109 / 30%); border-radius: 4px; transition: border-color .15s, box-shadow .15s; }
.number-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgb(215 182 109 / 15%); }
.number-wrap input { height: 100%; border: 0; box-shadow: none !important; padding: 0 15px; font-weight: 700; font-size: 17px; }
.number-wrap input:focus { outline: 0; }
.number-wrap > span { flex: 0 0 auto; padding: 0 15px; color: var(--muted); font-size: 13px; font-weight: 600; }
.number-wrap > span:first-of-type { border-right: 1px solid var(--line); }
.years-wrap input { text-align: right; }
.calculation-note { display: flex; align-items: start; gap: 8px; margin-top: 17px; padding: 11px; background: #242019; border: 1px solid #403522; border-radius: 3px; }
.calculation-note > span { width: 16px; height: 16px; flex: 0 0 auto; display: grid; place-items: center; margin-top: 2px; color: var(--gold); border: 1px solid #80683e; border-radius: 50%; font-family: Georgia, serif; font-size: 10px; font-weight: 700; }
.calculation-note p { margin: 0; color: #c3b493; font-size: 10px; }
.calculator-footer { display: flex; justify-content: space-between; align-items: center; margin: 17px -22px 0; padding: 15px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.calculator-footer strong { color: var(--ink); font-size: 15px; font-weight: 700; }
.custom-plan-dialog { width: min(560px, calc(100% - 32px)); max-width: none; max-height: calc(100% - 32px); overflow-y: auto; margin: auto; padding: 0; color: var(--ink); background: #191816; border: 1px solid #6a5430; border-radius: 5px; box-shadow: 0 20px 60px rgb(0 0 0 / 55%); }
.custom-plan-dialog::backdrop { background: rgb(0 0 0 / 68%); backdrop-filter: blur(2px); }
.custom-plan-form { display: grid; gap: 20px; padding: 23px; }
.custom-plan-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.custom-plan-heading .eyebrow { margin-bottom: 1px; }
.custom-plan-heading h2 { margin: 0; font-size: 19px; font-weight: 600; }
.custom-plan-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 12px; }
.discount-toggle { min-height: 43px; display: flex; align-items: center; gap: 9px; padding: 0 12px; color: var(--ink); background: #211e19; border: 1px solid var(--line); border-radius: 3px; font-size: 12px; cursor: pointer; }
.discount-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--gold); }
.custom-discount-field[hidden] { display: none; }
.custom-plan-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.custom-plan-results > div { min-width: 0; display: grid; gap: 4px; padding: 13px 12px; border-bottom: 1px solid var(--line); }
.custom-plan-results > div:nth-child(even) { border-right: 1px solid var(--line); }
.custom-plan-results span { color: var(--muted); font-size: 11px; }
.custom-plan-results strong { overflow-wrap: anywhere; color: var(--green-dark); font-size: 14px; font-weight: 600; }
.admin-auth-dialog, .admin-dialog { width: min(760px, calc(100% - 32px)); max-width: none; max-height: calc(100% - 32px); overflow-y: auto; margin: auto; padding: 0; color: var(--ink); background: #191816; border: 1px solid #6a5430; border-radius: 5px; box-shadow: 0 20px 60px rgb(0 0 0 / 55%); }
.admin-auth-dialog { width: min(420px, calc(100% - 32px)); }
.admin-auth-dialog::backdrop, .admin-dialog::backdrop { background: rgb(0 0 0 / 68%); backdrop-filter: blur(2px); }
.admin-auth-form, .admin-panel { display: grid; gap: 16px; padding: 22px; }
.admin-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.admin-dialog-heading .eyebrow { margin-bottom: 1px; }
.admin-dialog-heading h2 { margin: 0; font-size: 19px; font-weight: 600; }
.admin-local-note { margin: -7px 0 0; color: var(--muted); font-size: 11px; }
.admin-auth-error { margin: 0; color: var(--error); font-size: 12px; }
.admin-auth-error[hidden] { display: none; }
.admin-submit, .admin-secondary, .admin-delete { min-height: 38px; padding: 0 13px; border: 1px solid #59472b; border-radius: 3px; font: inherit; font-size: 12px; cursor: pointer; }
.admin-submit { color: #171410; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.admin-secondary { color: var(--gold); background: transparent; }
.admin-delete { color: #efb2a8; background: #462522; border-color: #71423b; }
.admin-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-toolbar select, .admin-toolbar input, .admin-unit-fields > .field-group > input { width: 100%; height: 42px; padding: 0 11px; color: var(--ink); background: #11100e; border: 1px solid #4c402d; border-radius: 3px; }
.admin-unit-form { display: grid; gap: 12px; padding: 15px; background: #211e19; border: 1px solid #403522; border-radius: 4px; }
.admin-unit-form h3, .admin-units-heading h3 { margin: 0; font-size: 14px; font-weight: 600; }
.admin-unit-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.admin-unit-fields .field-group { min-width: 0; }
.admin-unit-fields input, .admin-unit-fields select { min-width: 0; }
.admin-unit-fields .number-wrap input { min-width: 0; }
.admin-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-units-heading { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.admin-unit-list { max-height: 300px; display: grid; overflow: auto; border-top: 1px solid var(--line); }
.admin-unit-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.admin-unit-details { min-width: 0; display: grid; gap: 3px; }
.admin-unit-details strong { font-size: 12px; }
.admin-unit-details span, .admin-unit-details small { overflow-wrap: anywhere; color: var(--muted); font-size: 10px; }
.admin-unit-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-unit-actions button { min-height: 31px; padding: 0 9px; font-size: 10px; }
.admin-list-empty { margin: 0; padding: 18px 5px; color: var(--muted); text-align: center; font-size: 12px; }
.admin-import { display: grid; gap: 12px; padding: 14px; background: #211e19; border: 1px solid #403522; border-radius: 4px; }
.admin-import-heading, .admin-import-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px; }
.admin-import-heading h3, .admin-import-plan h4 { margin: 0; font-size: 13px; font-weight: 600; }
.admin-import-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.admin-import-body { display: grid; gap: 13px; }
.admin-import-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.admin-import-toolbar input[type="file"], .admin-new-project input, .admin-import-plan-fields input, .admin-import-plan-fields select { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; color: var(--ink); background: #11100e; border: 1px solid #4c402d; border-radius: 3px; font: inherit; font-size: 11px; }
.admin-new-project, .admin-import-plan { display: grid; gap: 10px; }
.admin-import-plan { padding-top: 12px; border-top: 1px solid var(--line); }
.admin-import-plan-fields { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.admin-import-plan-fields .field-group { min-width: 0; }
.admin-import-checkbox { display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--muted); font-size: 11px; }
.admin-import-checkbox input { width: 16px; min-height: 16px; accent-color: var(--gold); }
.admin-import-review { display: grid; gap: 10px; }
.admin-import-summary { color: var(--muted); font-size: 11px; line-height: 1.7; }
.admin-import-table-wrap { max-height: 370px; overflow: auto; border: 1px solid var(--line); }
.admin-import-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 10px; text-align: right; }
.admin-import-table th, .admin-import-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-import-table th { position: sticky; top: 0; color: var(--gold); background: #191816; }
.admin-import-table td { color: var(--muted); }
.admin-import-table td:first-child { color: var(--ink); font-weight: 600; }
.admin-import-table select { min-height: 34px; color: var(--ink); background: #11100e; border: 1px solid #4c402d; border-radius: 3px; font: inherit; }
.admin-import-table .import-new { color: #cfbd89; }
.admin-import-missing { max-height: 120px; overflow: auto; color: var(--muted); font-size: 10px; line-height: 1.7; }
.admin-import-actions { justify-content: flex-start; }
.admin-import-actions .admin-auth-error { flex-basis: 100%; }
.search-panel, .unit-card, .calculator, .empty-state, .custom-plan-dialog, .admin-auth-dialog, .admin-dialog {
  background-color: rgb(25 25 25 / 78%);
  border-color: rgb(215 182 109 / 18%);
  backdrop-filter: blur(12px);
}
.calculator { border-top-color: rgb(217 182 95 / 72%); }
.unit-card-top { background: rgb(255 255 255 / 1.5%); }
.payment-summary { background: rgb(255 255 255 / 3%); }
.admin-unit-form, .calculation-note, .discount-toggle { background-color: rgb(255 255 255 / 3%); }
.admin-submit:hover { background: #f0d27d; box-shadow: 0 0 20px rgb(217 182 95 / 22%); }
.admin-import { background-color: rgb(255 255 255 / 3%); }
.page-footer { display: flex; justify-content: space-between; margin-top: 35px; padding: 16px 0 22px; color: #978b74; border-top: 1px solid #403522; font-size: 10px; }
.page-footer span:first-child { color: var(--gold); font-weight: 600; }

@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 720px) {
  .topbar { height: 66px; padding: 0 20px; }
  .page-shell { width: min(100% - 36px, 520px); }
  .intro { padding: 33px 0 22px; }
  .intro h1 { max-width: 350px; font-size: 26px; }
  .intro-copy { max-width: 330px; font-size: 12px; }
  .project-count { padding: 0 0 2px 12px; }
  .project-count span { max-width: 60px; text-align: center; line-height: 1.35; }
  .search-panel { gap: 11px; padding: 16px 15px 25px; }
  .content-grid { grid-template-columns: 1fr; gap: 22px; margin-top: 24px; }
  .admin-unit-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-import-plan-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .unit-catalog { gap: 6px; }
  .unit-catalog-item { min-height: 98px; padding: 9px; }
  .custom-plan-form { gap: 16px; padding: 18px; }
  .unit-section { order: 1; }
  .calculator { order: 2; }
  .calculator-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .calculator { padding-right: 17px; padding-left: 17px; }
  .calculator-footer { margin-right: -17px; margin-left: -17px; padding-right: 17px; padding-left: 17px; }
  .number-wrap > span { padding: 0 8px; }
}

@media (max-width: 420px) {
  .page-shell { width: calc(100% - 28px); }
  .topbar { padding: 0 14px; }
  .topbar-note { font-size: 10px; }
  .topbar-actions { gap: 8px; }
  .intro { align-items: center; }
  .intro h1 { font-size: 23px; }
  .intro-copy { max-width: 255px; font-size: 11px; }
  .project-count { font-size: 10px; }
  .search-panel { grid-template-columns: 1fr; gap: 10px; }
  .search-hint { right: 15px; }
  .unit-catalog { grid-template-columns: 1fr; }
  .calculator-fields { grid-template-columns: 1fr; }
  .custom-plan-fields { grid-template-columns: 1fr; }
  .admin-toolbar, .admin-unit-fields, .admin-import-toolbar, .admin-import-plan-fields { grid-template-columns: 1fr; }
  .admin-panel, .admin-auth-form { padding: 16px; }
  .number-wrap { height: 42px; }
  .page-footer { flex-wrap: wrap; gap: 5px 14px; }
  .page-footer span:last-child { width: 100%; }
  .unit-card-top, .unit-specs, .price-block { padding-right: 16px; padding-left: 16px; }
  .payment-summary > div { padding-right: 16px; padding-left: 16px; }
  .final-price-line { width: 100%; min-height: 76px; gap: 8px; padding: 11px 12px; }
  .final-price { font-size: 23px !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .cursor-glow { display: none; }
}

@media (hover: none), (pointer: coarse) {
  .cursor-glow { display: none; }
}

.theme-toggle { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; color: var(--gold); background: transparent; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.theme-toggle svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-moon { display: none; }
.theme-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

html[data-theme="light"] {
  color-scheme: light;
  --ink: #22364f;
  --muted: #536a84;
  --line: #d4e0ee;
  --paper: #ffffff;
  --canvas: #f1f6fb;
  --green: #3475b5;
  --green-dark: #24588f;
  --gold: #316da9;
  --gold-pale: #e9f2fb;
  --error: #a13f45;
  --surface-soft: #f5f9fe;
  --surface-input: #ffffff;
  --input-border: #c6d7e8;
  --blue-line: #d8e5f2;
  --blue-hover: #e6f0fa;
  --blue-focus: rgb(49 109 169 / 17%);
}

html[data-theme="light"] body {
  background: radial-gradient(ellipse at 82% 8%, rgb(49 109 169 / 7%), transparent 36%), var(--canvas);
}
html[data-theme="light"] body::before {
  background-image: linear-gradient(to right, rgb(49 109 169 / 3%) 1px, transparent 1px), linear-gradient(to bottom, rgb(49 109 169 / 3%) 1px, transparent 1px);
}
html[data-theme="light"] .liquid-frame {
  background: linear-gradient(transparent, transparent) padding-box, conic-gradient(from var(--gold-frame-angle), rgb(49 109 169 / 10%), rgb(133 174 214 / 50%), rgb(49 109 169 / 7%) 24%, rgb(201 221 241 / 70%), rgb(49 109 169 / 8%) 62%, rgb(133 174 214 / 45%), rgb(49 109 169 / 10%)) border-box;
  filter: drop-shadow(0 0 4px rgb(49 109 169 / 9%));
}
html[data-theme="light"] .cursor-glow { background: radial-gradient(circle, rgb(67 132 194 / 5%) 0%, rgb(67 132 194 / 2%) 32%, transparent 70%); }
html[data-theme="light"] .click-ripple { border-color: rgb(49 109 169 / 55%); background: radial-gradient(circle, rgb(49 109 169 / 12%), transparent 72%); box-shadow: 0 0 12px rgb(49 109 169 / 12%); }
html[data-theme="light"] .theme-toggle { color: var(--gold); background: #fff; }
html[data-theme="light"] .theme-icon-sun { display: none; }
html[data-theme="light"] .theme-icon-moon { display: block; }
html[data-theme="light"] .topbar { background: rgb(255 255 255 / 92%); border-bottom-color: var(--line); box-shadow: 0 2px 12px rgb(34 66 102 / 4%); }
html[data-theme="light"] .brand-logo { color: var(--gold); background: #eaf2fb; border-color: #b9cfe5; }
html[data-theme="light"] .admin-open { color: var(--gold); background: #fff; border-color: #cbdced; }
html[data-theme="light"] .status-dot { background: #4a9a6a; }
html[data-theme="light"] .field-group label { color: #294f78; }
html[data-theme="light"] .down-payment-mode { background: #edf4fb; border-color: #d4e0ee; }
html[data-theme="light"] .down-payment-mode button { color: #536a84; }
html[data-theme="light"] .down-payment-mode button[aria-pressed="true"] { color: #24588f; background: #fff; box-shadow: 0 1px 4px rgb(32 64 98 / 12%); }
html[data-theme="light"] .down-payment-mode button:focus-visible { outline-color: #397bb8; }
html[data-theme="light"] .field-group input,
html[data-theme="light"] .field-group select,
html[data-theme="light"] .unit-catalog-toolbar select,
html[data-theme="light"] .admin-toolbar select,
html[data-theme="light"] .admin-toolbar input,
html[data-theme="light"] .admin-unit-fields > .field-group > input {
  color: var(--ink);
  background: var(--surface-input);
  border-color: var(--input-border);
}
html[data-theme="light"] .field-group input::placeholder { color: #70839a; }
html[data-theme="light"] .field-group input:focus,
html[data-theme="light"] .field-group select:focus,
html[data-theme="light"] .unit-catalog-toolbar select:focus { border-color: #6f9dca; box-shadow: 0 0 0 4px var(--blue-focus); }
html[data-theme="light"] select option { color: var(--ink); background: #fff; }
html[data-theme="light"] .unit-options { background: rgb(255 255 255 / 98%); border-color: #cad9e9; box-shadow: 0 12px 24px rgb(27 52 80 / 14%); }
html[data-theme="light"] .unit-option { color: var(--ink); border-bottom-color: #e0e9f2; }
html[data-theme="light"] .unit-option:hover,
html[data-theme="light"] .unit-option[aria-selected="true"] { color: #204e7c; background: #e8f1fb; }
html[data-theme="light"] .unit-option span { color: var(--muted); }
html[data-theme="light"] .unit-catalog-item { color: var(--ink); background: rgb(255 255 255 / 94%); border-color: #d5e2ef; box-shadow: 0 2px 8px rgb(29 57 88 / 4%); }
html[data-theme="light"] .unit-catalog-item:hover,
html[data-theme="light"] .unit-catalog-item:focus-visible { background: #f1f7fd; border-color: #8eb1d4; }
html[data-theme="light"] .search-panel,
html[data-theme="light"] .unit-card,
html[data-theme="light"] .calculator,
html[data-theme="light"] .empty-state,
html[data-theme="light"] .custom-plan-dialog,
html[data-theme="light"] .admin-auth-dialog,
html[data-theme="light"] .admin-dialog {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 12px 30px rgb(32 64 98 / 10%);
}
html[data-theme="light"] .calculator { border-top-color: #3475b5; }
html[data-theme="light"] .unit-card-top { background: #f7faff; }
html[data-theme="light"] .status-available { color: #216442; background: #e7f5ec; }
html[data-theme="light"] .status-reserved,
html[data-theme="light"] .status-hold { color: #805c18; background: #fbf2db; }
html[data-theme="light"] .status-sold { color: #963f43; background: #fae9e8; }
html[data-theme="light"] .status-unknown { color: #52657a; background: #edf2f7; }
html[data-theme="light"] .meter-price-line strong { color: #536a84; }
html[data-theme="light"] .old-price { color: var(--ink); text-decoration: none; }
html[data-theme="light"] .final-price { text-shadow: none; }
html[data-theme="light"] .final-price-line { border-color: #b5cce4; background: linear-gradient(115deg, #fff, #e9f2fb 52%, #f7fbff); box-shadow: 0 10px 24px rgb(49 109 169 / 12%), 0 0 18px rgb(49 109 169 / 9%); }
html[data-theme="light"] .final-price-line::before { background: linear-gradient(90deg, transparent, rgb(255 255 255 / 78%), transparent); }
html[data-theme="light"] .final-price-line > span { color: #294f78; }
html[data-theme="light"] .final-price { color: #245c9c; text-shadow: 0 0 12px rgb(49 109 169 / 16%); }
html[data-theme="light"] .payment-summary { background: #edf4fb; }
html[data-theme="light"] .empty-state { border-style: dashed; border-color: #b8ccdf; }
html[data-theme="light"] .empty-icon { color: #3475b5; background: #eaf2fb; border-color: #c9dbee; }
html[data-theme="light"] .empty-state.is-error .empty-icon { color: var(--error); background: #fae9e8; }
html[data-theme="light"] .unit-icon,
html[data-theme="light"] .calculator-icon,
html[data-theme="light"] .calculator-add,
html[data-theme="light"] .icon-button { color: #2f679f; background: #eaf2fb; border-color: #c7d9eb; }
html[data-theme="light"] .number-wrap { border-color: var(--input-border); background: #fff; }
html[data-theme="light"] .number-wrap:focus-within { border-color: #6f9dca; box-shadow: 0 0 0 4px var(--blue-focus); }
html[data-theme="light"] .number-wrap > span:first-of-type { border-right-color: var(--line); }
html[data-theme="light"] .calculation-note,
html[data-theme="light"] .discount-toggle,
html[data-theme="light"] .admin-unit-form,
html[data-theme="light"] .admin-import { color: var(--ink); background: #f2f7fc; border-color: #d6e2ef; }
html[data-theme="light"] .admin-import-table th { color: #24588f; background: #edf4fb; }
html[data-theme="light"] .admin-import-table select { color: var(--ink); background: #fff; border-color: var(--input-border); }
html[data-theme="light"] .admin-import-table select:focus { border-color: #6f9dca; outline: 0; box-shadow: 0 0 0 3px var(--blue-focus); }
html[data-theme="light"] .calculation-note > span { color: #2f679f; border-color: #9cbadb; }
html[data-theme="light"] .calculation-note p { color: #536a84; }
html[data-theme="light"] .discount-toggle input { accent-color: #3475b5; }
html[data-theme="light"] .admin-auth-dialog::backdrop,
html[data-theme="light"] .admin-dialog::backdrop,
html[data-theme="light"] .custom-plan-dialog::backdrop { background: rgb(24 43 64 / 42%); }
html[data-theme="light"] .admin-submit { color: #fff; background: #3475b5; border-color: #3475b5; }
html[data-theme="light"] .admin-submit:hover { color: #fff; background: #24588f; box-shadow: 0 0 16px rgb(52 117 181 / 18%); }
html[data-theme="light"] .admin-secondary { color: #2b6198; border-color: #9fbad6; }
html[data-theme="light"] .admin-delete { color: #963f43; background: #fae9e8; border-color: #e2b9b8; }
html[data-theme="light"] .admin-unit-form h3,
html[data-theme="light"] .admin-units-heading,
html[data-theme="light"] .admin-unit-details strong { color: var(--ink); }
html[data-theme="light"] .admin-unit-list { border-top-color: var(--line); }
html[data-theme="light"] .admin-unit-row { border-bottom-color: var(--line); }
html[data-theme="light"] .page-footer { color: #5c7087; border-top-color: var(--line); }

@media (prefers-reduced-motion: reduce) {
  .final-price-line::before { animation: none; }
}