:root {
  --bg: #0a0f1e;
  --bg2: #0d1428;
  --bg3: #111b35;
  --card: #121d36;
  --border: #1e2d50;
  --accent: #06b6d4;
  --accent2: #0891b2;
  --accent-dim: rgba(6,182,212,0.12);
  --red: #ef4444;
  --red-bright: #ff2d2d;
  --red-dim: rgba(239,68,68,0.15);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251,191,36,0.12);
  --green: #22c55e;
  --text: #e2eeff;
  --text2: #6b8cbc;
  --text3: #334f7a;
  --white: #ffffff;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* Force proper mobile scaling on Android Chrome PWAs that ignore viewport meta */
@viewport { width: device-width; zoom: 1; }
@-ms-viewport { width: device-width; }

html, body {
  height: 100%; width: 100%; overflow: hidden;
  max-width: 100vw;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ── SCREENS ── */
.screen { position: fixed; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ── LOGIN ── */
.login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(6,182,212,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(8,145,178,0.06) 0%, transparent 50%), var(--bg);
}
.login-wrap {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; padding: 24px; gap: 28px;
}
.login-logo { display: flex; align-items: center; gap: 14px; }
.logo-mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--accent); color: #0a0f1e;
  font-family: var(--font-display); font-size: 26px;
  display: flex; align-items: center; justify-content: center; letter-spacing: 1px;
}
.logo-text { display: flex; flex-direction: column; }
.logo-title { font-family: var(--font-display); font-size: 22px; letter-spacing: 2px; color: var(--text); }
.logo-sub { font-size: 12px; color: var(--text2); letter-spacing: 3px; text-transform: uppercase; }

.login-step { width: 100%; max-width: 360px; display: none; flex-direction: column; align-items: center; gap: 18px; }
.login-step.active { display: flex; }
.login-prompt { font-size: 17px; font-weight: 500; color: var(--text); text-align: center; line-height: 1.5; }

.contractor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.contractor-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px 12px;
  text-align: center; cursor: pointer; transition: all 0.15s;
  font-weight: 600; font-size: 15px; color: var(--text);
}
.contractor-card:active { background: var(--accent-dim); border-color: var(--accent); transform: scale(0.97); }

.pin-display { display: flex; gap: 16px; margin: 4px 0; }
.pin-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--border); transition: background 0.1s; }
.pin-dot.filled { background: var(--accent); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 280px; }
.pin-btn {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  font-family: var(--font-display); font-size: 28px; color: var(--text);
  cursor: pointer; transition: all 0.1s;
}
.pin-btn:active { background: var(--accent-dim); border-color: var(--accent); transform: scale(0.95); }
.pin-clear, .pin-back { font-size: 20px; }
.pin-error { color: var(--red); font-size: 14px; min-height: 20px; }

/* Restoring-session splash — shown INSTEAD of the tappable name list when a
   restorable 60-day session exists, until the restore resolves (ghost-tap fix). */
.restore-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: restoreSpin 0.8s linear infinite;
}
@keyframes restoreSpin { to { transform: rotate(360deg); } }

/* Transition tap-guard: while appScreen carries .clock-guard (600ms after a
   login→app swap), clock buttons can't receive taps at all. Belt half of the
   belt-and-suspenders pair with the Date.now() check inside toggleClock. */
.clock-guard .clock-btn { pointer-events: none; }

/* ── APP HEADER ── */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  /* iOS notch/Dynamic Island: header owns the top inset (viewport-fit=cover);
     left/right insets cover Safari landscape (PWA manifest locks portrait). */
  padding: calc(10px + env(safe-area-inset-top, 0px))
           calc(14px + env(safe-area-inset-right, 0px))
           10px
           calc(14px + env(safe-area-inset-left, 0px));
  background: var(--bg2);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  gap: 8px;
}
.header-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.header-logo {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent); color: #0a0f1e;
  font-family: var(--font-display); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.header-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-date { font-size: 11px; color: var(--text2); white-space: nowrap; }
.logout-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text2); border-radius: 6px; padding: 4px 10px;
  font-size: 12px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}

/* ── TAB BAR ── */
.tab-bar { display: flex; background: var(--bg2); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 8px 4px;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text3); font-family: var(--font-body); font-size: 10px;
  font-weight: 500; cursor: pointer; transition: all 0.15s; letter-spacing: 0.5px;
}
.tab-btn .tab-icon { font-size: 18px; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── TAB CONTENT ── */
.tab-content { display: none; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tab-content.active { display: block; }

/* ── CLOCK TAB ── */
.clock-wrap { padding: 14px; display: flex; flex-direction: column; gap: 14px; }

.property-banner {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.property-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; flex-shrink: 0; }
.property-name { font-weight: 600; font-size: 14px; flex: 1; }
.property-unit { font-size: 11px; color: var(--accent); margin-top: 1px; }
.change-prop-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text2); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}

.live-timer { text-align: center; padding: 6px 0; }
.timer-type { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 2px; }
.timer-display { font-family: var(--font-display); font-size: 52px; letter-spacing: 4px; color: var(--accent); line-height: 1; }

/* ── CLOCK BUTTONS ── */
.clock-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.clock-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 20px 8px;
  background: var(--white); border: 2px solid rgba(255,255,255,0.15);
  border-radius: var(--radius); cursor: pointer;
  transition: all 0.2s ease; position: relative; overflow: hidden;
}
.clock-btn-icon { font-size: 26px; }
.clock-btn-label { font-family: var(--font-display); font-size: 17px; letter-spacing: 1.5px; color: #0a0f1e; }
.clock-btn-status { font-size: 8px; letter-spacing: 1px; text-transform: uppercase; color: rgba(10,15,30,0.45); }
.clock-btn.active {
  background: var(--red-bright); border-color: var(--red-bright);
  box-shadow: 0 0 20px rgba(255,45,45,0.4); transform: scale(1.02);
}
.clock-btn.active .clock-btn-label { color: #fff; }
.clock-btn.active .clock-btn-status { color: rgba(255,255,255,0.8); }
.clock-btn.active .clock-btn-icon { filter: brightness(0) invert(1); }
.clock-btn:active { transform: scale(0.97); }

/* Drive GPS status */
.drive-gps-status {
  background: rgba(251,191,36,0.1); border: 1px solid var(--yellow);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 12px; color: var(--yellow); text-align: center;
  display: none;
}
.drive-gps-status.visible { display: block; }

/* Geofence punch reminder (foreground-only). Hidden until fired. */
.geofence-reminder {
  display: none; align-items: center; gap: 10px;
  background: rgba(251,191,36,0.12); border: 1px solid var(--yellow);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 8px;
}
.geofence-reminder.visible { display: flex; }
.geofence-reminder-icon { font-size: 16px; flex-shrink: 0; }
.geofence-reminder-text { flex: 1; font-size: 13px; color: var(--yellow); line-height: 1.3; }
.geofence-reminder-dismiss {
  flex-shrink: 0; background: transparent; border: none; color: var(--yellow);
  font-size: 15px; cursor: pointer; padding: 2px 6px; opacity: 0.8;
}
.geofence-reminder-dismiss:hover { opacity: 1; }

.quick-note-input {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text); font-family: var(--font-body); font-size: 14px;
}
.quick-note-input::placeholder { color: var(--text3); }
.quick-note-input:focus { outline: none; border-color: var(--accent); }

.sessions-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.sessions-header span { font-size: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.add-manual-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--accent); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.sessions-list { display: flex; flex-direction: column; gap: 8px; }
.session-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.session-item:active { border-color: var(--accent); }
.session-type-badge {
  font-size: 9px; font-weight: 600; letter-spacing: 1px;
  padding: 3px 7px; border-radius: 20px; text-transform: uppercase; flex-shrink: 0;
}
.badge-jobsite { background: var(--accent-dim); color: var(--accent); }
.badge-drive { background: var(--yellow-dim); color: var(--yellow); }
.badge-shop { background: rgba(34,197,94,0.12); color: var(--green); }
.session-info { flex: 1; min-width: 0; }
.session-prop { font-size: 13px; font-weight: 600; }
.session-route { font-size: 11px; color: var(--yellow); }
.session-unit { font-size: 11px; color: var(--accent); }
.session-time { font-size: 11px; color: var(--text2); font-family: var(--font-mono); }
.session-dur { font-family: var(--font-mono); font-size: 13px; color: var(--accent); flex-shrink: 0; }
.session-active-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red-bright); animation: pulse 1.5s infinite; flex-shrink: 0; }
.session-pending-badge { font-size: 10px; font-weight: 600; color: var(--yellow); flex-shrink: 0; white-space: nowrap; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.3} }

/* ── NOTES TAB ── */
.notes-wrap { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.notes-header { display: flex; gap: 8px; align-items: center; }
.notes-filter {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  color: var(--text); font-family: var(--font-body); font-size: 13px;
}
.add-note-btn {
  background: var(--accent); color: #0a0f1e; border: none;
  border-radius: var(--radius-sm); padding: 9px 14px;
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.notes-search-row { display: flex; align-items: center; gap: 10px; }
.notes-search-input {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  color: var(--text); font-family: var(--font-body); font-size: 13px;
}
.notes-search-input::placeholder { color: var(--text3); }
.notes-search-input:focus { outline: none; border-color: var(--accent); }
.show-archived-label { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text2); cursor: pointer; white-space: nowrap; }

/* Archived-view toggle button (replaces the old "Archived" checkbox) */
.archived-toggle-btn {
  background: var(--card); border: 1px solid var(--border); color: var(--text2);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.archived-toggle-btn:hover { border-color: var(--accent); color: var(--text); }
.archived-toggle-btn.active {
  background: var(--accent); color: #0a0f1e; border-color: var(--accent);
}

/* Archived note card footer bar (when-archived + Unarchive) */
.note-archived-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border);
}
.note-archived-when { font-size: 10px; color: var(--text3); }
.note-unarchive-btn {
  background: var(--accent); color: #0a0f1e; border: none;
  border-radius: var(--radius-sm); padding: 5px 10px;
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.note-unarchive-btn:hover { opacity: 0.9; }

.notes-section-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 1.5px; padding: 2px 0; }
.notes-list { display: flex; flex-direction: column; gap: 10px; }

/* Note card styles in Google Keep section below */



/* Archived checklist items */
.archived-section { padding: 4px 14px 8px; }
.archived-toggle-btn {
  background: transparent; border: none; color: var(--text3);
  font-size: 11px; cursor: pointer; padding: 2px 0; text-decoration: underline;
}
.archived-items { display: none; flex-direction: column; gap: 4px; margin-top: 6px; }
.archived-items.open { display: flex; }

/* Inline add checklist item */
.note-card-add-item {
  display: flex; gap: 6px; padding: 6px 14px 10px; align-items: center;
}
.note-card-add-input {
  flex: 1; background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 13px; padding: 4px 2px;
  font-family: var(--font-body);
}
.note-card-add-input::placeholder { color: var(--text3); }
.note-card-add-input:focus { outline: none; border-bottom-color: var(--accent); }
.note-card-add-btn {
  background: transparent; border: none; color: var(--accent);
  font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1;
}

/* Note photos */
.note-photos { display: flex; gap: 8px; padding: 0 14px 12px; flex-wrap: wrap; }
.note-photo { width: 68px; height: 68px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.note-card-add-photo {
  width: 68px; height: 68px; border: 1.5px dashed var(--border);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text3); font-size: 22px;
}

/* ── WISH LIST TAB ── */
.wishlist-wrap { padding: 14px; display: flex; flex-direction: column; gap: 18px; }
.wish-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.wish-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.wish-section-title { font-family: var(--font-display); font-size: 20px; letter-spacing: 1px; }
.wish-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.votes-left { font-size: 12px; color: var(--yellow); font-weight: 600; }
.winner-badge { background: var(--accent); color: #0a0f1e; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.winner-badge.hidden { display: none; }
.wish-reset-info { font-size: 11px; color: var(--text3); }
.friday-countdown { font-size: 12px; color: var(--yellow); margin-bottom: 10px; }
.wish-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.wish-item { display: flex; align-items: center; gap: 8px; background: var(--bg3); border-radius: var(--radius-sm); padding: 10px 12px; }
.wish-item-name { flex: 1; font-size: 14px; }
.wish-vote-btn {
  display: flex; align-items: center; gap: 5px;
  background: transparent; border: 1.5px solid var(--border);
  border-radius: 20px; padding: 4px 10px;
  color: var(--text2); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.wish-vote-btn.voted { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.wish-vote-btn:active { transform: scale(0.95); }
.wish-winner-item { border: 1.5px solid var(--accent); }
.wish-delete-btn { background: transparent; border: none; color: var(--text3); font-size: 15px; cursor: pointer; padding: 0 2px; flex-shrink: 0; }
.wish-delete-btn:hover { color: var(--red); }
.wish-add-row { display: flex; gap: 8px; }
.wish-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  color: var(--text); font-family: var(--font-body); font-size: 14px;
}
.wish-input:focus { outline: none; border-color: var(--accent); }
.wish-add-btn { background: var(--accent); color: #0a0f1e; border: none; border-radius: var(--radius-sm); padding: 9px 14px; font-weight: 700; cursor: pointer; }

/* Suggestion box (submit-only, no list in the worker app) */
.suggestion-copy { font-size: 12px; color: var(--text2); margin-bottom: 10px; }
.wish-suggestion-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text);
  font-family: var(--font-body); font-size: 14px; resize: vertical; min-height: 72px;
}
.wish-suggestion-input::placeholder { color: var(--text3); }
.wish-suggestion-input:focus { outline: none; border-color: var(--accent); }
.suggestion-name-label {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--text2); cursor: pointer; margin: 8px 0;
}
.suggestion-submit-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.suggestion-thanks { font-size: 13px; color: var(--accent); font-weight: 600; }

/* ── MY PAY TAB ── */
.mypay-wrap { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.pay-period-selector {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px;
}
.period-nav { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 4px 12px; font-size: 18px; cursor: pointer; }
.period-label { font-weight: 600; font-size: 14px; }
.pay-summary-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
}
.pay-stat { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.pay-stat-label { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.pay-stat-value { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; }
.pay-stat.highlight .pay-stat-value { color: var(--accent); }
.pay-breakdown { display: flex; flex-direction: column; gap: 8px; }
.pay-row {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.pay-row-prop { font-size: 13px; font-weight: 600; }
.pay-row-detail { font-size: 12px; color: var(--text2); margin-top: 2px; }
.pay-row-amount { font-family: var(--font-mono); font-size: 14px; color: var(--accent); }

/* ── MODALS ── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-box {
  position: relative; z-index: 1; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
  /* bottom sheets sit flush with the screen edge — pad past the home indicator */
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  width: 100%; max-width: 480px;
  max-height: 88vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from{transform:translateY(30px);opacity:0}to{transform:translateY(0);opacity:1} }
.modal-title { font-family: var(--font-display); font-size: 22px; letter-spacing: 2px; color: var(--accent); }
.modal-input, .modal-select, .modal-textarea {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px;
  color: var(--text); font-family: var(--font-body); font-size: 14px;
}
.modal-input:focus, .modal-select:focus, .modal-textarea:focus { outline: none; border-color: var(--accent); }
.modal-textarea { resize: vertical; min-height: 80px; }
.modal-label { font-size: 12px; color: var(--text2); margin-bottom: -6px; }
.modal-actions { display: flex; gap: 8px; margin-top: 4px; }
.modal-cancel { flex: 1; background: transparent; border: 1px solid var(--border); color: var(--text2); border-radius: var(--radius-sm); padding: 12px; font-size: 14px; cursor: pointer; }
.modal-save { flex: 2; background: var(--accent); border: none; color: #0a0f1e; border-radius: var(--radius-sm); padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
.modal-delete { flex: 1; background: var(--red-dim); border: 1px solid var(--red); color: var(--red); border-radius: var(--radius-sm); padding: 12px; font-size: 14px; cursor: pointer; }

/* Property picker */
.prop-search { margin-bottom: 4px; }
/* Tappable property field (button styled like a select) that opens the picker */
.prop-select-btn { text-align: left; cursor: pointer; color: var(--text2); }
.prop-select-btn.has-value { color: var(--text); }
/* The picker opens on top of other modals (z 100) and the material detail
   overlay (z 200). The add-property modal must in turn stack above the picker
   — it is later in the DOM, so an equal z-index keeps that ordering. */
#propertyModal, #addPropertyModal { z-index: 300; }
/* Add Stock opens FROM INSIDE the material detail sheet (.mat-detail-overlay,
   z 200), so as a plain .modal (z 100) it rendered behind that sheet's
   full-screen backdrop and the button looked dead. Same lift as the picker. */
#addStockModal { z-index: 300; }
.gps-suggestion { background: rgba(6,182,212,0.1); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; }
.gps-suggestion.hidden { display: none; }
.property-picker-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; }
.prop-picker-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 14px; cursor: pointer; font-size: 14px; font-weight: 500; }
.prop-picker-item:active { border-color: var(--accent); background: var(--accent-dim); }
.prop-picker-item .prop-address { font-size: 11px; color: var(--text2); margin-top: 2px; }
.prop-picker-item.current-prop { border-color: var(--accent); }

/* Unobtrusive "+ Add a new property" affordance (property picker + manual entry) */
.add-property-link {
  background: transparent; border: 1px dashed var(--border); color: var(--accent);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; font-weight: 600;
  cursor: pointer; width: 100%; font-family: var(--font-body);
}
.add-property-link:hover { border-color: var(--accent); background: var(--accent-dim); }

/* Unit picker */
.unit-picker-list { display: flex; flex-direction: column; gap: 8px; }
.unit-picker-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; font-size: 14px; font-weight: 500; }
.unit-picker-item:active { border-color: var(--accent); background: var(--accent-dim); }

/* Note editor modal */
.checklist-section { display: flex; flex-direction: column; gap: 8px; }
.checklist-header { font-size: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.checklist-edit-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checklist-edit-row button { background: transparent; border: none; color: var(--red); font-size: 16px; cursor: pointer; padding: 0 4px; }
.checklist-add-row { display: flex; gap: 8px; }
.checklist-add-btn { background: var(--accent); color: #0a0f1e; border: none; border-radius: var(--radius-sm); padding: 10px 16px; font-size: 18px; font-weight: 700; cursor: pointer; }
.photo-section { display: flex; flex-direction: column; gap: 8px; }
.photo-header { font-size: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.photo-preview-list { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-preview-img { width: 68px; height: 68px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.photo-upload-btn { display: inline-block; background: var(--card); border: 1.5px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 16px; color: var(--text2); font-size: 13px; cursor: pointer; }

/* Spin wheel */
.spin-modal-box { align-items: center; }
.spin-subtitle { font-size: 13px; color: var(--text2); text-align: center; }
#spinWheel { border-radius: 50%; }
.spin-btn { background: var(--accent); color: #0a0f1e; border: none; border-radius: var(--radius-sm); padding: 14px 32px; font-family: var(--font-display); font-size: 22px; letter-spacing: 2px; cursor: pointer; width: 100%; }
.spin-result { background: var(--accent-dim); border: 1.5px solid var(--accent); border-radius: var(--radius-sm); padding: 14px; text-align: center; font-size: 18px; font-weight: 700; color: var(--accent); }
.spin-result.hidden { display: none; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
select option { background: #0d1428; }

/* Color dots */
.color-dot.selected { outline: 3px solid var(--text); outline-offset: 2px; }

/* Today's property totals */
.sessions-totals { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.sessions-totals-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.sessions-total-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }
/* Build: 1775765740 */
/* Build: 1776089261 */

/* ── GOOGLE KEEP STYLE NOTES ── */
.notes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.notes-grid .note-card { break-inside: avoid; }

.note-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
  background: var(--card);
}
.note-card.colored { border-color: transparent; }
.note-card:active { transform: scale(0.98); }
.note-card.expanded {
  grid-column: 1 / -1;
  cursor: default;
}
.note-card.dragging { opacity: 0.5; transform: scale(0.97); }
.note-card.drag-over { box-shadow: 0 0 0 2px var(--accent); }

.note-card-body { padding: 10px 12px; }
.note-card-title {
  font-weight: 600; font-size: 14px;
  margin-bottom: 4px; color: inherit;
}
.note-card-preview {
  font-size: 12px; color: rgba(255,255,255,0.6);
  line-height: 1.4; max-height: 60px; overflow: hidden;
}
.note-card.colored .note-card-preview { color: rgba(0,0,0,0.55); }

/* Checklist in collapsed card */
.note-checklist-preview { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.note-checklist-preview-item {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: rgba(255,255,255,0.7);
}
.note-checklist-preview-item.done { text-decoration: line-through; opacity: 0.5; }
.note-checklist-preview-item input { accent-color: var(--accent); width: 13px; height: 13px; }

/* Expanded note */
.note-expanded-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.note-expanded-box {
  background: var(--card); border-radius: var(--radius);
  width: 100%; max-width: 480px; max-height: 88vh;
  overflow-y: auto; display: flex; flex-direction: column;
  animation: popIn 0.2s ease;
}
@keyframes popIn { from{opacity:0;transform:scale(0.95)} to{opacity:1;transform:scale(1)} }
.note-expanded-box.colored { }

.note-exp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 6px;
}
.note-exp-title-input {
  font-size: 17px; font-weight: 700; background: transparent;
  border: none; color: inherit; width: 100%; outline: none;
  font-family: var(--font-body);
}
.note-exp-close {
  background: transparent; border: none; color: inherit;
  font-size: 20px; cursor: pointer; padding: 4px; opacity: 0.7;
  flex-shrink: 0;
}

.note-exp-text {
  margin: 0 16px 8px;
  background: transparent; border: none; color: inherit;
  font-family: var(--font-body); font-size: 14px; line-height: 1.5;
  resize: none; outline: none; width: calc(100% - 32px);
  min-height: 40px;
}

/* Expanded checklist */
.note-exp-checklist { padding: 0 12px 8px; display: flex; flex-direction: column; gap: 2px; }

.checklist-item-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px; border-radius: 6px;
  cursor: grab; position: relative;
  transition: background 0.1s;
}
.checklist-item-wrap:hover { background: rgba(255,255,255,0.06); }
.checklist-item-wrap.editing { background: rgba(255,255,255,0.08); }
.checklist-item-wrap.dragging-item { opacity: 0.4; }
.checklist-item-wrap.drag-target { border-top: 2px solid var(--accent); }

.drag-handle {
  color: rgba(255,255,255,0.2); font-size: 14px; cursor: grab;
  flex-shrink: 0; user-select: none; touch-action: none;
}
.checklist-item-wrap:hover .drag-handle { color: rgba(255,255,255,0.5); }

.item-checkbox { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }

.item-text-display {
  flex: 1; font-size: 14px; cursor: text; word-break: break-word;
  color: inherit;
}
.item-text-display.done { text-decoration: line-through; opacity: 0.45; }

.item-text-edit {
  flex: 1; font-size: 14px; background: transparent; border: none;
  border-bottom: 1px solid var(--accent); color: inherit;
  font-family: var(--font-body); outline: none; padding: 0;
}

.item-actions {
  display: none; gap: 4px; flex-shrink: 0;
}
.checklist-item-wrap.editing .item-actions,
.checklist-item-wrap:hover .item-actions { display: flex; }

.item-action-btn {
  background: transparent; border: none; color: inherit;
  opacity: 0.5; cursor: pointer; font-size: 13px; padding: 2px 4px;
  border-radius: 4px;
}
.item-action-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }

/* Insert above/below */
.insert-btn {
  display: none; align-items: center; gap: 4px;
  padding: 2px 8px; font-size: 11px; color: var(--accent);
  background: transparent; border: none; cursor: pointer; opacity: 0.7;
}
.checklist-item-wrap:hover ~ .insert-btn,
.checklist-item-wrap:hover .insert-btn { display: flex; }
.insert-line {
  display: none; height: 1px; background: var(--accent);
  margin: 0 8px; opacity: 0;
  transition: opacity 0.15s;
}
.checklist-item-wrap:hover + .insert-line { display: block; opacity: 0.4; }

/* Add new item row */
.note-exp-add-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px 10px;
}
.note-exp-add-input {
  flex: 1; background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: inherit; font-family: var(--font-body); font-size: 14px;
  padding: 4px 2px; outline: none;
}
.note-exp-add-input:focus { border-bottom-color: var(--accent); }
.note-exp-add-input::placeholder { color: rgba(255,255,255,0.3); }

/* Archived section in expanded */
.note-exp-archived { padding: 4px 16px 8px; }
.note-exp-archived-toggle {
  font-size: 11px; color: rgba(255,255,255,0.4); cursor: pointer;
  background: transparent; border: none; text-decoration: underline;
}

/* Bottom toolbar */
.note-exp-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-top: 1px solid rgba(255,255,255,0.1);
  flex-wrap: wrap; gap: 8px;
}
.note-exp-colors { display: flex; gap: 6px; align-items: center; }
.note-exp-color-dot {
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform 0.1s;
  flex-shrink: 0;
}
.note-exp-color-dot:hover { transform: scale(1.2); }
.note-exp-color-dot.selected { border-color: #fff; }
.note-exp-color-dot.none { background: var(--bg3); border-color: var(--border); }

.note-exp-actions { display: flex; gap: 8px; align-items: center; }
.note-exp-action {
  background: transparent; border: none; color: inherit; opacity: 0.6;
  font-size: 18px; cursor: pointer; padding: 8px 10px; border-radius: 6px;
}
.note-exp-action:hover { opacity: 1; background: rgba(255,255,255,0.1); }
/* Fat-finger guard: pull the destructive Delete well clear of Archive so the two
   are hard to mistap for each other. Divider reinforces the separation. */
.note-exp-action.danger {
  margin-left: 22px; position: relative;
}
.note-exp-action.danger::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  height: 20px; width: 1px; background: rgba(255,255,255,0.15);
}

/* Non-blocking write-error toast (showWriteError) */
.sh-write-toast {
  position: fixed; left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)); /* clear the iOS home indicator */
  transform: translateX(-50%) translateY(20px);
  background: #b91c1c; color: #fff; padding: 11px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; line-height: 1.3; z-index: 99999;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45); max-width: 90vw; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.sh-write-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* Success variant — same geometry as the error toast so confirmations and
   failures land in the same place, just a different colour. */
.sh-write-toast.ok { background: #15803d; }

/* Work-order link picker */
.wo-link-list { max-height: 46vh; overflow-y: auto; margin: 4px 0 8px; }
.wo-link-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg3, rgba(255,255,255,0.04)); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; color: inherit;
}
.wo-link-row:active { opacity: 0.7; }
.wo-link-row.selected { border-color: var(--accent, #22d3ee); }
.wo-link-title { font-size: 14px; font-weight: 600; line-height: 1.25; }
.wo-link-meta { font-size: 11px; color: var(--text3, rgba(255,255,255,0.5)); margin-top: 3px; }
.wo-link-urgent {
  display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  background: #b91c1c; color: #fff; border-radius: 4px; padding: 1px 5px; margin-right: 6px;
  vertical-align: middle;
}
.wo-link-empty { color: var(--text3, rgba(255,255,255,0.5)); font-size: 13px; text-align: center; padding: 18px; }

/* Note card footer */
.note-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px 6px;
}
.note-card-prop-badge {
  font-size: 9px; color: rgba(255,255,255,0.5); text-transform: uppercase;
  letter-spacing: 0.5px; max-width: 80%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.note-card.colored .note-card-prop-badge { color: rgba(0,0,0,0.4); }
.note-pin-indicator { font-size: 11px; opacity: 0.7; }

/* Color tints for note cards */
.note-color-cyan { background: rgba(6,182,212,0.25) !important; color: #e2eeff; }
.note-color-green { background: rgba(74,222,128,0.25) !important; color: #e2eeff; }
.note-color-red { background: rgba(248,113,113,0.25) !important; color: #e2eeff; }
.note-color-yellow { background: rgba(251,191,36,0.25) !important; color: #e2eeff; }
.note-color-purple { background: rgba(167,139,250,0.25) !important; color: #e2eeff; }
.note-color-orange { background: rgba(251,146,60,0.25) !important; color: #e2eeff; }
.note-color-pink { background: rgba(232,121,249,0.25) !important; color: #e2eeff; }

/* Color map */
.note-color-none { background: var(--card) !important; }

/* ── RESPONSIVE FIXES ── */
/* Single column notes on very small screens */
@media (max-width: 360px) {
  .notes-grid { grid-template-columns: 1fr; }
  .clock-buttons { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .clock-btn { padding: 16px 6px; }
  .clock-btn-label { font-size: 14px; }
}

/* Notes section labels in grid */
.notes-section-label {
  grid-column: 1 / -1;
  font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 4px 2px 2px;
}

/* ── CLOCK BUTTON LOADING STATE ── */
.clock-btn.loading {
  opacity: 0.6; pointer-events: none; position: relative;
}
.clock-btn.loading::after {
  content: ''; position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 18px; border: 2px solid rgba(10,15,30,0.2);
  border-top: 2px solid var(--accent); border-radius: 50%;
  animation: clockSpin 0.6s linear infinite;
}
.clock-btn.active.loading::after { border-color: rgba(255,255,255,0.2); border-top-color: #fff; }
@keyframes clockSpin { to { transform: translateX(-50%) rotate(360deg); } }

/* ── MATERIALS TAB ── */
.materials-wrap { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.mat-job-banner {
  background: var(--card); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.mat-job-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mat-job-label { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; }
.mat-job-prop { font-size: 14px; font-weight: 600; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-log-btn {
  background: var(--accent); color: #0a0f1e; border: none; border-radius: var(--radius-sm);
  padding: 10px 16px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap;
  font-family: var(--font-body); flex-shrink: 0;
}
.mat-log-btn:active { transform: scale(0.97); }

.materials-header { display: flex; gap: 8px; align-items: center; }
.materials-search {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  color: var(--text); font-family: var(--font-body); font-size: 13px;
}
.materials-search::placeholder { color: var(--text3); }
.materials-search:focus { outline: none; border-color: var(--accent); }
.materials-cat-bar {
  display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 2px 0; scrollbar-width: none;
}
.materials-cat-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0; padding: 5px 12px; border-radius: 20px; font-size: 11px;
  font-weight: 600; cursor: pointer; transition: all 0.15s; white-space: nowrap;
  border: 1px solid var(--border); background: transparent; color: var(--text2);
}
.cat-pill.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.materials-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
@media (max-width: 360px) { .materials-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 500px) { .materials-grid { grid-template-columns: repeat(4, 1fr); } }

.mat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all 0.15s; display: flex; flex-direction: column;
  position: relative; /* anchors the LOW badge */
}
.mat-card:active { transform: scale(0.97); border-color: var(--accent); }
.mat-card-img {
  width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
}
.mat-card-img img { width: 100%; height: 100%; object-fit: cover; }
.mat-card-icon {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  background: var(--bg3); font-size: 28px;
}
.mat-card-info { padding: 8px 8px 6px; }
.mat-card-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mat-card-qty {
  font-size: 11px; font-family: var(--font-mono); color: var(--accent); margin-top: 2px;
}
.mat-card-cat {
  font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px;
}
.mat-card.low-stock { border-color: var(--yellow); }
.mat-card.out-of-stock { border-color: var(--red); opacity: 0.7; }

/* Low-stock threshold badge on grid cards */
.mat-badge-low {
  position: absolute; top: 6px; left: 6px; z-index: 1;
  background: var(--yellow); color: #0a0f1e;
  font-size: 9px; font-weight: 800; letter-spacing: 1px;
  padding: 2px 6px; border-radius: 4px;
}
/* LOW chip next to the name in the detail view */
.mat-low-chip {
  display: inline-block; vertical-align: middle;
  background: var(--yellow); color: #0a0f1e;
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  padding: 2px 6px; border-radius: 4px;
}

/* Material detail modal */
.mat-detail-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.mat-detail-box {
  background: var(--bg2); border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 480px; max-height: 92vh;
  overflow-y: auto; display: flex; flex-direction: column;
  animation: slideUp 0.25s ease;
}
.mat-detail-img {
  width: 100%; height: 200px; object-fit: cover; background: var(--bg3);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mat-detail-img img { width: 100%; height: 100%; object-fit: cover; }
.mat-detail-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mat-detail-name { font-size: 18px; font-weight: 700; }
.mat-detail-meta { display: flex; gap: 16px; align-items: center; }
.mat-detail-meta-item { display: flex; flex-direction: column; gap: 2px; }
.mat-detail-meta-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; }
.mat-detail-meta-value { font-family: var(--font-mono); font-size: 16px; color: var(--accent); }

.mat-use-section {
  background: var(--card); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.mat-use-title { font-family: var(--font-display); font-size: 18px; letter-spacing: 1px; color: var(--accent); }
.mat-qty-row { display: flex; align-items: center; gap: 12px; }
.mat-qty-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--accent);
  background: var(--accent-dim); color: var(--accent); font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.mat-qty-btn:active { background: var(--accent); color: #0a0f1e; }
.mat-qty-display {
  font-family: var(--font-display); font-size: 36px; color: var(--text);
  min-width: 50px; text-align: center; letter-spacing: 2px;
}
.mat-use-btn {
  width: 100%; padding: 14px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: #0a0f1e; font-weight: 700; font-size: 14px;
  cursor: pointer; font-family: var(--font-display); letter-spacing: 1px; font-size: 16px;
}
.mat-use-btn:active { transform: scale(0.98); }
.mat-use-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Recent usage log */
.mat-usage-log { display: flex; flex-direction: column; gap: 6px; }
.mat-usage-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; background: var(--bg3); border-radius: var(--radius-sm); font-size: 12px;
}
.mat-usage-prop { font-weight: 600; color: var(--text); }
.mat-usage-detail { color: var(--text2); }
.mat-usage-qty { font-family: var(--font-mono); color: var(--yellow); font-weight: 700; }

/* Edit / delete icon buttons in mat detail header */
.mat-icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg3);
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mat-icon-btn:active { opacity: 0.7; }
.mat-icon-btn--delete { border-color: var(--red); }

/* Add Stock button */
.mat-addstock-btn {
  width: 100%; padding: 11px; border: 1.5px dashed var(--accent);
  border-radius: var(--radius-sm); background: transparent;
  color: var(--accent); font-weight: 700; font-size: 13px;
  font-family: var(--font-display); letter-spacing: 1px;
  cursor: pointer;
}
.mat-addstock-btn:active { background: var(--accent-dim); }

/* Add material form */
.mat-add-form { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.mat-photo-upload {
  width: 100%; height: 160px; border: 2px dashed var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; color: var(--text3); font-size: 13px; transition: all 0.15s;
  background: var(--bg3); overflow: hidden; position: relative;
}
.mat-photo-upload:active { border-color: var(--accent); }
.mat-photo-upload img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.mat-photo-upload .photo-prompt { z-index: 1; text-align: center; }

/* Empty state */
.mat-empty {
  text-align: center; padding: 40px 20px; color: var(--text3); font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.mat-empty-icon { font-size: 40px; opacity: 0.4; }

/* ── Barcode / Receipt scan buttons in materials header ── */
.mat-scan-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg3);
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative; /* anchors the reorder count badge */
}
.mat-scan-btn:active { background: var(--accent-dim); border-color: var(--accent); }

/* Count bubble on the 🛒 reorder button */
.mat-reorder-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--yellow); color: #0a0f1e;
  font-size: 10px; font-weight: 800; font-family: var(--font-mono);
  display: flex; align-items: center; justify-content: center;
}

/* Reorder list rows */
.reorder-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border-radius: var(--radius-sm); padding: 10px 12px;
  border-left: 3px solid var(--yellow);
}
.reorder-row--out { border-left-color: var(--red); }
.reorder-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reorder-detail { font-size: 11px; color: var(--text2); margin-top: 2px; }
.reorder-suggest { text-align: right; flex-shrink: 0; }
.reorder-suggest-qty { font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--accent); }
.reorder-suggest-label { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }

/* Receipt item rows */
.receipt-item-row {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--bg3); border-radius: var(--radius-sm); padding: 10px;
}
.receipt-item-check { display: flex; align-items: center; padding-top: 10px; flex-shrink: 0; }
.receipt-item-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* Receipt spinner */
.receipt-spinner {
  width: 36px; height: 36px; border: 3px solid var(--bg3);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 16px auto 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Materials Report */
.mat-report-card {
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 12px; border-left: 3px solid var(--accent);
}
.mat-report-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 8px;
}

/* Briefings */
.briefing-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
}
.briefing-card--today { border-left: 3px solid var(--accent); }
.briefing-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.briefing-card-prop { font-size: 13px; font-weight: 600; color: var(--accent); }
.briefing-badge {
  flex-shrink: 0; white-space: nowrap;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--text2); background: var(--bg3);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px;
}
.briefing-badge--now { color: var(--yellow); border-color: var(--yellow); background: transparent; }
.briefing-deliver-row { display: flex; gap: 8px; }
.briefing-deliver-opt {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 13px; cursor: pointer;
}
.briefing-deliver-opt input[type="radio"] { accent-color: var(--accent); }
.briefing-deliver-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.briefing-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.briefing-body { font-size: 14px; color: var(--text); margin-top: 8px; white-space: pre-wrap; }
.briefing-receipts { font-size: 11px; color: var(--text2); margin-top: 8px; }
.briefing-popup-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
}
.briefing-popup-prop { font-size: 13px; font-weight: 600; color: var(--accent); }
.briefing-crew-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.briefing-crew-item input[type="checkbox"] { accent-color: var(--accent); }
.briefing-crew-item input[type="checkbox"]:disabled + span { color: var(--text3); }
