:root {
  --ai-navy: #0d2a45;
  --ai-blue: #1976d2;
  --ai-teal: #0f8b8d;
  --ai-soft: #f3f7fb;
  --ai-border: #d9e3ed;
}

.ai-loading { min-height: 280px; display: grid; place-content: center; text-align: center; }
.ai-spinner { width: 34px; height: 34px; border: 3px solid #dce8f2; border-top-color: var(--ai-blue); border-radius: 50%; animation: ai-spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes ai-spin { to { transform: rotate(360deg); } }

.ai-hero { background: linear-gradient(130deg, #0d2a45, #164d78); color: #fff; border-radius: 16px; padding: 28px 30px; display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 18px; box-shadow: 0 10px 24px rgba(13,42,69,.15); }
.ai-hero.employee { background: linear-gradient(130deg, #123653, #0f777a); }
.ai-hero h2 { color: #fff; margin: 5px 0 8px; font-size: clamp(1.35rem, 2.1vw, 2rem); }
.ai-hero p { margin: 0; max-width: 800px; color: rgba(255,255,255,.86); line-height: 1.55; }
.ai-hero .eyebrow { color: #83d7ff; }
.ai-hero .button-row { flex: 0 0 auto; }
.ai-hero .ghost { color: #fff; border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.08); }
.ai-plan-controls { display: grid; grid-template-columns: minmax(160px,1fr) auto; gap: 10px; align-items: center; flex: 0 0 auto; }
.ai-plan-controls input { min-width: 0; background: #fff; color: #17283a; }

.cards-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.ai-metrics .card { min-width: 0; }
.ai-dashboard-grid { align-items: start; margin-top: 18px; }
.ai-dashboard-grid > .card { min-width: 0; overflow: hidden; }
.ai-guardrail { margin-top: 18px; border-left: 4px solid #d69819; background: #fffaf0; }
.ai-guardrail p { margin-bottom: 0; }

.ai-list { display: grid; }
.ai-list article { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--ai-border); }
.ai-list article:last-child { border-bottom: 0; }
.ai-list article > div { min-width: 0; }
.ai-list article > div:last-child { text-align: right; display: grid; justify-items: end; gap: 6px; }
.ai-list strong, .ai-list p, .ai-list small { overflow-wrap: anywhere; }
.ai-list p { margin: 4px 0; color: #5c6c7b; }
.ai-list small { display: block; color: #788694; }
.ai-coach-inline { color: #815d05 !important; }

.ai-form-layout { grid-template-columns: minmax(290px,.75fr) minmax(0,1.6fr); align-items: start; gap: 18px; }
.ai-sticky-card { position: sticky; top: 18px; }
.ai-form { display: grid; gap: 8px; }
.ai-form label { margin-top: 7px; }
.ai-check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; line-height: 1.45; }
.ai-check input { width: auto; margin-top: 3px; flex: 0 0 auto; }
.ai-button-field { display: flex; align-items: end; }
.ai-button-field button { width: 100%; }

.ai-card-list { display: grid; gap: 14px; }
.ai-card-list > article { border: 1px solid var(--ai-border); border-radius: 12px; padding: 17px; background: #fff; min-width: 0; }
.ai-card-list p { overflow-wrap: anywhere; line-height: 1.5; }
.ai-card-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.ai-card-top > div { min-width: 0; }
.ai-card-top strong { font-size: 1.04rem; color: var(--ai-navy); overflow-wrap: anywhere; }
.ai-card-top p { margin: 5px 0 0; color: #66788a; }
.ai-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; font-size: .82rem; color: #6b7d8d; border-top: 1px solid #e8eef4; padding-top: 12px; margin-top: 12px; }
.ai-obligation-review { display: grid; gap: 10px; margin-top: 12px; }
.ai-obligation-review > div { background: var(--ai-soft); border-radius: 9px; padding: 12px; }
.ai-obligation-review-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ai-obligation-review-head > div { min-width: 0; }
.ai-obligation-review-head .badge { margin-left: 8px; }
.ai-obligation-review-head button { flex: 0 0 auto; }
.ai-obligation-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
.ai-obligation-actions button { white-space: nowrap; }
.ai-obligation-review p { margin: 5px 0; }
.ai-modal-form textarea { min-height: 92px; }
details summary { cursor: pointer; color: var(--ai-blue); font-weight: 650; margin-top: 12px; }

.ai-table-wrap { width: 100%; max-width: 100%; overflow: auto; }
.ai-table { width: 100%; min-width: 1050px; table-layout: fixed; }
.ai-table th:nth-child(1) { width: 19%; }
.ai-table th:nth-child(2) { width: 17%; }
.ai-table th:nth-child(3) { width: 12%; }
.ai-table th:nth-child(4) { width: 10%; }
.ai-table th:nth-child(5) { width: 13%; }
.ai-table th:nth-child(6) { width: 21%; }
.ai-table th:nth-child(7) { width: 8%; }
.ai-table td { vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
.ai-table td small { display: block; margin-top: 5px; color: #718190; }
.ai-source { font-size: .86rem; line-height: 1.4; overflow-wrap: anywhere; }
.ai-commitment-table { min-width: 1360px; }
.ai-commitment-table th:nth-child(1) { width: 4%; }
.ai-commitment-table th:nth-child(2) { width: 19%; }
.ai-commitment-table th:nth-child(3) { width: 9%; }
.ai-commitment-table th:nth-child(4) { width: 12%; }
.ai-commitment-table th:nth-child(5) { width: 10%; }
.ai-commitment-table th:nth-child(6) { width: 12%; }
.ai-commitment-table th:nth-child(7) { width: 11%; }
.ai-commitment-table th:nth-child(8) { width: 14%; }
.ai-commitment-table th:nth-child(9) { width: 9%; }
.ai-select-cell { text-align: center; }
.ai-select-cell input, .ai-card-selector input { width: 19px; height: 19px; margin: 0; accent-color: var(--ai-blue); cursor: pointer; }
.ai-table-actions { display: grid; gap: 7px; align-content: start; }
.ai-table-actions button { width: 100%; min-width: 82px; white-space: nowrap; }
.ai-goal-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ai-border); flex-wrap: wrap; }
.ai-point-list { margin: 16px 0; padding-left: 24px; display: grid; gap: 9px; }
.ai-point-list li { line-height: 1.55; padding-left: 4px; }
.ai-point-list li::marker { color: var(--ai-teal); font-size: 1.05em; }
.ai-commitment-mobile { display: none; }
#commitmentCompanyFilter { width: min(280px, 100%); min-width: 220px; }
.ai-bulk-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; padding: 14px 16px; border: 1px solid var(--ai-border); border-radius: 10px; background: var(--ai-soft); }
.ai-bulk-toolbar > div:first-child { display: grid; gap: 3px; }
.ai-bulk-toolbar > div:first-child span { color: #63778a; font-size: .88rem; }
.ai-bulk-toolbar .button-row { justify-content: flex-end; }
.ai-bulk-toolbar button:disabled { cursor: not-allowed; opacity: .52; }
.ai-commitment-mobile article { border: 1px solid var(--ai-border); border-radius: 12px; padding: 16px; background: #fff; min-width: 0; }
.ai-card-selector { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.ai-card-selector label { display: inline-flex; align-items: center; gap: 8px; color: var(--ai-navy); font-weight: 700; cursor: pointer; }
.ai-commitment-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 14px 0; }
.ai-commitment-fields > div { display: grid; align-content: start; gap: 5px; min-width: 0; }
.ai-commitment-fields small { color: #687b8c; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ai-commitment-fields strong, .ai-commitment-fields span { overflow-wrap: anywhere; }

.ai-output-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 14px 0; }
.ai-output-grid > div { background: var(--ai-soft); border-radius: 9px; padding: 12px; min-width: 0; }
.ai-output-grid small { display: block; text-transform: uppercase; letter-spacing: .05em; color: #6f7e8d; font-weight: 700; }
.ai-output-grid p { margin: 5px 0 0; }
.ai-coach { background: #fff8df; border: 1px solid #ead594; border-radius: 10px; padding: 12px 14px; margin: 12px 0; color: #624b0e; }
.ai-coach p { margin: 4px 0 0; }
.ai-guidance { display: grid; gap: 6px; }
.ai-guidance strong { color: var(--ai-navy); margin-top: 8px; }
.ai-guidance p { margin: 0 0 8px; line-height: 1.55; color: #526577; }

.ai-priority-list { display: grid; gap: 16px; }
.ai-priority { border-left: 5px solid #7c8d9e; }
.ai-priority.priority-1 { border-left-color: #c93d3d; }
.ai-priority.priority-2 { border-left-color: #d98318; }
.ai-priority.priority-3 { border-left-color: #1976d2; }
.ai-next-action, .ai-initiative, .ai-response { border-radius: 10px; padding: 13px 15px; margin: 12px 0; }
.ai-next-action { background: #edf6ff; border: 1px solid #cce2f6; display: grid; gap: 4px; }
.ai-next-action small { text-transform: uppercase; color: #52728e; font-weight: 700; letter-spacing: .04em; }
.ai-initiative { background: #eef9f6; border: 1px solid #cde9df; }
.ai-initiative p, .ai-response p { margin: 4px 0 0; }
.ai-response { background: #f7f2ff; border: 1px solid #ddcff4; }
.ai-response-buttons { flex-wrap: wrap; margin-top: 14px; }

.ai-score-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; margin: 14px 0; }
.ai-score-grid span { background: var(--ai-soft); border-radius: 10px; padding: 13px; display: grid; gap: 5px; min-width: 0; }
.ai-score-grid small { color: #647687; line-height: 1.35; }
.ai-score-grid strong { font-size: 1.35rem; color: var(--ai-navy); }
.ai-score-grid .overall { background: var(--ai-navy); }
.ai-score-grid .overall small, .ai-score-grid .overall strong { color: #fff; }
.ai-score-grid.large { grid-template-columns: repeat(4,minmax(0,1fr)); }
.ai-score-grid.large .overall { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.ai-manager-note { background: #f6f8fa; padding: 14px; border-radius: 10px; }
.ai-manager-note p { margin-bottom: 0; }

.ai-team-plan-list { display: grid; gap: 18px; }
.ai-team-plan-card { overflow: hidden; }
.ai-plan-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.ai-plan-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 16px 0; }
.ai-plan-summary span { background: var(--ai-soft); border-radius: 10px; padding: 12px; display: grid; gap: 4px; }
.ai-plan-summary strong { color: var(--ai-navy); font-size: 1.25rem; }
.ai-plan-summary small { color: #66798a; line-height: 1.35; }
.ai-plan-columns { align-items: start; gap: 16px; }
.ai-plan-columns > section { min-width: 0; }
.ai-plan-columns h3 { color: var(--ai-navy); margin: 4px 0 10px; }
.ai-card-list.compact { gap: 9px; }
.ai-card-list.compact > article { padding: 13px; background: #fbfdff; }
.ai-card-list.compact p { margin: 6px 0; }
.ai-learning-note { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--ai-teal); background: #eef9f7; border-radius: 6px; color: #315d5d; line-height: 1.45; overflow-wrap: anywhere; }
.ai-jd-strip { margin-bottom: 18px; }
.ai-jd-coverage { display: grid; gap: 9px; }
.ai-jd-coverage > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 11px 13px; border: 1px solid var(--ai-border); border-radius: 9px; background: #fbfdff; }
.ai-jd-coverage > div > div { min-width: 0; display: grid; gap: 4px; }
.ai-jd-coverage strong, .ai-jd-coverage small { overflow-wrap: anywhere; }
.ai-jd-coverage small { color: #687b8c; }
.ai-jd-coverage > div > span { min-width: 58px; padding: 7px 9px; border-radius: 999px; background: #eaf4ff; color: #175f9b; text-align: center; font-weight: 750; }

/* Global containment: wide operational tables scroll inside their card instead of escaping it. */
#content, #content > *, .card, .table-wrap { min-width: 0; max-width: 100%; }
.table-wrap { overflow-x: auto; overscroll-behavior-inline: contain; }
.table-wrap table { max-width: none; }

.memo-revision { margin-top: 10px; border: 1px solid var(--ai-border); border-radius: 10px; background: #fbfdff; overflow: hidden; }
.memo-revision summary { cursor: pointer; padding: 13px 15px; font-weight: 700; color: var(--ai-navy); }
.memo-revision[open] summary { border-bottom: 1px solid var(--ai-border); }
.memo-revision > .progress-note, .memo-revision > .table-wrap { margin: 12px; }
.button-row { flex-wrap: wrap; }

@media (max-width: 1180px) {
  .cards-5 { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .ai-score-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 820px) {
  .ai-hero { display: grid; padding: 22px; }
  .ai-form-layout, .ai-output-grid, .ai-score-grid, .ai-score-grid.large { grid-template-columns: 1fr; }
  .ai-plan-controls { grid-template-columns: 1fr; width: 100%; }
  .ai-plan-summary, .ai-plan-columns { grid-template-columns: 1fr; }
  .ai-sticky-card { position: static; }
  .ai-score-grid.large .overall { grid-column: auto; }
  .cards-5 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ai-bulk-toolbar { align-items: stretch; flex-direction: column; }
  .ai-bulk-toolbar .button-row { justify-content: flex-start; }
  .ai-commitment-table-wrap { display: none; }
  .ai-commitment-mobile { display: grid; gap: 12px; }
}

@media (max-width: 520px) {
  .cards-5 { grid-template-columns: 1fr; }
  .ai-card-top, .ai-list article { grid-template-columns: 1fr; display: grid; }
  .ai-list article > div:last-child { text-align: left; justify-items: start; }
  .ai-response-buttons button { width: 100%; }
  .ai-obligation-review-head { display: grid; }
  .ai-obligation-actions { justify-content: stretch; }
  .ai-obligation-actions button { width: 100%; }
  .ai-commitment-fields { grid-template-columns: 1fr; }
  .ai-plan-badges { justify-content: flex-start; }
  .ai-jd-coverage > div { grid-template-columns: 1fr; }
  .ai-jd-coverage > div > span { justify-self: start; }
}
