:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #0f172a;
  --emerald: #059669;
  --emerald-bg: #ecfdf5;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --rose: #be123c;
  --rose-bg: #fff1f2;
  --blue: #2563eb;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--emerald);
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.primary-nav {
  display: inline-flex;
  gap: 6px;
}

.nav-link {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.nav-link.active {
  background: var(--ink);
  color: #ffffff;
}

.subbar {
  background: #f8fafc;
  border-top: 1px solid var(--border);
}

.subbar-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-head {
  margin-bottom: 14px;
}

.page-heading {
  margin: 0 0 2px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.filter-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.badge-p0 {
  background: var(--rose-bg);
  color: var(--rose);
}

.badge-p1 {
  background: var(--amber-bg);
  color: var(--amber);
}

.badge-p2 {
  background: #f1f5f9;
  color: #475569;
}

.badge-ai-queued {
  background: #eff6ff;
  color: var(--blue);
}

.insight-block {
  margin: 8px 0;
  font-size: 13.5px;
  color: #334155;
  line-height: 1.55;
}

.insight-block strong {
  color: var(--ink);
}

.insight-verify {
  background: #f8fafc;
  border-left: 3px solid var(--emerald);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 10px 0 12px;
  font-size: 13px;
  color: #065f46;
}

.user-instruction-note {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 13px;
}

.tabs {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 10px;
  gap: 4px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Main */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 18px 16px 64px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-select {
  font-size: 14px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}

.session-meta {
  font-size: 13px;
  color: var(--muted);
}

/* Cards */
.cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.loading-box,
.empty-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.card.status-rejected {
  opacity: 0.65;
}

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

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.badge-score {
  background: var(--emerald-bg);
  color: var(--emerald);
}

.badge-platform {
  background: #f1f5f9;
  color: #334155;
}

.badge-status-pending {
  background: #f1f5f9;
  color: var(--muted);
}

.badge-status-viewed,
.badge-status-considering {
  background: var(--amber-bg);
  color: var(--amber);
}

.badge-status-applied {
  background: var(--emerald-bg);
  color: var(--emerald);
}

.badge-status-rejected {
  background: var(--rose-bg);
  color: var(--rose);
}

.card-title {
  margin: 6px 0 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.card-headline {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.card-meta-line {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--amber);
  font-weight: 600;
}

.summary-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 13.5px;
  color: #334155;
}

.summary-list li {
  margin: 3px 0;
}

.cover-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 3px solid var(--emerald);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0 14px;
}

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

.cover-box-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--emerald);
}

.cover-text {
  margin: 0;
  font-size: 13.5px;
  white-space: pre-wrap;
  color: var(--ink);
  line-height: 1.6;
}

.extra-details {
  margin: 10px 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.extra-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #475569;
  user-select: none;
}

.extra-details-body {
  margin-top: 8px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

/* Action Bar */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
}

.btn-primary:hover {
  background: #1e293b;
}

.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.btn-link {
  background: #eff6ff;
  color: var(--blue);
  border-color: #bfdbfe;
}

.btn-link:hover {
  background: #dbeafe;
}

.btn-success {
  background: var(--emerald-bg);
  color: var(--emerald);
  border-color: #a7f3d0;
}

.btn-success:hover {
  background: #d1fae5;
}

.btn-danger {
  background: var(--rose-bg);
  color: var(--rose);
  border-color: #fecdd3;
}

.btn-danger:hover {
  background: #ffe4e6;
}

.btn-ghost {
  background: var(--surface);
  color: #475569;
  border-color: var(--border);
}

.btn-ghost:hover {
  background: #f1f5f9;
}

.btn-sm {
  font-size: 12px;
  padding: 4px 10px;
}

/* Native Modal Dialog + Scroll Containment (modern-web-guidance) */
dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  max-width: 480px;
  width: calc(100% - 28px);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  background: var(--surface);
  color: var(--ink);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
}

.dialog-shell {
  padding: 20px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.icon-close {
  border: 0;
  background: #f1f5f9;
  color: #475569;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

.dialog-target {
  margin: 10px 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
}

.dialog-sub {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.dialog-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.choice-btn {
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.choice-btn.selected {
  border-color: var(--ink);
  background: #f8fafc;
}

.sub-panel {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

.panel-label {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
}

.chip.selected {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.field input,
.field textarea {
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.reject-note {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--rose);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
