/* Villa Build – app screens. Colours come from the shared Gins tokens (core/gins-core.css) so light and dark match the
 * other family apps. The app accent (brown #92400E) is used only on the app tile, the lock tile and the avatar. */
:root {
  --accent: #92400E;
  --warn: #8A4500; --warn-bg: #FFF1DC; --bad: #B42318; --bad-bg: #FDECEA; --info: #1D4ED8; --info-bg: #E8EEFD; --ok-bg: #E3F1EA;
  --chip: #EEF2F0; --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --warn: #F5B04A; --warn-bg: #33250F; --bad: #FF8A80; --bad-bg: #3A1A17; --info: #9DB8FF; --info-bg: #1A2540; --ok-bg: #12302A; --chip: #1C2B25; color-scheme: dark; } }
:root[data-theme="dark"] { --warn: #F5B04A; --warn-bg: #33250F; --bad: #FF8A80; --bad-bg: #3A1A17; --info: #9DB8FF; --info-bg: #1A2540; --ok-bg: #12302A; --chip: #1C2B25; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--g-bg); color: var(--g-fg); font: 400 15px/1.45 var(--g-font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--g-brand); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 800; }
.muted { color: var(--g-muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid #6FB08F; outline-offset: 2px; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- shell: bottom tabs (phone), icon rail (iPad), sidebar + details pane (desktop) ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding: calc(14px + var(--safe-t)) 16px calc(96px + var(--safe-b)); }
.pane { display: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--g-card); border-top: 1px solid var(--g-line); padding: 6px 4px calc(10px + var(--safe-b)); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 50px; padding-top: 4px; font-size: 11.5px; font-weight: 700; color: var(--g-muted); text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--g-brand); }
.side a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--g-fg); text-decoration: none; font-weight: 700; font-size: 14px; }
.side a[aria-current="page"] { background: var(--ok-bg); color: var(--g-brand); }
.side a .badge { margin-left: auto; font-size: 12px; color: var(--g-muted); font-weight: 600; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 16px; }
.brand i { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.brand b { display: block; font-size: 16px; }
.brand small { display: block; font-size: 12px; color: var(--g-muted); }
@media (min-width: 768px) {
  .tabbar { display: none; }
  .side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; width: 88px; flex-shrink: 0; background: var(--g-card); border-right: 1px solid var(--g-line); padding: 18px 8px; overflow-y: auto; }
  .side .lbl, .brand span, .side a .badge { display: none; }
  .side a { flex-direction: column; justify-content: center; gap: 2px; font-size: 10.5px; min-height: 56px; padding: 6px 2px; }
  .side a .lbl { display: block; }
  .brand { justify-content: center; padding: 0 0 12px; }
  .main { padding: 24px 26px 32px; }
}
@media (min-width: 1100px) {
  .pane.show { display: flex; flex-direction: column; gap: 14px; width: 380px; flex-shrink: 0; border-left: 1px solid var(--g-line); background: var(--g-card); height: 100vh; position: sticky; top: 0; overflow-y: auto; padding: 22px 20px; }
}
@media (min-width: 1280px) {
  .side { width: 240px; padding: 20px 14px; }
  .brand { justify-content: flex-start; padding: 0 6px 16px; }
  .brand span { display: block; }
  .side a { flex-direction: row; justify-content: flex-start; font-size: 14px; min-height: 44px; padding: 0 12px; gap: 10px; }
  .side a .badge { display: inline; }
  .pane.show { width: 400px; }
}
.page { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.head { display: flex; align-items: center; gap: 10px; }
.head .t { flex: 1; min-width: 0; }
.kicker { font-size: 12px; font-weight: 600; color: var(--g-muted); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--g-line); background: var(--g-card); color: var(--g-fg); display: grid; place-items: center; flex-shrink: 0; }
.icon-btn.plain { border-radius: 12px; }
.chip-q { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--info-bg); color: var(--info); font-size: 12.5px; font-weight: 700; }
@media (min-width: 768px) { .head .avatar.phone-only { display: none; } }

/* ---------- banners, cards ---------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; font-size: 13.5px; font-weight: 600; background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.info { background: var(--info-bg); color: var(--info); }
.banner button { margin-left: auto; min-height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: rgba(0,0,0,.07); color: inherit; font-weight: 700; }
.card { background: var(--g-card); border: 1px solid var(--g-line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
button.card, a.card { text-align: left; color: inherit; text-decoration: none; width: 100%; }
.card.sel { border-color: var(--g-brand); box-shadow: 0 0 0 1px var(--g-brand) inset; }
.card .top { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--g-muted); }
.card .top .pill:last-child { margin-left: auto; }
.card .title { font-size: 15px; font-weight: 600; }
.card .sub { font-size: 13px; color: var(--g-muted); }
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--g-muted); white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--ok-bg); color: var(--g-brand); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; font-weight: 600; }
.tags span { padding: 3px 8px; border-radius: 8px; background: var(--chip); }
.flag { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--bad); }
.flag svg { width: 14px; height: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--g-line); background: var(--g-card); font-weight: 700; font-size: 14px; text-decoration: none; color: var(--g-fg); }
.btn.primary { background: var(--g-brand); border-color: var(--g-brand); color: var(--g-brand-fg); }
.btn.big { min-height: 56px; border-radius: 16px; font-size: 16px; width: 100%; }
.btn.block { width: 100%; min-height: 50px; }
.btn.danger { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn.dash { border: 1.5px dashed var(--g-brand); background: var(--ok-bg); color: var(--g-brand); width: 100%; }
.btn:disabled { opacity: .5; }
.link-btn { border: 0; background: none; color: var(--g-brand); font-weight: 700; min-height: 44px; padding: 0 4px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 768px) { .kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 14px; background: var(--g-card); border: 1px solid var(--g-line); color: inherit; text-decoration: none; min-width: 0; }
.kpi .l { font-size: 11.5px; font-weight: 600; color: var(--g-muted); }
.kpi .v { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.kpi .n { font-size: 11.5px; font-weight: 700; }
.hero { padding: 16px; border-radius: 18px; background: var(--g-brand); color: var(--g-brand-fg); display: flex; flex-direction: column; gap: 10px; }
.hero .l { font-size: 12.5px; font-weight: 600; opacity: .85; }
.hero .v { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.hero .g { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-size: 12.5px; }
.hero .g div { padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.14); }
.hero .g b { display: block; }
.sec-h { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--g-muted); padding: 6px 2px 0; }
.sec-h.big { font-size: 16px; font-weight: 800; color: var(--g-fg); }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--chip); }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--g-muted); font-weight: 700; font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: var(--g-card); color: var(--g-fg); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button, .chips button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--g-line); background: var(--g-card); font-weight: 700; font-size: 13.5px; }
.filters button[aria-pressed="true"], .chips button[aria-pressed="true"] { background: var(--g-brand); border-color: var(--g-brand); color: var(--g-brand-fg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.bar { height: 8px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.bar i { display: block; height: 8px; background: var(--g-brand); border-radius: 999px; }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; background: var(--g-card); border: 1px solid var(--g-line); color: inherit; text-decoration: none; width: 100%; text-align: left; min-height: 52px; }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-size: 14px; }
.row .t span { display: block; font-size: 12px; color: var(--g-muted); overflow-wrap: anywhere; }
.row .r { font-weight: 800; white-space: nowrap; }
.empty { padding: 26px 16px; text-align: center; color: var(--g-muted); border: 1px dashed var(--g-line); border-radius: 16px; }
.masked { color: inherit; letter-spacing: 1px; opacity: .85; }
.search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--g-line); background: var(--g-card); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; }
.tbl { overflow-x: auto; border: 1px solid var(--g-line); border-radius: 14px; background: var(--g-card); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 12px; color: var(--g-muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--g-line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--g-line); white-space: nowrap; }
td.r, th.r { text-align: right; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini { padding: 10px 12px; border-radius: 12px; background: var(--chip); font-size: 12.5px; }
.mini b { display: block; font-size: 16px; }
.cols { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 768px) { .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; } }
.cols > div { display: flex; flex-direction: column; gap: 10px; }
.fab { position: fixed; right: 18px; bottom: calc(86px + var(--safe-b)); z-index: 21; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--g-brand); color: var(--g-brand-fg); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
@media (min-width: 768px) { .fab { display: none; } }
.only-wide { display: none; }
@media (min-width: 768px) { .only-wide { display: inline-flex; } .only-phone { display: none !important; } }

/* ---------- forms (sheet on phone, pane on desktop) ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--g-muted); }
.f input, .f select, .f textarea { min-height: 46px; border-radius: 12px; border: 1px solid var(--g-input); background: var(--g-card); color: var(--g-fg); padding: 0 12px; font-size: 16px; font-weight: 500; width: 100%; }
.f textarea { padding: 10px 12px; min-height: 84px; resize: vertical; }
.f input[type="range"] { padding: 0; border: 0; accent-color: var(--g-brand); }
.f .big { font-size: 22px; font-weight: 800; min-height: 54px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--g-brand); }
.note { padding: 10px 12px; border-radius: 12px; background: var(--ok-bg); color: var(--g-brand); font-size: 12.5px; font-weight: 600; }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.thumbs .th { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--chip); }
.thumbs .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .th button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; }
.thumbs .add { aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--g-brand); background: var(--ok-bg); color: var(--g-brand); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 700; }
.err { color: var(--bad); font-size: 13px; font-weight: 600; min-height: 1em; }
.full { position: fixed; inset: 0; z-index: 40; background: var(--g-bg); display: flex; flex-direction: column; }
.full .fh { display: flex; align-items: center; gap: 10px; padding: calc(14px + var(--safe-t)) 12px 10px 16px; border-bottom: 1px solid var(--g-line); background: var(--g-card); }
.full .fh .t { flex: 1; min-width: 0; }
.full .fh h2 { font-size: 20px; }
.full .fb { flex: 1; overflow-y: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.full .ff { padding: 12px 16px calc(14px + var(--safe-b)); border-top: 1px solid var(--g-line); background: var(--g-card); }
.pane .ff { margin-top: 4px; }
.pane-empty { padding-top: 80px; text-align: center; color: var(--g-muted); }

/* ---------- confirm-it's-you modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: var(--g-scrim); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 768px) { .modal-bg { align-items: center; } }
.modal { width: 100%; max-width: 420px; background: var(--g-card); border-radius: 22px 22px 0 0; padding: 20px 20px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 768px) { .modal { border-radius: 22px; } }
.modal input.pin { text-align: center; letter-spacing: 8px; font-size: 22px; min-height: 52px; border-radius: 12px; border: 1px solid var(--g-input); background: var(--g-card); }
.modal .actions { display: flex; gap: 10px; }
.modal .actions .btn { flex: 1; }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(96px + var(--safe-b)); z-index: 80; max-width: 460px; margin: 0 auto; padding: 12px 16px; border-radius: 14px; background: var(--g-fg); color: var(--g-bg); font-weight: 600; font-size: 14px; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: none; }
@media (min-width: 768px) { #toast { bottom: 24px; } }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
