@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Premium Minimalist Palette */
  --bg-app: #09090b; /* zinc-950 */
  --bg-surface: #18181b; /* zinc-900 */
  --bg-surface-hover: #27272a; /* zinc-800 */
  --bg-element: rgba(255, 255, 255, 0.05);
  
  --border: rgba(255, 255, 255, 0.1);
  --border-muted: rgba(255, 255, 255, 0.05);

  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --text-faint: #71717a;

  --accent-base: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --accent-text: #60a5fa;

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --topbar-h: 52px;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent-text); text-decoration: none; }
button { background: transparent; border: none; cursor: pointer; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; }

/* Views */
.view { display: none; opacity: 0; transition: opacity 0.3s ease; }
.view.active { display: block; opacity: 1; min-height: 100vh; }
#review-view.active { display: flex; height: 100vh; padding-top: var(--topbar-h); }
#login-view.active { display: flex; align-items: center; justify-content: center; }

/* Topbar */
.topbar {
  position: fixed; top: 0; width: 100%; height: var(--topbar-h);
  background: rgba(9, 9, 11, 0.8); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border); z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; font-size: 0.95rem;
}
.brand-mark {
  background: linear-gradient(135deg, var(--text-main), var(--text-muted));
  color: var(--bg-app); width: 26px; height: 26px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700;
}
.topbar-nav { display: flex; gap: 4px; }
.nav-btn {
  padding: 6px 12px; border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 500;
  color: var(--text-muted); display: flex; align-items: center; gap: 6px; transition: 0.2s;
}
.nav-btn svg { width: 14px; height: 14px; fill: currentColor; }
.nav-btn:hover { color: var(--text-main); background: var(--bg-element); }
.nav-btn.active { color: var(--text-main); background: var(--bg-surface-hover); }

.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-pill {
  display: flex; align-items: center; gap: 8px; font-size: 0.8rem;
  padding: 4px 10px 4px 4px; border-radius: 20px; border: 1px solid var(--border);
}
.user-avatar {
  background: var(--bg-surface-hover); width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: var(--text-muted);
}
.user-badge { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-text); background: var(--accent-glow); padding: 2px 6px; border-radius: 4px; }
.btn-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: 0.2s; }
.btn-icon:hover { background: var(--bg-surface-hover); color: var(--text-main); }
.btn-icon svg { width: 16px; height: 16px; fill: currentColor; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; font-size: 0.85rem; font-weight: 500; border-radius: var(--radius-sm);
  transition: all 0.2s ease; border: 1px solid transparent; text-align: center; white-space: nowrap;
}
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-full { width: 100%; }
.btn svg { width: 14px; height: 14px; fill: currentColor; }

.btn-primary { background: var(--text-main); color: var(--bg-app); }
.btn-primary:hover { background: #e4e4e7; transform: translateY(-1px); }
.btn-secondary { background: var(--bg-element); color: var(--text-main); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-surface-hover); border-color: rgba(255,255,255,0.2); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-element); color: var(--text-main); }

.btn-success { background: var(--success-bg); color: var(--success); border-color: rgba(16,185,129,0.2); }
.btn-success:hover { background: rgba(16,185,129,0.15); }
.btn-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(245,158,11,0.2); }
.btn-warning:hover { background: rgba(245,158,11,0.15); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.15); }
.btn:disabled,
.btn-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.field-input { position: relative; display: flex; align-items: center; }
.field-icon { position: absolute; left: 12px; width: 16px; height: 16px; fill: var(--text-faint); }
input, select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-app); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-main); font-size: 0.85rem; outline: none; transition: 0.2s;
}
.field-input input { padding-left: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-text); box-shadow: 0 0 0 2px var(--accent-glow); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--bg-surface); }

/* Layout & Containers */
.page-container { max-width: 1100px; margin: 0 auto; padding: calc(var(--topbar-h) + 2rem) 1.5rem 2rem; }
.section { margin-bottom: 2.5rem; }
.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 1rem; }
.section-title { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
.section-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* Filter Chips */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 500; color: var(--text-muted); border: 1px solid transparent; transition: 0.2s; background: var(--bg-element); }
.chip:hover { color: var(--text-main); background: var(--bg-surface-hover); }
.chip.active { background: var(--text-main); color: var(--bg-app); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1.25rem; display: flex; align-items: center; gap: 16px; transition: transform 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.2); }
.stat-icon { font-size: 1.25rem; width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.icon-docs { background: rgba(59,130,246,0.1); color: #60a5fa; }
.icon-done { background: var(--success-bg); color: var(--success); }
.icon-items { background: rgba(168,85,247,0.1); color: #c084fc; }
.icon-alert { background: var(--danger-bg); color: var(--danger); }
.stat-value { font-size: 1.5rem; font-weight: 600; font-family: var(--font-mono); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

/* Doc Cards */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.doc-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; cursor: pointer; transition: all 0.2s ease; position: relative; overflow: hidden;
}
.doc-card:hover { border-color: rgba(255,255,255,0.2); background: var(--bg-surface-hover); }
.doc-key { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-faint); margin-bottom: 6px; }
.doc-location { font-size: 0.85rem; font-weight: 500; margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-status { font-size: 0.65rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.doc-admin-flag {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: var(--danger-bg);
  color: var(--danger);
  text-transform: uppercase;
}
.status-pending { background: var(--bg-element); color: var(--text-muted); }
.status-processing { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-ready { background: rgba(250,204,21,0.15); color: #fde047; }
.status-in_progress { background: rgba(168,85,247,0.15); color: #c084fc; }
.status-completed { background: var(--success-bg); color: var(--success); }

.doc-progress-bar { height: 4px; background: var(--bg-element); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.doc-progress-fill { height: 100%; background: var(--text-main); border-radius: 4px; transition: width 0.4s ease; }
.doc-card.completed .doc-progress-fill { background: var(--success); }

/* Activity */
.activity-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.activity-list { list-style: none; }
.activity-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-muted); font-size: 0.8rem; }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-dot.approve { background: var(--success); }
.activity-dot.correct { background: var(--warning); }
.activity-dot.flag { background: var(--danger); }
.activity-text { flex: 1; color: var(--text-muted); }
.activity-text strong { color: var(--text-main); font-weight: 500; }
.activity-time { font-size: 0.75rem; color: var(--text-faint); font-family: var(--font-mono); }
.activity-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* Tables */
.table-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table thead th { padding: 12px 16px; font-size: 0.75rem; font-weight: 500; color: var(--text-faint); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody td { padding: 12px 16px; font-size: 0.85rem; border-bottom: 1px solid var(--border-muted); color: var(--text-muted); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-surface-hover); color: var(--text-main); }
.table-empty { text-align: center; padding: 48px !important; color: var(--text-faint); }

.empty-state { grid-column: 1/-1; text-align: center; padding: 4rem 1rem; color: var(--text-faint); font-size: 0.9rem; border: 1px dashed var(--border); border-radius: var(--radius-md); }

/* --- LOGIN VIEW --- */
.login-scene { width: 100vw; height: 100vh; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.login-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: -1; }
.login-gradient { position: absolute; width: 60vw; height: 60vh; background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 60%); filter: blur(40px); }
.login-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--border-muted) 1px, transparent 1px), linear-gradient(90deg, var(--border-muted) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%); }
.login-card { width: 100%; max-width: 380px; padding: 32px; background: rgba(24, 24, 27, 0.6); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 20px 40px rgba(0,0,0,0.4); }
.login-header { text-align: center; margin-bottom: 24px; }
.login-logo { font-size: 1.25rem; font-weight: 700; color: var(--bg-app); background: var(--text-main); width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.login-header h1 { font-size: 1.25rem; font-weight: 600; margin-bottom: 6px; }
.login-header p { font-size: 0.85rem; color: var(--text-muted); }
.login-tabs { display: flex; background: var(--bg-app); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 24px; border: 1px solid var(--border); }
.login-tab { flex: 1; padding: 6px; text-align: center; border-radius: 4px; font-size: 0.8rem; font-weight: 500; color: var(--text-faint); transition: 0.2s; }
.login-tab.active { background: var(--bg-surface-hover); color: var(--text-main); }
.help-text { font-size: 0.8rem; color: var(--text-muted); padding: 12px; background: var(--bg-app); border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 16px; }
.login-message { margin-top: 16px; padding: 12px; border-radius: var(--radius-sm); font-size: 0.8rem; text-align: center; border: 1px solid transparent; }
.login-message:not(.error) { background: var(--success-bg); color: var(--success); border-color: rgba(16,185,129,0.2); }
.login-message.error { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.login-footer { margin-top: 24px; text-align: center; font-size: 0.75rem; color: var(--text-faint); }

/* --- REVIEW VIEW (3 columnas) --- */
.review-layout { display: flex; flex: 1; overflow: hidden; height: 100%; }

/* COL 1 — Navegador de páginas */
.review-sidebar { width: 210px; background: var(--bg-app); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.btn-back { display: flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-muted); transition: 0.2s; }
.btn-back:hover { background: var(--bg-surface-hover); color: var(--text-main); }
.btn-back svg { width: 13px; height: 13px; fill: currentColor; }
.sidebar-doc-info { flex: 1; overflow: hidden; }
.sidebar-doc-key { font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-progress-bar { height: 3px; background: var(--bg-element); border-radius: 4px; overflow: hidden; }
.sidebar-progress-fill { height: 100%; background: var(--text-main); transition: 0.3s ease; }
.sidebar-progress-text { font-size: 0.65rem; color: var(--text-faint); margin-top: 3px; }
.sidebar-actions { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.sidebar-flag-note {
  font-size: 0.72rem;
  line-height: 1.45;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.28);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
}
.sidebar-flag-note strong {
  display: block;
  color: #fca5a5;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.page-nav { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 1px; }
.page-nav-btn { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-radius: var(--radius-sm); font-size: 0.78rem; color: var(--text-muted); transition: 0.15s; }
.page-nav-btn:hover { background: var(--bg-surface); color: var(--text-main); }
.page-nav-btn.active { background: var(--bg-surface-hover); color: var(--text-main); font-weight: 500; }
.page-nav-btn.done { color: var(--success); }
.page-nav-badge { font-size: 0.6rem; padding: 1px 5px; border-radius: 4px; background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.page-nav-empty { padding: 12px; color: var(--text-faint); font-size: 0.75rem; }
.keyboard-help { padding: 12px; border-top: 1px solid var(--border); }
.help-title { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 5px 8px; align-items: center; font-size: 0.7rem; color: var(--text-faint); }
kbd { background: var(--bg-app); border: 1px solid var(--border); padding: 1px 5px; border-radius: 3px; font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted); }

/* COL 2 — Hoja alineada */
.review-page-col { width: 390px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg-surface); }
.page-col-header { padding: 8px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.page-col-label { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.page-col-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; align-items: center; padding: 8px; }
.page-col-scroll img#page-aligned-img { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.page-col-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-faint); font-size: 0.78rem; margin: auto; text-align: center; }

/* COL 3 — Crops + tabla */
.review-detail { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-app); }

/* Panel de crops */
.crop-panel { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-surface); display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.crop-header { display: flex; justify-content: space-between; align-items: center; }
.crop-title { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.crop-meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-faint); }
.crop-viewer { height: 60px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-app); display: flex; align-items: center; justify-content: center; }
.crop-placeholder { color: var(--text-faint); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.75rem; margin: auto; }
.crop-placeholder svg { width: 20px; height: 20px; stroke: currentColor; }
.crop-img { width: 100%; height: auto; display: block; }

/* Dígitos centenas/decenas/unidades */
.crop-digits { display: flex; gap: 8px; }
.digit-block { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; }
.digit-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.digit-img-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; overflow: hidden; width: 100%; max-height: 80px; display: flex; align-items: center; justify-content: center; }
.digit-img-wrap img { width: 100%; max-height: 80px; object-fit: contain; display: block; }

/* Vista de fila */
.crop-row-section { display: flex; flex-direction: column; gap: 3px; }
.crop-row-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; overflow: hidden; max-height: 52px; display: flex; align-items: center; }
.crop-row-wrap img { width: 100%; max-height: 52px; object-fit: contain; display: block; }

/* Predicción */
.crop-prediction { display: flex; gap: 16px; padding: 8px 12px; background: var(--bg-app); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.pred-block { display: flex; flex-direction: column; gap: 2px; }
.pred-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.pred-value { font-size: 1.1rem; font-weight: 700; font-family: var(--font-mono); color: var(--text-main); }
.pred-pattern, .pred-conf { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }

/* Tabla de items */
.items-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.items-toolbar { padding: 8px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.items-toolbar-left { display: flex; align-items: center; gap: 10px; }
.page-label { font-size: 0.85rem; font-weight: 600; }
.items-count { font-size: 0.75rem; color: var(--text-faint); }
.items-toolbar-right { display: flex; gap: 8px; }
.items-scroll { flex: 1; overflow-y: auto; }
.items-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.items-table thead th { padding: 8px 12px; position: sticky; top: 0; background: var(--bg-app); color: var(--text-faint); font-size: 0.72rem; font-weight: 500; border-bottom: 1px solid var(--border); z-index: 10; text-align: left; }
.items-table tbody tr { transition: background 0.15s ease; cursor: pointer; }
.items-table tbody td { padding: 8px 12px; font-size: 0.82rem; border-bottom: 1px solid var(--border-muted); color: var(--text-muted); vertical-align: middle; }
.items-table tbody tr:hover td { background: var(--bg-surface); color: var(--text-main); }
.items-table tbody tr.selected td { background: var(--bg-surface-hover); color: var(--text-main); }
.items-table tbody tr.value-break td {
  border-top: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border));
  padding-top: 12px;
}

/* Inline row edit input */
.edit-cell { padding: 4px 8px !important; }
.row-edit-input {
  width: 64px; padding: 4px 8px;
  font-size: 1rem; font-family: var(--font-mono); font-weight: 600;
  background: var(--bg-app); color: var(--text-muted);
  border: 1px solid var(--border-muted); border-radius: 4px;
  text-align: center; outline: none; cursor: pointer;
}
.row-edit-input.row-done { color: var(--warning); border-color: transparent; background: transparent; cursor: default; }
tr.selected .row-edit-input {
  color: var(--text-main); border-color: var(--accent); cursor: text;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}
.row-edit-input:focus { border-color: var(--accent); color: var(--text-main); }
.row-edit-input:disabled { opacity: 0.65; cursor: wait; }

.review-status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-pending { background: var(--text-faint); }
.dot-approved { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,0.4); }
.dot-corrected { background: var(--warning); box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.dot-flagged { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.dot-skipped { background: var(--text-faint); opacity: 0.3; }

.correction-input { width: 56px; padding: 3px 6px; font-family: var(--font-mono); font-size: 0.82rem; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-app); color: var(--text-main); outline: none; }
.correction-input:focus { border-color: var(--text-muted); }
.row-actions { display: flex; gap: 3px; }
.row-action-btn { padding: 3px 7px; font-size: 0.72rem; border-radius: 4px; color: var(--text-muted); transition: 0.2s; }
.row-action-btn:hover { background: var(--bg-element); color: var(--text-main); }

.page-navigator { padding: 12px 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; background: var(--bg-surface); }
.page-counter { font-size: 0.85rem; color: var(--text-faint); }

/* --- INTERVENTORIA --- */
.interventoria-hero { text-align: center; padding: 3rem 1rem; }
.hero-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg-surface-hover); color: var(--text-main); border: 1px solid var(--border); margin-bottom: 24px; }
.hero-title { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 12px; }
.hero-sub { font-size: 0.95rem; color: var(--text-muted); max-width: 540px; margin: 0 auto; line-height: 1.6; }

.public-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 40px; }
.pub-stat { padding: 24px; text-align: center; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.pub-stat-val { font-size: 2rem; font-weight: 600; font-family: var(--font-mono); color: var(--text-main); line-height: 1; }
.pub-stat-lbl { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; }

.radio-group { display: flex; flex-direction: column; gap: 12px; }
.radio-opt { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; }
.radio-opt input { accent-color: var(--text-main); width: auto; }
.radio-opt:has(input:checked) { color: var(--text-main); }

/* --- ADMIN --- */
.admin-tabs { display: flex; gap: 8px; }
.admin-section { display: none; }
.admin-section.active { display: block; animation: fade-in 0.3s ease; }
.assign-controls { max-width: 500px; padding: 24px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); }

/* --- MODAL --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 200; animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); width: 100%; max-width: 420px; box-shadow: 0 24px 48px rgba(0,0,0,0.5); overflow: hidden; animation: slide-up 0.2s ease; }
@keyframes slide-up { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1rem; font-weight: 500; }
.modal-close { font-size: 1.25rem; color: var(--text-muted); }
.modal-close:hover { color: var(--text-main); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; background: rgba(9,9,11,0.5); }
.modal-crop-preview { margin-bottom: 16px; }
.modal-digits { display: flex; gap: 10px; margin-bottom: 8px; }
.modal-digits .digit-block { flex: 1; }
.modal-row-view { border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.modal-row-view img { width: 100%; height: auto; display: block; }
.original-value { padding: 10px 12px; font-family: var(--font-mono); font-size: 1rem; background: var(--bg-app); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); }

/* --- TOAST --- */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 300; max-width: 380px; }
.toast { padding: 12px 16px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; color: var(--text-main); display: flex; align-items: flex-start; gap: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes toast-in { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

/* --- DOC PAGINATION --- */
.doc-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 20px 0 4px; }
.doc-page-info { font-size: 0.8rem; color: var(--text-muted); min-width: 120px; text-align: center; }

/* --- RESPONSIVE (tablet / mobile) --- */
@media (max-width: 900px) {
  .review-layout { flex-direction: column; overflow-y: auto; height: auto; }
  .review-sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; }
  .review-page-col { width: 100%; flex-shrink: 1; border-right: none; border-bottom: 1px solid var(--border); max-height: 320px; }
  .review-detail { height: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; gap: 8px; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  input, textarea, select { font-size: 16px; } /* prevent iOS zoom on focus */
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
