/* ================================================================
   27 SECOND Staff Portal — Design System
   Apple-style minimal, mobile-first
================================================================ */

/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colors (light) */
  --c-blue:        #007AFF;
  --c-green:       #34C759;
  --c-orange:      #FF9500;
  --c-red:         #FF3B30;
  --c-purple:      #AF52DE;
  --c-teal:        #30B0C7;
  --c-indigo:      #5856D6;

  --c-label:       #000000;
  --c-label-2:     rgba(60,60,67,.6);
  --c-label-3:     rgba(60,60,67,.3);
  --c-fill:        rgba(120,120,128,.2);
  --c-fill-2:      rgba(120,120,128,.16);
  --c-fill-3:      rgba(120,120,128,.12);
  --c-bg:          #f2f2f7;
  --c-bg-2:        #ffffff;
  --c-separator:   rgba(60,60,67,.18);
  --c-separator-o: rgba(60,60,67,.29);

  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-xl:    20px;

  --font:         -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;

  --nav-h:        56px;
  --top-bar-h:    52px;
  --safe-top:     env(safe-area-inset-top, 0px);
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-label:       #ffffff;
    --c-label-2:     rgba(235,235,245,.6);
    --c-label-3:     rgba(235,235,245,.3);
    --c-fill:        rgba(116,116,128,.36);
    --c-fill-2:      rgba(116,116,128,.32);
    --c-fill-3:      rgba(116,116,128,.24);
    --c-bg:          #1c1c1e;
    --c-bg-2:        #2c2c2e;
    --c-separator:   rgba(84,84,88,.6);
    --c-separator-o: rgba(84,84,88,.8);
  }
}

html {
  font-family: var(--font);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  background: var(--c-bg);
  color: var(--c-label);
  height: 100%;
}

body {
  min-height: 100%;
  overflow-x: hidden;
  overscroll-behavior: none;
}

/* ── Typography ──────────────────────────────────────────────── */
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
h3 { font-size: 17px; font-weight: 600; }
p  { font-size: 15px; line-height: 1.5; color: var(--c-label-2); }

/* ── Screens ─────────────────────────────────────────────────── */
.screen { min-height: 100vh; }

/* ── LOGIN ───────────────────────────────────────────────────── */
.screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--c-bg);
}

.login-wrap {
  width: 100%;
  max-width: 360px;
}

.login-logo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.logo-mark {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--c-blue);
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--c-label);
}

.login-sub {
  font-size: 15px;
  color: var(--c-label-2);
  margin-bottom: 36px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-error {
  background: rgba(255,59,48,.12);
  color: var(--c-red);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  text-align: center;
}

/* ── Fields ──────────────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-label-2);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.field-input {
  background: var(--c-bg-2);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 16px;
  font-family: var(--font);
  color: var(--c-label);
  outline: none;
  transition: box-shadow .15s;
  -webkit-appearance: none;
}

.field-input:focus {
  box-shadow: 0 0 0 3px rgba(0,122,255,.35);
}

.field-pin {
  letter-spacing: 6px;
  font-size: 20px;
  text-align: center;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .12s, transform .1s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.btn:active { opacity: .8; transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }

.btn-primary  { background: var(--c-blue);   color: #fff; }
.btn-secondary{ background: var(--c-fill-2); color: var(--c-blue); }
.btn-danger   { background: rgba(255,59,48,.12); color: var(--c-red); }
.btn-full     { width: 100%; }

/* ── App Shell ───────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ── Top Bar ─────────────────────────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  height: var(--top-bar-h);
  padding: 0 16px;
  background: var(--c-bg-2);
  border-bottom: 1px solid var(--c-separator);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-left, .top-bar-right {
  flex: 0 0 56px;
  display: flex;
  align-items: center;
}

.top-bar-right { justify-content: flex-end; }
.top-bar-center { flex: 1; text-align: center; }

.top-bar-logo {
  font-size: 18px;
  font-weight: 800;
  color: var(--c-blue);
  letter-spacing: -1px;
}

.top-bar-title {
  font-size: 17px;
  font-weight: 600;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  color: var(--c-blue);
  -webkit-tap-highlight-color: transparent;
  transition: opacity .12s;
}

.icon-btn svg { width: 20px; height: 20px; display: block; }
.icon-btn:active { opacity: .6; }

/* ── Page Container ──────────────────────────────────────────── */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + 8px);
}

.page { display: none; }
.page.active { display: block; }

.page-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 560px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.4px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--c-bg-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--c-separator);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

/* ── Greeting Card ───────────────────────────────────────────── */
.greeting-card {
  background: var(--c-blue);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #fff;
}

.greeting-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.greeting-time {
  font-size: 14px;
  opacity: .8;
  color: #fff;
  margin-bottom: 2px;
}

.greeting-name {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.greeting-meta {
  font-size: 13px;
  opacity: .75;
  color: #fff;
}

.role-badge {
  background: rgba(255,255,255,.25);
  color: #fff;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Attendance Card ─────────────────────────────────────────── */
.attendance-status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--c-fill);
  color: var(--c-label-2);
}

.attendance-status-badge.checked-in {
  background: rgba(52,199,89,.15);
  color: var(--c-green);
}

.attendance-status-badge.checked-out {
  background: var(--c-fill);
  color: var(--c-label-2);
}

.attendance-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--c-separator);
  border-bottom: 1px solid var(--c-separator);
}

.att-time-item {
  background: var(--c-bg-2);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.att-time-label {
  font-size: 12px;
  color: var(--c-label-2);
  font-weight: 500;
}

.att-time-val {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.3px;
}

.attendance-actions {
  padding: 12px 16px;
  display: flex;
  gap: 10px;
}

.attendance-actions .btn {
  flex: 1;
  padding: 12px;
  font-size: 15px;
}

/* ── Stats Grid ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  background: var(--c-bg-2);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--c-label-2);
  font-weight: 500;
}

.stat-card.accent-blue .stat-value  { color: var(--c-blue); }
.stat-card.accent-green .stat-value { color: var(--c-green); }
.stat-card.accent-orange .stat-value{ color: var(--c-orange); }
.stat-card.accent-purple .stat-value{ color: var(--c-purple); }

/* ── Quick Actions ───────────────────────────────────────────── */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-item {
  background: var(--c-bg-2);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  border: none;
  text-align: left;
  width: 100%;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  transition: opacity .12s;
}

.action-item:active { opacity: .7; }

.action-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

.action-text { flex: 1; }
.action-title { font-size: 15px; font-weight: 600; color: var(--c-label); }
.action-desc  { font-size: 13px; color: var(--c-label-2); margin-top: 2px; }

/* ── Task List ───────────────────────────────────────────────── */
.task-progress-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-label-2);
}

.progress-bar-wrap { }
.progress-bar {
  height: 6px;
  background: var(--c-fill);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--c-green);
  border-radius: 3px;
  transition: width .3s ease;
}

.task-list {
  background: var(--c-bg-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-separator);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}

.task-item:last-child { border-bottom: none; }
.task-item:active { background: var(--c-fill-3); }

.task-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--c-separator-o);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  margin-top: 1px;
}

.task-item.done .task-check {
  background: var(--c-green);
  border-color: var(--c-green);
}

.task-check-icon {
  display: none;
  color: #fff;
}

.task-check-icon svg { width: 14px; height: 14px; }
.task-item.done .task-check-icon { display: block; }

.task-body { flex: 1; }
.task-title { font-size: 15px; font-weight: 500; color: var(--c-label); }
.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--c-label-2);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.task-hint { font-size: 12px; color: var(--c-label-3); }
.task-cat  {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--c-fill-3);
  color: var(--c-label-2);
}

/* ── SOP List ────────────────────────────────────────────────── */
.sop-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sop-item {
  background: var(--c-bg-2);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  border: none;
  text-align: left;
  width: 100%;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  transition: opacity .12s;
}

.sop-item:active { opacity: .7; }

.sop-num {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--c-fill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-blue);
  flex-shrink: 0;
}

.sop-info { flex: 1; }
.sop-title { font-size: 15px; font-weight: 600; color: var(--c-label); }
.sop-desc  { font-size: 13px; color: var(--c-label-2); margin-top: 2px; }

.sop-chevron {
  color: var(--c-label-3);
  flex-shrink: 0;
}

.sop-chevron svg { width: 16px; height: 16px; }

/* ── SOP Detail ──────────────────────────────────────────────── */
.sop-detail-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--c-blue);
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.btn-back svg { width: 20px; height: 20px; }
.sop-detail-title { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }

/* Markdown body */
.markdown-body {
  font-size: 15px;
  line-height: 1.65;
  color: var(--c-label);
}

.markdown-body h1 { font-size: 22px; font-weight: 700; margin: 20px 0 12px; color: var(--c-label); }
.markdown-body h2 { font-size: 18px; font-weight: 700; margin: 18px 0 10px; color: var(--c-label); }
.markdown-body h3 { font-size: 16px; font-weight: 600; margin: 14px 0 8px; color: var(--c-label); }
.markdown-body p  { margin: 0 0 10px; color: var(--c-label); }
.markdown-body ul, .markdown-body ol { margin: 6px 0 10px 20px; }
.markdown-body li { margin-bottom: 4px; color: var(--c-label); }
.markdown-body strong { font-weight: 700; }
.markdown-body code {
  background: var(--c-fill);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 13px;
  font-family: 'SF Mono', 'Menlo', monospace;
}
.markdown-body pre {
  background: var(--c-fill);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
  margin: 10px 0;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--c-separator);
  margin: 16px 0;
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 14px;
}
.markdown-body th, .markdown-body td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-separator);
}
.markdown-body th { font-weight: 600; background: var(--c-fill-3); }
.markdown-body blockquote {
  border-left: 3px solid var(--c-blue);
  margin: 10px 0;
  padding: 8px 14px;
  color: var(--c-label-2);
  background: var(--c-fill-3);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Attendance History ───────────────────────────────────────── */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 14px 16px;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.week-day-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--c-label-2);
  text-transform: uppercase;
}

.week-day-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-fill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--c-label-2);
}

.week-day-dot.present { background: var(--c-green); color: #fff; }
.week-day-dot.absent  { background: rgba(255,59,48,.15); color: var(--c-red); }
.week-day-dot.today   {
  border: 2px solid var(--c-blue);
  color: var(--c-blue);
}

.attendance-history {
  background: var(--c-bg-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.att-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-separator);
}

.att-history-item:last-child { border-bottom: none; }

.att-history-date { font-size: 15px; font-weight: 600; }
.att-history-day  { font-size: 12px; color: var(--c-label-2); margin-top: 2px; }

.att-history-times {
  text-align: right;
  font-size: 13px;
  color: var(--c-label-2);
}

.att-history-status {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.att-history-status.present {
  background: rgba(52,199,89,.15);
  color: var(--c-green);
}

.att-history-status.absent {
  background: rgba(255,59,48,.12);
  color: var(--c-red);
}

/* ── Profile ─────────────────────────────────────────────────── */
.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 0 8px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--c-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.profile-name  { font-size: 22px; font-weight: 700; }
.profile-role  { font-size: 14px; color: var(--c-label-2); }

/* List items inside card */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-separator);
}

.list-item-last { border-bottom: none; }
.list-item-label{ font-size: 15px; color: var(--c-label); }
.list-item-val  { font-size: 15px; color: var(--c-label-2); }

.pin-change-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 16px;
}

/* ── Bottom Nav ──────────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  height: var(--nav-h);
  background: var(--c-bg-2);
  border-top: 1px solid var(--c-separator);
  position: sticky;
  bottom: 0;
  z-index: 100;
  padding-bottom: var(--safe-bottom);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-label-3);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  transition: color .12s;
  padding: 6px 0;
}

.nav-btn svg   { width: 22px; height: 22px; display: block; }
.nav-btn span  { font-size: 10px; font-weight: 500; }
.nav-btn.active { color: var(--c-blue); }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.82);
  color: #fff;
  padding: 12px 20px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 9999;
  transition: opacity .2s, transform .2s;
  opacity: 0;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--c-label-2);
  font-size: 15px;
}

/* ── Utilities ───────────────────────────────────────────────── */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ── Mobile Safari Fixes ─────────────────────────────────────── */

/* Fix 100vh on iOS Safari (URL bar issue) */
@supports (-webkit-touch-callout: none) {
  .screen     { min-height: -webkit-fill-available; }
  .app-shell  { min-height: -webkit-fill-available; }
}

/* Ensure touch targets are at least 44×44px (iOS HIG) */
.nav-btn { min-height: 44px; }
.btn     { min-height: 44px; }
.sop-item { min-height: 60px; }

/* Prevent text zoom on input focus in Safari */
input[type='text'],
input[type='password'],
input[type='email'],
input[type='search'],
select,
textarea {
  font-size: max(16px, 1em);
}

/* Fix select appearance on iOS */
select.field-input {
  -webkit-appearance: none;
  background-image: url(data:image/svg+xml,%3Csvg xmlns=http://www.w3.org/2000/svg width=12 height=8 viewBox=0 0 12 8%3E%3Cpath d=M1 1l5 5 5-5 stroke=%238E8E93 stroke-width=1.5 fill=none/%3E%3C/svg%3E);
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Touch action on interactive items */
.task-item,
.sop-item,
.action-item,
.icon-btn,
.nav-btn,
.btn,
.btn-back {
  touch-action: manipulation;
}

/* Page container extra scroll padding for admin bar */
.has-admin-nav .page-container {
  padding-bottom: calc(var(--nav-h) * 2 + 8px);
}

/* ── Attendance late status ──────────────────────────────────── */
.att-history-status.late {
  background: rgba(255,149,0,.15);
  color: #FF9500;
}
.attendance-status-badge.late {
  background: rgba(255,149,0,.15);
  color: #FF9500;
}

/* ── Inventory Chips ─────────────────────────────────────────── */
.inv-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid #C6C6C8;
  background: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  color: #8E8E93;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background .15s, color .15s, border-color .15s;
}
.inv-chip.active {
  background: #007AFF;
  border-color: #007AFF;
  color: #FFFFFF;
}

/* ── Inventory Cards ─────────────────────────────────────────── */
.inv-card {
  background: #FFFFFF;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.inv-grade-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}
.inv-card-body { flex: 1; min-width: 0; }
.inv-card-model { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.inv-card-sub   { font-size: 13px; color: #8E8E93; }
.inv-status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* status pill colours */
.inv-s-intake        { background: rgba(88,86,214,.15); color: #5856D6; }
.inv-s-grading       { background: rgba(255,149,0,.15);  color: #FF9500; }
.inv-s-testing       { background: rgba(255,204,0,.15);  color: #C9A000; }
.inv-s-refurb        { background: rgba(255,59,48,.12);  color: #FF3B30; }
.inv-s-ready_to_list { background: rgba(52,199,89,.15);  color: #34C759; }
.inv-s-listed        { background: rgba(0,122,255,.15);  color: #007AFF; }
.inv-s-sold          { background: rgba(142,142,147,.15);color: #8E8E93; }
.inv-s-returned      { background: rgba(255,59,48,.12);  color: #FF3B30; }

/* grade badge colours */
.inv-g-S { background: rgba(52,199,89,.15);  color: #34C759; }
.inv-g-A { background: rgba(0,122,255,.15);  color: #007AFF; }
.inv-g-B { background: rgba(255,149,0,.15);  color: #FF9500; }
.inv-g-C { background: rgba(255,59,48,.12);  color: #FF3B30; }

/* ── Pricing cards ───────────────────────────────────────────── */
.price-card {
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.price-card-model  { font-size: 14px; font-weight: 700; }
.price-card-detail { font-size: 12px; color: #8E8E93; margin: 3px 0; }
.price-card-price  { font-size: 18px; font-weight: 800; color: #34C759; }

/* ── Reports & Repairs page styles ─────────────────────────── */
.report-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.repair-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* KPI Progress bar widget */
#home-kpi-widget {
  margin-bottom: 16px;
}

/* KPI live indicator pulse */
@keyframes kpi-pulse {
  0%   { opacity: 1; }
  50%  { opacity: .4; }
  100% { opacity: 1; }
}
#kpi-live-elapsed {
  animation: kpi-pulse 2s infinite;
}

/* Report photo preview */
#report-photo-preview img {
  transition: opacity .2s;
}
#report-photo-preview img:hover {
  opacity: .8;
}

/* Repair status border colors */
.repair-status-pending    { border-left-color: #FF9500 !important; }
.repair-status-in_progress { border-left-color: #007AFF !important; }
.repair-status-completed  { border-left-color: #34C759 !important; }
.repair-status-cancelled  { border-left-color: #8E8E93 !important; }


/* ── Founder Cockpit ──────────────────────────────────────────────── */
#page-cockpit { background: #1C1C1E; min-height: 100vh; }
.cockpit-section { padding: 12px 16px 0; }
.cockpit-section-title {
  font-size: 11px; font-weight: 700; color: #636366;
  letter-spacing: .8px; margin-bottom: 8px;
}
.cockpit-card {
  background: #2C2C2E; border-radius: 12px; padding: 14px;
  color: #FFFFFF;
}
.cockpit-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid #38383A;
}
.cockpit-stat-row:last-child { border-bottom: none; }
.cockpit-stat-label { font-size: 13px; color: #EBEBF5; }
.cockpit-stat-val { font-size: 15px; font-weight: 700; }
.cockpit-stat-val.green { color: #30D158; }
.cockpit-stat-val.yellow { color: #FFD60A; }
.cockpit-stat-val.red { color: #FF453A; }

.cockpit-kpi-row {
  background: #2C2C2E; border-radius: 10px; padding: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.cockpit-kpi-role { font-size: 11px; font-weight: 700; color: #636366; letter-spacing: .5px; }
.cockpit-kpi-bar-wrap { height: 6px; background: #38383A; border-radius: 3px; overflow: hidden; }
.cockpit-kpi-bar-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }
.cockpit-kpi-nums { font-size: 12px; color: #8E8E93; display: flex; justify-content: space-between; }

.cockpit-alert-card {
  background: #2C2C2E; border-radius: 10px; padding: 12px;
  border-left: 4px solid #FF453A;
}
.cockpit-alert-card.warn { border-left-color: #FFD60A; }
.cockpit-alert-card.info { border-left-color: #0A84FF; }
.cockpit-alert-title { font-size: 12px; font-weight: 700; color: #EBEBF5; margin-bottom: 6px; }
.cockpit-alert-body { font-size: 12px; color: #8E8E93; }

.cockpit-inv-chip {
  background: #2C2C2E; border-radius: 10px; padding: 10px 14px;
  min-width: 80px; text-align: center;
}
.cockpit-inv-label { font-size: 10px; color: #636366; font-weight: 600; letter-spacing: .4px; }
.cockpit-inv-count { font-size: 22px; font-weight: 800; color: #FFFFFF; }
.cockpit-inv-cost { font-size: 10px; color: #8E8E93; }

.cockpit-inactive-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #38383A; border-radius: 8px; padding: 5px 10px;
  font-size: 12px; color: #FF453A; margin: 3px;
}

/* ── Phase 1-6 new pages ─────────────────────────────────────────── */
.field-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #C6C6C8;
  font-size: 15px;
  font-family: var(--font);
  background: #FFFFFF;
  box-sizing: border-box;
  -webkit-appearance: none;
}
.field-input:focus {
  outline: none;
  border-color: #007AFF;
}
select.field-input { cursor: pointer; }
textarea.field-input { resize: vertical; min-height: 60px; }

/* ── PATCH A.3: Selfie modal & device badge ─────────────────── */
#_selfie-modal video { max-height: 260px; }
#_selfie-modal button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#_device-trust-badge { font-size: 12px; padding: 4px 10px; border-radius: 20px; margin-top: 8px; display: inline-block; transition: all .3s; }
#_device-approval-panel, #_checkin-anomaly-panel { min-height: 36px; }

/* ── SIMPLIFY UX: WiFi + Device status card ──────────────────── */
#wifi-device-status-card { margin-bottom: 0; }
#wifi-device-status-card button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: opacity .15s;
}
#wifi-device-status-card button:active { opacity: .75; }
#wifi-device-status-card button:disabled { opacity: .45; pointer-events: none; }

/* SSID chip buttons */
[id^='_ssid-chip-'] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

/* Owner cockpit onboarding panels */
#_owner-onboarding-cockpit img {
  object-fit: cover;
}
#_owner-onboarding-cockpit button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  cursor: pointer;
}

/* ── Attendance History v2 ── */
.att-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #2C2C2E;
  transition: background .15s;
}
.att-history-item:active { background: #2C2C2E; }
.att-history-item:last-child { border-bottom: none; }

.att-history-status.late {
  color: #FF9500;
  font-size: 12px;
  font-weight: 600;
}
.att-history-status.present {
  color: #30D158;
  font-size: 12px;
  font-weight: 600;
}
.att-history-status.absent {
  color: #FF3B30;
  font-size: 12px;
  font-weight: 600;
}

/* week-day clickable */
.week-day { cursor: pointer; }
.week-day:active .week-day-dot { opacity: .7; }

/* owner att board card */
#_owner-att-board-card {
  margin: 0 16px 12px;
}

/* Date modal backdrop anim */
#_date-att-modal {
  animation: fadeInBd .15s ease;
}
#_date-att-sheet {
  animation: slideUp .2s cubic-bezier(.32,1.25,.6,1);
}
@keyframes fadeInBd { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp  { from { transform:translateY(60px);opacity:0 } to { transform:none;opacity:1 } }

/* ── Market Intelligence ── */
#_mkt-stats { padding: 0 16px; }
#_mkt-results { padding: 0 16px 16px; }

#_mkt-stats .mkt-stat-cell {
  background: #2C2C2E;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

/* Listing cards dark mode */
#_mkt-results > div {
  cursor: default;
}

/* FB config modal slide-up */
#_fb-config-modal {
  animation: fadeInBd .15s ease;
}
#_fb-config-sheet {
  animation: slideUp .2s cubic-bezier(.32,1.25,.6,1);
}

/* Pricing page dark sections */
#page-pricing #_mkt-stats,
#page-pricing #_mkt-results {
  background: transparent;
}

/* ── FB Cookie Wizard v3 ─────────────────────────────────────── */
#_fb-wiz-modal {
  animation: fadeIn .15s ease;
}
#_fb-wiz-sheet {
  animation: slideUp .25s cubic-bezier(.32,1,.5,1);
}
#_fb-wiz-sheet textarea {
  outline: none;
  transition: border-color .2s;
}
#_fb-wiz-sheet textarea:focus {
  border-color: #007AFF !important;
}
#_fb-wiz-sheet button {
  transition: opacity .15s, transform .1s;
}
#_fb-wiz-sheet button:active {
  transform: scale(.97);
}
#_fb-wiz-sheet button:disabled {
  opacity: .5;
  cursor: not-allowed;
}
/* Step icon bounce */
@keyframes stepIconBounce {
  0%   { transform: scale(.8); opacity:.5; }
  60%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity:1; }
}
#_fb-wiz-sheet .step-icon {
  animation: stepIconBounce .3s ease forwards;
}


/* ═══════════════════════════════════════════════════════════════════
   MARKET WATCHLIST MATRIX UI — v1
   ═══════════════════════════════════════════════════════════════════ */

/* Main tab bar */
#_wl-tab-bar {
  display: flex;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
._wl-main-tab {
  flex: 1;
  background: #2C2C2E;
  border: none;
  color: #8E8E93;
  border-radius: 10px;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
._wl-main-tab-active {
  background: #0A84FF;
  color: #fff;
}

/* Brand tabs */
#_wl-brand-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 0;
}
._wl-brand-btn {
  flex: 1;
  background: #2C2C2E;
  border: none;
  color: #8E8E93;
  border-radius: 8px;
  padding: 7px 0;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
._wl-brand-active {
  background: #1C1C1E;
  color: #fff;
  border: 1px solid #3A3A3C;
}

/* Stats bar */
#_wl-stats-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 14px 0 10px;
  font-size: 12px;
}
._wl-stat { color: #8E8E93; }
._wl-stat-sep { color: #3A3A3C; }

/* Generation pills */
#_wl-gen-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 14px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#_wl-gen-pills::-webkit-scrollbar { display: none; }
._wl-gen-pill {
  background: #2C2C2E;
  border: none;
  color: #8E8E93;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
._wl-gen-pill-active {
  background: #0A84FF;
  color: #fff;
}

/* Generation section */
._wl-gen-section {
  margin-bottom: 24px;
}
._wl-gen-title {
  font-size: 13px;
  font-weight: 700;
  color: #8E8E93;
  letter-spacing: .3px;
  margin-bottom: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Model block */
._wl-model-block {
  background: #1C1C1E;
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
._wl-model-no-data {
  opacity: .6;
}
._wl-model-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
}
._wl-model-name {
  font-size: 14px;
  font-weight: 600;
  color: #F2F2F7;
}
._wl-model-trend {
  font-size: 18px;
  line-height: 1;
}
._wl-no-data-badge {
  font-size: 10px;
  color: #8E8E93;
  background: #2C2C2E;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Matrix table */
._wl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
._wl-th {
  padding: 5px 8px;
  text-align: center;
  color: #8E8E93;
  font-weight: 500;
  font-size: 11px;
  background: #2C2C2E;
  letter-spacing: .2px;
}
._wl-th-storage {
  width: 50px;
  text-align: left;
}
._wl-storage-lbl {
  padding: 8px 8px 8px 14px;
  color: #8E8E93;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border-top: 1px solid rgba(255,255,255,0.05);
}
._wl-cell {
  padding: 7px 8px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.05);
  border-left: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
  transition: background .15s;
}
._wl-cell-empty {
  color: #3A3A3C;
}
._wl-price {
  font-size: 13px;
  font-weight: 700;
  color: #F2F2F7;
  line-height: 1.2;
}
._wl-trend {
  font-size: 11px;
  margin-top: 2px;
  line-height: 1;
}
._wl-pct {
  font-size: 9px;
  margin-left: 1px;
  vertical-align: middle;
}
._wl-cnt {
  font-size: 9px;
  color: #636366;
  margin-top: 2px;
}
._wl-no-data {
  color: #3A3A3C;
  font-size: 14px;
}


/* ── Watchlist Trust Engine v2 ─────────────────────────────────── */

/* Weak / insufficient cell */
._wl-cell-weak {
  padding: 7px 8px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.05);
  border-left: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
._wl-weak-msg {
  font-size: 10px;
  color: #48484A;
  font-style: italic;
}

/* Confidence-level cell background borders */
._wl-cell-high   { border-left: 2px solid rgba(52,199,89,0.3) !important; }
._wl-cell-medium { border-left: 2px solid rgba(255,159,10,0.3) !important; }
._wl-cell-low    { border-left: 2px solid rgba(255,69,58,0.3) !important; }

/* Cell top badge row */
._wl-cell-top {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 2px;
  min-height: 14px;
}

/* Confidence badge */
._wl-conf {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.4;
}
._wl-conf-h { background: rgba(52,199,89,0.18);  color: #34C759; }
._wl-conf-m { background: rgba(255,159,10,0.18); color: #FF9F0A; }
._wl-conf-l { background: rgba(255,69,58,0.15);  color: #FF453A; }

/* Liquidity dot */
._wl-liq-h { color: #34C759; font-size: 8px; margin-left: 2px; }

/* Dimmed price for low confidence */
._wl-price-dim { color: #8E8E93 !important; }

/* Fast-sale … safe-sell spread */
._wl-spread {
  font-size: 9px;
  color: #8E8E93;
  margin-top: 1px;
  line-height: 1.2;
}
._wl-fs    { color: #FF9F0A; }   /* fast sale  = buy cheap */
._wl-spsep { color: #48484A; margin: 0 1px; }
._wl-ss    { color: #34C759; }   /* safe sell  = sell confident */

/* Seller count */
._wl-sellers {
  font-size: 9px;
  color: #636366;
  margin-top: 1px;
}

/* Volatility warning */
._wl-vol {
  font-size: 9px;
  color: #FF9F0A;
  margin-top: 1px;
}

/* Low confidence warning */
._wl-low-w {
  font-size: 9px;
  color: #FF453A;
  margin-top: 1px;
}

/* Trust stats bar */
._wl-trust-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px;
  background: #1C1C1E;
  border-radius: 8px;
  margin-bottom: 6px;
}
._wl-tstat {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
._wl-ts-h { color: #34C759; }
._wl-ts-m { color: #FF9F0A; }
._wl-ts-l { color: #FF453A; }
._wl-ts-i { color: #48484A; }
._wl-ts-e { color: #3A3A3C; }

/* Wrap */
#_wl-wrap { padding-bottom: 40px; }
#_wl-sections { margin-top: 4px; }
