:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #eceee9;
  --text: #1a1d1b;
  --muted: #5f6661;
  --faint: #8b918d;
  --border: #dcdfd9;
  --accent: #1d6b57;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe5;
  --danger: #b42318;

  --st-pendiente: #b54708;
  --st-pendiente-soft: #fbeadd;
  --st-en_curso: #1d5fb0;
  --st-en_curso-soft: #e0ebf8;
  --st-listo: #1f7a4d;
  --st-listo-soft: #dcf0e4;
  --st-no_aplica: #7a807c;
  --st-no_aplica-soft: #e7e9e6;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 1px 1px rgba(20, 30, 25, .04);
  --shadow-lg: 0 12px 40px rgba(20, 30, 25, .18);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131614;
    --surface: #1c201e;
    --surface-2: #252a27;
    --text: #e9ece9;
    --muted: #a3aaa5;
    --faint: #7c837e;
    --border: #2f3531;
    --accent: #5cc4a3;
    --accent-ink: #0d1f19;
    --accent-soft: #1d3a31;
    --danger: #f97066;
    --st-pendiente: #f3a15f;
    --st-pendiente-soft: #3a2a1c;
    --st-en_curso: #7fb3f0;
    --st-en_curso-soft: #1c2c40;
    --st-listo: #6fd19c;
    --st-listo-soft: #1a3527;
    --st-no_aplica: #9aa19c;
    --st-no_aplica-soft: #2a2f2c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* ── Layout ── */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-t)) 16px calc(var(--nav-h) + var(--safe-b) + 88px);
}
.page.detail { padding-bottom: calc(var(--safe-b) + 48px); }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login ── */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 16px calc(24px + var(--safe-b));
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 28px 22px 24px; box-shadow: var(--shadow);
}
.login-mark {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); margin-bottom: 16px;
}
.login h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
.login p { margin: 0 0 22px; color: var(--muted); font-size: 15px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; min-height: 48px; padding: 11px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; transition: border-color .15s, background .15s;
}
.input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
textarea.input { resize: none; line-height: 1.5; min-height: 96px; }
.form-error { color: var(--danger); font-size: 14px; margin: -4px 0 12px; min-height: 1em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 15px;
  transition: transform .08s, background .15s;
  text-decoration: none; color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .6; }
.btn svg { width: 20px; height: 20px; flex: none; }

/* ── Header / resumen ── */
.hero { margin: 4px 0 18px; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero h1 { font-size: 28px; line-height: 1.15; margin: 0; letter-spacing: -.02em; }
.hero .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.progress-card {
  margin-top: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.progress-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.progress-head strong { font-size: 22px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.progress-head span { color: var(--muted); font-size: 14px; }
.bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.bar > i { display: block; height: 100%; }
.bar .listo { background: var(--st-listo); }
.bar .en_curso { background: var(--st-en_curso); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.legend b { color: var(--text); font-weight: 600; }

.alerts { margin-top: 12px; display: grid; gap: 8px; }
.alert {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface);
}
.alert.warn { border-color: color-mix(in srgb, var(--st-pendiente) 45%, var(--border)); background: var(--st-pendiente-soft); }
.alert.bad { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.alert .a-when { margin-left: auto; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--st-pendiente); }
.alert.bad .a-when { color: var(--danger); }
.alert .a-title { font-size: 15px; font-weight: 500; }
.alert svg { width: 18px; height: 18px; color: var(--st-pendiente); flex: none; }
.alert.bad svg { color: var(--danger); }

/* ── Filtros ── */
.chips {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 8px; padding: 2px 16px 6px;
  scrollbar-width: none; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--bg) 80%, transparent);
  padding-top: calc(8px + var(--safe-t));
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 38px; padding: 0 14px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { opacity: .65; font-size: 13px; }

/* ── Secciones e ítems ── */
.section { margin-top: 18px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 4px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700;
}
.section-head span { font-weight: 500; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.list {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.row { display: flex; align-items: stretch; min-height: 64px; }
.row + .row { border-top: 1px solid var(--border); }
.row-status {
  flex: none; width: 56px; display: grid; place-items: center; border: 0; background: none; padding: 0;
}
.dot {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--c); color: var(--c); background: transparent; transition: background .15s, transform .15s;
}
.dot svg { width: 15px; height: 15px; }
.row-status:active .dot { transform: scale(.88); }
.dot.pendiente { --c: var(--st-pendiente); }
.dot.en_curso { --c: var(--st-en_curso); background: linear-gradient(90deg, var(--c) 50%, transparent 50%); }
.dot.listo { --c: var(--st-listo); background: var(--c); color: var(--surface); }
.dot.no_aplica { --c: var(--st-no_aplica); border-style: dashed; }
.row-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left;
  background: none; border: 0; padding: 12px 14px 12px 0; text-decoration: none; color: inherit;
}
.row-text { flex: 1; min-width: 0; }
.row-title { font-size: 16px; font-weight: 500; line-height: 1.3; }
.row.is-listo .row-title, .row.is-no_aplica .row-title { color: var(--muted); }
.row.is-no_aplica .row-title { text-decoration: line-through; text-decoration-color: var(--faint); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 13px; color: var(--muted); }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg { width: 14px; height: 14px; }
.meta .warn { color: var(--st-pendiente); font-weight: 600; }
.meta .bad { color: var(--danger); font-weight: 600; }
.chev { width: 18px; height: 18px; color: var(--faint); flex: none; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

.total-row {
  display: flex; justify-content: space-between; padding: 12px 16px; font-size: 14px;
  border-top: 1px solid var(--border); background: var(--surface-2); font-variant-numeric: tabular-nums;
}
.total-row b { font-size: 15px; }

/* ── Barra inferior ── */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
}
.nav-inner { display: flex; width: 100%; max-width: 680px; }
.nav a {
  flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); text-decoration: none; font-size: 12px; font-weight: 600;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--accent); }

.fab {
  position: fixed; z-index: 19; right: max(16px, calc(50% - 324px)); bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-lg);
  display: grid; place-items: center;
}
.fab svg { width: 26px; height: 26px; }
.fab:active { transform: scale(.95); }

/* ── Detalle ── */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  margin: calc(-16px - var(--safe-t)) -16px 8px; padding: calc(6px + var(--safe-t)) 8px 6px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: none;
  display: grid; place-items: center; color: var(--text); flex: none;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.topbar .crumb { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-state { font-size: 12px; color: var(--faint); padding-right: 4px; white-space: nowrap; }

.title-input {
  width: 100%; border: 0; background: none; padding: 4px 0; margin: 0 0 14px;
  font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; resize: none; overflow: hidden;
}
.title-input:focus { outline: none; }

.status-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 18px; }
.status-picker button {
  min-height: 56px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 6px 2px;
}
.status-picker .dot { width: 18px; height: 18px; border-width: 2px; }
.status-picker .dot svg { width: 11px; height: 11px; }
.status-picker button[aria-pressed="true"] { color: var(--c); border-color: var(--c); background: var(--soft); box-shadow: inset 0 0 0 1px var(--c); }
.status-picker [data-status="pendiente"] { --c: var(--st-pendiente); --soft: var(--st-pendiente-soft); }
.status-picker [data-status="en_curso"] { --c: var(--st-en_curso); --soft: var(--st-en_curso-soft); }
.status-picker [data-status="listo"] { --c: var(--st-listo); --soft: var(--st-listo-soft); }
.status-picker [data-status="no_aplica"] { --c: var(--st-no_aplica); --soft: var(--st-no_aplica-soft); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px;
}
.card-title span { text-transform: none; letter-spacing: 0; font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }
.hint.warn { color: var(--st-pendiente); font-weight: 600; }
.hint.bad { color: var(--danger); font-weight: 600; }
.plain-area {
  width: 100%; border: 0; background: none; padding: 0; min-height: 60px; resize: none; overflow: hidden;
  font-size: 16px; line-height: 1.55;
}
.plain-area:focus { outline: none; }
.plain-area::placeholder, .title-input::placeholder { color: var(--faint); }

/* Tareas */
.tasks { list-style: none; margin: 0 -16px; padding: 0; }
.task { display: flex; align-items: center; gap: 4px; padding: 0 8px 0 4px; min-height: 48px; }
.task + .task { border-top: 1px solid var(--border); }
.check {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; background: none; padding: 0;
}
.check i {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--faint); display: grid; place-items: center; color: var(--surface);
}
.check i svg { width: 14px; height: 14px; }
.task.done .check i { background: var(--st-listo); border-color: var(--st-listo); }
.task-text { flex: 1; min-width: 0; border: 0; background: none; padding: 10px 0; font-size: 16px; }
.task-text:focus { outline: none; }
.task.done .task-text { color: var(--muted); text-decoration: line-through; }
.task .icon-btn { color: var(--faint); width: 40px; height: 40px; }
.task-add { display: flex; gap: 8px; margin-top: 8px; }
.task-add .input { min-height: 44px; }
.task-add .btn { min-height: 44px; padding: 0 14px; }

/* Documentos */
.docs { list-style: none; margin: 0 -16px; padding: 0; }
.doc { display: flex; align-items: center; min-height: 64px; padding-right: 4px; }
.doc + .doc { border-top: 1px solid var(--border); }
.doc-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 4px 10px 16px;
  background: none; border: 0; text-align: left; text-decoration: none; color: inherit;
}
.thumb {
  width: 44px; height: 44px; border-radius: 10px; flex: none; overflow: hidden;
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted);
  font-size: 11px; font-weight: 800; letter-spacing: .03em;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.pdf { background: #fde7e7; color: #b42318; }
.thumb.word { background: #e1ecfb; color: #1d5fb0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .thumb.pdf { background: #3b1f1f; color: #f97066; }
  :root:not([data-theme="light"]) .thumb.word { background: #1c2c40; color: #7fb3f0; }
}
.doc-name { font-size: 15px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.doc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.upload-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.progress { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.danger-zone { margin-top: 24px; display: grid; }

/* ── Documentos (pestaña) ── */
.search { position: relative; margin: 14px 0 4px; }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--faint); }
.search .input { padding-left: 42px; background: var(--surface); }
.doc-group { font-size: 13px; color: var(--muted); padding: 14px 4px 6px; font-weight: 600; display: flex; justify-content: space-between; gap: 10px; }
.doc-group a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Datos ── */
.kv { list-style: none; margin: 0 -16px; padding: 0; }
.kv li + li { border-top: 1px solid var(--border); }
.kv button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 0;
  padding: 10px 16px; min-height: 56px;
}
.kv .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kv .v { font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.kv .copy { margin-left: auto; color: var(--faint); flex: none; }
.kv .copy svg { width: 18px; height: 18px; }
.kv button:active { background: var(--surface-2); }

.account { display: grid; gap: 8px; }

/* ── Hoja inferior / diálogos ── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(10, 15, 12, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out;
}
.sheet {
  width: 100%; max-width: 560px; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(16px + var(--safe-b)); box-shadow: var(--shadow-lg); animation: up .2s ease-out;
  max-height: 90vh; overflow: auto;
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 14px; }
.sheet h2 { font-size: 18px; margin: 0 0 14px; }
.sheet .actions { display: grid; gap: 8px; margin-top: 6px; }
.sheet .menu { display: grid; margin: 0 -16px; }
.sheet .menu button, .sheet .menu a {
  display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 20px; border: 0; background: none;
  font-size: 16px; text-align: left; color: var(--text); text-decoration: none;
}
.sheet .menu button:active, .sheet .menu a:active { background: var(--surface-2); }
.sheet .menu svg { width: 22px; height: 22px; color: var(--muted); }
.sheet .menu .danger, .sheet .menu .danger svg { color: var(--danger); }
@media (min-width: 600px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 20px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

/* Visor de imágenes */
.viewer {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .94);
  display: flex; flex-direction: column; animation: fade .15s ease-out;
}
.viewer-bar { display: flex; align-items: center; gap: 4px; padding: calc(6px + var(--safe-t)) 8px 6px; color: #fff; }
.viewer-bar .icon-btn { color: #fff; }
.viewer-bar .icon-btn:active { background: rgba(255, 255, 255, .12); }
.viewer-bar .name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 8px 8px calc(8px + var(--safe-b)); touch-action: pinch-zoom; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Escáner */
.scanner { background: #111312; }
.upload-row .wide { grid-column: 1 / -1; }
.scan-cta { min-height: 56px; font-size: 16px; margin-bottom: 14px; }
.sheet .menu button:disabled { opacity: .5; }
.scan-pages {
  flex: 1; min-height: 0; overflow: auto; padding: 8px 16px 16px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; align-content: start;
}
.scan-page, .scan-add { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; }
.scan-page { background: #232725; display: grid; place-items: center; }
.scan-page img { width: 100%; height: 100%; object-fit: contain; display: block; }
.scan-page .n {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 10px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 700;
}
.scan-page .icon-btn { position: absolute; top: 4px; right: 4px; width: 38px; height: 38px; background: rgba(0, 0, 0, .6); color: #fff; }
.scan-page .icon-btn.crop { right: auto; left: 4px; }
.scan-thumb { width: 100%; height: 100%; padding: 0; border: 0; background: none; display: block; }

/* Ajustar bordes */
.scan-crop { position: absolute; inset: 0; z-index: 2; background: #111312; display: flex; flex-direction: column; }
.crop-stage { flex: 1; min-height: 0; display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.crop-box { position: relative; }
.crop-box img, .crop-box svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.crop-box img { -webkit-user-drag: none; pointer-events: none; }
.crop-shade { fill: rgba(0, 0, 0, .5); }
.crop-line { fill: none; stroke: #5cc4a3; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.crop-handle {
  position: absolute; width: 48px; height: 48px; margin: -24px 0 0 -24px; padding: 0; border: 0; background: none;
  display: grid; place-items: center; touch-action: none; cursor: grab;
}
.crop-handle i { width: 22px; height: 22px; border-radius: 50%; background: rgba(92, 196, 163, .35); border: 3px solid #5cc4a3; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }
.crop-hint { font-size: 14px; color: var(--muted); text-align: center; }
.scan-foot .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scan-page .icon-btn svg { width: 18px; height: 18px; }
.scan-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px;
  border: 2px dashed rgba(255, 255, 255, .35); color: #fff; font-size: 14px; font-weight: 600; text-align: center; cursor: pointer;
}
.scan-add:active { background: rgba(255, 255, 255, .08); }
.scan-add svg { width: 32px; height: 32px; }
.scan-foot {
  width: 100%; max-width: 560px; margin: 0 auto; display: grid; gap: 10px;
  padding: 14px 16px calc(14px + var(--safe-b)); background: var(--surface); border-radius: 20px 20px 0 0;
}
.scan-foot .progress { margin-top: 0; }
.scan-filter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--bg); border-radius: var(--radius-sm); }
.scan-filter button { min-height: 40px; border: 0; border-radius: 8px; background: none; font-size: 14px; font-weight: 600; color: var(--muted); }
.scan-filter button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Toast */
.toast {
  position: fixed; left: 50%; translate: -50% 0; bottom: calc(var(--nav-h) + var(--safe-b) + 84px); z-index: 60;
  background: var(--text); color: var(--bg); border-radius: 12px; padding: 10px 10px 10px 16px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); width: max-content;
  animation: up .2s ease-out;
}
.toast button { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 6px 8px; filter: invert(0); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast button { color: #1d6b57; } }
.toast:not(:has(button)) { padding-right: 16px; }

@media (min-width: 700px) {
  .hero h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.legend .dot { width: 14px; height: 14px; border-width: 2px; }
.legend .dot svg { width: 9px; height: 9px; }
.login-mark svg { width: 24px; height: 24px; }
