/* ============================================================================
   Assured Services LLC — shared design system.
   Tokens and motion mirrored from ASL.html so both properties read as one brand.
   ========================================================================== */

:root {
  color-scheme: light;
  --ink: #101014;
  --ink-2: #3f3f46;
  --ink-3: #71717a;
  --ink-4: #a1a1aa;
  --line: #e8e8ec;
  --paper: #fff;
  --bg: #fafafa;
  --accent: #0a6cf5;
  --accent-ink: #fff;
  --accent-soft: rgba(10, 108, 245, .08);
  --green: #059669;
  --amber: #b45309;
  --rose: #e11d48;
  --violet: #6d28d9;
  --radius: 1rem;
  --shell: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

h1, h2, h3, h4 { letter-spacing: -.02em; line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.65rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.15rem); font-weight: 700; }
h3 { font-size: 1.06rem; font-weight: 700; }
p  { margin: 0 0 1rem; color: var(--ink-2); }
a  { color: var(--accent); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: .4rem;
}

/* ---- Ambient 3D background (three.js) ---------------------------------- */
#bg3d { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* ---- Layout ------------------------------------------------------------ */
.shell { width: min(var(--shell), calc(100vw - 2rem)); margin-inline: auto; }
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; scroll-margin-top: 88px; }
.section-head { max-width: 60ch; margin-bottom: 2rem; }
.kicker {
  margin: 0 0 .5rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
}
.lede { font-size: 1.06rem; color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: .875rem; }
.grid { display: grid; gap: 1.1rem; }
.grid > * { min-width: 0; }
/* min(Xpx, 100%) keeps these from forcing an overflow inside narrow containers. */
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }

/* Quote calculator: form + sticky running total, stacked on small screens. */
.quote-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); gap: 1.5rem; }
@media (max-width: 920px) { .quote-grid { grid-template-columns: 1fr; } }

/* Maintenance catalog: an even 2x2 of service groups, one column on phones. */
.catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
@media (max-width: 820px) { .catalog-grid { grid-template-columns: 1fr; } }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.between { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }
.hidden { display: none !important; }

/* ---- Surfaces ---------------------------------------------------------- */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.35rem;
  box-shadow: 0 1px 2px rgba(16, 16, 20, .03);
}
.card-hover { transition: box-shadow .25s ease, transform .2s ease; }
.card-hover:hover { box-shadow: 0 10px 30px rgba(16, 16, 20, .07); transform: translateY(-3px); }
.card-accent { border-left: 4px solid var(--accent); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 1.25rem; padding: clamp(1.35rem, 3vw, 2.25rem); }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .62rem 1.3rem; border-radius: 9999px;
  border: 1px solid transparent; font-size: .9rem; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0857c9; }
.btn-secondary { background: #fff; color: var(--ink); border-color: #d9d9e0; }
.btn-secondary:hover { border-color: var(--ink-4); background: #fafafa; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { opacity: .85; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #f4f4f5; color: var(--ink); }
.btn-sm { min-height: 36px; padding: .35rem .85rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Forms ------------------------------------------------------------- */
.field { display: block; margin-bottom: .9rem; }
.field > span, .label {
  display: block; font-size: .78rem; font-weight: 600;
  color: var(--ink-2); margin-bottom: .35rem;
}
.input, select.input, textarea.input {
  width: 100%; background: #fff; border: 1px solid #d9d9e0; border-radius: .625rem;
  padding: .6rem .8rem; font-size: .9rem; color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 108, 245, .12); }
textarea.input { min-height: 110px; resize: vertical; }
.check-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
.check {
  display: flex; align-items: flex-start; gap: .65rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: .75rem; padding: .7rem .85rem;
  background: #fff; transition: border-color .15s, background .15s;
}
.check:hover { border-color: var(--ink-4); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check input { margin-top: .22rem; accent-color: var(--accent); width: 1rem; height: 1rem; flex: none; }
.check b { display: block; font-size: .875rem; font-weight: 600; }
.check small { color: var(--ink-3); font-size: .78rem; }

/* ---- Badges & status --------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem;
  border-radius: 9999px; font-size: .7rem; font-weight: 600; white-space: nowrap;
}
.badge-blue   { background: #eff6ff; color: #0a6cf5; border: 1px solid #dbeafe; }
.badge-green  { background: #ecfdf5; color: #059669; border: 1px solid #d1fae5; }
.badge-amber  { background: #fffbeb; color: #b45309; border: 1px solid #fef3c7; }
.badge-rose   { background: #fff1f2; color: #e11d48; border: 1px solid #ffe4e6; }
.badge-violet { background: #f5f3ff; color: #6d28d9; border: 1px solid #ede9fe; }
.badge-gray   { background: #f4f4f5; color: var(--ink-3); border: 1px solid var(--line); }

.note { border-radius: .75rem; padding: .7rem .9rem; font-size: .85rem; border: 1px solid; }
.note-info    { background: #eff6ff; border-color: #dbeafe; color: #0b4fae; }
.note-success { background: #ecfdf5; border-color: #d1fae5; color: #046c4e; }
.note-warning { background: #fffbeb; border-color: #fef3c7; color: #92400e; }
.note-danger  { background: #fff1f2; border-color: #ffe4e6; color: #a3113a; }

.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #f4f4f5; border: 1px solid var(--line); border-radius: 9999px;
  padding: .32rem .85rem; font-size: .78rem; font-weight: 500; color: var(--ink-2);
}

/* ---- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th {
  font-weight: 600; color: var(--ink-3); text-align: left;
  padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: .6rem; border-bottom: 1px solid #f1f1f4; vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: var(--ink-3); padding: 2rem 1rem; font-size: .875rem; }

/* ---- Dialogs ----------------------------------------------------------- */
dialog {
  border: 1px solid var(--line); border-radius: 1.25rem; padding: 0;
  width: min(540px, calc(100vw - 2rem)); max-height: 90vh;
  background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(16, 16, 20, .22);
}
dialog::backdrop { background: rgba(16, 16, 20, .35); backdrop-filter: blur(4px); }
.dialog-body { padding: 1.5rem; overflow-y: auto; max-height: 90vh; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.dialog-close {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  width: 36px; height: 36px; cursor: pointer; font-size: 1.1rem; color: var(--ink-3); flex: none;
}
.dialog-close:hover { background: #f4f4f5; color: var(--ink); }

/* ---- Motion ------------------------------------------------------------ */
.grad-flow {
  background: linear-gradient(100deg, #0a6cf5 10%, #6d28d9 35%, #06b6d4 60%, #0a6cf5 90%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: gradFlow 7s ease-in-out infinite;
}
@keyframes gradFlow { 0% { background-position: 0% 0 } 50% { background-position: 100% 0 } 100% { background-position: 0% 0 } }

.reveal {
  opacity: 0; will-change: opacity, transform; backface-visibility: hidden;
  transition: opacity .5s cubic-bezier(.22, .68, 0, 1.2), transform .5s cubic-bezier(.22, .68, 0, 1.2);
}
.reveal.from-left  { transform: translateX(-32px); }
.reveal.from-right { transform: translateX(32px); }
.reveal.from-up    { transform: translateY(18px); }
.reveal.revealed   { opacity: 1; transform: translate(0, 0); will-change: auto; }

.card3d { will-change: transform; }

/* On phones the horizontal slide-in would push past the viewport edge, so the
   reveal becomes a straight fade-up instead. */
@media (max-width: 700px) {
  .reveal.from-left, .reveal.from-right { transform: translateY(16px); }
}
.fade-in { animation: fadeIn .45s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grad-flow { animation: none; color: var(--accent); background: none; -webkit-text-fill-color: currentColor; }
  .reveal { opacity: 1; transform: none; transition: none; }
  #bg3d { display: none; }
  .card-hover:hover { transform: none; }
}

/* ---- Header ------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 250, 250, .82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 40px; height: 40px; border-radius: .7rem; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .82rem; letter-spacing: .02em;
  box-shadow: 0 8px 18px rgba(10, 108, 245, .22);
}
.brand-name { font-weight: 700; font-size: .96rem; line-height: 1.2; }
.brand-sub { font-size: .7rem; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.mainnav { display: flex; align-items: center; gap: .15rem; }
.mainnav a {
  color: var(--ink-2); text-decoration: none; font-size: .875rem; font-weight: 500;
  padding: .5rem .7rem; border-radius: 999px; transition: background .15s, color .15s;
}
.mainnav a:hover { background: #f0f0f2; color: var(--ink); }
.navtoggle { display: none; }
@media (max-width: 1000px) {
  .mainnav { display: none; }
  .mainnav.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: .75rem 1rem 1.1rem; gap: .2rem;
  }
  .mainnav.open a { padding: .7rem .8rem; }
  .navtoggle { display: inline-flex; }
  .topbar-inner { position: relative; }
}

/* ---- Hero -------------------------------------------------------------- */
.hero { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.hero-grid { display: grid; gap: 2.25rem; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: start; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.hero p.lede { font-size: 1.12rem; max-width: 52ch; }
.trustbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }

/* ---- Quote calculator -------------------------------------------------- */
.quote-total {
  background: linear-gradient(135deg, #0b1220, #1b2a4a);
  color: #fff; border-radius: 1.15rem; padding: 1.5rem;
}
.quote-total .big { font-size: clamp(2.1rem, 5vw, 2.9rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.quote-total .big span { font-size: .95rem; font-weight: 500; opacity: .7; letter-spacing: 0; }
.quote-line { display: flex; justify-content: space-between; gap: 1rem; padding: .42rem 0; font-size: .85rem; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.quote-line:last-child { border-bottom: none; }
.quote-line span:first-child { color: rgba(255, 255, 255, .72); }
.quote-line b { font-variant-numeric: tabular-nums; }

/* ---- Steps ------------------------------------------------------------- */
.step-num {
  width: 34px; height: 34px; border-radius: 999px; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem; margin-bottom: .7rem;
}
.icon-bubble {
  width: 42px; height: 42px; border-radius: .8rem; flex: none;
  background: var(--accent-soft); display: inline-flex; align-items: center;
  justify-content: center; font-size: 1.15rem; margin-bottom: .8rem;
}
.tick-list { list-style: none; padding: 0; margin: .6rem 0 0; }
.tick-list li { position: relative; padding-left: 1.4rem; font-size: .86rem; color: var(--ink-2); margin-bottom: .35rem; }
.tick-list li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

/* ---- Footer ------------------------------------------------------------ */
.footer { border-top: 1px solid var(--line); background: var(--paper); padding: 2.5rem 0 2rem; margin-top: 2rem; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer-cols { display: grid; gap: 1.75rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.footer h4 { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .6rem; }
.footer ul { list-style: none; padding: 0; margin: 0; font-size: .875rem; }
.footer li { margin-bottom: .35rem; }
.legal { border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 1.25rem; font-size: .78rem; color: var(--ink-3); }

/* ---- Portal ------------------------------------------------------------ */
.portal-grid { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .portal-grid { grid-template-columns: 1fr; } }
.sidenav { position: sticky; top: 88px; display: flex; flex-direction: column; gap: .2rem; }
@media (max-width: 860px) { .sidenav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: .4rem; } }
.sidenav button {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  background: transparent; border: 1px solid transparent; border-radius: .7rem;
  padding: .6rem .8rem; font-size: .875rem; font-weight: 500; color: var(--ink-2);
  cursor: pointer; text-align: left; white-space: nowrap;
  transition: background .15s, color .15s;
}
.sidenav button:hover { background: #f0f0f2; color: var(--ink); }
.sidenav button.active { background: var(--ink); color: #fff; }
.kpi-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.kpi .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.kpi .v { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; margin-top: .2rem; font-variant-numeric: tabular-nums; }

/* Notification bell */
.bell { position: relative; }
.bell-dot {
  position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px;
  border-radius: 999px; background: var(--rose); color: #fff;
  font-size: .62rem; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 4px;
}
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif {
  display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid #f1f1f4;
  background: transparent; padding: .8rem .2rem; cursor: pointer;
}
.notif.unread { background: var(--accent-soft); }
.notif b { display: block; font-size: .875rem; }
.notif small { color: var(--ink-3); font-size: .78rem; }

/* Toasts */
#toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; max-width: min(360px, calc(100vw - 2rem)); }
.toast {
  background: var(--ink); color: #fff; border-radius: .75rem; padding: .75rem 1rem;
  font-size: .86rem; box-shadow: 0 12px 30px rgba(16, 16, 20, .25); animation: fadeIn .25s ease both;
}
.toast.ok  { background: #065f46; }
.toast.err { background: #9f1239; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff;
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 .5rem 0;
}
.skip-link:focus { left: 0; }

.quote-sticky { position: sticky; top: 96px; }
@media (max-width: 920px) { .quote-sticky { position: static; } }
