:root {
  --bg-color: #f8fafc;
  --panel-bg: #ffffff;
  --panel-border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent-blue: #2563eb;
  --accent-cyan: #0284c7;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-yellow: #d97706;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  padding: 16px 12px;
}

.shell {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Header & Topbar */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-md);
  border-radius: 16px;
  padding: 16px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
}

.status-indicator.live {
  animation: pulse 2s infinite;
}

.status-indicator.paused {
  background: var(--accent-yellow);
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.4);
  animation: none;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.2s ease;
  min-height: 42px;
}

.btn-primary {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--panel-border);
}

.btn-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.btn-warning.active-resume {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Target Header Card & Filter Controls */
.target-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
  border: 1.5px solid #bfdbfe;
  box-shadow: var(--shadow-sm);
  border-radius: 16px;
  padding: 16px 18px;
}

.target-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.provider-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  border-radius: 12px;
}

.provider-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.provider-chip {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-target {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 20px;
  display: inline-block;
}

.time-filter-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #cbd5e1;
  padding: 3px 6px;
  border-radius: 12px;
}

.control-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 4px;
}

.filter-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.target-info h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.target-info p {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 2px;
  line-height: 1.4;
}

.countdown-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  padding-left: 12px;
}

.timer-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-blue);
}

/* Summary Grid */
.summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.summary > div {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary .muted {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.summary strong {
  font-size: 0.95rem;
  font-weight: 700;
}

/* Section Header */
.section-container h2 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-muted);
}

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

/* 4 Company Cards (Grouping AM & PM) */
.company-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-md);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.company-card.ok {
  border: 2px solid var(--accent-green);
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
  animation: glow 1.5s infinite alternate;
}

@keyframes glow {
  from { box-shadow: 0 0 8px rgba(16, 185, 129, 0.2); }
  to { box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); }
}

.company-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
}

.company-head h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.company-head .course-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Slots Container Inside Card */
.slots-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.slot-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slot-box.slot-avail {
  background: #ecfdf5;
  border-color: var(--accent-green);
}

.slot-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
}

.badge-ok { background: #10b981; color: #ffffff; }
.badge-full { background: #f1f5f9; color: #64748b; }

.slot-note {
  font-size: 0.75rem;
  color: var(--accent-blue);
  font-weight: 700;
}

.book-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--panel-border);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 8px;
  border-radius: 8px;
  text-decoration: none;
  margin-top: auto;
  transition: all 0.2s;
}

.book-btn.btn-highlight {
  background: var(--accent-green);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Company DL Info */
.company-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 0.78rem;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  padding: 10px 12px;
  border-radius: 10px;
}

.company-info dt { color: var(--text-muted); }
.company-info dd { font-weight: 700; text-align: right; color: var(--text-main); }

.timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--accent-green);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.alert b { font-size: 0.88rem; color: var(--text-main); }
.alert span { font-size: 0.78rem; color: var(--text-muted); }
.alert a {
  color: var(--accent-blue);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  background: #eff6ff;
  padding: 6px 10px;
  border-radius: 8px;
}

/* Desktop layout override for wider screens */
@media (min-width: 641px) {
  body { padding: 24px; }
  .shell { gap: 20px; }
  .topbar { flex-direction: row; }
  .actions { width: auto; display: flex; }
  .summary { grid-template-columns: repeat(4, 1fr); }
  .grid { display: grid; grid-template-columns: repeat(2, 1fr); }
}
