/* ============================================================
 * LAPSIT Kawasan — SitRoom TEP 2026
 * Desktop: control panel + export strip
 * Mobile: native-app shell (sticky header, bottom dock, snap KPIs)
 * ============================================================ */

:root {
  --ls-navy: #0b1330;
  --ls-navy-2: #132447;
  --ls-ink: #0f172a;
  --ls-muted: #64748b;
  --ls-line: #e2e8f0;
  --ls-gold: #e3c16f;
  --ls-gold-deep: #b38a2b;
  --ls-surface: #f4f7fb;
  --ls-radius: 16px;
  --ls-touch: 44px;
  --ls-safe-top: env(safe-area-inset-top, 0px);
  --ls-safe-bottom: env(safe-area-inset-bottom, 0px);
}

.ls-app {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(28, 60, 122, 0.08), transparent 55%),
    var(--ls-surface);
  min-height: 100dvh;
  color: var(--ls-ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.ls-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* —— Topbar —— */
.ls-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: var(--ls-safe-top);
  backdrop-filter: saturate(1.2) blur(14px);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
}

.pt-topbar__link--accent {
  background: rgba(28, 60, 122, 0.1);
  color: #1c3c7a;
  font-weight: 700;
}

/* —— Controls panel —— */
.ls-controls {
  position: sticky;
  top: calc(56px + var(--ls-safe-top));
  z-index: 45;
  padding: 10px 16px 12px;
  background: rgba(244, 247, 251, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ls-line);
}

.ls-controls__panel {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--ls-line);
  border-radius: var(--ls-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ls-controls__grid {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(130px, 0.8fr) minmax(180px, 1.4fr) minmax(150px, 1fr);
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ls-controls__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.ls-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.ls-field--grow { min-width: 0; }

.ls-field > span {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ls-muted);
}

.ls-input {
  height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid #d8e0ec;
  border-radius: 12px;
  background: #f8fafc;
  font: inherit;
  font-size: 14px;
  color: var(--ls-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.ls-input:hover { background: #fff; }
.ls-input:focus {
  outline: none;
  background: #fff;
  border-color: #1c3c7a;
  box-shadow: 0 0 0 3px rgba(28, 60, 122, 0.14);
}

.ls-field.is-dim { opacity: 0.55; }

.ls-result-hint {
  flex: 1 1 100%;
  margin: 2px 0 0;
  padding: 0 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ls-muted);
  line-height: 1.35;
}

.ls-chipbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--ls-touch);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--ls-line);
  background: #fff;
  color: #1c3c7a;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.ls-chipbtn:hover { background: #f1f5f9; }
.ls-chipbtn:active { transform: scale(0.97); }

/* —— Export bar (desktop strip / mobile bottom dock) —— */
.ls-exportbar {
  position: sticky;
  top: calc(118px + var(--ls-safe-top));
  z-index: 44;
  padding: 12px 16px;
  background:
    radial-gradient(80% 140% at 0% 0%, rgba(227, 193, 111, 0.18), transparent 50%),
    linear-gradient(135deg, var(--ls-navy) 0%, var(--ls-navy-2) 55%, #1a335f 100%);
  border-bottom: 1px solid rgba(227, 193, 111, 0.22);
}

.ls-exportbar__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.ls-exportbar__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #fff;
  min-width: 120px;
}

.ls-exportbar__kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ls-gold);
}

.ls-exportbar__label strong {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.ls-exportbar__actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  flex: 1;
  min-width: min(100%, 420px);
}

.ls-xbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ls-xbtn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(227, 193, 111, 0.5);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.ls-xbtn:active { transform: scale(0.98); }

.ls-xbtn__ico {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ls-xbtn--pdf .ls-xbtn__ico { background: rgba(248, 113, 113, 0.22); color: #fecaca; }
.ls-xbtn--word .ls-xbtn__ico { background: rgba(96, 165, 250, 0.22); color: #bfdbfe; }
.ls-xbtn--txt .ls-xbtn__ico { background: rgba(52, 211, 153, 0.22); color: #a7f3d0; }

.ls-xbtn__txt { display: flex; flex-direction: column; gap: 1px; line-height: 1.15; min-width: 0; }
.ls-xbtn__name { font-size: 14px; font-weight: 800; }
.ls-xbtn__sub { font-size: 11px; opacity: 0.72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ls-exportbar__hint {
  flex-basis: 100%;
  margin: 0;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.62);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

/* —— Main / KPI —— */
.ls-main {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 calc(28px + var(--ls-safe-bottom));
  flex: 1;
}

.ls-summary {
  margin: 0 0 16px;
  overflow: hidden;
}

.ls-summary__track {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.ls-summary__item {
  background: #fff;
  border: 1px solid var(--ls-line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.ls-summary__item span {
  display: block;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ls-muted);
  margin-bottom: 4px;
}

.ls-summary__item strong {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ls-navy);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.ls-loading,
.ls-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--ls-muted);
  font-size: 14px;
}

/* —— Document —— */
.ls-doc {
  background: #fff;
  border: 1px solid var(--ls-line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(13, 19, 38, 0.04), 0 18px 40px -28px rgba(13, 19, 38, 0.35);
  overflow: hidden;
}

.ls-doc__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 32px 36px 24px;
  border-bottom: 2px solid var(--ls-navy);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 72%);
}

.ls-doc__logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: 6px; }
.ls-doc__org {
  margin: 0;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ls-gold-deep);
}
.ls-doc__title {
  margin: 4px 0 10px;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 600;
  color: var(--ls-navy);
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-align: center;
  max-width: 22em;
}
.ls-doc__meta { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ls-doc__date,
.ls-doc__pukul {
  margin: 0;
  font-size: 14px;
  color: #1e293b;
  font-weight: 600;
  text-align: center;
}
.ls-doc__cycle {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--ls-muted);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  max-width: 36em;
}

.ls-doc__toc {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 14px 24px;
  border-bottom: 1px solid #eef2f7;
  background: #fafbfc;
}
.ls-doc__toc a {
  font-size: 12px;
  font-weight: 650;
  color: #1c3c7a;
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(28, 60, 122, 0.06);
}
.ls-doc__toc a:hover { background: rgba(28, 60, 122, 0.12); }
.ls-doc__toc a.is-alert { color: #b91c1c; background: rgba(185, 28, 28, 0.08); }
.ls-doc__toc a.is-missing { color: var(--ls-muted); background: #f1f5f9; }

.ls-doc__body { padding: 4px 0 36px; }

.ls-kawasan {
  padding: 26px 40px 18px;
  scroll-margin-top: 160px;
}
.ls-kawasan + .ls-kawasan { border-top: 1px solid #d8e0ec; }
.ls-kawasan__title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ls-navy);
  letter-spacing: 0.02em;
  line-height: 1.35;
  padding-bottom: 8px;
  border-bottom: 1px solid #e8edf5;
}
.ls-kawasan__meta-block { display: grid; gap: 4px; margin-bottom: 8px; }
.ls-kawasan__meta {
  margin: 0;
  font-size: 13.5px;
  color: #1e293b;
  line-height: 1.45;
  display: grid;
  grid-template-columns: minmax(11.5em, 38%) 1fr;
  gap: 8px 12px;
}
.ls-kawasan__meta span { color: var(--ls-muted); font-weight: 600; }
.ls-kawasan__meta span::after { content: " :"; }
.ls-kawasan__meta strong { font-weight: 700; color: var(--ls-navy); }

.ls-kawasan__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 6px 0 14px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.ls-kawasan__badge--ok { color: #0f766e; background: rgba(15, 118, 110, 0.1); }
.ls-kawasan__badge--partial { color: #a37b1a; background: rgba(195, 154, 60, 0.14); }
.ls-kawasan__badge--miss { color: var(--ls-muted); background: #f1f5f9; }
.ls-kawasan__badge--alert { color: #b91c1c; background: rgba(185, 28, 28, 0.1); }

.ls-sec { margin: 16px 0 6px; }
.ls-sec__title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ls-navy);
  letter-spacing: 0.04em;
}

.ls-olist {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: ols;
  font-size: 13.5px;
  color: #1e293b;
  line-height: 1.5;
}
.ls-olist > li {
  counter-increment: ols;
  position: relative;
  padding: 4px 0 4px 1.75em;
}
.ls-olist > li::before {
  content: counter(ols) ")";
  position: absolute;
  left: 0;
  top: 4px;
  color: var(--ls-muted);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.ls-olist__row {
  display: grid;
  grid-template-columns: minmax(10.5em, 36%) 1fr;
  gap: 6px 14px;
  align-items: baseline;
}
.ls-olist__k { font-weight: 600; color: #334155; }
.ls-olist__k::after { content: " :"; }
.ls-olist__v { font-weight: 700; color: var(--ls-navy); font-variant-numeric: tabular-nums; }
.ls-olist__block .ls-olist__k { display: block; margin-bottom: 4px; }

.ls-ket { margin: 2px 0 0; padding-left: 1.15em; list-style: disc; }
.ls-ket li { margin-bottom: 3px; line-height: 1.45; }

.ls-team-list { margin: 0; padding: 0; list-style: none; }
.ls-team {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dotted #e8edf5;
}
.ls-team:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.ls-team__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 13.5px;
}
.ls-team__num { color: var(--ls-muted); font-weight: 650; font-variant-numeric: tabular-nums; min-width: 1.6em; }
.ls-team__label { font-weight: 750; color: var(--ls-navy); }
.ls-team__pt { font-weight: 600; color: var(--ls-muted); font-size: 12.5px; }
.ls-team__bullets {
  margin: 0 0 0 1.7em;
  padding-left: 1.1em;
  list-style: disc;
  font-size: 13.5px;
  color: #1e293b;
  line-height: 1.5;
}
.ls-team__bullets li { margin-bottom: 2px; }
.ls-team__empty { margin-left: 1.7em; font-size: 13px; color: #94a3b8; font-style: italic; }
.ls-muted { color: #94a3b8; font-style: italic; font-size: 13px; }

/* —— Tablet —— */
@media (max-width: 980px) {
  .ls-controls__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ls-summary__track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ls-controls {
    top: calc(52px + var(--ls-safe-top));
  }
  .ls-exportbar {
    top: calc(150px + var(--ls-safe-top));
  }
}

/* —— Mobile native shell —— */
@media (max-width: 720px) {
  .ls-app {
    background: #eef2f7;
  }

  .ls-controls {
    position: static;
    padding: 10px 12px 8px;
    background: transparent;
    border: 0;
    backdrop-filter: none;
  }

  .ls-controls__panel {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  }

  .ls-controls__grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .ls-field--grow {
    grid-column: 1 / -1;
  }

  .ls-input {
    height: var(--ls-touch);
    font-size: 16px; /* avoid iOS zoom */
    border-radius: 14px;
    background: #f1f5f9;
  }

  .ls-controls__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ls-chipbtn {
    width: 100%;
    min-height: 46px;
    border-radius: 14px;
  }

  /* Bottom dock — thumb zone */
  .ls-exportbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 60;
    padding: 10px 12px calc(10px + var(--ls-safe-bottom));
    border-bottom: 0;
    border-top: 1px solid rgba(227, 193, 111, 0.28);
    box-shadow: 0 -12px 32px rgba(11, 19, 48, 0.28);
    background:
      radial-gradient(90% 120% at 50% 120%, rgba(227, 193, 111, 0.16), transparent 55%),
      linear-gradient(180deg, #132447 0%, #0b1330 100%);
  }

  .ls-exportbar__inner {
    gap: 8px;
  }

  .ls-exportbar__label {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    width: 100%;
  }

  .ls-exportbar__label strong {
    font-size: 13px;
  }

  .ls-exportbar__actions {
    width: 100%;
    min-width: 0;
    gap: 8px;
  }

  .ls-xbtn {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    min-height: 68px;
    padding: 10px 6px;
    border-radius: 16px;
    text-align: center;
  }

  .ls-xbtn__ico {
    width: 34px;
    height: 34px;
  }

  .ls-xbtn__txt {
    align-items: center;
  }

  .ls-xbtn__name {
    font-size: 12.5px;
  }

  .ls-xbtn__sub {
    display: none;
  }

  .ls-exportbar__hint {
    display: none;
  }

  .ls-main {
    width: 100%;
    padding: 8px 12px calc(118px + var(--ls-safe-bottom));
  }

  /* KPI horizontal snap */
  .ls-summary {
    margin: 0 -12px 14px;
    padding: 0;
  }

  .ls-summary__track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 12px 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ls-summary__track::-webkit-scrollbar { display: none; }

  .ls-summary__item {
    flex: 0 0 42%;
    scroll-snap-align: start;
    border-radius: 16px;
    padding: 14px;
  }

  .ls-summary__item strong {
    font-size: 1.55rem;
  }

  .ls-doc {
    border-radius: 18px;
    border: 0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  }

  .ls-doc__head {
    padding: 24px 18px 18px;
  }

  .ls-doc__logo {
    width: 52px;
    height: 52px;
  }

  .ls-doc__toc {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 14px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ls-doc__toc::-webkit-scrollbar { display: none; }
  .ls-doc__toc a {
    flex: 0 0 auto;
    padding: 8px 12px;
  }

  .ls-kawasan,
  .ls-doc__head {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ls-kawasan {
    scroll-margin-top: 80px;
    padding-top: 18px;
  }

  .ls-kawasan__meta,
  .ls-olist__row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (max-width: 420px) {
  .ls-controls__grid {
    grid-template-columns: 1fr;
  }
  .ls-summary__item {
    flex-basis: 48%;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ls-xbtn,
  .ls-chipbtn,
  .ls-input {
    transition: none;
  }
}

/* —— Print / PDF —— */
@media print {
  .no-print,
  .auth-gate,
  .pt-topbar,
  .ls-controls,
  .ls-exportbar,
  .ls-summary,
  .ls-loading,
  .ls-empty,
  .ls-doc__toc {
    display: none !important;
  }

  .ls-app,
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .ls-main {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .ls-doc {
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .ls-doc__head {
    padding: 0 0 14pt;
    border-bottom: 1.5pt solid #000;
    background: none;
    break-after: avoid;
  }

  .ls-doc__logo { width: 48px; height: 48px; }
  .ls-doc__title { font-size: 15pt; max-width: none; }
  .ls-doc__date,
  .ls-doc__pukul { font-size: 11pt; color: #000; }
  .ls-doc__cycle { color: #333; font-size: 9pt; }
  .ls-doc__body { padding: 0; }

  .ls-kawasan {
    padding: 12pt 0 8pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .ls-kawasan + .ls-kawasan { border-top: 0.6pt solid #999; }
  .ls-kawasan__title { font-size: 11pt; border-bottom-color: #ccc; color: #000; }
  .ls-kawasan__badge { display: none; }
  .ls-kawasan__meta,
  .ls-sec__title,
  .ls-olist,
  .ls-team__head,
  .ls-team__bullets,
  .ls-ket { font-size: 10pt; color: #000; }
  .ls-team { border-bottom-color: #ccc; }
  .ls-team__empty,
  .ls-muted { color: #555; }
  a { color: inherit; text-decoration: none; }
}
