/* ADS Home Services — ADS master design system + Home Services sector profile
   (Software-Factory docs/handbook/UIUX_REGISTER.md row 12; docs/uiux/ads-design-tokens.v1.json).
   Mobile-first (360 px), breakpoints 768 / 1280, 44 px targets, visible focus, reduced motion. */
:root {
  --ads-navy: #102B43;
  --primary: #0B766B; --primary-fg: #FFFFFF; --primary-hover: #095F56;
  --nav: #164940; --nav-fg: #FFFFFF; --nav-muted: #CFE5DF;
  --accent: #DFF5EF; --canvas: #F3F9F7; --surface: #FFFFFF;
  --text: #1F3833; --muted: #4B675F; --border: #CCDFD9; --focus: #0B766B;
  --success: #18794E; --success-bg: #E3F4EA; --warning: #8B5B12; --warning-bg: #FBF0DC; --danger: #B42332; --danger-bg: #FBE7E9;
  --info-bg: #E4F0F7; --info: #1D5A80;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 43, 67, .08), 0 2px 8px rgba(16, 43, 67, .06);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--text); background: var(--canvas); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .75rem; color: var(--ads-navy); }
h2, .h3 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1.05rem; margin: 0; }
p { margin: .25rem 0 .5rem; }
a { color: var(--primary); }
.muted { color: var(--muted); } .small { font-size: .875rem; } .big { font-size: 1.25rem; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ads-navy); color: #fff; padding: .75rem 1rem; z-index: 100; }
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sidebar :focus-visible, .topbar :focus-visible { outline-color: #FFFFFF; }

/* Banners */
.testmode { background: var(--warning-bg); color: var(--warning); border-bottom: 2px solid var(--warning); padding: .5rem 1rem; font-weight: 700; text-align: center; font-size: .9rem; }
.offline-banner { background: var(--ads-navy); color: #fff; padding: .5rem 1rem; text-align: center; font-size: .9rem; }

/* Shell: drawer on phones, persistent sidebar from 768 px */
.layout { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; max-width: 85vw; background: var(--nav); color: var(--nav-fg); transform: translateX(-100%);
  transition: transform .2s ease; z-index: 50; overflow-y: auto; padding: 1rem .75rem; }
.drawer-open .sidebar { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(16, 43, 67, .45); z-index: 40; }
.brand { display: flex; align-items: center; gap: .5rem; padding: .25rem .5rem 1rem; font-weight: 700; }
.brand-mark { background: var(--ads-navy); color: #fff; border-radius: 6px; padding: .2rem .45rem; font-size: .8rem; letter-spacing: .05em; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: flex; align-items: center; min-height: 44px; padding: .5rem .75rem; border-radius: 8px; color: var(--nav-fg); text-decoration: none; }
.sidebar a:hover { background: rgba(255, 255, 255, .08); }
.sidebar a[aria-current="page"] { background: rgba(255, 255, 255, .16); font-weight: 600; }
/* Phone menu: the drawer covers the top bar, so it carries its own language switch (owner rule). */
.drawer-lang { padding: 1rem .5rem; border-top: 1px solid rgba(255, 255, 255, .16); margin-top: .5rem; }
.drawer-lang .btn { color: var(--nav-fg); border-color: rgba(255, 255, 255, .5); min-height: 44px; width: 100%; }
.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; background: var(--nav); color: var(--nav-fg); min-height: 56px; }
.topbar-title { color: var(--nav-fg); font-weight: 700; text-decoration: none; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .25rem; }
.topbar .btn-ghost { color: var(--nav-fg); border-color: rgba(255, 255, 255, .5); }
.topbar .btn-primary { background: #fff; color: var(--nav); border-color: #fff; }
.who { display: none; color: var(--nav-muted); font-size: .875rem; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: inherit;
  font-size: 1.2rem; border-radius: 8px; cursor: pointer; text-decoration: none; }
.count { position: absolute; top: 4px; right: 2px; background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; min-width: 1.2rem; padding: 0 .3rem; line-height: 1.2rem; text-align: center; }
main { flex: 1; outline: none; }
.page { overflow-wrap: anywhere; }
.view { padding: 1rem; max-width: 1080px; margin: 0 auto; width: 100%; }
.footer { padding: 1rem; color: var(--muted); font-size: .85rem; text-align: center; }

/* Components */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; min-width: 44px; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--primary); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-outline { color: var(--danger); border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-small { min-height: 44px; padding: .25rem .75rem; font-size: .875rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; box-shadow: var(--shadow); }
.card.highlight { border-color: var(--primary); background: var(--accent); }
.card.warn, .card.overdue { border-color: var(--warning); }
.card.narrow { max-width: 32rem; margin: 2rem auto; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .25rem; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; grid-template-columns: 1fr; }
.cards > .card { margin: 0; }
.list { padding-left: 1.2rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: .15rem .6rem; font-size: .8rem; font-weight: 600; background: var(--canvas); color: var(--muted); border: 1px solid var(--border); }
.badge-success, .badge-verified { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.badge-warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.price { font-weight: 700; font-size: 1.05rem; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 1rem; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: .5rem 1rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 600; }
.chip[aria-current="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.form .field, .field { margin-bottom: .75rem; }
label { display: block; font-weight: 600; margin-bottom: .25rem; }
input, select, textarea { width: 100%; min-height: 44px; padding: .5rem .75rem; font: inherit; color: var(--text); background: #fff; border: 1px solid #8FA8A1; border-radius: 8px; }
textarea { min-height: 88px; }
input[type="checkbox"], input[type="radio"] { width: 24px; min-height: 24px; height: 24px; margin: 0 .5rem 0 0; accent-color: var(--primary); }
input[type="file"] { padding: .5rem; }
[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.help { color: var(--muted); font-size: .875rem; margin: .25rem 0 0; }
.field-error { color: var(--danger); font-size: .875rem; margin: .25rem 0 0; min-height: 0; }
.form-message:not(:empty) { color: var(--danger); font-weight: 600; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: .5rem .75rem; margin: 0 0 .75rem; }
.check, .radio { display: flex; align-items: center; min-height: 44px; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.inline-form { display: grid; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: .5rem 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--canvas); }
.timeline { list-style: none; padding: 0 0 0 1rem; margin: 0; border-left: 3px solid var(--primary); }
.timeline li { position: relative; padding: .25rem 0 .5rem .5rem; }
.timeline li::before { content: ""; position: absolute; left: -1.45rem; top: .6rem; width: .75rem; height: .75rem; border-radius: 50%; background: var(--primary); }
.inbox { list-style: none; padding: 0; margin: 0; }
.inbox li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .75rem; margin-bottom: .5rem; }
.inbox li.unread { border-left: 4px solid var(--primary); }
.thread { list-style: none; padding: 0; } .thread li { padding: .5rem .75rem; border-radius: 8px; margin-bottom: .5rem; background: var(--surface); border: 1px solid var(--border); }
.thread li.support { background: var(--accent); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; display: block; overflow-x: auto; }
.table th, .table td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--border); }
.state { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding: 1rem; border-radius: var(--radius); border: 1px dashed var(--border); background: var(--surface); margin: .5rem 0; }
.state-error, .state-denied { border-style: solid; border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.state-success { border-style: solid; border-color: var(--success); background: var(--success-bg); color: var(--success); }
.state-loading { flex-direction: row; align-items: center; color: var(--muted); }
.spinner { width: 1.1rem; height: 1.1rem; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
.skeleton { height: 4.5rem; border-radius: var(--radius); background: linear-gradient(90deg, #E7F0ED, #F5FAF8, #E7F0ED); background-size: 200% 100%; animation: shimmer 1.5s infinite; margin-bottom: .75rem; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
.dialog { border: 0; border-radius: var(--radius); padding: 1.25rem; max-width: min(32rem, calc(100vw - 2rem)); box-shadow: 0 10px 40px rgba(16, 43, 67, .3); color: var(--text); }
.dialog::backdrop { background: rgba(16, 43, 67, .5); }
.toasts { position: fixed; bottom: 1rem; left: 1rem; right: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 60; pointer-events: none; }
.toast { pointer-events: auto; padding: .75rem 1rem; border-radius: 8px; background: var(--ads-navy); color: #fff; box-shadow: var(--shadow); }
.toast-error { background: var(--danger); }
.photo-list { list-style: none; padding: 0; }

@media (min-width: 768px) {
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none; flex: 0 0 248px; }
  .menu-btn, .scrim, .drawer-lang { display: none !important; }
  .who { display: inline; }
  .view { padding: 1.5rem 2rem; }
  h1 { font-size: 1.75rem; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .inline-form { grid-template-columns: 1fr auto; }
  .toasts { left: auto; width: 24rem; }
  .table { display: table; }
}
@media (min-width: 1280px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* Phone: the top bar has no room for the product name (it showed as "A"); the drawer shows it. */
@media (max-width: 419px) { .topbar-title { visibility: hidden; } }
