:root {
  --navy: #0b2a5b;
  --navy-2: #13408a;
  --red: #c8102e;
  --ink: #111827;
  --ink-2: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f3f5f8;
  --card: #ffffff;
  --ok: #0f7a3a;
  --warn: #9a6700;
  --radius: 14px;
  --tap: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; padding-bottom: calc(76px + var(--safe-bottom)); line-height: 1.5; }
body.auth { padding-bottom: 0; }
a { color: var(--navy-2); }
h1 { margin: 0.2rem 0 1rem; font-size: 1.6rem; line-height: 1.2; letter-spacing: -0.01em; }
h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }
h3 { margin: 1rem 0 0.5rem; font-size: 1rem; }
p { margin: 0 0 0.75rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--navy-2); outline-offset: 2px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.85rem; }
.hint { display: block; margin-top: 0.3rem; color: var(--muted); font-size: 0.85rem; }

/* Header and bottom tabs (like a native app) */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: calc(0.6rem + env(safe-area-inset-top, 0px)) 1rem 0.6rem; background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 0.5rem; color: var(--navy); font-weight: 800; text-decoration: none; }
.brand img { border-radius: 8px; }
.top-add { padding: 0.5rem 0.9rem; border-radius: 999px; background: var(--red); color: #fff; font-weight: 700; text-decoration: none; }
.page { width: min(100% - 2rem, 760px); margin: 1rem auto 0; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: var(--safe-bottom); background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.tabs a { position: relative; display: grid; justify-items: center; gap: 2px; padding: 0.5rem 0 0.45rem; color: var(--muted); font-size: 0.72rem; font-weight: 600; text-decoration: none; }
.tabs a.is-on { color: var(--navy); }
.ic { width: 24px; height: 24px; border-radius: 6px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.ic-home { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 11 12 3l9 8v10h-6v-6H9v6H3z'/%3E%3C/svg%3E"); }
.ic-list { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 5h18v3H3zm0 6h18v3H3zm0 6h18v3H3z'/%3E%3C/svg%3E"); }
.ic-inbox { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 4h18v16H3zm2 9v5h14v-5h-4a3 3 0 0 1-6 0z'/%3E%3C/svg%3E"); }
.ic-sales { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 20V10h3v10zm6 0V4h3v16zm6 0v-7h3v7z'/%3E%3C/svg%3E"); }
.ic-more { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='5' cy='12' r='2.5'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3Ccircle cx='19' cy='12' r='2.5'/%3E%3C/svg%3E"); }
.badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 0.7rem; line-height: 18px; text-align: center; }

/* Buttons and controls */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0.6rem 1.1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font-weight: 600; font-size: 1rem; line-height: 1.2; font-family: inherit; text-decoration: none; cursor: pointer; }
.btn:active { transform: scale(0.98); }
.btn-primary { border-color: var(--navy); background: var(--navy); color: #fff; }
.btn-big { width: 100%; min-height: 56px; font-size: 1.1rem; }
.btn[disabled] { opacity: 0.55; }
.btn.danger, button.danger { color: var(--red); }
.toast { padding: 0.75rem 1rem; border-radius: 12px; background: #e8f5ec; color: var(--ok); font-weight: 600; }
.form-error { color: var(--red); font-weight: 600; }
.form-error:empty { display: none; }
.empty { padding: 1.5rem; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.crumbs { margin: 0; color: var(--muted); font-size: 0.9rem; }
.card { margin: 0 0 1rem; padding: 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.card-section + .card-section { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.section-title { margin-top: 1.5rem; }

/* Sign in */
.auth-card { max-width: 420px; margin: 12vh auto 0; padding: 2rem 1.5rem; border-radius: 20px; background: #fff; box-shadow: 0 10px 40px rgba(11, 42, 91, 0.12); text-align: center; }
.auth-logo { margin: 0 auto 1rem; border-radius: 22px; }
.steps { margin: 1rem 0 1.25rem; padding-left: 1.2rem; text-align: left; }

/* Dashboard */
.hello { font-size: 1.5rem; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.quick-btn { display: grid; justify-items: center; gap: 0.25rem; padding: 1.1rem 0.5rem; border-radius: var(--radius); background: var(--navy); color: #fff; font-weight: 700; text-decoration: none; }
.quick-btn:nth-child(2) { background: var(--red); }
.plus { font-size: 1.8rem; line-height: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem; margin-bottom: 0.5rem; }
.stat { padding: 0.85rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 0.85rem; }

/* Lists */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filters input[type="search"] { flex: 1 1 100%; }
.unit-list, .sale-list, .messages, .activity, .plain, .menu { margin: 0; padding: 0; list-style: none; }
.unit-row { display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; }
.unit-row img, .no-photo { width: 72px; height: 54px; border-radius: 8px; object-fit: cover; }
.no-photo { display: grid; place-items: center; background: var(--bg); color: var(--muted); font-size: 0.65rem; }
.unit-row-text { display: grid; min-width: 0; }
.unit-row-text strong { overflow: hidden; font-size: 0.95rem; text-overflow: ellipsis; white-space: nowrap; }
.unit-row-text .muted { font-size: 0.85rem; }
.pill { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--bg); color: var(--ink-2); font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.pill-available { background: #e8f5ec; color: var(--ok); }
.pill-draft { background: #fff4d6; color: var(--warn); }
.pill-sold { background: #fde8eb; color: var(--red); }
.pill-offer { background: #e7efff; color: var(--navy-2); }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.seg { display: flex; gap: 0.25rem; margin-bottom: 1rem; padding: 0.25rem; border-radius: 12px; background: #e5e9f0; }
.seg a { flex: 1; padding: 0.55rem; border-radius: 9px; color: var(--ink-2); font-weight: 600; text-align: center; text-decoration: none; }
.seg a.is-on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

/* Forms */
.grid { display: grid; gap: 0.9rem; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } .field-wide { grid-column: 1 / -1; } }
.field { display: block; min-width: 0; margin: 0; padding: 0; border: 0; }
form.card > .field { margin-bottom: 1.1rem; }
.label { display: block; margin-bottom: 0.3rem; font-size: 0.9rem; font-weight: 700; }
.label em { color: var(--red); font-style: normal; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 0.6rem 0.75rem; border: 1px solid #cfd5df; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 400; font-size: 16px; line-height: 1.4; font-family: inherit; }
textarea { min-height: 120px; resize: vertical; }
.with-unit { display: flex; align-items: center; border: 1px solid #cfd5df; border-radius: 10px; background: #fff; }
.with-unit input { border: 0; }
.with-unit i { padding: 0 0.75rem; color: var(--muted); font-style: normal; }
.with-unit.prefix i { padding-right: 0; }
.has-error input, .has-error select, .has-error textarea, .has-error .with-unit { border-color: var(--red); }
.error { display: block; margin-top: 0.3rem; color: var(--red); font-size: 0.85rem; font-weight: 600; }
.radios { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.radio { display: inline-flex; align-items: center; gap: 0.4rem; min-height: var(--tap); padding: 0 1rem; border: 1px solid #cfd5df; border-radius: 10px; background: #fff; font-weight: 600; }
.radio input { width: auto; min-height: 0; }
.radio:has(input:checked) { border-color: var(--navy); background: #e7efff; color: var(--navy); }
details > summary { display: grid; cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary h2::after { content: " ▾"; color: var(--muted); }
details[open] > summary { margin-bottom: 0.9rem; }
.save-bar { position: sticky; bottom: calc(68px + var(--safe-bottom)); z-index: 5; display: flex; justify-content: flex-end; gap: 0.5rem; margin: 1rem -1.1rem -1.1rem; padding: 0.75rem 1.1rem; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: rgba(255, 255, 255, 0.96); }
.save-bar .btn { flex: 1; }
.actions-card { display: grid; gap: 0.6rem; }
.actions-card form { margin: 0; }
.actions-card .btn { width: 100%; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.6rem; margin: 0 0 0.75rem; padding: 0; list-style: none; }
.photo-grid li { position: relative; overflow: hidden; border-radius: 10px; background: var(--bg); }
.photo-grid img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.cover-tag { position: absolute; top: 6px; left: 6px; padding: 0.1rem 0.45rem; border-radius: 6px; background: var(--navy); color: #fff; font-size: 0.72rem; font-weight: 700; }
.photo-actions { display: flex; gap: 2px; padding: 4px; }
.photo-actions button { flex: 1; min-height: 36px; border: 0; border-radius: 6px; background: #fff; font-weight: 600; font-size: 0.8rem; font-family: inherit; cursor: pointer; }
.uploader, .picker { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.picker .photo-grid, .picker .hint { flex-basis: 100%; }
.upload-queue { flex-basis: 100%; margin: 0.5rem 0 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 0.9rem; }

/* Sales, inbox, activity */
.table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; border-radius: 12px; background: #fff; overflow: hidden; }
.table th, .table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; font-size: 0.9rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.sale-list li, .message, .activity li { display: grid; gap: 0.2rem; margin-bottom: 0.5rem; padding: 0.85rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.sale-list li.is-void { opacity: 0.6; }
.sale-list li.is-void .sale-money { text-decoration: line-through; }
.sale-money { font-weight: 700; }
.sale-money small { color: var(--muted); font-weight: 400; }
.message.status-new { border-left: 4px solid var(--red); }
.message-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0; }
.offer-amount { color: var(--navy); font-size: 1.15rem; }
.message-body { padding: 0.6rem 0.75rem; border-radius: 8px; background: var(--bg); white-space: pre-wrap; }
.message p { margin: 0; }
.status-form { display: flex; gap: 0.35rem; margin-top: 0.4rem; }
.chip { padding: 0.4rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-weight: 600; font-size: 0.85rem; font-family: inherit; cursor: pointer; }
.chip.is-on { border-color: var(--navy); background: var(--navy); color: #fff; }
.menu li a { display: grid; padding: 0.8rem 0; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; text-decoration: none; }
.menu li:last-child a { border-bottom: 0; }
.menu .muted { font-weight: 400; font-size: 0.85rem; }
.plain li { padding: 0.25rem 0; color: var(--ink-2); }
section.card form { margin: 0.5rem 0 0; }
.passkeys li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.passkeys form { margin: 0; }
.toast-warn { display: grid; gap: 0.5rem; background: #fff4d6; color: var(--warn); }
