/* ====================================
   Gemba Walk — Mobile-first PWA Styles
   Brand: Lean Akademija (navy + red)
   ==================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

:root {
  --navy: #0A2540;
  --navy-2: #143058;
  --red: #E8003D;
  --light: #F0F4F8;
  --gray: #6B7280;
  --gray-2: #94A3B8;
  --dark: #1F2937;
  --green: #059669;
  --amber: #D97706;
  --blue: #2563EB;
  --purple: #7C3AED;
  --bg: #F8FAFC;
  --border: #E2E8F0;
  --border-2: #F1F5F9;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, select {
  user-select: text;
  -webkit-user-select: text;
}

#app {
  height: 100%;
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

/* === SCREENS === */
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
}
.screen.active { display: flex; }

/* === APP HEADER === */
.app-header {
  background: var(--navy);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding-top: max(14px, env(safe-area-inset-top));
}
.app-header .title { font-size: 16px; font-weight: 600; flex: 1; }
.header-btn {
  background: transparent; border: none; color: white;
  font-size: 22px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.header-btn:active { background: rgba(255,255,255,0.15); }

/* === PROGRESS BAR === */
.progress-bar { height: 3px; background: rgba(232,0,61,0.15); flex-shrink: 0; }
.progress-fill { height: 100%; background: var(--red); width: 0%; transition: width 0.3s; }

/* === CONTENT === */
.content { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }

/* === HEADINGS === */
h2 { font-size: 18px; margin: 4px 0 12px 0; color: var(--navy); }
.section-title {
  font-size: 12px; color: var(--gray);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 16px 0 10px 0; font-weight: 600;
}

/* === BUTTONS === */
.btn {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  font-family: inherit;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--red); color: white; }
.btn-secondary { background: white; color: var(--navy); border: 2px solid var(--navy); }
.btn-success { background: var(--green); color: white; }
.btn-warning { background: var(--amber); color: white; }
.btn-danger { background: #EF4444; color: white; }
.btn-ghost { background: transparent; color: var(--gray); }

/* === FORMS === */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: white;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--navy); }

/* === HOME WELCOME === */
.welcome-card {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: white;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.welcome-card::before {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 140px; height: 140px;
  background: rgba(232,0,61,0.18);
  border-radius: 50%;
  pointer-events: none;
}
.welcome-label { font-size: 11px; opacity: 0.7; letter-spacing: 1.5px; text-transform: uppercase; }
.welcome-name { font-size: 22px; font-weight: 700; margin-top: 4px; position: relative; }
.welcome-meta { font-size: 13px; opacity: 0.85; margin-top: 4px; position: relative; }

/* === TABS === */
.tab-row {
  display: flex;
  gap: 8px;
  margin: 22px 0 12px 0;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tab-btn.active { color: var(--navy); border-bottom-color: var(--red); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.badge {
  background: var(--red);
  color: white;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  display: inline-block;
  text-align: center;
}
.badge:empty, .badge[data-count="0"] { display: none; }

/* === HISTORY === */
.history-item {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  position: relative;
}
.history-item:active { background: var(--border-2); }
.history-item .info { flex: 1; min-width: 0; }
.history-item .name { font-weight: 600; font-size: 15px; color: var(--navy); }
.history-item .date { font-size: 12px; color: var(--gray); margin-top: 2px; }
.history-item .score-pill {
  background: var(--border-2);
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
}
.score-pill.grade-A { background: #D1FAE5; color: #065F46; }
.score-pill.grade-B { background: #FEF3C7; color: #92400E; }
.score-pill.grade-C { background: #FEE2E2; color: #991B1B; }
.score-pill.grade-D { background: #1E1B4B; color: white; }

.history-item .btn-delete {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #cbd5e1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: 8px;
}
.history-item .btn-delete:hover { color: #ef4444; background: #fee2e2; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; line-height: 1.5; }

/* === KANBAN === */
.kanban {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.kanban-col {
  flex: 0 0 240px;
  background: var(--border-2);
  border-radius: 12px;
  padding: 10px;
  min-height: 200px;
}
.kanban-col-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.kanban-col-header .dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-open { background: #EF4444; }
.dot-doing { background: var(--amber); }
.dot-done { background: var(--green); }
.kanban-count {
  margin-left: auto;
  background: white;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 11px;
}
.kanban-card {
  background: white;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  cursor: pointer;
  border-left: 3px solid var(--red);
}
.kanban-col[data-status="doing"] .kanban-card { border-left-color: var(--amber); }
.kanban-col[data-status="done"] .kanban-card { border-left-color: var(--green); opacity: 0.75; }
.kanban-card .kc-title { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 4px; line-height: 1.3; }
.kanban-card .kc-meta { font-size: 11px; color: var(--gray); display: flex; gap: 8px; flex-wrap: wrap; }
.kanban-card .kc-meta .overdue { color: #EF4444; font-weight: 600; }
.kanban-card .kc-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

/* === INFO BOX === */
.info-box {
  background: var(--border-2);
  padding: 12px 14px;
  border-radius: 10px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--gray);
  line-height: 1.5;
}
.info-box strong { color: var(--navy); }

.prompt-box {
  background: #FEF3C7;
  border-left: 3px solid var(--amber);
  padding: 10px 12px;
  border-radius: 8px;
  margin: 10px 0;
  font-size: 13px;
  color: #78350F;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}
.prompt-box .prompt-icon { flex-shrink: 0; }

/* === BOTTOM BAR === */
.bottom-bar {
  background: white;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.bottom-bar .btn { flex: 1; padding: 12px; font-size: 14px; }

/* === QUESTION SCREEN === */
.q-category {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.q-category .dot { width: 10px; height: 10px; border-radius: 50%; }
.q-subtitle { font-size: 13px; color: var(--gray); margin: -4px 0 8px 0; line-height: 1.4; }

/* === RUBRIC === */
.rubric {
  background: var(--border-2);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.5;
}
.rubric-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: flex-start; }
.rubric-row:last-child { margin-bottom: 0; }
.rubric-row.highlighted {
  background: rgba(255,255,255,0.7);
  margin: -2px -4px 6px -4px;
  padding: 4px;
  border-radius: 6px;
  font-weight: 600;
}
.rubric-pill {
  flex-shrink: 0;
  width: 32px;
  height: 24px;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rubric-pill.p0 { background: #EF4444; }
.rubric-pill.p5 { background: var(--amber); }
.rubric-pill.p10 { background: var(--green); }

/* === SCORE BUTTONS === */
.score-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.score-btn {
  aspect-ratio: 1;
  border: 3px solid var(--border);
  background: white;
  border-radius: 14px;
  font-size: 32px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-family: inherit;
}
.score-btn .label-text {
  font-size: 11px; font-weight: 500; margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.score-btn:active { transform: scale(0.95); }
.score-btn.score-0 { border-color: #EF4444; color: #EF4444; }
.score-btn.score-5 { border-color: var(--amber); color: var(--amber); }
.score-btn.score-10 { border-color: var(--green); color: var(--green); }
.score-btn.selected.score-0 { background: #EF4444; color: white; box-shadow: 0 4px 14px rgba(239,68,68,0.35); }
.score-btn.selected.score-5 { background: var(--amber); color: white; box-shadow: 0 4px 14px rgba(217,119,6,0.35); }
.score-btn.selected.score-10 { background: var(--green); color: white; box-shadow: 0 4px 14px rgba(5,150,105,0.35); }

/* === PHOTO SECTION === */
.photo-section {
  margin-top: 16px;
  padding: 14px;
  border: 2px dashed var(--gray-2);
  border-radius: 12px;
  text-align: center;
  background: var(--bg);
}
.photo-section.required { border-color: var(--amber); background: #FEF3C7; }
.photo-section.has-photo { border-style: solid; border-color: var(--green); background: #D1FAE5; }
.photo-section-title { font-size: 13px; font-weight: 600; color: #92400E; margin-bottom: 10px; }
.photo-section.has-photo .photo-section-title { color: #065F46; }
.photo-thumbs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.photo-thumb { width: 80px; height: 60px; border-radius: 8px; background-size: cover; background-position: center; position: relative; cursor: pointer; }
.photo-thumb-remove {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #EF4444; color: white; border: 2px solid white;
  font-size: 12px; cursor: pointer; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.btn-photo { padding: 10px; font-size: 14px; }

/* === SUCCESS MSG === */
.success-msg {
  background: #D1FAE5;
  border-radius: 10px;
  padding: 14px;
  margin-top: 16px;
  text-align: center;
  color: #065F46;
  font-size: 14px;
  font-weight: 500;
}

/* === SUMMARY === */
.summary-meta { font-size: 13px; color: var(--gray); text-align: center; margin-bottom: 12px; }
.summary-score {
  text-align: center;
  padding: 28px 16px;
  background: white;
  border-radius: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.summary-score .big {
  font-size: 56px; font-weight: 800; margin-bottom: 4px;
  background: linear-gradient(135deg, var(--navy), var(--red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.summary-score .pct { font-size: 18px; color: var(--gray); }
.grade-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 8px;
}
.grade-badge.grade-A { background: #D1FAE5; color: #065F46; }
.grade-badge.grade-B { background: #FEF3C7; color: #92400E; }
.grade-badge.grade-C { background: #FEE2E2; color: #991B1B; }
.grade-badge.grade-D { background: #1E1B4B; color: white; }

/* === PER-CATEGORY BARS === */
.s-bar { margin-bottom: 14px; }
.s-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 14px;
  align-items: center;
}
.s-bar-header .dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
}
.s-bar-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.s-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }

/* === BENCHMARK CARD === */
.card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-title {
  font-size: 12px; color: var(--gray);
  margin-bottom: 8px; text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600;
}
.benchmark-row { display: flex; justify-content: space-between; align-items: center; }
.benchmark-dates { color: var(--gray); font-size: 13px; }
.benchmark-delta { font-size: 18px; font-weight: 700; }
.benchmark-delta.up { color: var(--green); }
.benchmark-delta.down { color: #EF4444; }
.benchmark-icon { font-size: 32px; }

/* === ACTION CARDS === */
.action-card {
  background: white;
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.action-card .number {
  font-size: 11px; color: var(--gray);
  font-weight: 700; margin-bottom: 6px;
  text-transform: uppercase;
}
.action-card .desc { font-size: 14px; margin-bottom: 8px; font-weight: 500; }
.action-card .meta-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.action-card .meta-row input,
.action-card .meta-row select {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: white;
}

/* === MODAL === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal {
  background: white;
  border-radius: 16px;
  padding: 22px;
  max-width: 380px;
  width: 100%;
}
.modal-lg { max-width: 420px; }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; color: var(--navy); }
.modal-text { font-size: 14px; color: var(--gray); margin-bottom: 16px; line-height: 1.5; }
.modal-buttons { display: flex; gap: 10px; margin-top: 12px; }
.modal-buttons .btn { flex: 1; padding: 12px; font-size: 14px; }

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 1001;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  animation: toast-up 0.3s;
  max-width: 360px;
}
@keyframes toast-up {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* === FOOTER === */
.app-footer {
  padding: 12px 16px;
  text-align: center;
  font-size: 11px;
  color: var(--gray-2);
  border-top: 1px solid var(--border-2);
  background: white;
  flex-shrink: 0;
}
.app-footer a { color: var(--red); text-decoration: none; font-weight: 500; }
.app-footer a:hover { text-decoration: underline; }

/* === QUICK DATE ROW === */
.quick-date-row { display: flex; gap: 6px; margin-bottom: 8px; }
.btn-quick-date {
  flex: 1;
  padding: 8px 4px;
  background: var(--border-2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-quick-date:hover { background: var(--border); }
.btn-quick-date.active { background: var(--navy); color: white; border-color: var(--navy); }
.btn-quick-date:active { transform: scale(0.97); }
