
/* Layout: phone-first app. Sticky header, scrolling card list, bottom tab bar, full-screen sheets for detail and forms. */
:root {
  --bg: #F2F2EE;
  --surface: #FFFFFF;
  --surface2: #EAEAE4;
  --line: #DEDDD5;
  --ink: #151514;
  --muted: #6A6962;
  --yellow: #FFC400;
  --on-yellow: #151514;
  --green: #1E7B4F;
  --red: #B8342A;
  --blue: #2B58C8;
  --shadow: 0 1px 2px rgba(20,20,10,.06), 0 6px 18px rgba(20,20,10,.06);
  --font-display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110; --surface: #1B1B19; --surface2: #262623; --line: #2F2E2A;
    --ink: #F3F2EC; --muted: #A3A299; --green: #4CC088; --red: #FF8274; --blue: #86A8FF;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111110; --surface: #1B1B19; --surface2: #262623; --line: #2F2E2A;
  --ink: #F3F2EC; --muted: #A3A299; --green: #4CC088; --red: #FF8274; --blue: #86A8FF;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.4;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.app { max-width: 640px; margin: 0 auto; min-height: 100vh; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }

header.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 10px;
}
.brand { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.brand i { width: 14px; height: 14px; background: var(--yellow); border-radius: 4px; display: inline-block; }
.who { font-size: 13px; color: var(--muted); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner { background: var(--surface2); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }

main { padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
h2.sec { font-family: var(--font-display); font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }

nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
nav.tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; font-size: 12px; font-weight: 600; color: var(--muted); position: relative; border-radius: 10px; }
nav.tabs button svg { width: 24px; height: 24px; }
nav.tabs button[aria-current="true"] { color: var(--ink); }
nav.tabs button[aria-current="true"]::before { content: ""; position: absolute; top: -7px; width: 28px; height: 3px; border-radius: 2px; background: var(--yellow); }
.badge { position: absolute; top: 2px; left: calc(50% + 8px); background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

.fab {
  position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 19;
  background: var(--yellow); color: var(--on-yellow); font-weight: 700; padding: 14px 20px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  display: flex; align-items: center; gap: 8px;
}
.fab svg { width: 18px; height: 18px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 14px; color: var(--muted); }
.chip b { font-variant-numeric: tabular-nums; margin-left: 4px; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-pressed="true"] b { color: var(--bg); }

.list { display: grid; gap: 12px; }
.card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); display: grid; grid-template-columns: 112px minmax(0, 1fr); overflow: hidden; text-align: left; width: 100%; min-height: 124px; }
.thumb { background: var(--surface2); display: grid; place-items: center; color: var(--muted); position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.thumb svg { width: 56px; height: 42px; opacity: .6; }
.thumb .count { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
.info { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.info .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.age { font-size: 12px; color: var(--muted); }
.info h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 17px; line-height: 1.15; letter-spacing: -.01em; overflow-wrap: anywhere; }
.meta { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.price-row { margin-top: auto; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price { font-family: var(--font-display); font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.sub { font-size: 12.5px; color: var(--muted); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.s-toclean { background: var(--yellow); color: var(--on-yellow); }
.s-cleaning { background: color-mix(in srgb, var(--blue) 16%, var(--surface)); color: var(--blue); }
.s-ready { background: color-mix(in srgb, var(--green) 18%, var(--surface)); color: var(--green); }
.s-sold { background: var(--surface2); color: var(--muted); }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h3 { font-family: var(--font-display); color: var(--ink); font-size: 20px; margin: 0 0 6px; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.sheet[hidden] { display: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--bg); }
.sheet-head h1 { flex: 1; min-width: 0; margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { padding: 10px 12px; border-radius: 10px; font-weight: 600; color: var(--ink); }
.iconbtn:active { background: var(--surface2); }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.sheet-inner { max-width: 640px; margin: 0 auto; }
.sheet-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet-foot .inner { max-width: 640px; margin: 0 auto; }

.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding: 0 max(16px, env(safe-area-inset-left, 0px)); }
.gallery img { flex: none; height: 260px; max-width: 86%; border-radius: 14px; scroll-snap-align: center; object-fit: cover; background: var(--surface2); }
.gallery .none { height: 160px; width: 100%; border-radius: 14px; background: var(--surface2); display: grid; place-items: center; color: var(--muted); }
.d-title { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1.1; letter-spacing: -.02em; margin: 14px 0 6px; overflow-wrap: anywhere; }
.d-prices { display: flex; gap: 20px; align-items: baseline; flex-wrap: wrap; margin: 4px 0 12px; }
.d-prices .price { font-size: 30px; }
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; background: var(--surface); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
dl.facts dt { color: var(--muted); font-size: 13px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.note { background: var(--surface); border-radius: 14px; padding: 14px; margin-top: 10px; box-shadow: var(--shadow); white-space: pre-wrap; overflow-wrap: anywhere; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--surface2); padding: 4px; border-radius: 12px; margin-top: 14px; }
.seg button { padding: 10px 2px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn { padding: 12px 16px; border-radius: 12px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); }
.btn.primary { background: var(--yellow); color: var(--on-yellow); border-color: var(--yellow); }
.btn.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; padding: 15px; font-size: 16px; }
.btn:disabled { opacity: .5; }

.thread { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.msg { max-width: 88%; display: flex; flex-direction: column; gap: 4px; }
.msg .bubble { background: var(--surface); border-radius: 14px 14px 14px 4px; padding: 10px 12px; box-shadow: var(--shadow); overflow-wrap: anywhere; white-space: pre-wrap; }
.msg .by { font-size: 12px; color: var(--muted); }
.msg.mine { align-self: flex-end; }
.msg.mine .bubble { background: var(--yellow); color: var(--on-yellow); border-radius: 14px 14px 4px 14px; }
.msg.mine .by { text-align: right; }
.msg img { max-width: 100%; border-radius: 10px; margin-top: 6px; display: block; }
.evt { align-self: center; font-size: 12.5px; color: var(--muted); background: var(--surface2); padding: 4px 12px; border-radius: 999px; text-align: center; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 11px 12px; max-height: 120px; }
.attach-chip { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .field .lab { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; font-size: 16px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photos .ph { aspect-ratio: 1; border-radius: 12px; overflow: hidden; position: relative; background: var(--surface2); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .ph button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 13px; background: rgba(0,0,0,.7); color: #fff; font-weight: 700; line-height: 1; }
.photos .add { border: 2px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-weight: 600; font-size: 13px; text-align: center; padding: 6px; }

/* hours */
.clock { background: var(--ink); color: var(--bg); border-radius: 20px; padding: 20px; display: grid; gap: 12px; }
.clock .big { font-family: var(--font-display); font-weight: 800; font-size: 44px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.clock .lab { font-size: 13px; opacity: .7; }
.clock input { background: rgba(255,255,255,.1); border: 0; border-radius: 12px; padding: 12px; color: inherit; width: 100%; font-size: 16px; }
.clock input::placeholder { color: inherit; opacity: .55; }
.clock .btn { border: 0; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat { background: var(--surface); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.stat .n { font-family: var(--font-display); font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--muted); }
.team { background: var(--surface); border-radius: 14px; padding: 6px 14px; box-shadow: var(--shadow); }
.team .r { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.team .r:last-child { border: 0; }
.team .bar { grid-column: 1 / -1; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.team .bar i { display: block; height: 100%; background: var(--yellow); }
.team .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team .hr { font-variant-numeric: tabular-nums; font-weight: 700; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; background: var(--surface); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.entry .when { font-weight: 600; }
.entry .dur { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.entry .sub { grid-column: 1; overflow-wrap: anywhere; }
.entry .rm { grid-column: 2; grid-row: 2; font-size: 12.5px; color: var(--red); text-align: right; padding: 0; }

/* feed */
.fitem { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); text-align: left; width: 100%; }
.fitem .dot { width: 8px; border-radius: 4px; background: var(--line); }
.fitem.new .dot { background: var(--yellow); }
.fitem .t { overflow-wrap: anywhere; }
.fitem .t b { font-weight: 700; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 60; font-weight: 600; max-width: 90%; text-align: center; }
@media (prefers-reduced-motion: no-preference) { .card, .fitem { transition: transform .12s; } .card:active, .fitem:active { transform: scale(.985); } }

/* ---- standalone additions ---- */
html { background: var(--bg); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 18px; max-width: 420px; margin: 0 auto; padding: 24px 0; }
.login .brand { font-size: 30px; }
.login h1 { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -.02em; margin: 0; }
.login p { margin: 0; color: var(--muted); }
.err { color: var(--red); font-size: 14px; min-height: 20px; }
.linkbtn { color: var(--muted); text-decoration: underline; padding: 6px 0; font-size: 14px; }
.who { background: none; color: var(--muted); font-weight: 600; padding: 8px 0 8px 12px; }
.pushcard { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; margin-bottom: 14px; }
.pushcard p { margin: 0; color: var(--muted); font-size: 14px; }
.pushcard strong { color: var(--ink); }
[hidden] { display: none !important; }
