/* ── Reset + Base ─────────────────────────────────────────────────────────── */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(180deg, #2266dd 0%, #227777 100%);
  min-height: 100vh;
  color: #1f2937;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── App Header ───────────────────────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  white-space: nowrap;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  flex-shrink: 0;
  background: rgba(255,255,255,0.2);
}

.user-name {
  color: rgba(255,255,255,0.9);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  display: none; /* shown on wider screens */
}

.logout-btn {
  color: rgba(255,255,255,0.75);
  font-size: 0.78rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  white-space: nowrap;
  transition: background 0.15s;
}

.logout-btn:hover { background: rgba(255,255,255,0.22); }

/* ── Filter Bar ───────────────────────────────────────────────────────────── */

.filter-bar {
  max-width: 1000px;
  margin: 14px auto 0;
  padding: 0 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-bar input[type="search"],
.filter-bar select {
  height: 40px;
  background: rgba(255,255,255,0.97);
  border: none;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 0.875rem;
  font-family: inherit;
  color: #1f2937;
  box-shadow: 0 2px 8px rgba(0,0,0,0.14);
  outline: none;
  flex-shrink: 0;
}

.filter-bar input[type="search"] {
  flex: 1 1 180px;
  min-width: 140px;
}

.filter-bar select {
  cursor: pointer;
  padding-right: 8px;
}

.filter-bar input[type="search"]:focus,
.filter-bar select:focus {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.4), 0 2px 8px rgba(0,0,0,0.14);
}

/* ── Job List ─────────────────────────────────────────────────────────────── */

.job-list {
  max-width: 1000px;
  margin: 14px auto 40px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Job Card ─────────────────────────────────────────────────────────────── */

.job-card {
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  transition: transform 0.13s, box-shadow 0.13s;
  -webkit-tap-highlight-color: transparent;
}

.job-card:hover  { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.job-card:active { transform: translateY(0); }

/* Status-tinted left border */
.job-card.status-on_hold          { border-left: 4px solid #9ca3af; }
.job-card.status-awaiting_materials { border-left: 4px solid #f59e0b; }
.job-card.status-complete          { border-left: 4px solid #10b981; opacity: 0.8; }
.job-card.status-cancelled         { border-left: 4px solid #e5e7eb; opacity: 0.6; }

.job-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.job-name {
  font-size: 0.93rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */

.badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.6;
}

.badge-rush      { background: #fee2e2; color: #b91c1c; }
.badge-firm-date { background: #ede9fe; color: #6d28d9; }
.badge-on-hold   { background: #f3f4f6; color: #6b7280; }
.badge-awaiting  { background: #fef3c7; color: #b45309; }
.badge-complete  { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #f3f4f6; color: #9ca3af; }

/* ── Card Meta Row ────────────────────────────────────────────────────────── */

.job-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 11px;
}

.due-date { font-weight: 500; }
.due-overdue { color: #dc2626; }
.due-today   { color: #d97706; }
.due-soon    { color: #ca8a04; }

.distro-link {
  color: #667eea;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.distro-link:hover { text-decoration: underline; }

/* ── Step Chips ───────────────────────────────────────────────────────────── */

.step-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.step-chip {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  line-height: 1.5;
}

.chip-pending      { background: #f3f4f6; color: #9ca3af; border: 1px solid #e5e7eb; }
.chip-in_progress  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.chip-complete     { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.chip-skipped      { background: #f9fafb; color: #d1d5db; border: 1px dashed #e5e7eb; text-decoration: line-through; }

/* ── State messages ───────────────────────────────────────────────────────── */

.state-msg {
  text-align: center;
  color: rgba(255,255,255,0.9);
  padding: 56px 16px;
  font-size: 1rem;
}

.state-error {
  max-width: 1000px;
  margin: 16px auto;
  padding: 14px 16px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (min-width: 480px) {
  .user-name { display: block; }
}

@media (min-width: 640px) {
  .app-title  { font-size: 1.2rem; }
  .filter-bar { gap: 10px; }
  .job-name   { font-size: 0.97rem; }
}

@media (min-width: 960px) {
  .app-header { height: 60px; }
  .job-list   { gap: 12px; }
}
