:root {
  color-scheme: only light;
  --bg-deep: #07131d;
  --bg-mid: #0c2232;
  --bg-warm: #b27a1b;
  --accent: #f2c200;
  --accent-strong: #f8d66d;
  --text: #f8f6ef;
  --muted: rgba(248, 246, 239, 0.62);
  --card: rgba(15, 33, 48, 0.82);
  --shadow: rgba(2, 8, 14, 0.35);
  --border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--bg-deep);
}

body {
  font-family: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Avenir Next",
    "Futura", "Trebuchet MS", sans-serif;
  background-color: var(--bg-deep);
  background:
    radial-gradient(120% 80% at 50% 10%, rgba(242, 194, 0, 0.16), transparent 55%),
    radial-gradient(90% 120% at 50% 110%, rgba(12, 38, 58, 0.95), transparent 60%),
    linear-gradient(165deg, var(--bg-deep), var(--bg-mid) 60%, #0f2c42 100%);
  color: var(--text);
  overflow: hidden;
}

.app {
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px clamp(14px, 6vw, 28px) 14px;
  overflow: hidden;
}

.safe-area {
  height: env(safe-area-inset-top);
  width: 100%;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
  border-radius: 14px;
  background: transparent;
  border: none;
  box-shadow: none;
  flex-shrink: 0;
}

.seal {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.06);
}

.seal-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.titles h1 {
  font-size: 1rem;
  margin: 0;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.sub {
  margin: 4px 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.splash {
  position: fixed;
  inset: 0;
  background: #ffffff;
  color: #0b1d2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  z-index: 50;
}

.splash.hidden {
  display: none;
}

.splash-content {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
}

.splash-button {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.splash-logo {
  width: min(260px, 70vw);
  height: auto;
  display: block;
}

.splash-footer {
  font-size: 0.85rem;
  color: #4b5563;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.capture-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  border-radius: 22px;
  background: rgba(12, 28, 42, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
  box-shadow: 0 18px 40px rgba(4, 12, 18, 0.35);
}

.section-head h2 {
  margin: 0;
  font-size: 1.02rem;
}

.section-head p {
  margin: 4px 0 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.list-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  border-radius: 16px;
  background: rgba(6, 16, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.actions.wide {
  grid-template-columns: minmax(0, 1fr);
}

.activity {
  display: none;
  gap: 12px;
  align-items: center;
  background: rgba(12, 30, 44, 0.9);
  border: 1px solid rgba(247, 210, 79, 0.28);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 14px 30px rgba(2, 8, 12, 0.3);
}

.activity.visible {
  display: flex;
}

.activity-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(247, 210, 79, 0.35);
  border-top-color: var(--accent-strong);
  animation: spin 1s linear infinite;
}

.activity-title {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}

.activity-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.summary-panel {
  background: rgba(12, 28, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: 0 16px 34px rgba(3, 10, 16, 0.3);
}

.summary-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.summary-panel p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.summary-stats {
  display: grid;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}

.summary-row strong {
  color: var(--text);
  font-weight: 600;
}

button,
.file-label,
.file-picker {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

button.primary {
  background: linear-gradient(135deg, #f2c200, #e6a90b 70%);
  color: #1b1200;
  font-weight: 600;
  border: none;
}

button.full {
  width: 100%;
  height: 48px;
  font-size: 0.98rem;
  border-radius: 16px;
}

button.secondary {
  background: rgba(255, 255, 255, 0.1);
}

button:active,
.file-label:active,
.file-picker:active {
  transform: translateY(1px) scale(0.99);
}

.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: rgba(17, 37, 54, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 16px 36px rgba(2, 8, 12, 0.25);
}

.card.working {
  border-color: rgba(247, 210, 79, 0.35);
  box-shadow: 0 18px 40px rgba(8, 20, 30, 0.35);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.card-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
}

.card-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 0 0 6px rgba(247, 210, 79, 0.65);
  animation: pulse 1.2s ease-in-out infinite;
}

.badge {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.card-title {
  font-size: 0.95rem;
  margin: 6px 0 0;
}

.card-body {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.preview {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.field input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.95rem;
}

.analysis {
  font-size: 0.85rem;
  color: var(--text);
}

.results {
  display: grid;
  gap: 12px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 18, 0.65);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 14px;
  z-index: 20;
}

.overlay.open {
  display: flex;
}

.results-sheet {
  width: min(520px, 100%);
  max-height: min(92vh, 760px);
  background: rgba(8, 20, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.results-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.results-head p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.results-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.result-card {
  background: rgba(8, 20, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 14px;
}

.result-card h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.result-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}

.result-line strong {
  color: var(--text);
}

.notice {
  font-size: 0.78rem;
  color: #f7d24f;
  margin-top: 6px;
}

.status {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(7, 18, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.status.visible {
  opacity: 1;
}

.file-picker {
  position: relative;
  overflow: hidden;
  min-height: 46px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.file-picker input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-picker span {
  pointer-events: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.8);
    opacity: 0.55;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

.placeholder {
  padding: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  background: rgba(6, 16, 26, 0.6);
}

@media (min-width: 720px) {
  .app {
    max-width: 520px;
    margin: 0 auto;
  }
}

.site {
  min-height: 100vh;
  display: flex;
  background: transparent;
}

.screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen.hidden {
  display: none;
}

.login-screen {
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-card {
  width: min(420px, 90vw);
  background: rgba(12, 28, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 18px 40px rgba(4, 12, 18, 0.35);
  text-align: center;
}

.login-logo {
  width: 120px;
  height: auto;
  margin-bottom: 12px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.login-card input {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 16, 26, 0.7);
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.95rem;
  outline: none;
}

.login-error {
  min-height: 20px;
  margin-top: 10px;
  color: #f8b4b4;
  font-size: 0.8rem;
}

.app-screen,
.admin-screen {
  padding: 20px 24px 24px;
  gap: 16px;
  min-height: 100vh;
  overflow: hidden;
}

.app-header.wide {
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(12, 28, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.header-actions {
  display: flex;
  gap: 10px;
}

.header-actions .ghost {
  background: rgba(6, 16, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 12px;
}

.admin-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
}

.admin-tabs .tab {
  flex: 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(6, 16, 26, 0.6);
  color: var(--text);
  padding: 10px;
  cursor: pointer;
}

.admin-tabs .tab.active {
  background: rgba(242, 194, 0, 0.18);
  border-color: rgba(242, 194, 0, 0.5);
}

.admin-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 16px;
  padding: 16px;
  background: rgba(6, 16, 26, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-card {
  border-radius: 14px;
  padding: 14px;
  background: rgba(12, 28, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
}

.admin-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.admin-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.admin-actions button {
  border-radius: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 16, 26, 0.6);
  color: var(--text);
}

.admin-detail {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.admin-detail pre {
  white-space: pre-wrap;
  background: rgba(3, 10, 16, 0.6);
  padding: 10px;
  border-radius: 10px;
  margin-top: 6px;
  color: var(--text);
  font-size: 0.75rem;
}

@media (min-width: 900px) {
  .capture-layout {
    padding: 20px 22px;
  }

  .actions {
    grid-template-columns: repeat(2, minmax(0, 240px));
    justify-content: flex-start;
  }

  .list-area {
    padding: 16px;
  }

  .panel {
    flex: initial;
  }

  .capture-layout {
    flex: initial;
    min-height: auto;
    overflow: visible;
  }

  .list-area {
    overflow: visible;
    max-height: none;
  }
}

@media (min-width: 1024px) {
  .app-screen {
    max-width: 1200px;
    margin: 0 auto;
  }

  .app-header.wide {
    padding: 18px 22px;
  }

  .brand-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }

  .app-header.wide h1 {
    font-size: 1.4rem;
  }

  .app-header.wide .sub {
    font-size: 0.85rem;
  }

  .header-actions .ghost {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .capture-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
    grid-template-areas:
      "head summary"
      "actions summary"
      "activity summary"
      "list summary";
    gap: 18px 24px;
    align-items: start;
  }

  .section-head {
    grid-area: head;
  }

  .actions {
    grid-area: actions;
  }

  .activity {
    grid-area: activity;
  }

  .list-area {
    grid-area: list;
    min-height: 420px;
  }

  .summary-panel {
    grid-area: summary;
    position: sticky;
    top: 20px;
  }
}

body {
  overflow: auto;
}

.site {
  overflow: auto;
}

.app-screen,
.admin-screen {
  overflow: auto;
}

.panel {
  overflow: visible;
}
