/* Soldek.ai — self-service panel styles (UX-SPEC §1.1/§1.2-1.4, §5, §6).
   Loads after app.css; uses only :root tokens defined there.
   Class names .panel/.backdrop/.doc/.tl/.skel verified absent from app.css. */

/* ---------------- overlay ---------------- */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 37, 64, 0.28);
  z-index: 8;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.backdrop.is-open { opacity: 1; }

.panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, calc(100vw - 48px));
  background: var(--bg);
  border-left: 1px solid var(--line);
  border-radius: 0;
  box-shadow: -8px 0 32px rgba(10, 37, 64, 0.10);
  z-index: 9;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease; /* closing */
}
.panel.is-open {
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1); /* opening */
}

.panel__head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.panel__title {
  font-size: 1rem; font-weight: 650; letter-spacing: -0.01em;
  margin: 0; flex: 1;
}
.panel__close {
  border: 0; background: none;
  font-size: 1.4rem; line-height: 1;
  color: var(--muted); cursor: pointer;
  padding: 6px 8px; border-radius: 8px;
}
.panel__close:hover { background: var(--bg-soft); }
.panel__grab { display: none; }

.panel__body {
  flex: 1; overflow-y: auto;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom));
  display: grid; gap: 18px; align-content: start;
}

/* ---------------- sections & chrome ---------------- */
.pv { animation: pv-fadeUp 0.32s both; }
@keyframes pv-fadeUp {
  from { opacity: 0; transform: translateY(8px); }
}
.pv__eyebrow {
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.pv-hero { position: relative; overflow: hidden; }
.pv-hero::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 15%, #fff));
}
.pv-hero__row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; font-size: 0.82rem;
}
.pv-readiness .kv { margin-top: 8px; }

/* ---------------- profile: completeness meter ---------------- */
.pv-meter__row { display: flex; align-items: baseline; gap: 8px; }
.pv-meter__pct { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pv-meter__lbl { font-size: 0.82rem; color: var(--muted); flex: 1; }
.pv-meter__track {
  height: 6px; border-radius: 999px; background: var(--line);
  margin-top: 10px; overflow: hidden;
}
.pv-meter__fill {
  height: 100%; border-radius: 999px; background: var(--accent);
  transition: width 0.45s ease-out;
}
.pv-meter--done .pv-meter__fill { background: var(--ok); }

/* ---------------- profile: next-question CTA ---------------- */
.pv-next {
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: 12px; padding: 14px 16px;
}
.pv-next__q { margin: 4px 0 12px; font-weight: 600; line-height: 1.45; }

/* ---------------- profile: fact groups ---------------- */
.pv-group { border: 1px solid var(--line); border-radius: 12px; padding: 2px 14px 6px; }
.pv-group + .pv-group { margin-top: 10px; }
.pv-group__head {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 0 7px; border-bottom: 1px solid var(--line);
}
.pv-group__icon {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex: none;
}
.pv-group__name { font-weight: 600; font-size: 0.9rem; flex: 1; }
.pv-group__count { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------- polis: cover rows ---------------- */
.pv-line { display: flex; gap: 12px; }
.pv-line__icon {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex: none; margin-top: 2px;
}
.pv-line__txt { flex: 1; min-width: 0; }

/* ---------------- polis: endorsement timeline (vertical) ---------------- */
.tlv { padding-left: 2px; }
.tlv__item { position: relative; display: flex; gap: 12px; padding: 8px 0; }
.tlv__item::before {
  content: ""; position: absolute; left: 4px; top: 24px; bottom: -10px;
  width: 2px; background: var(--line);
}
.tlv__item:last-child::before { display: none; }
.tlv__dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex: none; margin-top: 5px; position: relative; z-index: 1;
}
.tlv__item--start .tlv__dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.tlv__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex: 1; }
.tlv__kind { font-weight: 600; font-size: 0.9rem; }
.tlv__date { font-size: 0.78rem; color: var(--muted); }
.tlv__body { flex: 1; min-width: 0; }

/* ---------------- claims: description + report CTA ---------------- */
.pv-claim__desc {
  font-size: 0.85rem; color: var(--muted); margin-top: 6px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pv-claims__new { width: 100%; }

.pv-empty { text-align: center; padding: 24px 8px; color: var(--muted); }
.pv-empty p { margin: 0 0 16px; line-height: 1.5; }

.pv-error { text-align: center; padding: 32px 8px; }
.pv-error p { margin: 0 0 14px; }

.panel__hint {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.pv-download { margin-top: 12px; }

/* ---------------- skeleton ---------------- */
.pv-skel { display: grid; gap: 12px; align-content: start; }
.skel {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, #efedea 37%, var(--bg-soft) 63%);
  background-size: 400% 100%;
  animation: pv-shimmer 1.2s infinite;
}
@keyframes pv-shimmer {
  to { background-position: -100% 0; }
}

/* ---------------- polisblad document ---------------- */
.doc {
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.doc::before {
  content: ""; position: absolute; inset: 0 auto auto 0; height: 2px; width: 48px;
  background: var(--accent);
}
.doc__eyebrow {
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 2px;
}
.doc__tenant { font-weight: 700; margin-bottom: 10px; }
.doc__section {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin: 14px 0 2px;
}
.doc__foot {
  margin-top: 14px;
  font-size: 0.72rem; color: var(--muted); line-height: 1.5;
}

/* .card inside the panel: the section .pv handles the entrance — avoid double fade */
.panel .card { animation: none; }

/* ---------------- claims timeline ---------------- */
.tl { display: flex; align-items: flex-start; margin: 6px 0 10px; }
.tl__step {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative; text-align: center;
}
.tl__step::before {
  content: ""; position: absolute;
  top: 4px; right: 50%; width: 100%; height: 2px;
  background: var(--line-2);
}
.tl__step:first-child::before { display: none; }
.tl__step--done::before { background: var(--ok); }
.tl__step--current::before { background: var(--accent); }
.tl__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line-2);
  position: relative; z-index: 1;
}
.tl__step--done .tl__dot { background: var(--ok); }
.tl__step--current .tl__dot {
  background: var(--accent);
  animation: pv-blink 1.4s infinite;
}
.tl__label { font-size: 0.72rem; color: var(--muted); }
.tl__step--done .tl__label { color: var(--text); }
.tl__step--current .tl__label { color: var(--accent); font-weight: 600; }
@keyframes pv-blink {
  0%, 80%, 100% { opacity: 0.35; }
  40% { opacity: 1; }
}

/* ---------------- desktop: docked beside the sidebar ---------------- */
/* At >=1024px the app shell has a fixed left sidebar (app.css .side, width
   --side-w, raised above the panel there). The panel docks against the sidebar
   and slides in from the left (out from underneath it); the backdrop dims only
   the remaining canvas so the sidebar stays visible and interactive. Below
   1024px nothing changes: right sheet, and bottom sheet at <=720px. */
@media (min-width: 1024px) {
  .backdrop { left: var(--side-w); }
  .panel {
    left: var(--side-w); right: auto;
    border-left: 0;
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 32px rgba(10, 37, 64, 0.10);
    transform: translateX(-100%);
  }
  .panel.is-open { transform: translateX(0); }
}

/* ---------------- mobile: bottom sheet (§5) ---------------- */
@media (max-width: 720px) {
  .panel {
    inset: auto 0 0 0;
    width: 100%;
    height: min(88dvh, 100%);
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    transform: translateY(100%);
  }
  .panel.is-open { transform: translateY(0); }
  .panel__grab {
    display: block;
    position: absolute;
    top: 8px; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 999px;
    background: var(--line-2);
  }
}

@media (max-width: 480px) {
  .pv-hero .card__price { font-size: 1.7rem; }
  .panel .kv { font-size: 0.85rem; }
  .doc { padding: 14px; }
}

/* ---------------- reduced motion (§6) ---------------- */
@media (prefers-reduced-motion: reduce) {
  .panel,
  .panel.is-open,
  .backdrop { transition: none; }
  .pv,
  .skel,
  .tl__step--current .tl__dot { animation: none; }
  .pv-meter__fill { transition: none; }
}
