:root {
  --bg: #0b1220;
  --bg-panel: #111827;
  --bg-row: rgba(255, 255, 255, 0.03);
  --bg-row-hover: rgba(255, 255, 255, 0.06);
  --ink: #f1f5f9;
  --ink-muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.15);
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --warn: #fbbf24;
  --danger: #f87171;
  --ok: #34d399;
  --font: "Pretendard Variable", Pretendard, system-ui, sans-serif;
  --radius: 14px;
}

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

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 10% -10%, rgba(56, 189, 248, 0.12), transparent),
    radial-gradient(ellipse 50% 40% at 90% 0%, rgba(129, 140, 248, 0.1), transparent);
  overflow: hidden;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.04em;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.top-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.clock {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.sync {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-muted);
}

.sync.live { color: var(--ok); background: rgba(52, 211, 153, 0.12); }
.sync.err { color: var(--danger); background: rgba(248, 113, 113, 0.12); }
.sync.updating { color: var(--accent); background: rgba(56, 189, 248, 0.12); }

.dashboard {
  display: grid;
  grid-template-columns: 1fr 0.95fr 1.15fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 24px 8px;
  height: calc(100vh - 108px - 40px);
  min-height: 0;
}

.board {
  display: contents;
}

.panel-instructor {
  grid-column: 1;
  grid-row: 1;
}

.panel-collab {
  grid-column: 2;
  grid-row: 1;
}

.panel-projects {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.count-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

.panel-body {
  flex: 1;
  min-height: 0;
  padding: 10px 12px 14px;
}

.panel-projects .panel-body {
  overflow-y: auto;
}

.scroll-y {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.empty {
  text-align: center;
  color: var(--ink-muted);
  padding: 40px 16px;
  font-size: 14px;
}

/* Lectures table */
.lecture-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lecture-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg-panel);
}

.lecture-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.lecture-table tr:hover td { background: var(--bg-row-hover); }

.date-cell { font-weight: 600; white-space: nowrap; color: var(--accent); }
.time-cell { color: var(--ink-muted); font-size: 12px; white-space: nowrap; }

.lecture-table .instructor-cell {
  white-space: nowrap;
  min-width: 4.5em;
  word-break: keep-all;
  font-weight: 600;
}

.lecture-table .title-cell {
  word-break: keep-all;
  line-height: 1.4;
}

/* Project cards */
.project-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  overflow-y: auto;
}

.project-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg-row);
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.project-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.project-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.project-meta {
  font-size: 12px;
  color: var(--ink-muted);
}

.project-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.project-section:first-child {
  border-top: none;
  padding-top: 0;
}

.section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(129, 140, 248, 0.2);
  color: #c7d2fe;
}

.section-empty {
  padding: 12px 8px !important;
  font-size: 12px;
}

.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  margin-bottom: 10px;
  overflow: hidden;
}

.progress-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.detail-table th {
  text-align: left;
  color: var(--ink-muted);
  font-weight: 600;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}

.detail-table td {
  padding: 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-pending, .badge-open { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.badge-in_progress { background: rgba(129, 140, 248, 0.2); color: #c7d2fe; }
.badge-delayed, .badge-high, .badge-critical { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.badge-resolved { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }

/* Collab feed */
.collab-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-muted);
}

.stat-pill strong { color: var(--ink); margin-left: 2px; }

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

.feed-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-row);
  border-left: 3px solid var(--accent-2);
}

.feed-item.unread { border-left-color: var(--warn); background: rgba(251, 191, 36, 0.06); }
.feed-item.requested { border-left-color: var(--accent); }
.feed-item.activity { border-left-color: var(--ok); }

.feed-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.feed-msg {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.45;
  word-break: break-word;
}

.feed-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-muted);
}

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 24px 12px;
  font-size: 11px;
  color: var(--ink-muted);
}

.error-bar {
  color: var(--danger);
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-bar.hidden { display: none; }

.flash-update {
  animation: pulse 0.6s ease;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
  100% { box-shadow: 0 0 0 12px rgba(56, 189, 248, 0); }
}

@media (max-width: 1100px) {
  .dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    overflow: visible;
  }

  .panel-instructor,
  .panel-collab,
  .panel-projects,
  .news-band {
    grid-column: 1;
    grid-row: auto;
  }

  html, body { overflow: auto; }
  .panel { min-height: 320px; }
  .news-band { margin: 0; }
  .news-columns { grid-template-columns: 1fr; }
  .news-column + .news-column {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 4px;
  }
}


.panel-head-collab { align-items: flex-start; }
.panel-sub { margin: 4px 0 0; font-size: 12px; color: var(--ink-muted); }

.feed-section-label { margin: 8px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.feed-label-unread { color: #93c5fd; }
.feed-label-requested { color: #fcd34d; }
.feed-label-read { color: #9ca3af; }

.feed-rows { display: flex; flex-direction: column; gap: 6px; }
.feed-rows-dim { opacity: .72; }

.feed-row { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 8px 9px; }
.feed-row-unread { background: rgba(129, 140, 248, 0.12); border-color: rgba(129, 140, 248, 0.28); }
.feed-row-read { background: rgba(255,255,255,.03); }
.feed-row-amber { background: rgba(251, 191, 36, 0.10); border-color: rgba(251, 191, 36, 0.35); }

.feed-type-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 2px 7px; font-size: 10px; font-weight: 700; white-space: nowrap; margin-top: 1px; }
.badge-assigned { background: rgba(99, 102, 241, 0.22); color: #c7d2fe; }
.badge-comment { background: rgba(59, 130, 246, 0.22); color: #bfdbfe; }
.badge-requested { background: rgba(245, 158, 11, 0.22); color: #fde68a; }
.badge-default { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }

.feed-row-body { flex: 1; min-width: 0; }
.feed-row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.feed-row-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-row-time { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.feed-unread-dot { width: 6px; height: 6px; border-radius: 999px; background: #60a5fa; }
.feed-row-detail { margin-top: 3px; font-size: 12px; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-row-preview { margin-top: 2px; font-size: 12px; color: #94a3b8; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.feed-empty i { font-size: 30px; color: #475569; display:block; margin-bottom: 8px; }

/* News band (Yonhap + MBC) — spans instructor + collab columns */
.news-band {
  grid-column: 1 / 3;
  grid-row: 2;
  margin: 0;
  padding: 10px 14px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 228px;
  align-self: end;
}

.news-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.news-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.news-column + .news-column {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

.news-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.news-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.news-head h2 i { color: var(--warn); }

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.news-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 4px;
  border-radius: 8px;
}

.news-item:hover { background: var(--bg-row-hover); }

.news-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.news-title {
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-title:hover { color: var(--accent); text-decoration: underline; }

.news-time {
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.news-empty {
  color: var(--ink-muted);
  font-size: 13px;
  padding: 16px 8px;
}
