/* ────────────────────────────────────────────────────────────────────────────
   relay-desk-public  •  style.css
   RESA Power brand  •  accent: #FF5A2D
   Mobile-first, no external CDN
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  --accent:       #FF5A2D;
  --accent-dark:  #D94820;
  --bg:           #F5F5F7;
  --surface:      #FFFFFF;
  --header-bg:    #1C1C1E;
  --header-fg:    #FFFFFF;
  --text:         #1C1C1E;
  --text-muted:   #6E6E73;
  --border:       #E0E0E5;
  --danger:       #D94820;
  --off-color:    #6E6E73;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.18);
  --transition:   180ms ease;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input { font: inherit; }

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--header-bg);
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-logo .logo-mark {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.login-logo h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}
.login-logo .sub {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.login-form h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition);
  -webkit-appearance: none;
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  transition: background var(--transition), transform .1s;
  margin-top: 8px;
}
.btn-primary:active { transform: scale(.98); }
.btn-primary:hover  { background: var(--accent-dark); }
.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.error-msg {
  display: none;
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
}
.error-msg.visible { display: block; }

/* ── App shell ──────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Header */
.app-header {
  background: var(--header-bg);
  color: var(--header-fg);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: env(safe-area-inset-top, 0) 0 0;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo .logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.header-logo span {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-actions .user-name {
  font-size: 13px;
  color: rgba(255,255,255,.6);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.8);
  transition: background var(--transition);
}
.icon-btn:hover, .icon-btn:focus { background: rgba(255,255,255,.12); outline: none; }
.icon-btn svg { width: 20px; height: 20px; }

/* Scope toggle (My Jobs / Office) */
.scope-toggle {
  display: flex;
  background: rgba(255,255,255,.1);
  border-radius: 20px;
  margin: 0 16px 12px;
  padding: 3px;
}
.scope-toggle button {
  flex: 1;
  padding: 7px 0;
  font-size: 13px;
  font-weight: 600;
  border-radius: 18px;
  color: rgba(255,255,255,.6);
  transition: background var(--transition), color var(--transition);
}
.scope-toggle button.active {
  background: var(--accent);
  color: #fff;
}

/* Month navigation */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.month-nav .month-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.month-nav .nav-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.7);
  transition: background var(--transition), opacity var(--transition);
}
.month-nav .nav-arrow:hover:not(:disabled) { background: rgba(255,255,255,.12); }
.month-nav .nav-arrow:disabled { opacity: .25; cursor: default; }
.month-nav .nav-arrow svg { width: 18px; height: 18px; }

/* ── Schedule list ──────────────────────────────────────────────────────── */
.schedule-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 80px;   /* bottom padding for safe area */
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
}

.day-group {
  margin-bottom: 4px;
}

.day-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px 6px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.day-header .day-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.day-header .day-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.day-header.today .day-name { color: var(--accent); }
.day-header.today .day-date { color: var(--accent); }

.job-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 12px 8px;
  padding: 13px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  -webkit-tap-highlight-color: transparent;
  border-left: 4px solid transparent;
}
.job-card:active { transform: scale(.98); }
.job-card.project  { border-left-color: var(--accent); }
.job-card.off      { border-left-color: var(--off-color); cursor: default; }

.job-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.job-card.project .job-card-icon { background: #FFF0EC; }
.job-card.off      .job-card-icon { background: #F0F0F3; }

.job-card-body { flex: 1; min-width: 0; }
.job-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-card.off .job-card-title { color: var(--text-muted); }

.job-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}
.job-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-card-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}
.status-confirmed  { background: #E6F4EA; color: #2E7D32; }
.status-tentative  { background: #FFF8E1; color: #F57F17; }
.status-default    { background: #F0F0F3; color: #6E6E73; }

/* Employee name (office view) */
.job-card-employee {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Chevron */
.job-card-chevron {
  color: var(--border);
  flex-shrink: 0;
  align-self: center;
}
.job-card-chevron svg { width: 16px; height: 16px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p  { font-size: 14px; }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #e8e8ec 25%, #f5f5f7 50%, #e8e8ec 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  height: 72px;
  margin: 0 12px 8px;
  border-radius: var(--radius-sm);
}

/* ── Project detail modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32,.72,0,1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.modal-backdrop.open .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.modal-title-group { flex: 1; min-width: 0; }
.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}
.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 12px;
  margin-top: -2px;
  color: var(--text-muted);
}
.modal-close:hover { background: var(--border); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body {
  overflow-y: auto;
  padding: 16px 20px;
  flex: 1;
}

.detail-section {
  margin-bottom: 20px;
}
.detail-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: flex-start;
}
.detail-row .dr-icon {
  width: 32px;
  height: 32px;
  background: #F0F0F3;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.detail-row .dr-content { flex: 1; min-width: 0; }
.detail-row .dr-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.detail-row .dr-value {
  font-size: 14px;
  color: var(--text);
  margin-top: 1px;
  word-break: break-word;
}
.detail-row .dr-value a { color: var(--accent); }

/* Pill badges in modal */
.detail-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: #F0F0F3;
  color: var(--text-muted);
}
.pill.accent { background: #FFF0EC; color: var(--accent); }

/* Notes / prose */
.detail-note {
  background: #F5F5F7;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Call button */
.call-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #E6F4EA;
  color: #2E7D32;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}
.call-btn svg { width: 14px; height: 14px; }
.call-btn:hover { background: #D4EDDA; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--header-bg);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,90,45,.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive (tablet+) ───────────────────────────────────────────────── */
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
  .modal-sheet {
    border-radius: var(--radius);
    max-height: 80dvh;
    margin: 16px;
  }
  .job-card { margin: 0 16px 8px; }
}
