/* AIJH-DECISION-UI-20260722-1225 */

:root {
  --bg: #f7f9fc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --success: #059669;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --ai-soft: #eef7ff;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

template {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.topbar {
  min-height: 76px;
  padding: 18px clamp(16px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(247, 249, 252, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: 0;
  font-weight: 650;
}

.topbar p,
.summary p,
.profile p,
.company-line,
.source-line,
.source-note,
.sync-box span,
.ai-disclaimer,
.ai-warning,
.eligibility-note {
  color: var(--muted);
}

.sync-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
}

.sync-box span {
  font-size: 12px;
}

.sync-box .sync-error {
  color: var(--danger);
}

main {
  width: min(1240px, calc(100% - 32px));
  margin: 20px auto 48px;
}

.sync-button,
.pagination button,
.actions button,
.tab,
.copy-prompt,
.overflow-menu summary {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  min-height: 40px;
  padding: 8px 12px;
  cursor: pointer;
}

.sync-button {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
  white-space: nowrap;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.summary article,
.profile,
.source-panel,
.job-card,
.controls {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary article {
  padding: 12px 14px;
}

.summary span {
  display: block;
  font-size: 22px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 3px;
}

.summary p {
  margin-bottom: 0;
  font-size: 13px;
}

.profile {
  padding: 14px 16px;
  margin-bottom: 12px;
}

.profile.is-hidden {
  display: none;
}

.profile h2,
.source-panel h2 {
  font-size: 17px;
  font-weight: 650;
  margin-bottom: 6px;
}

.profile p,
.source-panel p {
  max-width: 960px;
  margin-bottom: 0;
  line-height: 1.5;
}

.controls {
  padding: 12px;
  margin-bottom: 12px;
}

.primary-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}

.tab {
  min-height: 36px;
  color: var(--muted);
}

.tab.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent);
  font-weight: 600;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 42px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.pagination span {
  color: var(--muted);
  font-size: 13px;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.job-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.job-card {
  position: relative;
  min-height: 290px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ai-label {
  display: block;
  color: var(--success);
  font-weight: 650;
  font-size: 12px;
  margin-bottom: 2px;
}

.score {
  display: block;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.pipeline-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  white-space: nowrap;
}

.status-interested,
.status-offer {
  color: var(--success);
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.status-applied,
.status-interview {
  color: var(--accent);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.status-later {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.status-rejected,
.status-archived {
  color: var(--muted);
  background: #f1f5f9;
}

.rank {
  color: var(--muted);
  font-size: 12px;
}

.job-card h3 {
  margin: 2px 0 3px;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0;
  font-weight: 650;
}

.company-line,
.source-line {
  margin-bottom: 4px;
  line-height: 1.35;
}

.company-line {
  color: var(--text);
  font-weight: 500;
}

.dot {
  color: #cbd5e1;
  padding: 0 4px;
}

.source-badge {
  color: var(--accent);
  font-weight: 600;
}

.location-block {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin: 9px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.location-pin {
  color: var(--accent);
  line-height: 1;
}

.location-main {
  margin: 0 0 2px;
  font-weight: 650;
  line-height: 1.35;
}

.location-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.location-badge {
  display: inline-flex;
  margin-left: 4px;
  min-height: 22px;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #f8fafc;
  font-size: 11px;
  white-space: nowrap;
}

.location-verified,
.location-from-job-description {
  color: #047857;
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.location-ai-suggested {
  color: #92400e;
  border-color: #fde68a;
  background: #fffbeb;
}

.location-multiple-offices {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.ai-summary {
  padding: 11px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ai-soft), #ffffff 74%);
  border: 1px solid #dbeafe;
}

.ai-summary strong,
.focus-block strong,
.detail-section strong {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.summary-text {
  margin: 0;
  line-height: 1.45;
}

.focus-block {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.resume-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.resume-focus span,
.source-chip-list span {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.copy-prompt {
  flex: 0 0 auto;
  min-height: 30px;
  color: var(--accent);
}

.actions {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(0, 0.85fr));
  gap: 7px;
  margin-top: auto;
  align-items: stretch;
}

.actions button,
.actions a,
.overflow-menu summary {
  min-height: 32px;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 13px;
  white-space: nowrap;
}

.actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  text-decoration: none;
}

.prepare-button {
  background: #111827 !important;
  border-color: #111827 !important;
  color: #fff !important;
}

.unsafe-link {
  background: #f8fafc !important;
  border-color: var(--line) !important;
  color: var(--accent) !important;
}

.overflow-menu {
  margin: 0;
  position: relative;
}

.overflow-menu summary {
  list-style: none;
}

.overflow-menu summary::-webkit-details-marker {
  display: none;
}

.overflow-menu[open] button {
  display: inline-flex;
  width: max-content;
  min-width: 0;
  margin-top: 5px;
  margin-right: 6px;
  background: #fff;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

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

.detail-button,
.source-panel > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  font-size: 13px;
}

.detail-button {
  width: fit-content;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.source-panel > summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

li {
  margin-bottom: 4px;
}

.application-angle {
  margin: 10px 0 6px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.location-detail-grid,
.review-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-grid {
  margin: 12px 0;
}

.location-detail-grid {
  margin-top: 10px;
}

.location-detail-grid p,
.review-grid p {
  margin: 0;
}

.location-detail-grid strong,
.review-grid strong,
.cover-letter strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.location-detail-grid span {
  display: block;
  line-height: 1.4;
}

.ai-disclaimer,
.ai-warning,
.eligibility-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  max-width: 300px;
}

.ai-warning {
  color: #92400e;
}

.review-dialog {
  width: min(820px, calc(100% - 28px));
  max-height: min(860px, calc(100vh - 28px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.26);
}

.review-dialog::backdrop {
  background: rgba(15, 23, 42, 0.36);
}

.review-dialog form {
  padding: 18px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.dialog-head h2 {
  font-size: 20px;
  margin-bottom: 0;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.ghost-button,
.dialog-actions button,
.dialog-actions a {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 36px;
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 16px;
}

.dialog-actions a,
.dialog-actions button:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.dialog-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.review-content {
  display: grid;
  gap: 12px;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.detail-section h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.secondary-inline {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--accent);
  padding: 7px 10px;
}

.cover-letter,
.review-blockers,
.review-ready {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.review-blockers {
  border-color: #fecaca;
  background: #fef2f2;
}

.review-ready {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.state-message {
  grid-column: 1 / -1;
  padding: 28px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.state-message strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.state-message p {
  margin: 0;
  color: var(--muted);
}

.state-message.loading {
  border-style: dashed;
  background: #f8fafc;
}

.state-message.error {
  border-color: #fecaca;
  background: #fef2f2;
}

.state-message.error strong {
  color: #b91c1c;
}

.state-message.no-match {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.state-message.empty-db {
  border-color: #fde68a;
  background: #fffbeb;
}

.source-panel {
  padding: 16px;
  margin-top: 18px;
}

.source-panel p {
  margin: 12px 0;
}

.source-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.source-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.source-group h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.source-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 920px) {
  .job-list {
    grid-template-columns: 1fr;
  }

  .filter-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .sync-box {
    width: 100%;
    align-items: stretch;
  }

  main {
    width: min(100% - 20px, 1180px);
    margin-top: 14px;
  }

  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-row,
  .source-groups,
  .details-grid,
  .location-detail-grid,
  .review-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .primary-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .focus-block {
    flex-direction: column;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions button,
  .actions a,
  .overflow-menu summary {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .dialog-head,
  .dialog-actions {
    flex-direction: column;
  }

  .dialog-actions a,
  .dialog-actions button {
    width: 100%;
    text-align: center;
  }

  .review-dialog {
    width: 100%;
    max-height: 88vh;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
  }

  .location-block {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .location-badge {
    grid-column: 2;
    justify-self: start;
    margin-left: 0;
  }
}
