/* ────────────────────────────────────────────────────────────────────────────
   relay-desk-public  •  style.css
   RESA Power — dark tech theme (matches internal relay-desk app exactly)
   Mobile-first, no external CDN
   ──────────────────────────────────────────────────────────────────────────── */

:root {
    --tech-bg:       #0f0f1a;
    --tech-surface:  #1a1a2e;
    --tech-surface2: #242440;
    --tech-border:   #2e2e4e;
    --tech-primary:  #1976d2;
    --tech-green:    #43a047;
    --tech-orange:   #f57c00;
    --tech-red:      #c62828;
    --tech-yellow:   #f9a825;
    --tech-text:     #f0f0f0;
    --tech-text-dim: #9090b0;
    --radius:        12px;
    --radius-sm:     8px;
    --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', sans-serif;
  background: var(--tech-bg);
  color: var(--tech-text);
  min-height: 100dvh;
  overflow-x: hidden;
}
a { color: var(--tech-primary); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input { font: inherit; }

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

.login-card {
  background: var(--tech-surface);
  border: 1px solid var(--tech-border);
  border-radius: var(--radius);
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
}

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

.login-bolt {
  font-size: 38px;
  line-height: 1;
  flex-shrink: 0;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--tech-text);
  line-height: 1.2;
}

.login-subtitle {
  font-size: 13px;
  color: var(--tech-text-dim);
  font-weight: 400;
  margin-top: 3px;
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--tech-text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--tech-border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--tech-text);
  background: var(--tech-surface2);
  transition: border-color var(--transition);
  -webkit-appearance: none;
}
.form-group input::placeholder { color: var(--tech-text-dim); opacity: 1; }
.form-group input:focus {
  outline: none;
  border-color: var(--tech-primary);
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--tech-primary);
  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;
  border: none;
  cursor: pointer;
}
.btn-primary:active  { transform: scale(.98); }
.btn-primary:hover   { background: #1565c0; }
.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.error-msg {
  display: none;
  color: var(--tech-red);
  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;
  background: var(--tech-bg);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--tech-surface);
  border-bottom: 1px solid var(--tech-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: env(safe-area-inset-top, 0);
}

/* Top bar row */
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 64px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-bolt {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.user-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--tech-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.logout-btn {
  padding: 8px 14px;
  border: 1.5px solid var(--tech-red);
  border-radius: 20px;
  color: var(--tech-red);
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  transition: background var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.logout-btn:hover { background: rgba(198, 40, 40, .14); }
.logout-btn:active { background: rgba(198, 40, 40, .22); }

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  padding: 0 16px;
  gap: 4px;
  border-bottom: 1px solid var(--tech-border);
}

.tab-btn {
  position: relative;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tech-text-dim);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--tech-primary);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform var(--transition);
}
.tab-btn.active {
  color: var(--tech-text);
}
.tab-btn.active::after {
  transform: scaleX(1);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--tech-primary);
  color: #fff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.tab-count:empty { display: none; }

/* ── Scope toggle ───────────────────────────────────────────────────────── */
.scope-toggle {
  display: flex;
  background: var(--tech-bg);
  border-radius: 20px;
  margin: 10px 16px;
  padding: 3px;
  border: 1px solid var(--tech-border);
}
.scope-toggle button {
  flex: 1;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  border-radius: 18px;
  color: var(--tech-text-dim);
  transition: background var(--transition), color var(--transition);
}
.scope-toggle button.active {
  background: var(--tech-primary);
  color: #fff;
}

/* ── Month navigation ───────────────────────────────────────────────────── */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 12px;
}

.month-nav .month-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--tech-text);
  letter-spacing: -.01em;
}

.month-nav .nav-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tech-surface2);
  border: 1px solid var(--tech-border);
  color: var(--tech-text);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  transition: background var(--transition);
  cursor: pointer;
}
.month-nav .nav-arrow:hover:not(:disabled) { background: var(--tech-border); }
.month-nav .nav-arrow:disabled { opacity: .3; cursor: default; }

/* ── FullCalendar container — white card above list view ────────────────── */
/*
 * Intentionally light-themed (white bg) inside the dark page — this matches
 * the internal relay-desk app design.  Hidden on phones via media query below.
 */
.ts-calendar {
    min-height: 480px;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid var(--tech-border);
    border-radius: 8px;
    overflow: hidden;
    margin: 12px 12px 0;
}

/* Hide calendar on phone — list view is primary on mobile */
@media (max-width: 640px) {
    .ts-calendar {
        display: none;
    }
}

/* ── Current-user row highlight (office view) ───────────────────────────── */
.ts-is-me {
    background: #fef9c3 !important;
}
.ts-is-me .fc-datagrid-cell-cushion {
    font-weight: 700;
    color: #854d0e;
}
/* Timeline lane for the highlighted row */
.ts-calendar .fc-resource-timeline-lane.ts-is-me,
.ts-calendar .fc-timeline-lane.ts-is-me {
    background: #fef9c3 !important;
}

/* ── FullCalendar overrides — clean white-card look ─────────────────────── */

/* Remove outer grid border that conflicts with card border/radius */
.ts-calendar .fc-scrollgrid {
    border-left-width: 0;
    border-top-width: 0;
}
.ts-calendar .fc-scrollgrid td:last-of-type {
    border-right-width: 0;
}
.ts-calendar .fc-scrollgrid tr:last-of-type td {
    border-bottom-width: 0;
}

/* Column header row */
.ts-calendar .fc-col-header-cell {
    background: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 5px 3px;
}
.ts-calendar .fc-col-header-cell-cushion {
    color: #475569;
    text-decoration: none;
    padding: 4px 6px;
}

/* Today column — subtle blue tint */
.ts-calendar .fc-day-today {
    background: rgba(25, 118, 210, .07) !important;
}
.ts-calendar .fc-col-header-cell.fc-day-today {
    background: rgba(25, 118, 210, .12) !important;
    color: #1976d2 !important;
}
.ts-calendar .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion {
    color: #1976d2;
    font-weight: 800;
}

/* Resource data-grid (left side — employee names) */
.ts-calendar .fc-datagrid-header {
    background: #f8fafc;
}
.ts-calendar .fc-datagrid-cell-cushion {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    padding: 8px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ts-calendar .fc-datagrid-header .fc-datagrid-cell-cushion {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Event bars */
.ts-calendar .fc-event {
    border-radius: 4px;
    border: none !important;
    padding: 2px 5px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.92;
    transition: opacity 120ms, filter 120ms;
}
.ts-calendar .fc-event:hover {
    opacity: 1;
    filter: brightness(0.88);
}
.ts-calendar .fc-event-title {
    font-size: 11px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Timeline grid lines */
.ts-calendar .fc-timeline-slot {
    border-color: #e2e8f0;
}
.ts-calendar .fc-timeline-slot-minor {
    border-color: #f1f5f9;
}
.ts-calendar .fc-timeline-lane {
    border-color: #e2e8f0;
}
.ts-calendar .fc-datagrid-divider {
    border-color: #e2e8f0;
}

/* Scrollgrid internal borders */
.ts-calendar .fc-scrollgrid-section td,
.ts-calendar .fc-scrollgrid-section th {
    border-color: #e2e8f0;
}

/* Now indicator */
.ts-calendar .fc-timeline-now-indicator-line {
    border-color: #ef4444;
    border-width: 2px;
}

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

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

/* Day label with left-border accent */
.day-label {
  padding: 10px 16px 6px 13px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tech-text);
  border-left: 3px solid var(--tech-border);
  margin-left: 12px;
  letter-spacing: .01em;
}
.day-label.today {
  color: var(--tech-primary);
  border-left-color: var(--tech-primary);
}

/* Individual schedule row */
.schedule-row {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  background: var(--tech-surface);
  border-bottom: 1px solid var(--tech-border);
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}
.schedule-row.clickable {
  cursor: pointer;
}
.schedule-row.clickable:hover  { background: var(--tech-surface2); }
.schedule-row.clickable:active { background: var(--tech-surface2); }

.row-body {
  flex: 1;
  min-width: 0;
}

/* "Employee → Project" main line */
.row-main {
  font-size: 14px;
  font-weight: 500;
  color: var(--tech-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.row-employee {
  color: var(--tech-text-dim);
  font-weight: 400;
}
.row-arrow {
  color: var(--tech-text-dim);
  margin: 0 4px;
}
.row-project {
  font-weight: 600;
  color: var(--tech-text);
}

/* Off rows — muted, not clickable */
.row-off .row-main {
  color: var(--tech-text-dim);
  font-style: italic;
  font-weight: 400;
}

/* Location sub-line */
.row-sub {
  font-size: 12px;
  color: var(--tech-text-dim);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* Chevron "›" */
.row-chevron {
  color: var(--tech-text-dim);
  font-size: 22px;
  font-weight: 300;
  flex-shrink: 0;
  line-height: 1;
  margin-top: -1px;
}

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

/* ── Loading skeleton ───────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--tech-surface) 25%,
    var(--tech-surface2) 50%,
    var(--tech-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-row {
  height: 58px;
  border-bottom: 1px solid var(--tech-border);
}

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

.modal-card {
  background: var(--tech-surface);
  border: 1px solid var(--tech-border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(.97);
  transition: transform .26s cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}
.modal-backdrop.open .modal-card {
  transform: translateY(0) scale(1);
}

/* Modal header */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 16px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--tech-border);
  gap: 12px;
}

.modal-title-group { flex: 1; min-width: 0; }

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--tech-text);
  word-break: break-word;
  line-height: 1.3;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--tech-text-dim);
  margin-top: 4px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tech-surface2);
  border: 1px solid var(--tech-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--tech-text-dim);
  font-size: 15px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}
.modal-close:hover { background: var(--tech-border); color: var(--tech-text); }

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

/* Modal footer */
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--tech-border);
  flex-shrink: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0));
}
.modal-footer .btn-primary {
  margin-top: 0;
}

/* ── Modal detail content ───────────────────────────────────────────────── */
.detail-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--tech-surface2);
  color: var(--tech-text-dim);
  border: 1px solid var(--tech-border);
}
.pill.primary {
  background: rgba(25, 118, 210, .2);
  color: var(--tech-primary);
  border-color: rgba(25, 118, 210, .4);
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tech-text-dim);
  margin-bottom: 10px;
}

.detail-row {
  margin-bottom: 12px;
}

.dr-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tech-text-dim);
  margin-bottom: 3px;
}

.dr-value {
  font-size: 14px;
  color: var(--tech-text);
  line-height: 1.5;
  word-break: break-word;
}
.dr-value a { color: var(--tech-primary); }

/* Tappable phone link */
.call-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: rgba(67, 160, 71, .15);
  color: var(--tech-green);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 5px;
  text-decoration: none;
  border: 1px solid rgba(67, 160, 71, .3);
  transition: background var(--transition);
}
.call-btn:hover { background: rgba(67, 160, 71, .25); }

/* Tappable email link */
.email-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: rgba(25, 118, 210, .15);
  color: var(--tech-primary);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 5px;
  text-decoration: none;
  border: 1px solid rgba(25, 118, 210, .3);
  transition: background var(--transition);
}
.email-btn:hover { background: rgba(25, 118, 210, .25); }

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

/* Status badges */
.status-confirmed { background: rgba(67,160,71,.18);  color: var(--tech-green);  border-radius: 6px; padding: 2px 7px; font-size: 11px; font-weight: 700; }
.status-tentative { background: rgba(245,124,0,.18); color: var(--tech-orange); border-radius: 6px; padding: 2px 7px; font-size: 11px; font-weight: 700; }
.status-default   { background: var(--tech-surface2); color: var(--tech-text-dim); border-radius: 6px; padding: 2px 7px; font-size: 11px; font-weight: 700; }

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

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

/* ── Mobile — bottom-sheet modal on small screens ───────────────────────── */
@media (max-width: 640px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-card {
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92dvh;
    transform: translateY(100%);
  }
  .modal-backdrop.open .modal-card {
    transform: translateY(0);
  }
}
