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

:root {
  --purple:       #3B1778;
  --purple-mid:   #5A2BAA;
  --purple-light: #EDE5F8;
  --purple-muted: #B89FD8;
  --green:        #1A7F4B;
  --red:          #C0392B;
  --bg:           #F5F5F5;
  --card:         #FFFFFF;
  --border:       #E5E5E5;
  --text:         #1A1A1A;
  --muted:        #888888;
  --safe-top:     env(safe-area-inset-top, 0px);
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── SCREENS ── */
.screen {
  display: none;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.screen.active { display: flex; }

/* ── HEADER ── */
.header {
  background: var(--purple);
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.header-left { display: flex; flex-direction: column; gap: 1px; }
.shop-name    { font-size: 10px; color: var(--purple-muted); letter-spacing: 0.1em; text-transform: uppercase; }
.screen-title { font-size: 16px; font-weight: 600; color: #fff; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #5A2BAA;
  border: 1.5px solid #8B5FCC;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #DDD0F5;
  flex-shrink: 0; letter-spacing: 0.04em; cursor: pointer;
}
.avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.avatar-hint { font-size: 9px; color: var(--purple-muted); }

/* ── SCREEN BODY ── */
.screen-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.screen-body.center { align-items: center; justify-content: center; }

/* ── SIGN IN SCREEN ── */
.signin-wrap {
  display: flex; flex-direction: column;
  align-items: center; gap: 18px;
  width: 100%; max-width: 320px; text-align: center;
}
.signin-logo   { margin-bottom: 4px; }
.signin-title  { font-size: 20px; font-weight: 600; color: var(--text); }
.signin-sub    { font-size: 14px; color: var(--muted); line-height: 1.5; max-width: 260px; }
.signin-error  { font-size: 13px; color: var(--red); line-height: 1.5; max-width: 280px; }

/* ── FIELD GROUPS ── */
.field-group { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.field-label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ── TECH LIST ── */
.select-list { display: flex; flex-direction: column; gap: 8px; }
.tech-item {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  font-size: 15px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tech-item.selected {
  border-color: var(--purple-mid);
  background: var(--purple-light);
  color: var(--purple);
}

/* ── JOB LIST ── */
.job-list { display: flex; flex-direction: column; gap: 8px; }
.job-item {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.job-item.selected {
  border-color: var(--purple-mid);
  background: var(--purple-light);
}
.job-item .ro-num    { font-size: 10px; font-weight: 700; color: var(--purple-mid); letter-spacing: 0.06em; margin-bottom: 2px; }
.job-item .job-desc  { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.job-item .job-vehicle { font-size: 12px; color: var(--muted); }
.muted-text { font-size: 14px; color: var(--muted); }

/* ── ACTIVE JOB CARD ── */
.active-job-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--purple);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  width: 100%; max-width: 340px;
}
.active-job-card .ro-num     { font-size: 10px; font-weight: 700; color: var(--purple-mid); letter-spacing: 0.06em; margin-bottom: 2px; }
.active-job-card .job-desc   { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.active-job-card .job-vehicle { font-size: 12px; color: var(--muted); }

/* ── TIMER ── */
.timer-display {
  font-size: 56px; font-weight: 200; color: var(--text);
  letter-spacing: 0.04em; font-variant-numeric: tabular-nums; line-height: 1;
}
.timer-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── PHOTO BUTTON ── */
.photo-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text); font-weight: 500;
  cursor: pointer; width: 100%; max-width: 340px;
  -webkit-tap-highlight-color: transparent;
}
.photo-btn-icon {
  width: 30px; height: 30px; background: var(--purple-light);
  border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.photo-count-pill {
  margin-left: auto; background: var(--purple-mid); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 10px; padding: 2px 8px;
}

/* ── BUTTONS ── */
.btn-area { width: 100%; display: flex; justify-content: center; padding-top: 8px; }

.btn-start {
  background: var(--green); border: none; border-radius: 50%;
  width: 130px; height: 130px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn-start:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-start:not(:disabled):active { transform: scale(0.96); }

.btn-stop {
  background: var(--red); border: none; border-radius: 50%;
  width: 130px; height: 130px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn-stop:active { transform: scale(0.96); }

.btn-label { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: 0.04em; }
.btn-sub   { font-size: 11px; color: rgba(255,255,255,0.65); margin-top: 3px; }

.submit-btn {
  background: var(--purple); color: #fff;
  border: none; border-radius: 10px;
  padding: 14px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.submit-btn.full  { width: 100%; }
.submit-btn:active { opacity: 0.85; }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.outline-btn {
  background: #f5f5f5; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  font-size: 14px; color: var(--text); font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.outline-btn.small { padding: 9px 14px; font-size: 13px; width: auto; }
.outline-btn:active { background: var(--purple-light); }

.signout-btn {
  background: none; border: none;
  font-size: 13px; color: var(--muted);
  cursor: pointer; padding: 8px; margin-top: 4px;
  -webkit-tap-highlight-color: transparent;
}
.signout-btn:active { color: var(--red); }

/* ── BOTTOM SHEETS ── */
.bottom-sheet { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.bottom-sheet.visible { pointer-events: all; }

.sheet-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0); transition: background 0.3s;
}
.bottom-sheet.visible .sheet-overlay { background: rgba(0,0,0,0.45); }

.sheet-content {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 16px 18px calc(18px + var(--safe-bottom));
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.bottom-sheet.visible .sheet-content { transform: translateY(0); }

.sheet-handle {
  width: 36px; height: 4px; background: #ddd;
  border-radius: 2px; margin: 0 auto 4px; flex-shrink: 0;
}
.sheet-title { font-size: 16px; font-weight: 600; color: var(--text); }
.sheet-sub   { font-size: 12px; color: var(--muted); margin-top: -4px; }

/* ── NOTES ── */
.notes-input {
  width: 100%; background: #f8f8f8; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
  font-size: 14px; color: var(--text); font-family: inherit;
  resize: none; outline: none;
}
.notes-input:focus { border-color: var(--purple-mid); }

/* ── PHOTO PREVIEW ── */
.photo-preview-area { display: flex; flex-direction: column; gap: 6px; }
.photo-preview-area img {
  width: 100%; max-height: 200px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--border);
}
.photo-action-row { display: flex; gap: 10px; align-items: center; }

/* ── SUBMIT THUMBS ── */
.submit-photo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.submit-thumb {
  width: 52px; height: 52px; border-radius: 8px;
  object-fit: cover; border: 1px solid var(--border);
}

/* ── SUBMIT STATUS ── */
.submit-status { font-size: 13px; color: var(--muted); text-align: center; padding: 8px 0; }
.submit-status.error { color: var(--red); }

/* ── SUCCESS ── */
.success-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.success-icon  { margin-bottom: 4px; }
.success-title  { font-size: 22px; font-weight: 600; color: var(--text); }
.success-detail { font-size: 14px; color: var(--muted); max-width: 260px; line-height: 1.5; white-space: pre-line; }

/* ── UTILS ── */
.hidden { display: none !important; }
