/* ═══════════════════════════════════════════════════════════════
   kiemtra-expiry — Production QC PWA
   Factory-floor optimized: clear, fast, high-contrast, touch-friendly
   Based on frontend-design.md steering guidelines
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  /* Primary palette */
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;

  /* Semantic colors */
  --success: #1e8e3e;
  --success-light: #e6f4ea;
  --danger: #d93025;
  --danger-light: #fce8e6;
  --warning: #e37400;
  --warning-light: #fef7e0;

  /* Surfaces */
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --border-focus: var(--primary);

  /* Radii */
  --radius: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Nav */
  --nav-bg: #2d3748;
  --nav-height: 48px;
}

/* ═══ BASE RESET ════════════════════════════════════════════════ */

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ═══ TYPOGRAPHY ════════════════════════════════════════════════ */

h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
}

h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}

p {
  margin: 0 0 0.75rem;
  max-width: 65ch;
}

.text-muted {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* Section labels */
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ═══ BUTTONS ═══════════════════════════════════════════════════ */

button, .btn {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 44px;
  min-width: 44px;
}

button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #c5221f;
}

.btn-full {
  width: 100%;
  padding: 12px 20px;
  font-size: 0.95rem;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  min-height: 36px;
}

/* ═══ FORMS ═════════════════════════════════════════════════════ */

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 44px;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #9aa0a6;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.form-field input:disabled,
.form-field select:disabled {
  background: #f1f3f4;
  color: #80868b;
}

.form-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.form-success {
  background: var(--success-light);
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.form-hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ═══ NAVIGATION ════════════════════════════════════════════════ */

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  color: #fff;
  padding: 0 16px;
  height: var(--nav-height);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  margin-right: 16px;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 2px;
  align-items: center;
  height: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s var(--ease);
  min-height: 34px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

.nav-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-user {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
}

.sync-badge {
  background: var(--warning);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.15);
  min-height: 32px;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* ═══ VIEW CONTENT ══════════════════════════════════════════════ */

.view-content {
  flex: 1;
  padding: 20px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

/* ═══ CONNECTIVITY INDICATOR ════════════════════════════════════ */

.connectivity-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 6px 12px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  z-index: 9999;
  transition: transform 0.3s var(--ease);
}

.connectivity-indicator.offline {
  background: var(--danger);
  color: #fff;
  transform: translateY(0);
}

.connectivity-indicator.online {
  transform: translateY(-100%);
}

/* ═══ LOGIN ═════════════════════════════════════════════════════ */

.view-login {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #1a2332;
  min-height: 100dvh;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-logo {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
}

.login-card h1 {
  text-align: center;
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin: 0 0 24px;
}

/* ═══ CHANGE PIN ════════════════════════════════════════════════ */

.view-change-pin {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100dvh;
}

/* ═══ CARDS ═════════════════════════════════════════════════════ */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* Status cards with left border stripe */
.card-status {
  border-left: 4px solid;
}

.card-status-success { border-left-color: var(--success); }
.card-status-danger { border-left-color: var(--danger); }
.card-status-warning { border-left-color: var(--warning); }

/* ═══ STEP CARDS (Scanner/Date Check workflow) ══════════════════ */

.step-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}

.step-card h3 {
  margin-bottom: 12px;
}

/* ═══ SKU LIST ══════════════════════════════════════════════════ */

.sku-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.sku-item {
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  font-size: 0.88rem;
  border-left: 3px solid var(--primary);
}

/* ═══ BARCODE CHECK ═════════════════════════════════════════════ */

.barcode-plan-info {
  margin-bottom: 16px;
}

.code-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.code-type-btn {
  padding: 12px 8px;
  font-size: 0.85rem;
  min-height: 48px;
}

/* Result cards */
.result-card {
  text-align: center;
  padding: 24px;
}

.result-pass-card {
  border: 2px solid var(--success);
  background: var(--success-light);
}

.result-fail-card {
  border: 2px solid var(--danger);
  background: var(--danger-light);
}

.result-hold-card {
  border: 2px solid var(--warning);
  background: var(--warning-light);
}

.result-card code {
  font-size: 1.1rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Makeup section */
.makeup-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

.makeup-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  min-height: 44px;
}

.makeup-checkbox input {
  accent-color: var(--warning);
  width: 18px;
  height: 18px;
}

.makeup-reason-select {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: var(--font);
  min-height: 44px;
}

/* Manual entry row */
.manual-input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.manual-input-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.2rem;
  letter-spacing: 0.15em;
  text-align: center;
  font-weight: 600;
  min-height: 48px;
}

.manual-input-row input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Manual fallback */
.manual-fallback {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.manual-fallback summary {
  cursor: pointer;
  padding: 8px 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* ═══ VIDEO / CAMERA ════════════════════════════════════════════ */

.video-container {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #1a1a1a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  gap: 8px;
}

.scanner-placeholder p {
  font-size: 0.85rem;
  margin: 0;
}

.scanner-controls,
.capture-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

/* ═══ FLASH OVERLAY (Check results) ════════════════════════════ */

.barcode-flash,
.date-flash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9990;
  animation: flash-in 0.2s var(--ease);
}

.flash-pass { background: rgba(30, 142, 62, 0.94); }
.flash-fail { background: rgba(217, 48, 37, 0.94); }
.flash-hold { background: rgba(227, 116, 0, 0.94); }
.flash-ng { background: rgba(217, 48, 37, 0.94); }

.flash-text {
  font-size: 3.5rem;
  font-weight: 700;
  color: #fff;
}

@keyframes flash-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* ═══ ERRORS ════════════════════════════════════════════════════ */

.barcode-error,
.date-error,
.dashboard-error,
.holds-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* ═══ TABLES ════════════════════════════════════════════════════ */

.dashboard-table,
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.83rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.dashboard-table th,
.admin-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.dashboard-table td,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f3f4;
  vertical-align: middle;
}

.dashboard-table td { text-align: center; }
.dashboard-table td:first-child { text-align: left; font-weight: 500; }

.admin-table td:first-child { font-weight: 500; }

.dashboard-table tbody tr:last-child td,
.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.dashboard-table tbody tr:hover,
.admin-table tbody tr:hover {
  background: var(--bg);
}

.totals-row td {
  background: #f1f3f4;
  font-weight: 600;
}

/* Result colors in tables */
.result-pass { color: var(--success); font-weight: 600; }
.result-fail { color: var(--danger); font-weight: 600; }
.result-hold { color: var(--warning); font-weight: 600; }
.result-ng { color: var(--danger); font-weight: 700; }

/* ═══ DASHBOARD ═════════════════════════════════════════════════ */

.dashboard-date-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.dashboard-date-picker label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.dashboard-date-picker input[type="date"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  min-height: 44px;
}

.dashboard-loading {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.dashboard-frequency {
  margin-top: 24px;
}

.btn-export {
  margin-top: 12px;
}

/* Frequency grid */
.frequency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.frequency-card {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  border-left: 3px solid;
}

.frequency-on_time { border-left-color: var(--success); }
.frequency-overdue { border-left-color: var(--danger); }
.frequency-makeup { border-left-color: var(--warning); }

.frequency-sku {
  font-weight: 600;
  font-size: 0.88rem;
  display: block;
}

.frequency-status {
  font-size: 0.78rem;
  font-weight: 500;
  display: block;
  margin-top: 2px;
}

.frequency-time {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

/* Frequency bar (top overview) */
.frequency-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

.freq-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
}

.freq-green { background: var(--success-light); color: var(--success); }
.freq-yellow { background: var(--warning-light); color: var(--warning); }
.freq-red { background: var(--danger-light); color: var(--danger); }

.freq-sku { font-weight: 600; }

.freq-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* ═══ HOLDS ═════════════════════════════════════════════════════ */

.holds-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.hold-item {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  border-left: 4px solid;
}

.hold-soft { border-left-color: var(--warning); }
.hold-escalate { border-left-color: var(--danger); }

.hold-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.hold-sku { font-weight: 600; }

.hold-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-hold_soft { background: var(--warning-light); color: var(--warning); }
.badge-escalate { background: var(--danger-light); color: var(--danger); }

.hold-dates {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.7;
}

.hold-date-label {
  font-weight: 500;
  margin-right: 4px;
}

.hold-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
}

.hold-resolve-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.resolve-options {
  border: none;
  padding: 0;
  margin: 0 0 12px;
}

.resolve-options legend {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.resolve-option {
  display: flex;
  align-items: center;
  padding: 8px 0;
  font-size: 0.88rem;
  cursor: pointer;
  min-height: 44px;
}

.resolve-option input {
  margin-right: 8px;
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

.resolve-comment-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.resolve-comment {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: var(--font);
  resize: vertical;
  min-height: 60px;
}

.resolve-comment:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.resolve-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-resolve {
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  font-size: 0.82rem;
  margin-top: 12px;
  min-height: 44px;
}

.holds-success {
  background: var(--success-light);
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.holds-empty {
  color: var(--text-secondary);
  text-align: center;
  padding: 40px 20px;
  font-size: 0.92rem;
}

.holds-loading {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ═══ ADMIN ═════════════════════════════════════════════════════ */

.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.tab-btn {
  flex: 1;
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: 0;
  font-size: 0.85rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  min-height: 44px;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-btn:hover:not(.active) {
  background: var(--bg);
}

.admin-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-form {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.import-errors {
  background: var(--warning-light);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

.import-errors h4 {
  margin: 0 0 8px;
  color: var(--warning);
  font-size: 0.88rem;
}

.empty-msg {
  color: var(--text-secondary);
  text-align: center;
  padding: 24px;
}

.loading-msg {
  color: var(--text-secondary);
  text-align: center;
  padding: 16px;
}

/* ═══ PLANS ═════════════════════════════════════════════════════ */

.plan-active-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  border-left: 4px solid var(--success);
  margin-bottom: 16px;
}

.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.plan-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.plan-badge.active {
  background: var(--success-light);
  color: var(--success);
}

.plan-empty {
  text-align: center;
  padding: 40px 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.plan-empty p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.plan-form {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-top: 16px;
}

.sku-selector {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.sku-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.15s;
  min-height: 44px;
}

.sku-checkbox:hover {
  background: var(--bg);
}

.sku-checkbox.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.sku-checkbox input {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

.plan-sku-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

.plan-sku-row.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.plan-sku-row .sku-checkbox {
  border: none;
  background: transparent;
  padding: 6px 8px;
}

.plan-sku-cadence {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px 8px 8px;
}

.plan-sku-cadence .text-muted {
  grid-column: 1 / -1;
  margin: 0;
}

.plan-defaults {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sku-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 8px;
}

.sku-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sku-only-selected {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  min-height: 44px;
}

.sku-only-selected input {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

/* ═══ DATE CHECK ════════════════════════════════════════════════ */

.date-form,
.date-confirm {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}

.barcode-manual-entry {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}

.date-actions {
  margin-top: 16px;
}

/* ═══ 404 ═══════════════════════════════════════════════════════ */

.view-not-found {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.view-not-found h1 {
  font-size: 4rem;
  color: var(--border);
  margin: 0 0 8px;
}

.view-not-found p {
  color: var(--text-secondary);
}

/* ═══ RESPONSIVE ════════════════════════════════════════════════ */

@media (max-width: 600px) {
  :root {
    --nav-height: 44px;
  }

  .app-nav {
    padding: 0 10px;
  }

  .nav-link {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  .nav-user { display: none; }
  .nav-brand { display: none; }

  .view-content {
    padding: 14px;
  }

  .login-card {
    padding: 24px 20px;
  }

  .scanner-controls,
  .capture-controls {
    grid-template-columns: 1fr;
  }

  .code-type-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dashboard-table,
  .admin-table {
    font-size: 0.78rem;
  }

  .dashboard-table th,
  .admin-table th {
    padding: 8px;
  }

  .dashboard-table td,
  .admin-table td {
    padding: 8px;
  }

  .frequency-grid {
    grid-template-columns: 1fr 1fr;
  }

  .plan-header {
    flex-direction: column;
  }

  .admin-toolbar {
    flex-direction: column;
  }

  .admin-toolbar .btn-primary,
  .admin-toolbar .btn-secondary {
    width: 100%;
  }
}

@media (min-width: 768px) {
  html { font-size: 16px; }
  .view-content { padding: 24px 32px; }
}

/* ═══ FOCUS VISIBLE ═════════════════════════════════════════════ */

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

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* ═══ ARIA LIVE REGIONS ═════════════════════════════════════════ */

[aria-live="assertive"] {
  /* Flash overlays — no additional styling needed */
}

[aria-live="polite"] {
  /* Connectivity indicator etc. */
}

/* ═══ PRINT ═════════════════════════════════════════════════════ */

@media print {
  .app-nav,
  .connectivity-indicator,
  .btn-logout,
  .sync-badge {
    display: none;
  }

  .view-content {
    max-width: 100%;
    padding: 0;
  }
}
