/* ==========================================================
   DecoMate — shared styles
   ========================================================== */
:root {
  --bg: #f6f4ee;
  --surface: #fffdf9;
  --surface-2: #f9f7f1;
  --border: #e6e1d6;
  --ink: #1e2b36;
  --text: #2a3128;
  --muted: #6e7468;
  --green: #5f7f4b;
  --green-dark: #4a6739;
  --green-soft: #e4ebd8;
  --green-softer: #f0f4e8;
  --orange: #df7a3c;
  --orange-soft: #fbe9dd;
  --blue-soft: #e3ecf4;
  --red: #c0533f;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(30, 43, 54, .05), 0 2px 8px rgba(30, 43, 54, .04);
  --sidebar-w: 230px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
html.auth-pending body { visibility: hidden; }
svg { flex-shrink: 0; }
.list-item > svg { width: 16px; height: 16px; color: var(--muted); }
.row > svg, .search > svg, b > svg, .brand-mark svg { width: 18px; height: 18px; }
.brand-mark svg { width: 30px; height: 30px; }
.toolbar > .icon-btn svg { width: 18px; height: 18px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-mark { width: 30px; height: 30px; color: var(--green); }
.brand-name { font-weight: 800; font-size: 17px; color: var(--ink); line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--green-soft); color: var(--green-dark); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 18px 28px 6px;
}
.topbar .title-wrap { flex: 1; min-width: 0; }
.breadcrumb { font-size: 12px; color: var(--muted); margin-top: 2px; }
.breadcrumb a { color: var(--muted); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--ink); position: relative;
}
.icon-btn:hover { background: var(--surface); border-color: var(--border); }
.icon-btn svg { width: 19px; height: 19px; }
.badge-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; background: var(--orange); border-radius: 50%; border: 2px solid var(--bg); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.menu-btn { display: none; }

.content { padding: 14px 28px 40px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* Hero banner */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(100deg, #e6edf3 0%, #eef2ea 60%, #f4f1e8 100%);
  border: 1px solid var(--border); padding: 24px 26px;
}
.hero h1 { font-size: 26px; }
.hero p { color: var(--muted); margin-top: 4px; }
.hero-stroke { position: absolute; right: -10px; top: -10px; width: 280px; opacity: .55; color: var(--green); pointer-events: none; }

/* Stat cards */
.stat { position: relative; padding: 16px 18px 18px; }
.stat .stat-top { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.stat .stat-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; }
.stat .stat-icon svg { width: 18px; height: 18px; }
.stat .stat-value { font-size: 30px; font-weight: 800; color: var(--ink); margin-top: 10px; letter-spacing: -.02em; }
.stat::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0 0 var(--radius) var(--radius); background: var(--accent, var(--green)); }
.accent-orange { --accent: var(--orange); }
.accent-orange .stat-icon { background: var(--orange-soft); color: var(--orange); }
.accent-green { --accent: var(--green); }
.accent-green .stat-icon { background: var(--green-soft); color: var(--green-dark); }
.accent-blue { --accent: #5b7fa3; }
.accent-blue .stat-icon { background: var(--blue-soft); color: #4a6a8c; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-soft { background: var(--green-soft); border-color: var(--green-soft); color: var(--green-dark); }
.btn-soft:hover { background: #d8e2c8; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--green-dark); font: inherit; font-weight: 600; cursor: pointer; }

/* ---------- Pills / tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--green-soft); color: var(--green-dark); white-space: nowrap; }
.pill-orange { background: var(--orange-soft); color: #b45a22; }
.pill-blue { background: var(--blue-soft); color: #3f6188; }
.pill-grey { background: #ecebe6; color: #5d6158; }
.pill-red { background: #f7e1dc; color: var(--red); }

/* ---------- Tabs ---------- */
.tabs { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 4px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 12px; border-radius: 7px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--green); color: #fff; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--border); color: var(--text); }
.list-item:first-child { border-top: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.thumb { width: 52px; height: 44px; border-radius: 8px; flex-shrink: 0; background: linear-gradient(135deg, #efe9dd, #d9d0bf); }
.thumb.t2 { background: linear-gradient(135deg, #ebe7df, #cfc6b5); }
.thumb.t3 { background: linear-gradient(135deg, #f1ece2, #dcd3c3); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-weight: 600; color: var(--ink); }
.chev { color: var(--muted); width: 16px; height: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td .sub { font-size: 12px; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Week schedule */
.week-row { display: grid; grid-template-columns: 40px 58px 1fr; align-items: center; gap: 8px; padding: 8px 6px; border-top: 1px solid var(--border); font-size: 13px; }
.week-row:first-child { border-top: 0; }
.week-row.today { background: var(--green-softer); border-radius: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 6px; }
.dot.orange { background: var(--orange); }
.dot.blue { background: #5b7fa3; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; font: inherit; color: var(--text);
}
.input:focus { outline: 2px solid var(--green-soft); border-color: var(--green); }
textarea.input { min-height: 90px; resize: vertical; }
.search { position: relative; min-width: 220px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search .input { padding-left: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* Checklist */
.check { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.check:first-child { border-top: 0; }
.check input { width: 17px; height: 17px; accent-color: var(--green); }
.check .grow { flex: 1; }

/* Summary box */
.summary { background: var(--green-softer); border: 1px solid #dbe4cd; border-radius: var(--radius); padding: 16px; }
.summary .line { display: flex; justify-content: space-between; padding: 4px 0; }
.summary .total { display: flex; justify-content: space-between; margin-top: 8px; padding: 10px 12px; background: var(--green-soft); border-radius: 8px; font-weight: 800; color: var(--ink); font-size: 16px; }

/* Info bar */
.infobar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius); background: #f3efe2; border: 1px solid #e6dfc9; }
.infobar svg { width: 18px; height: 18px; color: #8a7a45; flex-shrink: 0; }

/* Colour swatches */
.swatch { width: 54px; height: 40px; border-radius: 8px; border: 1px solid var(--border); flex-shrink: 0; }

/* Job header */
.job-header { display: flex; gap: 16px; align-items: center; }
.job-photo { width: 84px; height: 70px; border-radius: 10px; background: linear-gradient(135deg, #efe9dd, #cbbfa9); flex-shrink: 0; }
.meta-strip { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 14px 0 0; margin-top: 14px; border-top: 1px solid var(--border); }
.meta { display: flex; gap: 10px; align-items: center; }
.meta svg { width: 20px; height: 20px; color: var(--green-dark); }
.meta .k { font-size: 12px; color: var(--muted); }
.meta .v { font-weight: 600; color: var(--ink); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-head { padding: 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 104px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 12px; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day .d { font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.cal-day.other .d { color: #b9b6ac; }
.cal-day.today .d { background: var(--green); color: #fff; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-event { display: block; padding: 3px 6px; border-radius: 5px; margin-bottom: 4px; font-weight: 600; font-size: 11px; background: var(--green-soft); color: var(--green-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.orange { background: var(--orange-soft); color: #b45a22; }
.cal-event.blue { background: var(--blue-soft); color: #3f6188; }

/* Kanban (enquiries) */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.kanban-col h3 { display: flex; justify-content: space-between; font-size: 13px; }
.k-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); }
.k-card .name { font-weight: 700; color: var(--ink); }

/* Empty state */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  background: linear-gradient(160deg, #e7eee0 0%, #f2efe6 100%); padding: 40px; display: flex; flex-direction: column;
  justify-content: space-between; border-right: 1px solid var(--border); position: relative; overflow: hidden;
}
.auth-side h2 { font-size: 28px; line-height: 1.2; max-width: 420px; }
.auth-side ul { padding: 0; list-style: none; margin: 20px 0 0; display: flex; flex-direction: column; gap: 10px; }
.auth-side li { display: flex; gap: 10px; align-items: center; color: var(--ink); font-weight: 500; }
.auth-side li svg { width: 18px; height: 18px; color: var(--green); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-box h1 { font-size: 26px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--orange-soft); color: #9a4c1c; }

/* ---------- Landing ---------- */
.site-nav { display: flex; align-items: center; gap: 18px; padding: 18px 40px; max-width: 1180px; margin: 0 auto; }
.site-nav .links { display: flex; gap: 22px; margin-left: 30px; }
.site-nav .links a { color: var(--text); font-weight: 500; }
.landing-hero { max-width: 1180px; margin: 0 auto; padding: 60px 40px 40px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.landing-hero h1 { font-size: 46px; line-height: 1.08; letter-spacing: -.03em; }
.landing-hero p.lead { font-size: 17px; color: var(--muted); margin: 16px 0 26px; max-width: 520px; }
.mock { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 50px rgba(30,43,54,.10); padding: 18px; }
.section { max-width: 1180px; margin: 0 auto; padding: 50px 40px; }
.section h2 { font-size: 30px; text-align: center; letter-spacing: -.02em; }
.section .sub { text-align: center; color: var(--muted); margin: 8px auto 30px; max-width: 560px; }
.feature .f-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); display: grid; place-items: center; margin-bottom: 12px; }
.feature .f-icon svg { width: 20px; height: 20px; }
.feature p { color: var(--muted); margin-top: 6px; }
.price-card { text-align: center; padding: 28px; }
.price-card .price { font-size: 40px; font-weight: 800; color: var(--ink); margin: 10px 0 2px; }
.price-card ul { text-align: left; list-style: none; padding: 0; margin: 20px 0; display: flex; flex-direction: column; gap: 8px; }
.price-card li::before { content: "✓"; color: var(--green); font-weight: 800; margin-right: 8px; }
.price-card.featured { border: 2px solid var(--green); }
.site-foot { text-align: center; padding: 30px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(20,25,20,.35); z-index: 40; }
  .menu-btn { display: grid; }
  .topbar { padding: 14px 16px 4px; }
  .content { padding: 12px 16px 32px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .landing-hero { grid-template-columns: 1fr; padding: 30px 20px; }
  .landing-hero h1 { font-size: 34px; }
  .site-nav { padding: 16px 20px; }
  .site-nav .links { display: none; }
  .section { padding: 36px 20px; }
  .cal-day { min-height: 70px; padding: 4px; }
  .cal-event { font-size: 10px; padding: 2px 4px; }
  .hide-mobile { display: none !important; }
  .search { min-width: 0; flex: 1; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .stat .stat-value { font-size: 24px; }
  h1 { font-size: 21px; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 13px; opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.toast-error { background: var(--red); }

/* ---------- Modal (add / edit forms) ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 25, 20, .4); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.btn-danger { color: var(--red); border-color: #efd2cb; }
.btn-danger:hover { background: #fbeeea; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- Enquiry board ---------- */
.kanban { grid-template-columns: repeat(5, minmax(185px, 1fr)); }
.k-card { cursor: pointer; transition: border-color .15s; }
.k-card:hover { border-color: var(--green); }
.k-card .desc { margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.k-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 14px 6px; border: 1px dashed var(--border); border-radius: 10px; }
.status-select { padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); font: inherit; font-size: 11px; font-weight: 600; color: var(--ink); }
tr.clickable { cursor: pointer; }
.loading { color: var(--muted); padding: 24px; text-align: center; }

/* ---------- Pricing method picker ---------- */
.method-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.method-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff; }
.method-card input { display: none; }
.method-card.active { border-color: var(--green); background: var(--green-softer); }
@media (max-width: 860px) { .method-picker { grid-template-columns: 1fr; } }

/* ---------- Quote builder ---------- */
.room-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 12px; }
.room-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 0.8fr; gap: 10px; }
.room-grid .input { padding: 8px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--border); font-weight: 600; font-size: 13px; cursor: pointer; user-select: none; background: #fff; }
.chip input { display: none; }
.chip.on { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.room-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }
.room-foot .labour-input { width: 100px; padding: 6px 8px; }
.sticky-summary { position: sticky; top: 14px; }
.badge-warn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: var(--orange-soft); color: #b45a22; font-size: 11px; font-weight: 700; }
@media (max-width: 860px) {
  .room-grid { grid-template-columns: 1fr 1fr 1fr; }
  .room-grid .room-name { grid-column: 1 / -1; }
  .sticky-summary { position: static; }
}

/* ---------- Job editing ---------- */
.inline-add { display: flex; gap: 8px; margin-top: 10px; }
.inline-add .input { padding: 8px 10px; }
.check .del { opacity: 0; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 4px; }
.check:hover .del { opacity: 1; }
@media (hover: none) { .check .del { opacity: .6; } }
.check.done .grow { text-decoration: line-through; color: var(--muted); }

/* ---------- Phone: bottom tab bar + sheets ---------- */
.tabbar, .sheet-backdrop { display: none; }
@media (max-width: 860px) {
  .menu-btn { display: none !important; }
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(255, 253, 249, .97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
    color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; background: none; border: 0; cursor: pointer;
    text-decoration: none; -webkit-tap-highlight-color: transparent;
  }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar .active { color: var(--green-dark); }
  .tabbar .active svg { stroke-width: 2.4; }
  .tabbar .tab-plus {
    width: 54px; height: 54px; margin: -22px auto 2px; border-radius: 50%; padding: 0; justify-content: center;
    background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(74, 103, 57, .35);
  }
  .tabbar .tab-plus svg { width: 26px; height: 26px; }

  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(20, 25, 20, 0); transition: background .18s; }
  .sheet-backdrop.hidden { display: none !important; }
  .sheet-backdrop.open { background: rgba(20, 25, 20, .4); }
  .sheet {
    position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 20px 20px 0 0;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .18s ease;
  }
  .sheet-backdrop.open .sheet { transform: translateY(0); }
  .sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 4px auto 12px; }
  .sheet-title { font-weight: 800; color: var(--ink); font-size: 17px; margin: 0 4px 12px; }
  .sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .sheet-item {
    display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 14px;
    background: #fff; border: 1px solid var(--border); color: var(--ink); font-weight: 600; font-size: 13px; text-align: center;
  }
  .sheet-item:hover { text-decoration: none; }
  .sheet-item.active { border-color: var(--green); background: var(--green-softer); }
  .sheet-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--green-soft); color: var(--green-dark); display: grid; place-items: center; }
  .sheet-icon svg { width: 21px; height: 21px; }

  /* Modals sit above the bar and fill more of the screen */
  .modal-backdrop { padding: 12px 10px calc(12px + env(safe-area-inset-bottom)); z-index: 80; }
}
@media (max-width: 860px) {
  .stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px; }
  .stats-row .stat { padding: 10px 10px 12px; }
  .stats-row .stat-top { font-size: 11px; gap: 6px; line-height: 1.2; align-items: flex-start; }
  .stats-row .stat-icon { display: none !important; }
  .stats-row .stat-value { font-size: 20px; margin-top: 6px; }
  .hero { padding: 16px 18px; }
  .hero h1 { font-size: 21px; }
  .hero p { font-size: 13px; }
}

/* ---------- Phone polish ---------- */
.install-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.install-banner img { border-radius: 10px; flex-shrink: 0; }
.install-banner .grow { flex: 1; min-width: 0; }

html.standalone .topbar { padding-top: calc(14px + env(safe-area-inset-top)); }

@media (max-width: 860px) {
  /* 16px text stops iPhones zooming in when you tap a box */
  .input, select.input, textarea.input, .search .input { font-size: 16px; }
  .input, select.input { min-height: 44px; }

  /* Bigger targets for paint-covered fingers */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; padding: 7px 12px; }
  .check { padding: 13px 0; gap: 12px; }
  .check input { width: 22px; height: 22px; flex-shrink: 0; }
  .check .del { opacity: .6; font-size: 22px; padding: 0 8px; min-width: 36px; min-height: 36px; }
  .list-item { padding: 14px 4px; }
  .chip { padding: 9px 14px; font-size: 14px; }
  .status-select { padding: 7px 8px; font-size: 13px; }
  .tabs button { padding: 10px 12px; }
  .icon-btn { width: 42px; height: 42px; }

  /* Pop-up forms go full screen on phones */
  .modal-backdrop { padding: 0 !important; align-items: stretch; background: var(--bg); }
  .modal { max-width: none; min-height: 100%; border-radius: 0; box-shadow: none; display: flex; flex-direction: column;
           padding: calc(14px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
  .modal-head { position: sticky; top: 0; background: var(--surface); z-index: 2; margin: -4px -16px 12px; padding: 4px 16px 10px; border-bottom: 1px solid var(--border); }
  .modal-foot { margin-top: auto; padding-top: 16px; position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
  .modal-foot .btn-primary { flex: 1; }
  .modal .form-grid { gap: 12px; }

  /* Tables: hide less important columns already; tighten padding */
  td, th { padding: 10px 8px; }
}

/* ---------- Search + bell ---------- */
.badge-count { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.search-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 14px 4px 4px; }
.search-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--green-soft); color: var(--green-dark); display: grid; place-items: center; flex-shrink: 0; }
.search-ic svg { width: 17px; height: 17px; }
#search-modal .modal-head .search svg { width: 16px; height: 16px; }
.date-chip { width: 46px; height: 48px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1.1; }
.date-chip b { font-size: 18px; }
.date-chip span { font-size: 10px; font-weight: 700; text-transform: uppercase; }
.date-chip.empty-date { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border); }
.date-chip.empty-date span { font-size: 8px; }
