:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --surface: #13171f;
  --surface-2: #1a1f2a;
  --border: #232833;
  --text: #e6e8eb;
  --muted: #8b93a1;
  --accent: #6EA0C1;
  --green: #7ee787;
  --red: #ff7b72;
  --yellow: #f0c674;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-size: 15px; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { width: 100%; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; margin-top: 12px; font-weight: 600; letter-spacing: 0.02em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 10px; border: none; background: var(--accent); color: #0b0d12; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--red); color: #fff; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.5; }

.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; flex: 1; }
.topbar .brand img { height: 24px; }
.topbar .brand .name { font-weight: 700; letter-spacing: 0.08em; font-size: 14px; }
.topbar .back { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 8px; cursor: pointer; }

main { padding: 16px; max-width: 720px; margin: 0 auto; padding-bottom: 80px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.card h2 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }

.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.list-item { padding: 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.list-item:active { background: var(--surface-2); }
.list-item .title { font-weight: 600; }
.list-item .sub { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge.draft { background: rgba(139,147,161,0.2); color: var(--muted); }
.badge.in_progress { background: rgba(110,160,193,0.2); color: var(--accent); }
.badge.completed { background: rgba(126,231,135,0.15); color: var(--green); }
.badge.submitted { background: rgba(126,231,135,0.3); color: var(--green); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.accordion { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.accordion-head { padding: 14px 16px; background: var(--surface); display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.accordion-head .chev { transition: transform 0.2s; }
.accordion.open .accordion-head .chev { transform: rotate(90deg); }
.accordion-body { padding: 16px; display: none; }
.accordion.open .accordion-body { display: block; }

.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.photo-card { position: relative; }
.photo-card .rm { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); border: 0; color: #fff; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; }

.fab { position: fixed; right: 18px; bottom: 24px; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #0b0d12; font-size: 28px; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(0,0,0,0.4); cursor: pointer; border: none; z-index: 5; }

.login-screen { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand img { height: 56px; }
.login-brand h1 { margin: 18px 0 4px; font-size: 22px; }
.login-brand p { color: var(--muted); margin: 0; font-size: 13px; }

.signature-canvas { width: 100%; height: 180px; background: #fff; border-radius: 10px; border: 1px solid var(--border); touch-action: none; }
.signature-actions { display: flex; gap: 8px; margin-top: 8px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 80px; background: var(--surface); border: 1px solid var(--border); padding: 10px 18px; border-radius: 10px; z-index: 100; box-shadow: 0 6px 16px rgba(0,0,0,0.4); }
.toast.ok { border-color: var(--green); }
.toast.err { border-color: var(--red); }

.muted { color: var(--muted); font-size: 12px; }
.title-input { font-size: 18px; font-weight: 600; padding: 14px; }
