:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #f8fafc;
  background: #070b14;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  background: #070b14;
  overflow: hidden;
  touch-action: pan-y;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-panel {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  background: #070b14;
}

.app-toolbar {
  z-index: 10;
  display: flex;
  flex: 0 0 54px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.brand-dot { color: #00f0ff; }

.toolbar-button {
  min-height: 36px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 6px 14px;
  background: rgba(56, 189, 248, 0.15);
  color: #00f0ff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.toolbar-button:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #00f0ff;
}

iframe {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1;
  border: 0;
  background: #070b14;
}
iframe[hidden] { display: none; }

.offline-movement {
  position: absolute;
  z-index: 25;
  inset: 0;
  overflow: auto;
  padding: clamp(16px, 4vw, 30px);
  background: radial-gradient(circle at 100% 0, rgba(0, 191, 165, .11), transparent 34%), #f6f8fc;
  color: #172338;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.offline-movement[hidden] { display: none; }
.offline-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: min(760px, 100%);
  margin: 0 auto 18px;
}
.offline-kicker { color: #087f75; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.offline-heading h1 { margin-top: 6px; font-size: clamp(22px, 5vw, 30px); letter-spacing: -.04em; }
.offline-heading p { margin-top: 6px; color: #65758b; font-size: 13px; }
.offline-state-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(180, 83, 9, .28);
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11px;
  font-weight: 800;
}
.offline-state-pill span { width: 8px; height: 8px; border-radius: 50%; background: #f97316; }
.offline-notice,
.offline-cache-warning,
.offline-empty,
.offline-active-summary,
.offline-form,
.offline-queue-summary {
  width: min(760px, 100%);
  margin: 0 auto 14px;
  border: 1px solid rgba(26, 48, 105, .13);
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 28px rgba(31, 54, 82, .07);
}
.offline-notice {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-color: rgba(8, 127, 117, .26);
  background: #effcf9;
  color: #175b58;
  font-size: 12px;
  line-height: 1.5;
}
.offline-notice strong { font-size: 13px; }
.offline-cache-warning { padding: 12px 14px; color: #8a4310; font-size: 12px; line-height: 1.5; }
.offline-empty { padding: 20px; }
.offline-empty strong { font-size: 15px; }
.offline-empty p { margin-top: 8px; color: #65758b; font-size: 13px; line-height: 1.55; }
.offline-active-summary { padding: 14px 16px; color: #1737bd; font-size: 13px; line-height: 1.5; }
.offline-form { display: grid; gap: 9px; padding: 18px; }
.offline-form[hidden] { display: none; }
.offline-form h2 { margin-bottom: 3px; font-size: 18px; }
.offline-form label,
.offline-destination-options legend { color: #46546b; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.offline-form input,
.offline-form select,
.offline-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #c5d2e0;
  border-radius: 9px;
  background: #fff;
  color: #172338;
  font: inherit;
  font-size: 14px;
}
.offline-form textarea { min-height: 72px; resize: vertical; }
.offline-form input:focus,
.offline-form select:focus,
.offline-form textarea:focus { border-color: #087f75; outline: 3px solid rgba(8, 127, 117, .14); }
.offline-destination-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 5px 0;
  padding: 0;
  border: 0;
}
.offline-destination-options legend { grid-column: 1 / -1; margin-bottom: 4px; }
.offline-destination-choice {
  display: grid;
  gap: 5px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid #c5d2e0;
  border-radius: 10px;
  background: #fff;
  color: #172338;
  text-align: left;
  cursor: pointer;
}
.offline-destination-choice small { color: #65758b; line-height: 1.35; }
.offline-destination-choice.is-selected { border-color: #087f75; background: #effcf9; }
.offline-submit {
  min-height: 48px;
  margin-top: 6px;
  border: 0;
  border-radius: 10px;
  background: #1737bd;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}
.offline-submit:disabled { opacity: .55; cursor: not-allowed; }
.offline-queue-summary { padding: 12px 15px; color: #46546b; font-size: 12px; line-height: 1.45; }
.offline-extra {
  width: min(760px, 100%);
  margin: 0 auto 12px;
  overflow: hidden;
  border: 1px solid rgba(26, 48, 105, .13);
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 28px rgba(31, 54, 82, .07);
}
.offline-extra summary {
  padding: 15px 18px;
  color: #1737bd;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.offline-extra[open] summary { border-bottom: 1px solid rgba(26, 48, 105, .1); }
.offline-extra .offline-form {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.offline-banner {
  position: fixed;
  z-index: 100;
  inset: auto 16px max(16px, env(safe-area-inset-bottom));
  padding: 12px 18px;
  border-radius: 10px;
  background: #0f172a;
  border: 1px solid #00f0ff;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8), 0 0 20px rgba(0, 240, 255, 0.2);
}

@media (max-width: 480px) {
  .offline-heading { flex-direction: column; }
  .offline-destination-options { grid-template-columns: minmax(0, 1fr); }
  .offline-form { padding: 15px; }
}

html[data-theme="dark"] .offline-movement { background: #070b14; color: #f8fafc; }
html[data-theme="dark"] .offline-heading p,
html[data-theme="dark"] .offline-empty p,
html[data-theme="dark"] .offline-form label,
html[data-theme="dark"] .offline-destination-options legend { color: #94a3b8; }
html[data-theme="dark"] .offline-notice {
  border-color: rgba(0, 240, 255, .25);
  background: rgba(0, 191, 165, .1);
  color: #b7f7ec;
}
html[data-theme="dark"] .offline-notice,
html[data-theme="dark"] .offline-cache-warning,
html[data-theme="dark"] .offline-empty,
html[data-theme="dark"] .offline-active-summary,
html[data-theme="dark"] .offline-form,
html[data-theme="dark"] .offline-queue-summary {
  border-color: rgba(56, 189, 248, .2);
  background-color: #0f172a;
  color: #e2e8f0;
}
html[data-theme="dark"] .offline-extra {
  border-color: rgba(56, 189, 248, .2);
  background: #0f172a;
}
html[data-theme="dark"] .offline-extra summary { color: #00f0ff; }
html[data-theme="dark"] .offline-extra[open] summary { border-bottom-color: #26364f; }
html[data-theme="dark"] .offline-form input,
html[data-theme="dark"] .offline-form select,
html[data-theme="dark"] .offline-form textarea,
html[data-theme="dark"] .offline-destination-choice {
  border-color: #334155;
  background: #111b30;
  color: #f8fafc;
}
html[data-theme="dark"] .offline-destination-choice small { color: #94a3b8; }
html[data-theme="dark"] .offline-destination-choice.is-selected {
  border-color: #00f0ff;
  background: rgba(0, 191, 165, .12);
}