/* TickerTex — base styles. Mobile first; no inline styles anywhere (blocked by CSP). */

:root {
  --navy: #434970;
  --navy-deep: #23263d;
  --gold: #d8b22c;
  --text: #eef0f7;
  --muted: #a9aecb;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); line-height: 1.5; min-height: 100vh; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); }

/* ---- Splash pages (coming soon, errors) ---- */

body.splash {
  color: var(--text);
  background-color: var(--navy-deep);
  background-image: radial-gradient(ellipse at top, var(--navy) 0%, var(--navy-deep) 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
}

.splash-main { max-width: 560px; width: 100%; }

.splash-logo {
  width: 100%;
  max-width: 360px;
  margin: 0 auto 40px;
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 22px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}

.tag {
  display: inline-block;
  font-size: .75rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--navy-deep);
  background: var(--gold);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 20px;
}

.splash h1 {
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  line-height: 1.15;
  font-weight: 700;
  margin-bottom: 16px;
}
.splash h1 span { color: var(--gold); }
.splash p { color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.splash-contact { margin-top: 28px; }

.ticker {
  margin: 36px auto 0;
  height: 4px;
  width: 160px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
  position: relative;
}
.ticker::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--gold);
  border-radius: 2px;
  animation: ticker-slide 1.8s ease-in-out infinite;
}
@keyframes ticker-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker::after { animation: none; width: 100%; }
}

.splash-footer { margin-top: 56px; font-size: .85rem; color: var(--muted); opacity: .7; }

/* =====================================================================
   Public site
   ===================================================================== */

:root {
  --ink: #23263d;
  --ink-soft: #565b7a;
  --line: #e3e5ee;
  --tint: #f4f5f9;
  --white: #ffffff;
  --gold-dark: #8a6f12;
  --success-bg: #e8f6ee;
  --success-ink: #1d6b3f;
  --error-bg: #fdecec;
  --error-ink: #a12a2a;
  --info-bg: #eef0f9;
  --shadow: 0 6px 24px rgba(35, 38, 61, .08);
  --header-h: 64px;
}

body:not(.splash) { color: var(--ink); background: var(--white); }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }

.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: 8px; z-index: 100; background: var(--gold); color: var(--ink); padding: 8px 14px; border-radius: 6px; }
.skip-link:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* ---- Buttons ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none;
  padding: .8em 1.3em; border-radius: 10px; border: 2px solid transparent;
  cursor: pointer; transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-sm { padding: .55em 1em; font-size: .95rem; }
.btn-lg { padding: .95em 1.5em; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #e4c03d; }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--ink); }
.btn-outline { border-color: var(--navy); color: var(--navy); background: transparent; }
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-outline-light { border-color: rgba(255, 255, 255, .55); color: var(--white); background: transparent; }
.btn-outline-light:hover { border-color: var(--white); background: rgba(255, 255, 255, .08); }

/* ---- Header ---- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(8px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-h); gap: 16px; }
.brand img { width: 170px; height: auto; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; border-radius: 8px;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: transform .2s, background-color .2s;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -7px; }
.nav-toggle-bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-7px) rotate(-45deg); }

.site-nav {
  display: none;
  position: absolute; left: 0; right: 0; top: 100%;
  flex-direction: column; gap: 4px;
  padding: 12px 16px 20px;
  background: var(--white); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
}
.site-nav.is-open { display: flex; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 600; padding: 12px 8px; border-radius: 8px; }
.site-nav a:hover { background: var(--tint); }
.site-nav .nav-phone { display: inline-flex; align-items: center; gap: .45em; color: var(--navy); }
.site-nav .btn { margin-top: 8px; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav {
    display: flex; position: static; flex-direction: row; align-items: center; gap: 2px;
    padding: 0; border: 0; box-shadow: none; background: transparent;
  }
  .site-nav a { padding: 8px 12px; }
  .site-nav .btn { margin: 0 0 0 8px; }
}

/* ---- Hero ---- */

/* Philadelphia skyline under a navy tint so white text stays readable. */
.hero {
  color: var(--text);
  background-color: var(--navy-deep);
  background-image:
    linear-gradient(180deg, rgba(35, 38, 61, .86) 0%, rgba(35, 38, 61, .80) 100%),
    url("../img/philadelphia-pexels.jpg");
  background-size: cover;
  background-position: 62% 60%;
  background-repeat: no-repeat;
  padding: 56px 0 64px;
}
@media (min-width: 768px) {
  .hero {
    padding: 96px 0 104px;
    background-image:
      linear-gradient(90deg, rgba(35, 38, 61, .94) 0%, rgba(35, 38, 61, .82) 45%, rgba(35, 38, 61, .45) 100%),
      url("../img/philadelphia-pexels.jpg");
    background-position: center 65%;
  }
}
/* Parallax: the skyline stays put while the page scrolls over it. Desktop
   only — phone browsers (iOS especially) ignore or badly zoom fixed backgrounds. */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .hero { background-attachment: fixed; background-position: center 40%; }
}
.hero-lead { text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.hero-inner { max-width: 820px; }
.eyebrow { display: inline-flex; align-items: center; gap: .4em; color: var(--gold); font-weight: 700; font-size: .95rem; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.1rem, 7vw, 3.6rem); line-height: 1.08; letter-spacing: -.02em; margin-bottom: 20px; }
.hero h1 span { color: var(--gold); }
.hero-lead { font-size: clamp(1.05rem, 2.6vw, 1.25rem); color: var(--muted); max-width: 640px; margin-bottom: 30px; }
.hero-actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 34px; }
@media (min-width: 520px) { .hero-actions { flex-direction: row; flex-wrap: wrap; } }
.hero-trust { list-style: none; display: grid; gap: 10px; color: var(--text); font-weight: 600; }
.hero-trust .icon { color: var(--gold); margin-right: .35em; }
@media (min-width: 768px) { .hero-trust { grid-template-columns: repeat(3, auto); justify-content: start; gap: 28px; } }

.page-hero { background-color: var(--navy-deep); background-image: radial-gradient(ellipse at top, var(--navy) 0%, var(--navy-deep) 80%); color: var(--text); padding: 44px 0; }
.page-hero h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); line-height: 1.1; }
.page-hero .kicker { color: var(--gold); }
.page-meta { color: var(--muted); margin-top: 8px; }

/* ---- Sections ---- */

.section { padding: 56px 0; }
@media (min-width: 768px) { .section { padding: 88px 0; } }
.section-tint { background: var(--tint); }
.section-head { max-width: 720px; margin-bottom: 32px; }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; font-weight: 800; color: var(--gold-dark); margin-bottom: 10px; }
.section h2, .quote-copy h2 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.15; letter-spacing: -.01em; }
.quote-copy .h3, .card h3 { font-size: 1.25rem; line-height: 1.25; margin-bottom: 10px; }

/* ---- Cards ---- */

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 12px; margin-bottom: 16px;
  background: var(--navy); color: var(--gold);
}
.card-icon .icon { width: 26px; height: 26px; }
.card p { color: var(--ink-soft); }

.card-feature { margin-bottom: 20px; border-top: 4px solid var(--gold); }
@media (min-width: 768px) {
  .card-feature { display: flex; gap: 24px; padding: 32px; }
  .card-feature .card-icon { margin-bottom: 0; }
}
.card-feature p { margin-bottom: 18px; max-width: 760px; }

.card-grid { display: grid; gap: 20px; }
@media (min-width: 768px) { .card-grid { grid-template-columns: 1fr 1fr; } .card-grid .card { padding: 32px; } }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--tint); border: 1px solid var(--line); color: var(--navy); font-weight: 600; font-size: .92rem; padding: 6px 12px; border-radius: 999px; }

.ticks { list-style: none; display: grid; gap: 10px; color: var(--ink-soft); }
.ticks li { position: relative; padding-left: 28px; }
.ticks li::before {
  content: ""; position: absolute; left: 2px; top: .45em; width: 14px; height: 8px;
  border-left: 2.5px solid var(--gold-dark); border-bottom: 2.5px solid var(--gold-dark);
  transform: rotate(-45deg);
}

/* ---- Stats ---- */

.stats { display: grid; gap: 16px; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.stat { background: var(--white); border-radius: var(--radius); padding: 24px; border: 1px solid var(--line); }
.stat-icon { color: var(--gold-dark); margin-bottom: 10px; }
.stat-icon .icon { width: 28px; height: 28px; }
.stat-value { font-size: 2.4rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat-label { color: var(--ink-soft); font-weight: 600; }

/* ---- Quote / contact ---- */

.quote-grid { display: grid; gap: 32px; }
@media (min-width: 900px) { .quote-grid { grid-template-columns: 5fr 7fr; gap: 56px; align-items: start; } }
.quote-copy > p { color: var(--ink-soft); margin: 14px 0 22px; font-size: 1.05rem; }
.quote-copy .h3 { margin-top: 28px; }
.contact-list { list-style: none; display: grid; gap: 12px; font-weight: 600; }
.contact-list li { display: flex; align-items: center; gap: .6em; }
.contact-list .icon { color: var(--gold-dark); }
.contact-list a, .quote-copy a:not(.btn) { color: var(--navy); }
.form-card { padding: 20px; }
@media (min-width: 640px) { .form-card { padding: 32px; } }

.callout { background: var(--navy-deep); color: var(--text); border-radius: var(--radius); padding: 22px; margin-bottom: 8px; }
.callout h2 { font-size: 1.3rem; margin-bottom: 6px; }
.callout p { color: var(--muted); margin-bottom: 14px; }

/* ---- Forms ---- */

.form { display: grid; gap: 16px; }
.form-row { display: grid; gap: 16px; align-items: start; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: .95rem; }
.req { color: var(--error-ink); }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; /* 16px+ stops iOS zooming on focus */
  color: var(--ink); background: var(--white);
  border: 1.5px solid #c9cddc; border-radius: 10px; padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(67, 73, 112, .18);
}
.field [aria-invalid="true"] { border-color: var(--error-ink); }
.field-error { color: var(--error-ink); font-size: .9rem; font-weight: 600; }
.form-note { font-size: .85rem; color: var(--ink-soft); text-align: center; }
.form-note a { color: var(--navy); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.alert { border-radius: 10px; padding: 14px 16px; }
.alert-success { background: var(--success-bg); color: var(--success-ink); }
.alert-success a { color: inherit; font-weight: 700; }
.alert-error { background: var(--error-bg); color: var(--error-ink); font-weight: 600; }
.alert-info { background: var(--info-bg); color: var(--navy); margin-bottom: 16px; }

/* ---- Sign-in modal ---- */

.modal {
  border: 0; padding: 0; background: transparent;
  width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px);
  margin: auto;
}
.modal::backdrop { background: rgba(23, 25, 41, .62); backdrop-filter: blur(2px); }
.modal-card { position: relative; background: var(--white); border-radius: var(--radius); padding: 28px 22px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
@media (min-width: 480px) { .modal-card { padding: 34px 32px 30px; } }
.modal h2 { font-size: 1.5rem; margin-bottom: 8px; }
.modal-lead { color: var(--ink-soft); margin-bottom: 18px; }
.modal-close {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px;
  border: 0; border-radius: 8px; background: transparent; font-size: 1.7rem; line-height: 1;
  color: var(--ink-soft); cursor: pointer;
}
.modal-close:hover { background: var(--tint); color: var(--ink); }
.modal strong { color: var(--ink); word-break: break-all; }
.code-input { font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .95rem; color: var(--ink-soft); cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--navy); flex: none; }
.modal-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 16px; }
.link-button { background: none; border: 0; padding: 6px 0; font: inherit; font-size: .92rem; color: var(--navy); text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--ink); }

/* ---- Legal pages ---- */

.prose { max-width: 760px; color: var(--ink-soft); font-size: 1.03rem; }
.prose h2 { color: var(--ink); font-size: 1.3rem; margin: 32px 0 10px; }
.prose p, .prose ul { margin-bottom: 14px; }
.prose ul { padding-left: 22px; display: grid; gap: 8px; }
.prose a { color: var(--navy); }
.prose strong { color: var(--ink); }

/* ---- Footer ---- */

.site-footer { background: var(--navy-deep); color: var(--muted); padding: 48px 0 24px; }
.footer-grid { display: grid; gap: 32px; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-logo { width: 170px; background: var(--white); border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; }
.footer-heading { color: var(--white); font-size: .95rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 12px; }
.footer-list { list-style: none; display: grid; gap: 8px; }
.footer-list a { color: var(--text); text-decoration: none; }
.footer-list a:hover { color: var(--gold); text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 36px; padding-top: 18px; font-size: .85rem; }

/* =====================================================================
   Signed-in app (admin + client portal)
   ===================================================================== */

body.app { background: var(--tint); color: var(--ink); }

.app-header { background: var(--navy-deep); color: var(--text); position: sticky; top: 0; z-index: 40; }
.app-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; max-width: 1400px; margin: 0 auto; }
.app-brand img { width: 130px; background: var(--white); border-radius: 8px; padding: 5px 9px; }
.app-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-user-text { display: none; text-align: right; line-height: 1.25; min-width: 0; color: var(--text); text-decoration: none; }
.app-user-text:hover .app-user-name { text-decoration: underline; }
.app-user-name { display: block; font-weight: 700; }
.app-user-role { display: block; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 600px) { .app-user-text { display: block; } .app-brand img { width: 150px; } }

.app-shell { max-width: 1400px; margin: 0 auto; }
@media (min-width: 900px) { .app-shell { display: grid; grid-template-columns: 230px 1fr; gap: 24px; padding: 24px; } }

/* Phones: menu is a horizontal scrolling strip. Desktop: a sidebar. */
.app-nav { background: var(--white); border-bottom: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.app-nav-list { list-style: none; display: flex; gap: 4px; padding: 8px 12px; white-space: nowrap; }
.app-nav-list a, .app-nav-soon { display: block; padding: 9px 12px; border-radius: 8px; font-weight: 600; font-size: .95rem; text-decoration: none; }
.app-nav-list a { color: var(--ink); }
.app-nav-list a:hover { background: var(--tint); }
.app-nav-list a[aria-current="page"] { background: var(--navy); color: var(--white); }
.app-nav-soon { color: #9a9eb6; cursor: default; }
.app-nav-soon small { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: var(--tint); color: var(--ink-soft); padding: 2px 6px; border-radius: 999px; margin-left: 4px; }
@media (min-width: 900px) {
  .app-nav { background: transparent; border: 0; overflow: visible; }
  .app-nav-list { flex-direction: column; padding: 0; white-space: normal; position: sticky; top: 88px; }
}

.app-main { padding: 20px 16px 48px; min-width: 0; }
@media (min-width: 900px) { .app-main { padding: 0 0 48px; } }

.app-page-head { margin-bottom: 20px; }
.app-page-head h1 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.2; }
.app-page-head p { color: var(--ink-soft); }

.app-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 1100px) { .app-stats { grid-template-columns: repeat(4, 1fr); } }
.app-stat { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.app-stat-value { font-size: 1.7rem; font-weight: 800; color: var(--navy); line-height: 1.15; }
.app-stat-label { color: var(--ink-soft); font-size: .9rem; font-weight: 600; }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.1rem; }
.panel-empty { padding: 18px; color: var(--ink-soft); }

.callout-panel { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--navy-deep); color: var(--text); border: 0; }
.callout-panel h2 { font-size: 1.2rem; }
.callout-panel p { color: var(--muted); }
.callout-panel .btn { align-self: flex-start; }
@media (min-width: 640px) { .callout-panel { flex-direction: row; align-items: center; justify-content: space-between; } .callout-panel .btn { align-self: auto; } }

.list { list-style: none; }
.list-item { display: grid; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
@media (min-width: 768px) { .list-item { grid-template-columns: 1fr auto; gap: 20px; align-items: start; } }
.list-title { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.list-sub { color: var(--ink-soft); font-size: .93rem; margin-top: 2px; overflow-wrap: anywhere; }
.list-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .88rem; color: var(--ink-soft); }
@media (min-width: 768px) { .list-meta { flex-direction: column; align-items: flex-end; text-align: right; } }
.list-meta a { color: var(--navy); overflow-wrap: anywhere; }

.app-flash { margin-bottom: 16px; }
.muted { color: var(--ink-soft); }
.crumbs { font-size: .9rem; color: var(--ink-soft); margin-bottom: 2px; }
.crumbs a { color: var(--navy); }
.app-page-head-actions { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.app-page-head h1 .badge { vertical-align: middle; margin-left: 6px; }

.panel-pad { padding: 18px; }
@media (min-width: 640px) { .panel-pad { padding: 22px 24px; } }
.panel-title { font-size: 1.05rem; margin-bottom: 14px; }
.panel-head-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.count { display: inline-block; min-width: 1.6em; text-align: center; font-size: .8rem; background: var(--tint); color: var(--ink-soft); border-radius: 999px; padding: 1px 7px; margin-left: 4px; vertical-align: middle; }
.panel-empty a { color: var(--navy); font-weight: 700; }

.form-row-3 { display: grid; gap: 16px; }
@media (min-width: 640px) { .form-row-3 { grid-template-columns: 2fr 1fr 1fr; } }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 24px; }
.panel .form-actions { margin: 18px 0 0; }
.field-hint { color: var(--ink-soft); font-size: .88rem; font-weight: 400; }
.check .field-hint { display: inline; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { font-weight: 700; font-size: .95rem; margin-bottom: 6px; padding: 0; }
fieldset.field .check { padding: 4px 0; color: var(--ink); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.toolbar input[type="search"], .toolbar select {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--white);
  border: 1.5px solid #c9cddc; border-radius: 10px; padding: 10px 12px;
}
.toolbar input[type="search"] { flex: 1 1 220px; min-width: 0; }

/* Tables: rows become stacked cards on phones, using each cell's data-label. */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding: 10px 18px; border-bottom: 1px solid var(--line); background: #fafbfd; }
.table td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.table tr:last-child td { border-bottom: 0; }
.table td a { color: var(--navy); }
.table-link { font-weight: 700; }
.table-sub { display: block; font-size: .86rem; color: var(--ink-soft); }
.table-actions { text-align: right; white-space: nowrap; }
.table tr.is-inactive td { color: #8b8fa8; }
.table .badge { margin-left: 4px; }
.table td > .badge:first-child { margin-left: 0; }
@media (max-width: 767px) {
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { display: grid; grid-template-columns: 7.5em 1fr; gap: 10px; padding: 4px 0; border: 0; }
  .table td::before { content: attr(data-label); font-size: .8rem; font-weight: 700; color: var(--ink-soft); padding-top: 2px; }
  .table td > * { grid-column: 2; }
  .table td > .badge, .table td > .status-wrap, .table td > .inv-status { justify-self: start; }
  .table td:first-child { display: block; font-size: 1.05rem; }
  .table td:first-child::before { content: none; }
  .table td.table-actions { display: block; text-align: left; padding-top: 8px; }
  .table td.table-actions::before { content: none; }
}

.details { display: grid; gap: 12px 24px; }
@media (min-width: 640px) { .details { grid-template-columns: repeat(2, 1fr); } }
.details dt { font-size: .8rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.details dd { overflow-wrap: anywhere; }
.details a { color: var(--navy); }
.notes { margin-top: 16px; padding: 12px 14px; background: var(--tint); border-left: 4px solid var(--gold); border-radius: 6px; white-space: pre-wrap; }

.danger-zone { border-color: #f1c9c9; }
.danger-zone .panel-title { color: var(--error-ink); }
.danger-zone p { color: var(--ink-soft); margin-bottom: 12px; }
.btn-danger { background: var(--white); border-color: var(--error-ink); color: var(--error-ink); }
.btn-danger:hover { background: var(--error-ink); color: var(--white); }
.inline-form { display: inline; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.pager [aria-disabled="true"] { opacity: .4; pointer-events: none; }
.pager-info { color: var(--ink-soft); font-size: .9rem; }

.badge-muted { background: #ececf1; color: #6b7090; }

/* ---- Tickets ---- */

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link-more { font-size: .9rem; font-weight: 700; color: var(--navy); }
.link-danger { color: var(--error-ink); }
.app-stat-link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.app-stat-link:hover { border-color: var(--navy); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; border-bottom: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.tabs a { white-space: nowrap; padding: 10px 14px; font-weight: 700; font-size: .93rem; color: var(--ink-soft); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--gold); }

.ticket-num { color: var(--ink-soft); font-weight: 700; font-variant-numeric: tabular-nums; }
h1 .ticket-num { font-weight: 800; }
.ticket-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; color: var(--ink-soft); font-size: .92rem; }

.status, .prio { display: inline-block; font-size: .74rem; font-weight: 800; letter-spacing: .03em; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.status-new { background: #e1ecfb; color: #1f4f8f; }
.status-in-progress { background: #f6ecc4; color: #6d5609; }
.status-waiting { background: #f1e3f7; color: #6b2a83; }
.status-resolved { background: var(--success-bg); color: var(--success-ink); }
.status-closed { background: #ececf1; color: #555a75; }
.status-cancelled { background: #ececf1; color: #8b8fa8; text-decoration: line-through; }
.status-scheduled { background: #e4e6f2; color: var(--navy); }
.prio-high { background: #fde9d7; color: #8a4510; }
.prio-urgent { background: var(--error-bg); color: var(--error-ink); }

.ticket-layout { display: grid; gap: 0 20px; }
.ticket-aside .panel, .ticket-main .panel { margin-bottom: 16px; }
@media (min-width: 1100px) {
  .ticket-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .ticket-aside { grid-column: 2; grid-row: 1; position: sticky; top: 76px; }
  .ticket-main { grid-column: 1; grid-row: 1; }
}
.details-stack { grid-template-columns: 1fr !important; gap: 10px; }
.ticket-description { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.ai-summary { background: var(--info-bg); color: var(--navy); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.callout-scheduled { background: #eef0f9; border-color: #d4d8ec; }
.callout-scheduled p { margin-bottom: 10px; }
.callout-compact { padding: 16px; }
.callout-compact h2 { font-size: 1.05rem; }

.timeline { list-style: none; display: grid; gap: 12px; }
.tl-line { font-size: .9rem; color: var(--ink-soft); padding-left: 14px; border-left: 2px solid var(--line); }
.tl-line time, .tl-head time { color: #9a9eb6; font-size: .82rem; margin-left: 6px; white-space: nowrap; }
.tl-message { border-radius: 10px; padding: 12px 14px; border: 1px solid var(--line); }
.tl-staff { background: #f4f5fb; }
.tl-client { background: var(--white); border-left: 4px solid var(--navy); }
.tl-note { background: #fff9e6; border-color: #f1e2a6; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; font-size: .93rem; }
.tl-body { white-space: pre-wrap; overflow-wrap: anywhere; }

.time-total { font-weight: 800; color: var(--navy); }
.time-list { list-style: none; }
.time-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: .93rem; }
.time-list .muted { margin-left: 6px; font-size: .85rem; }
.time-form { padding: 14px 18px 18px; gap: 12px; }
.time-row { grid-template-columns: 1fr 1fr !important; gap: 8px 10px; }
.time-row > .field:first-child { grid-column: 1 / -1; }
.status-wrap { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.app-main a:not(.btn):not(.table-link) { color: var(--navy); }

.schedule-box { display: grid; gap: 14px; padding: 16px; background: var(--tint); border-radius: 10px; }
.schedule-box[hidden] { display: none; }

.input-with-button { display: flex; gap: 8px; }
.input-with-button select { flex: 1; min-width: 0; font: inherit; font-size: 1rem; border: 1.5px solid #c9cddc; border-radius: 10px; padding: 12px 14px; background: var(--white); color: var(--ink); }

.choice-grid { display: grid; gap: 10px; margin-top: 4px; }
@media (min-width: 640px) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice-body { display: block; height: 100%; border: 1.5px solid #c9cddc; border-radius: 10px; padding: 12px 14px; transition: border-color .15s, background-color .15s; }
.choice-body strong { display: block; color: var(--ink); }
.choice-body small { display: block; color: var(--ink-soft); font-size: .86rem; margin-top: 2px; }
.choice:hover .choice-body { border-color: var(--navy); }
.choice input:checked + .choice-body { border-color: var(--navy); background: #eef0f9; box-shadow: inset 0 0 0 1px var(--navy); }
.choice input:focus-visible + .choice-body { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---- Portal: company ---- */

.company-grid { display: grid; gap: 0 20px; }
@media (min-width: 1100px) { .company-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.company-grid .panel { margin-bottom: 16px; }
.rate-card .rate { font-size: 2.2rem; font-weight: 800; color: var(--navy); line-height: 1.1; margin-bottom: 8px; }
.rate-card .rate span { font-size: 1rem; font-weight: 600; color: var(--ink-soft); }
.rate-card .muted { font-size: .9rem; margin-bottom: 10px; }
.covered { margin-top: 16px; padding: 12px 14px; background: var(--info-bg); border-radius: 6px; color: var(--navy); }

/* ---- Ticket review ---- */

.rule-box summary { cursor: pointer; }
.rule-box .rule-table { max-width: 360px; margin: 12px 0; }
.rule-box .rule-table td, .rule-box .rule-table th { padding: 6px 10px; }
.review-card h2 { font-size: 1.05rem; }
.review-card h2 a { color: var(--ink); text-decoration: none; }
.review-card h2 a:hover { text-decoration: underline; }
.review-card .panel-head p { font-size: .88rem; margin-top: 4px; }
.input-sm { width: 6.5em; font: inherit; font-size: 1rem; border: 1.5px solid #c9cddc; border-radius: 8px; padding: 6px 8px; background: var(--white); color: var(--ink); }
.input-sm::placeholder { color: #b0b4c8; font-weight: 400; }
.review-summary { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 14px 18px; background: #fafbfd; border-top: 1px solid var(--line); }
.review-summary dl { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.review-summary dt { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.review-summary dd { font-weight: 700; }
.review-amount { color: var(--navy); font-size: 1.15rem; }
.review-actions { display: flex; align-items: center; gap: 12px; }
.review-entries .check { padding: 0; }

/* ---- Invoices ---- */

.inv-status { display: inline-block; font-size: .74rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; vertical-align: middle; }
.inv-draft { background: #ececf1; color: #555a75; }
.inv-sent, .inv-due { background: #e1ecfb; color: #1f4f8f; }
.inv-overdue { background: var(--error-bg); color: var(--error-ink); }
.inv-paid { background: var(--success-bg); color: var(--success-ink); }
.invoice-preview-total { padding: 14px 18px; text-align: right; font-size: 1.1rem; border-top: 1px solid var(--line); }

.invoice-panel { padding: 20px; }
@media (min-width: 768px) { .invoice-panel { padding: 40px; } }
.invoice-doc { max-width: 820px; margin: 0 auto; color: var(--ink); }
.invoice-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 3px solid var(--gold); }
.invoice-logo { width: 180px; margin-bottom: 10px; }
.invoice-from { color: var(--ink-soft); font-size: .9rem; }
.invoice-title h2 { font-size: 1.8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--navy); margin-bottom: 6px; }
.invoice-title dl > div { display: flex; gap: 10px; font-size: .92rem; }
.invoice-title dt { color: var(--ink-soft); min-width: 5em; }
.invoice-title dd { font-weight: 700; }
.invoice-billto { padding: 18px 0; }
.invoice-billto h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-bottom: 4px; }
.pre { white-space: pre-line; }
.invoice-lines { width: 100%; border-collapse: collapse; margin: 6px 0 18px; }
.invoice-lines th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); border-bottom: 2px solid var(--line); padding: 8px 6px; }
.invoice-lines td { border-bottom: 1px solid var(--line); padding: 10px 6px; vertical-align: top; overflow-wrap: anywhere; }
.invoice-lines .num { text-align: right; white-space: nowrap; }
.invoice-lines tfoot th { text-align: right; font-size: .95rem; color: var(--ink); text-transform: none; letter-spacing: 0; border: 0; padding-top: 14px; }
.invoice-lines tfoot td { border: 0; padding-top: 14px; }
.invoice-total { font-size: 1.3rem; font-weight: 800; color: var(--navy); }
.invoice-sub { display: block; font-size: .82rem; color: var(--ink-soft); }
.invoice-foot { font-size: .85rem; color: var(--ink-soft); display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }

@media print {
  body.app { background: #fff; }
  .app-header, .app-nav, .no-print, .app-flash, .skip-link, .danger-zone { display: none !important; }
  .app-shell { display: block; padding: 0; max-width: none; }
  .app-main { padding: 0; }
  .invoice-panel { border: 0; padding: 0; box-shadow: none; }
  .invoice-top { border-bottom-color: #999; }
  a { color: inherit; text-decoration: none; }
}
.badge { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; }
.badge-gold { background: #f6ecc4; color: #6d5609; }
.badge-navy { background: #e4e6f2; color: var(--navy); }
