/* Jobsites: one stylesheet. Desktop by default; `.m` on #app = phone layout. */

:root {
  /* One orange scale, lightest to darkest. Every color in the app is one of these or white. */
  --o-50: #FFF8F0;
  --o-100: #FFEEDC;
  --o-200: #FFDAB3;
  --o-300: #FFBE80;
  --o-400: #FFA146;
  --o-500: #FF830F;   /* primary orange */
  --o-600: #FF6600;   /* deeper orange: hover, pressed, strong accents */
  --o-700: #C24E00;
  --o-800: #8A3700;
  --o-900: #3F1A05;

  --brand: var(--o-500);
  --brand-dark: var(--o-600);
  --brand-text: var(--o-700);     /* orange for small text: #FF6600 is too light to read on white */
  --brand-soft: var(--o-100);
  --brand-track: var(--o-200);
  --ink: var(--o-900);            /* main text: darkest orange */
  --ink-2: #6E3E20;               /* secondary text */
  --muted: #976A4F;               /* hints, timestamps */
  --bg: var(--o-50);
  --card: #fff;
  --line: #F5E2D4;
  --line-2: #FAEEE5;
  /* meaning carried by shade: lighter = fine / done, darker = needs attention */
  --good: var(--o-600);
  --good-ink: var(--o-700);
  --good-soft: var(--o-100);
  --good-track: var(--o-200);
  --warn: var(--o-800);
  --warn-ink: var(--o-800);
  --warn-soft: var(--o-200);
  --bad: var(--o-800);
  --bad-soft: var(--o-200);
  --radius: 16px;
  --shadow: 0 1px 2px rgba(124, 50, 8, .05), 0 1px 3px rgba(124, 50, 8, .07);
  --shadow-lg: 0 12px 32px rgba(124, 50, 8, .16);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 750; }
h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
small { font-size: 13px; }
.ic { flex-shrink: 0; }
.muted { color: var(--muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- stage: desktop vs phone frame ---------- */

#stage, #phone { height: 100%; }
#phone { position: relative; }
#app { height: 100%; position: relative; overflow: hidden; overflow: clip; container: app / inline-size; }

body.phone-mode { background: var(--o-100); }
body.phone-mode #stage { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; padding: 20px; }
body.phone-mode #stage::after { content: "Phone preview · 390 × 844"; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
body.phone-mode #phone {
  width: 390px; height: min(844px, calc(100vh - 70px)); flex-shrink: 0;
  border: 12px solid var(--o-900); border-radius: 52px; overflow: hidden; overflow: clip; background: var(--bg);
  box-shadow: 0 0 0 2px var(--o-800), 0 30px 80px rgba(124, 50, 8, .3);
}
body.phone-mode #phone::before {
  content: ""; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 30px; border-radius: 20px; background: var(--o-900); z-index: 200;
}

/* ---------- demo bar ---------- */

#demobar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; justify-content: center;
  transform: translateY(calc(-100% - 40px)); transition: transform .22s ease; pointer-events: none;
}
#demobar.show { transform: translateY(0); pointer-events: auto; }
.demo-inner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: #fff; color: var(--ink); padding: 10px 14px; border-radius: 0 0 16px 16px; border: 1px solid var(--line); border-top: 0;
  box-shadow: var(--shadow-lg); font-size: 13px; max-width: calc(100vw - 16px);
}
.demo-tag { background: var(--brand); color: #fff; font-weight: 800; font-size: 11px; padding: 3px 7px; border-radius: 6px; letter-spacing: .06em; }
.demo-label { color: var(--muted); }
.demo-seg { display: inline-flex; background: var(--o-100); border-radius: 9px; padding: 3px; }
.demo-seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--ink-2); padding: 6px 11px; border-radius: 7px; font-weight: 600; font-size: 13px; }
.demo-seg button.on { background: var(--brand); color: #fff; }
.demo-select { background: var(--o-100); color: var(--ink); border: 0; border-radius: 9px; padding: 7px 10px; font-size: 13px; }
.demo-sep { width: 1px; height: 22px; background: var(--line); }
.demo-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line); color: var(--ink-2); padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.demo-btn:hover { border-color: var(--brand); color: var(--brand-text); }

/* ---------- buttons, inputs, small pieces ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--o-50); border-color: var(--o-200); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-text); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; gap: 6px; }
.btn.big { height: 52px; padding: 0 20px; font-size: 17px; border-radius: 12px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--o-100); }
.btn.danger, .icon-btn.danger:hover { color: var(--bad); }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-2); text-decoration: none; flex-shrink: 0;
}
.icon-btn:hover { background: var(--o-100); color: var(--ink); }
.link { background: none; border: 0; padding: 0; color: var(--brand-text); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.link:hover { text-decoration: underline; }
.link.center { display: flex; margin: 10px auto 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-sub { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
.count-pill { background: var(--o-100); color: var(--ink-2); font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.count-pill.good { background: var(--good-soft); color: var(--good-ink); }

.av {
  display: inline-grid; place-items: center; border-radius: 50%; flex-shrink: 0;
  background: var(--av); color: #fff; font-weight: 700; letter-spacing: .02em; user-select: none;
}
.av-client { background: #fff; color: var(--o-700); box-shadow: inset 0 0 0 2px var(--o-600); }
.av-group { background: var(--brand-soft); color: var(--brand-text); }
.av-more { background: var(--o-200); color: var(--ink-2); font-size: 11px; font-weight: 700; }
.av-stack { display: inline-flex; }
.av-stack .av { box-shadow: 0 0 0 2px #fff; }
.av-stack .av + .av { margin-left: -8px; }

.status { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 650; padding: 4px 10px 4px 8px; border-radius: 99px; }
.status-ontrack { background: var(--good-soft); color: var(--good-ink); }
.status-watch { background: var(--o-700); color: #fff; }

.tag { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 6px; background: var(--o-100); color: var(--ink-2); vertical-align: middle; }
.tag-manager { background: var(--o-200); color: var(--o-800); }
.tag-client { background: #fff; color: var(--o-700); box-shadow: inset 0 0 0 1.5px var(--o-300); }
.tag-boss { background: var(--o-800); color: #fff; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--o-100); color: var(--ink-2); border: 0; }
.chip-warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip-good { background: var(--good-soft); color: var(--good-ink); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-btn { cursor: pointer; border: 1px solid var(--line); background: #fff; padding: 6px 11px; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand-text); }

/* meters: fill + lighter track of the same hue */
.meter { height: 8px; border-radius: 99px; overflow: hidden; background: var(--brand-track); margin-top: 8px; }
.meter span { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .3s; }
.meter-good { background: var(--good-track); } .meter-good span { background: var(--good); }
.meter-warn { background: var(--o-200); } .meter-warn span { background: var(--warn); }
.meter-neutral { background: var(--o-100); } .meter-neutral span { background: var(--o-300); }
.meter-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.meter-label b { color: var(--ink); font-size: 14px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 12px; color: var(--muted); }
.empty-title { font-weight: 650; color: var(--ink-2); }
.empty-sub { font-size: 14px; max-width: 320px; }

.hint { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.hint .ic { margin-top: 2px; }

.tabs { display: flex; gap: 4px; background: var(--o-100); border-radius: 11px; padding: 4px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.tabs button span { color: var(--muted); font-weight: 600; margin-left: 2px; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* language switch */
.lang-seg { display: inline-flex; background: var(--o-100); border-radius: 10px; padding: 3px; }
.lang-seg button { border: 0; background: none; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.lang-seg button.on { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.lang-select { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; height: 36px; border-radius: 10px; background: var(--o-100); color: var(--ink-2); flex-shrink: 0; }
.lang-select select { border: 0; background: none; font-weight: 650; font-size: 14px; padding: 0; outline: none; }

/* logo */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.logo-mark svg { width: 26px; height: 26px; }
.logo-mark.sm { width: 32px; height: 32px; }
.logo-word { font-size: 21px; font-weight: 800; letter-spacing: -.03em; }

/* ---------- desktop shell (boss + site manager) ---------- */

.shell { display: flex; height: 100%; }
.sidebar { width: 248px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); color: var(--ink-2); display: flex; flex-direction: column; padding: 20px 14px 14px; overflow-y: auto; }
.sidebar .brand { padding: 2px 8px 22px; color: var(--ink); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 0; background: none; color: inherit; font-size: 15px; font-weight: 550; text-align: left; width: 100%; }
.nav-item:hover { background: var(--o-50); color: var(--ink); }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item .nav-ic { display: inline-grid; position: relative; }
.nav-item.site-link { padding: 8px 12px; font-size: 14px; }
.nav-item.add-link { color: var(--muted); font-size: 14px; padding: 8px 12px; }
.nav-section { text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); margin: 22px 12px 6px; }
.nav-badge { background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; display: inline-grid; place-items: center; line-height: 1; }
.nav-ic .nav-badge { position: absolute; top: -7px; right: -10px; box-shadow: 0 0 0 2px #fff; }
.nav-item.active .nav-badge { background: #fff; color: var(--brand-text); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin: 0 5px 0 6px; }
.dot-ontrack { background: var(--o-300); }
.dot-watch { background: var(--o-800); }
.side-bottom { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.side-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 0 6px; }
.sidebar .lang-seg { margin: 0 4px; }
.sidebar .lang-seg button { flex: 1; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.me-name { color: var(--ink); font-weight: 650; font-size: 14px; }
.me-role { font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.main-scroll.fill { overflow: hidden; display: flex; flex-direction: column; }

.page { padding: 28px 32px 56px; max-width: 1360px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.sub { color: var(--muted); margin: 6px 0 0; font-size: 15px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* ---------- boss dashboard ---------- */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.kpi-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.kpi.good .kpi-ic { background: var(--good-soft); color: var(--good-ink); }
.kpi-value { font-size: 38px; font-weight: 750; letter-spacing: -.02em; margin-top: 10px; line-height: 1.1; }
.kpi.good .kpi-value { color: var(--good-ink); }
.kpi-foot { color: var(--muted); font-size: 13px; margin-top: 8px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 24px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 20px; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.site-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.site-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.site-photo { position: relative; aspect-ratio: 16 / 8; background: var(--o-100); }
.site-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.site-photo .status { position: absolute; top: 10px; left: 10px; box-shadow: var(--shadow); }
.site-photo .status-ontrack { background: #fff; }
.unread-dot { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 4px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.site-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; width: 100%; }
.site-name { font-size: 16px; font-weight: 700; }
.site-addr { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-top: 3px; }
.site-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.site-stats div { background: var(--o-50); border-radius: 10px; padding: 8px 10px; }
.site-stats small { color: var(--muted); font-size: 12px; }
.site-stats small:first-child { display: block; }
.site-stats b { font-size: 16px; }
.site-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.site-foot .mgr { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; min-width: 0; }
.add-card { align-items: center; justify-content: center; gap: 6px; min-height: 260px; border: 2px dashed var(--o-200); background: transparent; box-shadow: none; color: var(--ink-2); font-weight: 700; font-size: 16px; text-align: center; }
.add-card small { color: var(--muted); font-weight: 500; }
.add-card:hover { border-color: var(--brand); color: var(--brand-text); background: var(--brand-soft); }

.att-list { display: flex; flex-direction: column; }
.att-item { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.att-item:first-child { border-top: 0; padding-top: 2px; }
.att-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.ic-good { background: var(--good-soft); color: var(--good-ink); }
.att-main { flex: 1; min-width: 0; }
.att-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.time { color: var(--muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.att-tag { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 1px; }
.att-tag.tag-client { color: var(--o-700); background: none; box-shadow: none; }
.att-tag.tag-manager { color: var(--o-600); background: none; }
.att-text { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.att-actions { display: flex; gap: 8px; margin-top: 10px; }

.ev-list { display: flex; flex-direction: column; gap: 12px; }
.ev-row { display: flex; gap: 12px; }
.ev-when { width: 78px; flex-shrink: 0; display: flex; flex-direction: column; font-size: 13px; }
.ev-when span { color: var(--muted); }
.ev-what { flex: 1; font-size: 14px; font-weight: 550; }
.ev-what small { color: var(--muted); font-weight: 500; }
.ev-type { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; margin-bottom: 2px; }

/* event colors (type is always also written as text) */
.ev-consult { --evc: var(--o-800); --evb: var(--o-200); }
.ev-inspection { --evc: var(--o-600); --evb: var(--o-100); }
.ev-delivery { --evc: var(--o-400); --evb: var(--o-50); }
.ev-other { --evc: var(--o-300); --evb: #fff; }
.ev-type { background: var(--evb); color: var(--evc); }

/* ---------- project page ---------- */

.back-link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--ink-2); font-weight: 600; padding: 0; margin-bottom: 12px; font-size: 14px; }
.back-link:hover { color: var(--ink); }
.proj-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.proj-title h1 { margin: 10px 0 6px; }
.addr { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; }
.addr:hover { text-decoration: underline; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.mini-stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.mini-stat small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.mini-stat b { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.stat-foot { display: block; font-size: 12px; color: var(--muted); margin-top: 8px; }

.proj-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.col-main, .col-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.photo-card { padding: 0; overflow: hidden; position: relative; }
.photo-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.photo-btn { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .95); padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 650; cursor: pointer; box-shadow: var(--shadow); }

.details { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.details dt { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.details dd { margin: 0; font-size: 15px; }
.details dd a { color: var(--brand-text); font-weight: 600; text-decoration: none; }
.details.compact { gap: 10px; margin-top: 14px; }
.details.compact > div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: baseline; }
.money-box { background: var(--o-50); border-radius: 12px; padding: 14px; margin-top: 18px; }
.money-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-2); padding: 3px 0; }
.money-row b { color: var(--ink); font-size: 15px; }
.money-row small { color: var(--muted); font-weight: 500; }
.progress-edit { margin-top: 6px; }
.progress-edit input[type=range] { width: 100%; accent-color: var(--brand); margin-top: 8px; height: 28px; }

.person-line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.person-line:first-of-type { border-top: 0; }
.pl-main { flex: 1; min-width: 0; }
.pl-name { font-weight: 650; font-size: 15px; }
.pl-sub { font-size: 13px; color: var(--muted); }

.receipt-line { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 4px; border-top: 1px solid var(--line-2); border-radius: 8px; }
.receipt-line:hover { background: var(--o-50); }
.rl-main { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.rl-main small { display: block; color: var(--muted); font-weight: 500; }

/* to-do list */
.task-list { display: flex; flex-direction: column; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-top: 1px solid var(--line-2); }
.task:first-child { border-top: 0; }
.check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--o-300); background: #fff; color: transparent;
  display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; transition: all .12s;
}
.check:hover { border-color: var(--good); color: var(--good); }
.task.done .check { background: var(--good); border-color: var(--good); color: #fff; }
.task-main { flex: 1; min-width: 0; cursor: pointer; }
.task-text { font-size: 16px; font-weight: 600; }
.task.done .task-text { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.assignees { display: inline-flex; align-items: center; gap: 6px; }

/* week calendar */
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.week-title { font-weight: 700; }
.week-nav { display: flex; align-items: center; gap: 4px; }
.week-nav .btn.sm:last-child { margin-left: 6px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wday { border: 1px solid var(--line); border-radius: 12px; background: var(--o-50); min-height: 150px; display: flex; flex-direction: column; }
.wday.is-today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: #fff; }
.wday.is-past { opacity: .62; }
.wday-head { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 10px 6px; border-bottom: 1px solid var(--line-2); font-size: 12px; color: var(--muted); font-weight: 650; text-transform: uppercase; }
.wday-head b { font-size: 17px; color: var(--ink); }
.wday.is-today .wday-head b { color: #fff; background: var(--brand); border-radius: 99px; min-width: 26px; height: 26px; display: inline-grid; place-items: center; font-size: 14px; }
.wday-body { padding: 6px; display: flex; flex-direction: column; gap: 5px; flex: 1; position: relative; }
.ev { background: var(--evb); border-left: 3px solid var(--evc); border-radius: 6px; padding: 4px 6px; font-size: 12px; display: flex; flex-direction: column; line-height: 1.3; }
.ev-time { color: var(--evc); font-weight: 700; font-size: 11px; }
.ev-title { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ev-site { color: var(--muted); font-size: 11px; }
.wtask { font-size: 12px; padding: 4px 6px; border-radius: 6px; background: var(--o-100); cursor: pointer; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wtask.done { text-decoration: line-through; color: var(--muted); }
.wmore { font-size: 12px; color: var(--muted); font-weight: 600; padding: 2px 6px; }
.wadd { margin-top: auto; align-self: flex-end; width: 26px; height: 26px; border-radius: 8px; border: 1px dashed var(--o-300); background: #fff; color: var(--muted); display: grid; place-items: center; opacity: 0; transition: opacity .12s; }
.wday:hover .wadd { opacity: 1; }
.wadd:hover { border-color: var(--brand); color: var(--brand); }
.legend { display: flex; gap: 18px; margin-top: 12px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.ev-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--evb); border-left: 3px solid var(--evc); }

/* ---------- team ---------- */

.team-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.team-side { display: flex; flex-direction: column; gap: 20px; }
.people { display: flex; flex-direction: column; }
.person-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 160px auto; gap: 14px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line-2); }
.person-row:first-child { border-top: 0; }
.pr-name { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pr-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-actions { display: flex; }
.site-select { height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 8px; background: #fff; width: 100%; font-size: 14px; }
.announce-line { padding: 10px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.announce-line:first-of-type { border-top: 0; padding-top: 0; }
.announce-line small { color: var(--muted); }

/* ---------- messages ---------- */

.msg-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100%; min-height: 0; flex: 1; background: #fff; }
.conv-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.conv-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 12px; }
.conv-head h2 { font-size: 20px; }
.conv-items { overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.conv-item:hover { background: var(--o-50); }
.conv-item.active { background: var(--brand-soft); }
.ci-main { flex: 1; min-width: 0; }
.ci-top, .ci-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ci-top b { font-weight: 600; font-size: 15px; }
.ci-bottom { color: var(--muted); font-size: 14px; margin-top: 2px; }
.conv-item.unread .ci-top b { font-weight: 800; }
.conv-item.unread .ci-bottom > span:first-child { color: var(--ink); font-weight: 600; }
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--o-50); }
.chat-empty { justify-content: center; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.ch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-main small { color: var(--muted); }
.chat-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.day-div { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; margin: 6px 0; }
.day-div span { background: var(--o-100); padding: 3px 10px; border-radius: 99px; }
.bubble-row { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
.bubble-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble-wrap { display: flex; flex-direction: column; min-width: 0; }
.bubble-row.mine .bubble-wrap { align-items: flex-end; }
.bubble-name { font-size: 12px; color: var(--muted); font-weight: 600; margin: 0 0 2px 4px; }
.bubble { background: #fff; border: 1px solid var(--line); padding: 9px 13px; border-radius: 18px 18px 18px 6px; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; }
.bubble-row.mine .bubble { background: var(--brand); color: #fff; border-color: var(--brand); border-radius: 18px 18px 6px 18px; }
.bubble-time { font-size: 11px; color: var(--muted); margin: 3px 6px 0; }
.composer { display: flex; gap: 8px; padding: 12px 16px; background: #fff; border-top: 1px solid var(--line); }
.composer input { flex: 1; height: 48px; border: 1.5px solid var(--line); border-radius: 24px; padding: 0 18px; font-size: 16px; outline: none; min-width: 0; }
.composer input:focus { border-color: var(--brand); }
.composer .send { height: 48px; border-radius: 24px; }

/* ---------- worker ---------- */

.wshell { display: flex; flex-direction: column; height: 100%; }
.wtop { height: 66px; flex-shrink: 0; display: flex; align-items: center; gap: 20px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.wtabs { display: flex; gap: 6px; flex: 1; justify-content: center; }
.wtab { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 9px 16px; border-radius: 10px; font-weight: 650; font-size: 16px; color: var(--ink-2); }
.wtab .nav-ic { position: relative; display: inline-grid; }
.wtab .nav-ic .nav-badge { box-shadow: 0 0 0 2px #fff; }
.wtab:hover { background: var(--o-50); color: var(--ink); }
.wtab.active { background: var(--brand); color: #fff; }
.wtab.active .nav-badge { background: #fff; color: var(--brand-text); }
.wtop-right { display: flex; align-items: center; gap: 14px; }
.me-chip { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }

.w-page { max-width: 660px; margin: 0 auto; padding: 28px 20px 48px; display: flex; flex-direction: column; gap: 16px; }
.w-hello h1 { font-size: 30px; }
.w-hello p { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.announce-banner { display: flex; gap: 12px; align-items: center; background: var(--o-100); border: 1px solid var(--o-200); color: var(--o-800); border-radius: 14px; padding: 14px 16px; font-weight: 600; font-size: 15px; }
.announce-banner .ic { color: var(--brand); }
.w-site { padding: 0; overflow: hidden; }
.w-site img { width: 100%; height: 180px; object-fit: cover; display: block; }
.w-site-body { padding: 16px 18px 18px; }
.eyebrow { text-transform: uppercase; font-size: 12px; font-weight: 750; letter-spacing: .07em; color: var(--brand-text); }
.w-site h2 { font-size: 21px; margin-top: 4px; }
.w-addr { display: flex; align-items: center; gap: 6px; color: var(--ink-2); margin: 6px 0 14px; font-size: 15px; }
.w-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.w-actions .btn { height: 48px; font-size: 16px; }
.w-tasks { display: flex; flex-direction: column; gap: 10px; }
.wt-row { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.wt-row.purchase { background: var(--o-50); border-color: var(--o-200); }
.wt-row.done { background: var(--o-50); }
.wt-status { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; border: 2px dashed var(--o-300); color: var(--muted); }
.wt-row.done .wt-status { background: var(--good); border: 0; color: #fff; }
.wt-row.purchase .wt-status { background: var(--brand); border: 0; color: #fff; }
.wt-main { flex: 1; min-width: 0; cursor: pointer; }
.wt-text { font-size: 17px; font-weight: 650; line-height: 1.3; }
.wt-row.done .wt-text { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.wt-meta { font-size: 14px; color: var(--muted); margin-top: 3px; }
.wt-meta .late { color: var(--bad); font-weight: 650; }
.new-tag { display: inline-block; background: var(--o-700); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 5px; margin-right: 6px; vertical-align: 2px; letter-spacing: .04em; }
.w-later { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line-2); color: var(--ink-2); cursor: pointer; }
.w-later:first-of-type { border-top: 0; }

/* ---------- modals + forms ---------- */

.modal-layer { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(63, 26, 5, .4); }
.modal { position: relative; background: #fff; border-radius: 18px; width: min(520px, 100%); max-height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-wide { width: min(700px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 18px 22px 6px; overflow-y: auto; flex: 1; min-height: 0; }
form.modal-body { display: flex; flex-direction: column; }
form.modal-body > * { flex-shrink: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-2); background: #fff; border-radius: 0 0 18px 18px; }
form .modal-foot { margin: 8px -22px 0; position: sticky; bottom: -6px; }
.modal-layer.anim .modal-backdrop { animation: fade .18s ease; }
.modal-layer.anim .modal { animation: pop .22s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes sheet { from { transform: translateY(100%); } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field-label { font-size: 14px; font-weight: 650; color: var(--ink); }
.field-label small { color: var(--muted); font-weight: 500; }
.field-hint { color: var(--muted); font-size: 13px; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; height: 46px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px;
  font-size: 16px; background: #fff; outline: none; transition: border-color .12s, box-shadow .12s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 131, 15, .15); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.money-input { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding-left: 12px; }
.money-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 131, 15, .15); }
.money-input span { color: var(--muted); font-weight: 650; }
.field .money-input input { border: 0 !important; box-shadow: none !important; padding-left: 6px; }
.money-input.big input { font-size: 24px !important; font-weight: 700; height: 56px !important; }
.form-error { color: var(--bad); font-size: 14px; font-weight: 600; min-height: 0; }
.form-error:not(:empty) { margin-bottom: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check > span { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 5px; border: 1.5px solid var(--line); border-radius: 99px; font-size: 14px; font-weight: 600; cursor: pointer; background: #fff; transition: all .12s; }
.chip-check > span small { color: var(--muted); font-weight: 500; font-size: 12px; }
.chip-check input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.chip-check input:focus-visible + span { box-shadow: 0 0 0 3px rgba(255, 131, 15, .25); }
.quick-groups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.recipients { display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--o-50); }
.rec-group small { display: block; font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }

.seg { display: inline-flex; flex-wrap: wrap; background: var(--o-100); border-radius: 11px; padding: 4px; gap: 2px; align-self: flex-start; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg > label > span { display: block; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(255, 131, 15, .25); }
.pick-date { display: none; margin-top: 8px; }
.form:has(input[name=when][value=pick]:checked) .pick-date { display: block; }

.toggle-row { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; margin-bottom: 14px; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row > span:last-child { display: flex; flex-direction: column; }
.toggle-row small { color: var(--muted); }
.toggle { width: 46px; height: 28px; border-radius: 99px; background: var(--o-200); position: relative; flex-shrink: 0; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(124, 50, 8, .25); transition: transform .15s; }
.toggle-row input:checked + .toggle { background: var(--brand); }
.toggle-row input:checked + .toggle::after { transform: translateX(18px); }
.form:has(#isPurchase:checked) .toggle-row { border-color: var(--brand); background: var(--brand-soft); }
.purchase-fields { display: none; }
.form:has(#isPurchase:checked) .purchase-fields { display: block; }

.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.pick-row input { position: absolute; opacity: 0; pointer-events: none; }
.pick-row .pr-main { flex: 1; display: flex; flex-direction: column; }
.pick-row small { color: var(--muted); }
.tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--o-300); display: grid; place-items: center; color: transparent; }
.pick-row:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.pick-row:has(input:checked) .tick { background: var(--brand); border-color: var(--brand); color: #fff; }

.task-detail-text { font-size: 20px; font-weight: 700; line-height: 1.3; }
.task-ref { display: flex; gap: 8px; align-items: center; background: var(--brand-soft); color: var(--brand-text); padding: 10px 12px; border-radius: 10px; font-weight: 600; margin-bottom: 12px; }
.camera-box { position: relative; display: block; height: 300px; border-radius: 22px; background: var(--o-900); overflow: hidden; cursor: pointer; border: 6px solid #2A1103; }
.camera-box img { width: 100%; height: 100%; object-fit: contain; display: none; background: #4A230B; }
.camera-box.has-photo img { display: block; }
.camera-empty { position: absolute; inset: 0 0 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--o-200); }
.camera-box.has-photo .camera-empty { display: none; }
.shutter { position: absolute; left: 0; right: 0; bottom: 0; height: 70px; border-top: 1px solid #5A2C0E; background: rgba(42, 17, 3, .85); }
.shutter::after { content: ""; position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(250, 191, 151, .45); }
.camera-box.has-photo .shutter { display: none; }
.receipt-img { width: 100%; max-height: 380px; object-fit: contain; background: var(--o-100); border-radius: 12px; }
.photo-drop { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1.5px dashed var(--o-300); border-radius: 12px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.photo-drop span { display: inline-flex; align-items: center; gap: 8px; }
.photo-drop img { width: 96px; height: 60px; object-fit: cover; border-radius: 8px; }
.photo-drop:hover { border-color: var(--brand); color: var(--brand-text); }

/* ---------- toasts ---------- */

#toasts { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--o-800); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 15px; font-weight: 550; box-shadow: var(--shadow-lg); animation: pop .25s ease; transition: opacity .35s, transform .35s; }
.toast .ic { color: var(--o-300); }
.toast.out { opacity: 0; transform: translateY(8px); }
body.phone-mode #toasts { bottom: 96px; }

/* ---------- medium desktop widths ---------- */

@container app (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: minmax(0, 1fr) 330px; }
  .proj-grid { grid-template-columns: minmax(0, 1fr) 340px; }
  .team-grid { grid-template-columns: minmax(0, 1fr) 330px; }
}
@container app (max-width: 1040px) {
  .dash-grid, .proj-grid, .team-grid { grid-template-columns: minmax(0, 1fr); }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .person-row { grid-template-columns: 42px minmax(0, 1fr) 150px auto; }
}

/* ---------- phone layout ---------- */

.mshell { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.mtop { display: flex; align-items: center; gap: 6px; height: 58px; flex-shrink: 0; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--line); color: var(--ink); padding-top: env(safe-area-inset-top); box-sizing: content-box; }
body.phone-mode .mtop { padding-top: 40px; }
.mtitle { flex: 1; font-weight: 750; font-size: 18px; margin-left: 4px; }
.tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); flex-shrink: 0; }
body.phone-mode .tabbar { padding-bottom: 22px; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; padding: 6px 2px; color: var(--muted); font-size: 11px; font-weight: 650; border-radius: 10px; }
.tab .nav-ic { position: relative; display: inline-grid; }
.tab .nav-ic .nav-badge { box-shadow: 0 0 0 2px #fff; }
.tab.active { color: var(--brand); }
.tab .nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.phone-mode .in-chat .composer { padding-bottom: 26px; }

.m .page { padding: 16px 14px 28px; }
.m h1 { font-size: 24px; }
.m .page-head { flex-direction: column; align-items: stretch; margin-bottom: 16px; gap: 12px; }
.m .page-head .btn { width: 100%; }
.m .card { padding: 16px; border-radius: 14px; }
.m .w-site, .m .photo-card { padding: 0; }
.m .kpis { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.m .kpi { padding: 14px; }
.m .kpi-top { font-size: 13px; align-items: flex-start; }
.m .kpi-ic { display: none; }
.m .kpi-value { font-size: 28px; margin-top: 6px; }
.m .kpi-foot { font-size: 12px; }
.m .dash-grid { display: flex; flex-direction: column; gap: 18px; }
.m .dash-side { order: -1; gap: 14px; }
.m .site-grid { grid-template-columns: 1fr; }
.m .add-card { min-height: 120px; }

.m .back-link { display: none; }
.m .proj-head { flex-direction: column; align-items: stretch; margin-bottom: 14px; }
.m .proj-title h1 { font-size: 22px; }
.m .head-actions { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 0 14px 2px; scrollbar-width: none; }
.m .head-actions .btn { height: 40px; font-size: 14px; }
.m .mini-stats { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.m .mini-stat b { font-size: 22px; }
.m .proj-grid { display: flex; flex-direction: column; gap: 14px; }
.m .col-main, .m .col-side { display: contents; }
.m .o-photo { order: 1; }
.m .o-todo { order: 2; }
.m .o-details { order: 3; }
.m .o-workers { order: 4; }
.m .o-week { order: 5; }
.m .o-receipts { order: 6; }
.m .o-todo .card-head .btn { height: 40px; padding: 0 14px; }
.m .task-text { font-size: 15px; }

.m .week-grid { grid-template-columns: 1fr; gap: 6px; }
.m .wday { min-height: 0; flex-direction: row; }
.m .wday-head { flex-direction: column; justify-content: center; align-items: center; width: 58px; flex-shrink: 0; border-bottom: 0; border-right: 1px solid var(--line-2); gap: 2px; }
.m .wday-body { flex-direction: row; flex-wrap: wrap; align-items: center; min-height: 52px; padding: 8px; }
.m .ev, .m .wtask { flex: 1 1 140px; }
.m .wadd { opacity: 1; margin: 0 0 0 auto; align-self: center; }
.m .week-nav .btn.sm:last-child { display: none; }

.m .team-grid { display: flex; flex-direction: column; gap: 14px; }
.m .team-grid, .m .dash-grid, .m .proj-grid { align-items: stretch; }
.m .team-grid > *, .m .dash-grid > *, .m .proj-grid .card { min-width: 0; }
.m .person-row { grid-template-columns: 42px minmax(0, 1fr) auto; row-gap: 8px; }
.m .pr-site { grid-column: 2 / 4; grid-row: 2; }

.m .msg-layout { grid-template-columns: minmax(0, 1fr); }
.m .msg-layout.has-conv .conv-list { display: none; }
.m .msg-layout:not(.has-conv) .chat { display: none; }
.m .conv-list { border-right: 0; }
.m .conv-head { padding: 14px 14px 10px; }
.m .chat-head { display: none; }
.m .chat-body { padding: 14px 12px; }
.m .bubble-row { max-width: 88%; }
.m .composer { padding: 10px 10px; }
.m .composer .send span { display: none; }
.m .composer .send { width: 48px; padding: 0; }

.m .w-page { padding: 16px 14px 28px; gap: 14px; }
.m .w-hello h1 { font-size: 26px; }
.m .w-site img { height: 150px; }
.m .w-actions .btn { flex: 1 1 auto; }
.m .w-actions .btn.primary { flex-basis: 100%; }
.m .wt-row { flex-wrap: wrap; }
.m .wt-row .btn.big { flex-basis: 100%; }

.m .modal-layer { padding: 0; align-items: flex-end; }
.m .modal, .m .modal-wide { width: 100%; max-height: 92%; border-radius: 20px 20px 0 0; }
.m .modal-layer.anim .modal { animation: sheet .26s cubic-bezier(.2, .9, .3, 1); }
.m .modal-body { padding: 16px 16px 6px; }
.m .modal-foot { padding: 12px 16px; border-radius: 0; }
body.phone-mode .m .modal-foot { padding-bottom: 26px; }
.m form .modal-foot { margin: 8px -16px 0; }
.m .modal-foot .btn.primary { flex: 1; }
.m .row2 { grid-template-columns: 1fr; gap: 0; }
.m .details.compact > div { grid-template-columns: 1fr; gap: 0; }
.m .camera-box { height: 260px; }

@media (max-width: 759px) {
  #toasts { bottom: 90px; }
}


/* ---------- v2: multi-site switcher, manager picker ---------- */

.site-switch { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.site-switch button { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); background: #fff; padding: 8px 14px 8px 8px; border-radius: 99px; font-weight: 650; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.site-switch button:hover { border-color: var(--o-400); }
.site-switch button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.site-switch .count-pill { margin-left: 4px; padding: 0 7px; font-size: 12px; }
.site-switch button.on .count-pill { background: #fff; color: var(--brand-text); }
.mgr-pick { display: flex; align-items: center; gap: 10px; margin: -4px 0 8px; padding: 8px 10px; background: var(--o-50); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.mgr-pick select { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: #fff; font-size: 14px; }

/* ---------- v2: specialty tags ---------- */

.spec-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; vertical-align: middle; }
.pl-sub .spec-tags { margin: 0 0 0 6px; }
.pick-row .spec-tags { display: flex; }
.spec { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 1px 7px; border-radius: 5px; background: var(--o-100); color: var(--o-700); white-space: nowrap; }
.tag-filter { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px; padding: 0 10px; height: 36px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-2); }
.tag-filter select { border: 0; background: none; font-weight: 600; font-size: 14px; outline: none; }

/* ---------- v2: roles & permissions ---------- */

.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.role-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.role-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.role-card b { font-size: 17px; }
.role-card .link { align-self: flex-start; }
.perm-table { padding: 6px 20px; }
.perm-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 130px 110px; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.perm-row:first-child { border-top: 0; }
.perm-head { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 0 10px; }
.perm-head > div:not(:first-child) { text-align: center; }
.perm-main b { display: block; font-size: 15px; }
.perm-main small { color: var(--muted); }
.perm-cell { display: flex; justify-content: center; align-items: center; }
.perm-role { display: none; }
.perm-always { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--o-700); color: #fff; }
.perm-na { color: var(--o-300); font-weight: 700; }
.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch input:checked + .toggle { background: var(--brand); }
.switch input:checked + .toggle::after { transform: translateX(18px); }
.switch input:focus-visible + .toggle { box-shadow: 0 0 0 3px rgba(255, 131, 15, .3); }

.check.locked { cursor: not-allowed; opacity: .55; }
.task.done .check.locked { opacity: 1; }
.wt-status.tappable { cursor: pointer; background: #fff; color: transparent; }
.wt-status.tappable:hover { border-color: var(--good); color: var(--good); border-style: solid; }
.wt-row.done .wt-status.tappable { background: var(--good); color: #fff; }

/* ---------- v2: message filters + pins ---------- */

.msg-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.msg-filters button { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); background: #fff; color: var(--ink-2); padding: 5px 12px; border-radius: 99px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.msg-filters button span { background: var(--o-700); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; }
.msg-filters button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ci-pin { color: var(--brand); display: inline-grid; flex-shrink: 0; margin-right: auto; }
.ci-top b { margin-right: 0; }
.ci-top .time { margin-left: auto; }
.btn.pinned-on, .icon-btn.pinned-on { color: var(--brand); }
.btn.pinned-on { border-color: var(--brand); background: var(--brand-soft); }

.pin-banner { background: var(--o-50); border-bottom: 1px solid var(--o-200); }
.pin-summary { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 10px 20px; text-align: left; color: var(--ink); font-size: 14px; }
.pin-summary > .ic:first-child { color: var(--brand); }
.pin-summary b { color: var(--brand-text); }
.pin-chev { margin-left: auto; color: var(--muted); }
.pin-banner.open .pin-chev { transform: rotate(-90deg); }
.pin-list { padding: 0 20px 10px; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.pin-item { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; background: #fff; border: 1px solid var(--o-200); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.pin-item small { color: var(--muted); }

.bubble-row { position: relative; }
.bubble-pin { align-self: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted); display: grid; place-items: center; opacity: 0; transition: opacity .12s; flex-shrink: 0; }
.bubble-row:hover .bubble-pin, .bubble-row.tapped .bubble-pin, .bubble-pin:focus-visible { opacity: 1; }
.bubble-pin:hover { color: var(--brand); border-color: var(--brand); }
.bubble-row.is-pinned .bubble-pin { color: var(--brand); }
.bubble[data-action] { cursor: pointer; }
.bubble-pinmark { display: inline-grid; vertical-align: -1px; margin-right: 5px; color: var(--brand); }
.bubble-row.mine .bubble-pinmark { color: #fff; }
.bubble-row.is-pinned .bubble { box-shadow: 0 0 0 2px var(--o-300); }

/* ---------- v2: pick from phone contacts ---------- */

.contacts-btn { width: 100%; height: 50px; border-color: var(--brand); color: var(--brand-text); font-size: 16px; }
.contacts-btn:hover { background: var(--o-50); }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px 0; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.contact-sheet { border: 1.5px solid var(--o-300); border-radius: 14px; padding: 10px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.contact-sheet[hidden] { display: none !important; }
.cs-head { display: flex; align-items: center; justify-content: space-between; padding-left: 4px; }
.cs-search { height: 42px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; font-size: 16px; outline: none; }
.cs-search:focus { border-color: var(--brand); }
.cs-list { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.cs-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 8px 6px; border-radius: 10px; }
.cs-item:hover { background: var(--o-50); }
.cs-item span:last-child { display: flex; flex-direction: column; min-width: 0; }
.cs-item small { color: var(--muted); }

@container app (max-width: 1040px) {
  .role-cards { grid-template-columns: 1fr; }
}
.m .role-cards { grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
.m .perm-table { padding: 4px 14px; }
.m .perm-head { display: none; }
.m .perm-row { grid-template-columns: 1fr 1fr 1fr; row-gap: 10px; }
.m .perm-main { grid-column: 1 / -1; }
.m .perm-cell { flex-direction: column; gap: 4px; }
.m .perm-role { display: block; font-size: 11px; font-weight: 650; color: var(--muted); }
.m .msg-filters { padding: 0 14px 10px; }
.m .bubble-pin { opacity: 0; }
.m .bubble-row.tapped .bubble-pin { opacity: 1; }
