:root {
  --bg: #0f0f13;
  --surface: #1a1a22;
  --surface2: #23232f;
  --border: #2e2e3e;
  --accent: #6c63ff;
  --accent2: #00d4aa;
  --danger: #ff4d6d;
  --warn: #ffb347;
  --ok: #00d4aa;
  --text: #e8e8f0;
  --muted: #8888a8;
  --radius: 12px;
  --font: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; font-size: 15px; }
a { color: var(--accent); text-decoration: none; }

.header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 16px; position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; }
.header-title { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
.header-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.btn-export { background: var(--accent); color: #fff; border: none; border-radius: 20px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-export:active { opacity: 0.8; }
.btn-link { color: var(--muted); font-size: 13px; }

.progress-bar { height: 3px; background: var(--border); }
.progress-fill { height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.4s; }

.nav { display: flex; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--border); scrollbar-width: none; gap: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav-tab { flex-shrink: 0; padding: 12px 16px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: all 0.2s; }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.section { display: none; padding: 16px; }
.section.active { display: block; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }

label { font-size: 14px; color: var(--text); display: block; margin-bottom: 6px; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], textarea, select {
  width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 15px; font-family: var(--font);
  padding: 11px 13px; margin-bottom: 14px; outline: none;
  transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--surface2); }

.status-group { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.status-btn { flex: 1; min-width: 60px; padding: 9px 4px; border-radius: 8px; border: 1.5px solid var(--border); background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; text-align: center; transition: all 0.15s; }
.status-btn:active { transform: scale(0.96); }
.status-btn.ok.active { background: #00d4aa22; border-color: var(--ok); color: var(--ok); }
.status-btn.ko.active { background: #ff4d6d22; border-color: var(--danger); color: var(--danger); }
.status-btn.warn.active { background: #ffb34722; border-color: var(--warn); color: var(--warn); }
.status-btn.na.active { background: #6c63ff22; border-color: var(--accent); color: var(--accent); }

.item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.item:last-child { border-bottom: none; }
.item-label { font-size: 14px; margin-bottom: 8px; font-weight: 500; }
.item-note { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; font-family: var(--font); padding: 8px 10px; outline: none; margin-top: 6px; resize: none; }
.item-note:focus { border-color: var(--accent); }

.reco-item { background: var(--surface2); border-radius: 8px; padding: 12px; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; }
.reco-prio { flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; margin-top: 2px; }
.prio-high { background: #ff4d6d22; color: var(--danger); }
.prio-med { background: #ffb34722; color: var(--warn); }
.prio-low { background: #00d4aa22; color: var(--ok); }
.reco-text { font-size: 13px; color: var(--text); flex: 1; word-break: break-word; }
.reco-delete { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }

.add-reco { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-reco input { flex: 1; min-width: 0; margin-bottom: 0; }
.add-reco select { width: auto; flex-shrink: 0; margin-bottom: 0; padding: 11px 8px; }
.btn-add { background: var(--surface2); border: 1.5px solid var(--border); color: var(--text); border-radius: 8px; padding: 11px 16px; font-size: 14px; cursor: pointer; font-family: var(--font); white-space: nowrap; }
.btn-add:active { background: var(--border); }
.btn-primary { background: var(--accent); border: none; color: #fff; border-radius: 8px; padding: 11px 16px; font-size: 14px; cursor: pointer; font-family: var(--font); }

.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.score-card { background: var(--surface2); border-radius: 10px; padding: 12px 8px; text-align: center; }
.score-num { font-size: 28px; font-weight: 700; }
.score-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.score-ok { color: var(--ok); }
.score-ko { color: var(--danger); }
.score-warn { color: var(--warn); }

.nav-btns { display: flex; gap: 10px; padding: 16px; }
.btn-prev, .btn-next { flex: 1; padding: 14px; border-radius: 10px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; font-family: var(--font); }
.btn-prev { background: var(--surface2); color: var(--text); }
.btn-next { background: var(--accent); color: #fff; }
.btn-prev:active, .btn-next:active { opacity: 0.8; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 20px; padding: 10px 20px; font-size: 13px; z-index: 999; opacity: 0; transition: opacity 0.3s; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; }

h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.section-desc { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.muted { color: var(--muted); }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; max-width: 380px; width: 100%; }
.auth-title { font-size: 22px; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.auth-form { display: flex; flex-direction: column; }
.auth-error { background: #ff4d6d22; color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.auth-foot { color: var(--muted); font-size: 13px; margin-top: 14px; text-align: center; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.checkbox-row input { width: auto; margin: 0; }

.dashboard { padding: 20px 16px 40px; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.dashboard .card { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .card-title { margin-bottom: 0; display: flex; align-items: center; gap: 8px; }
.card-head .card-title i { color: var(--accent); font-size: 14px; }

.team-list { list-style: none; }
.team-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.team-list li:last-child { border-bottom: none; }
.team-name { font-weight: 500; }
.pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; background: var(--surface2); color: var(--muted); padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); }

.btn-primary { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #fff; border: none; border-radius: 20px; padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--font); white-space: nowrap; transition: transform 0.1s, filter 0.15s; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.97); }
.btn-ghost { display: inline-flex; align-items: center; gap: 8px; background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 20px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--font); white-space: nowrap; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.audit-list { display: flex; flex-direction: column; gap: 10px; }
.audit-row { display: flex; align-items: center; gap: 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 14px 14px 16px; transition: border-color 0.15s; }
.audit-row:hover { border-color: var(--accent); }
.audit-row-link { flex: 1; min-width: 0; text-decoration: none; color: inherit; display: block; }
.audit-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.audit-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.audit-meta .dot { opacity: 0.5; }
.audit-actions { flex-shrink: 0; display: flex; align-items: center; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 14px; transition: all 0.15s; }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn-danger:hover { border-color: var(--danger); color: var(--danger); background: #ff4d6d11; }
.confirm-delete { display: flex; align-items: center; gap: 6px; }
.confirm-delete[hidden] { display: none !important; }
.confirm-label { font-size: 12px; color: var(--muted); margin-right: 4px; }
.btn-confirm { background: var(--danger); color: #fff; border: none; border-radius: 8px; padding: 8px 14px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: var(--font); }
.btn-confirm:hover { filter: brightness(1.1); }
.btn-cancel { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 14px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--font); }
.btn-cancel:hover { border-color: var(--muted); }

.empty-state { text-align: center; color: var(--muted); font-size: 13px; padding: 32px 12px; background: var(--surface2); border-radius: 10px; border: 1px dashed var(--border); }
.empty-state i { display: block; font-size: 28px; margin-bottom: 8px; opacity: 0.6; }

.inline-form { display: inline; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.photo-thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface2); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb button { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 14px; line-height: 1; }
.photo-upload { display: inline-block; }
.photo-upload .btn-add { display: inline-block; }

.signature-pad { width: 100%; max-width: 600px; height: 220px; background: #fff; border: 1.5px dashed var(--border); border-radius: 8px; touch-action: none; display: block; margin-bottom: 12px; }
.sig-actions { display: flex; gap: 8px; }

.confirm-inline { background: var(--surface2); border: 1px solid var(--danger); border-radius: 8px; padding: 12px; margin-top: 8px; display: flex; gap: 8px; align-items: center; }
.confirm-inline span { flex: 1; font-size: 13px; }
