:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #18202a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 6px; padding: 10px 14px; background: #1f5f8b; color: #fff; }
button:hover { background: #174b70; }
button.ghost, button.back { background: #e7ebef; color: #17202a; }
button.ghost:hover, button.back:hover { background: #d8dee5; }

.guidelineActions { justify-content: space-between; }
.aiSupplementButton { margin-left: auto; background: #d8f3ef; color: #0e5f57; border: 1px solid #8fd6cd; }
.aiSupplementButton:hover { background: #c3ebe5; }
.aiSupplementButton:disabled { background: #e8f5f3; color: #6f928d; cursor: not-allowed; }


.banner { width: 100%; background: #fff; border-bottom: 1px solid #dfe3e8; }
.banner img { display: block; width: 100%; max-height: 220px; object-fit: contain; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 18px max(28px, calc((100% - 1180px) / 2 + 16px)); background: #fff; border-bottom: 1px solid #dfe3e8; }
.brand { font-size: 22px; font-weight: 700; }
#userLine { font-size: 18px; font-weight: 600; color: #2f3a45; }
.muted { color: #66717d; }
main { width: min(1180px, calc(100% - 32px)); margin: 28px auto; }

.appShell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.sideNav { display: grid; gap: 8px; background: #fff; border: 1px solid #dfe3e8; border-radius: 8px; padding: 10px; }
.navItem { width: 100%; text-align: left; background: #fff; color: #18202a; border: 1px solid transparent; }
.navItem:hover { background: #eef5fa; border-color: #c3d8e7; }
.navItem.active { background: #1f5f8b; color: #fff; border-color: #1f5f8b; }
.caseHome { background: #fff; border: 1px solid #dfe3e8; border-radius: 8px; padding: 24px; min-width: 0; }
.panel, .workspace { background: #fff; border: 1px solid #dfe3e8; border-radius: 8px; padding: 24px; }
.hero { margin-bottom: 22px; }
.hero h1 { margin: 0 0 6px; font-size: 30px; }
.hero p { margin: 0; color: #66717d; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.action { text-align: left; min-height: 130px; display: flex; flex-direction: column; gap: 10px; justify-content: center; background: #fff; color: #18202a; border: 1px solid #cfd7df; }
.action:hover { background: #eef5fa; border-color: #8fb6d2; }
.action span { font-size: 20px; font-weight: 700; }
.action small { color: #66717d; line-height: 1.4; }
.sectionHead { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.sectionHead h2 { margin: 0; }
.gridForm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
input, textarea, select { width: 100%; border: 1px solid #cfd7df; border-radius: 6px; padding: 10px 12px; background: #fff; color: #18202a; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
.wide { grid-column: 1 / -1; }
.row { display: flex; gap: 10px; align-items: center; }
.result { white-space: pre-wrap; background: #f0f3f6; border-radius: 6px; padding: 14px; overflow: auto; }
.reviewLayout { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 18px; }
.list { display: grid; gap: 10px; margin-top: 12px; }
.listItem { border: 1px solid #dfe3e8; border-radius: 6px; padding: 12px; background: #fff; text-align: left; color: #18202a; }
.listItem:hover { background: #eef5fa; }
.detail { border: 1px solid #dfe3e8; border-radius: 6px; padding: 16px; background: #fff; min-height: 260px; overflow: auto; }
.detail pre { white-space: pre-wrap; overflow: auto; background: #f0f3f6; padding: 12px; border-radius: 6px; }
.danger { background: #9b2d30; }
.danger:hover { background: #7e2427; }
@media (max-width: 760px) {
  .actions, .gridForm, .reviewLayout, .appShell { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; }
}
select { height: 48px; }
.authorStep h3 { margin: 0 0 16px; }
.choiceGroup { border: 1px solid #cfd7df; border-radius: 6px; padding: 12px; margin: 0; display: flex; gap: 18px; flex-wrap: wrap; }
.choiceGroup legend { font-weight: 700; padding: 0 6px; }
.choiceGroup label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.choiceGroup input { width: auto; }
.splitRow { justify-content: space-between; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
.metadataGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.questionBlocks, .itemBlocks { display: grid; gap: 18px; }
.questionBlock, .brainstormingBlock, .examinationBlock, .diagnosisBlock, .procedureBlock, .procedureControlBlock, .finalDiagnosisBlock { display: grid; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid #dfe3e8; }
.questionBlock:last-child, .brainstormingBlock:last-child, .examinationBlock:last-child, .diagnosisBlock:last-child, .procedureBlock:last-child, .procedureControlBlock:last-child, .finalDiagnosisBlock:last-child { border-bottom: 0; }
.questionActions { margin-top: 18px; }
@media (max-width: 760px) { .metadataGrid { grid-template-columns: 1fr; } }
.stepTitleRow { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.stepTitleRow h3 { margin: 0; }
@media (max-width: 760px) { .stepTitleRow { align-items: stretch; flex-direction: column; } }

.stepPrompt { margin: 0 0 16px; color: #3d4955; line-height: 1.45; }
.fieldGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .fieldGrid { grid-template-columns: 1fr; } }
.compactBlocks { gap: 12px; }
.inlineHint { margin: 0; color: #66717d; font-size: 14px; line-height: 1.4; }
.procedureControlBlock h4 { margin: 4px 0 0; font-size: 16px; }

.smallText { font-size: 14px; margin: 4px 0 0; }
.compactMeta { max-width: 520px; }
.caseRow { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.caseRowMain { display: grid; gap: 3px; min-width: 0; }
.statusBadge { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 999px; padding: 4px 9px; font-size: 13px; font-weight: 700; background: #e7ebef; color: #26313d; }
.statusBadge.selectable { background: #dbeee3; color: #174f2b; }
.statusBadge.locked { background: #f0e3df; color: #7d3324; }
.listItem:disabled { cursor: not-allowed; opacity: 0.72; }
.listItem:disabled:hover { background: #fff; }
@media (max-width: 760px) { .caseRow { align-items: flex-start; flex-direction: column; } }

.polWorkspace { padding: 20px; }
.polLayout { display: grid; grid-template-columns: minmax(280px, 38%) minmax(0, 1fr); gap: 18px; align-items: start; }
.caseFile { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; border: 1px solid #dfe3e8; border-radius: 8px; background: #f9fafb; padding: 16px; }
.caseFile h3 { margin: 0 0 12px; }
.caseFileContent { display: grid; gap: 16px; }
.caseFileSection { display: grid; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid #dfe3e8; }
.caseFileSection:last-child { border-bottom: 0; padding-bottom: 0; }
.caseFileSection h4 { margin: 0; font-size: 15px; }
.caseFileSection p { margin: 0; line-height: 1.45; }
.caseFileEntry { display: grid; gap: 6px; border: 1px solid #dfe3e8; border-radius: 6px; background: #fff; padding: 10px; }
.polStep { min-width: 0; position: relative; z-index: 1; }
.polCard { display: grid; gap: 14px; border: 1px solid #dfe3e8; border-radius: 8px; background: #fff; padding: 20px; }
.polCard h3 { margin: 0; }
.feedbackBox { border-left: 4px solid #1f5f8b; background: #eef5fa; border-radius: 6px; padding: 12px; color: #26313d; }
.feedbackBox.success { border-left-color: #2f80b7; background: #eaf5fc; }
.feedbackBox.warning { border-left-color: #b26a00; background: #fff4df; }
.feedbackBox.neutral { border-left-color: #8291a1; background: #f4f6f8; }
.mediaGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.mediaTile { width: 100%; min-height: 120px; padding: 0; border: 1px solid #dfe3e8; border-radius: 6px; background: #fff; color: #18202a; overflow: hidden; display: grid; place-items: center; }
.mediaTile:hover { background: #eef5fa; border-color: #8fb6d2; }
.mediaTile img, .mediaTile video { width: 100%; max-height: 220px; object-fit: contain; background: #fff; }
.pdfTile { padding: 18px; font-weight: 700; color: #1f5f8b; overflow-wrap: anywhere; }
.mediaPreview { position: fixed; inset: 0; z-index: 50; background: rgba(18, 26, 34, 0.78); padding: 24px; }
.mediaPreview[hidden] { display: none; }
.mediaPreviewPanel { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 20px 80px rgba(0,0,0,0.35); }
.mediaPreviewHead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #dfe3e8; }
.mediaPreviewBody { min-height: 0; overflow: auto; background: #f6f7f9; padding: 16px; text-align: center; }
.mediaPreviewBody img { max-width: 100%; height: auto; background: #fff; }
.mediaPreviewBody video { width: min(100%, 1200px); max-height: 100%; background: #fff; }
.mediaPreviewBody iframe { width: 100%; height: 100%; min-height: 70vh; border: 0; background: #fff; }
@media (max-width: 900px) {
  .polLayout { grid-template-columns: 1fr; }
  .caseFile { position: static; max-height: none; }
}

.polCard textarea { min-height: 132px; pointer-events: auto; }

.caseManagementRow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; cursor: pointer; }
.caseManagementRow:focus { outline: 2px solid #8fb6d2; outline-offset: 2px; }
.caseOpenButton { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: #18202a; text-align: left; }
.caseOpenButton:hover { background: transparent; }
.caseCreator { color: #3d4955; }
.caseManagementControls { display: flex; align-items: center; gap: 10px; }
@media (max-width: 760px) { .caseManagementRow { grid-template-columns: 1fr; } .caseManagementControls { justify-content: space-between; } }

.suggestionList { display: grid; gap: 12px; margin-top: 12px; }
.suggestionCard { display: grid; gap: 8px; border: 1px solid #d7dde3; border-radius: 6px; background: #fff; padding: 12px; }
.suggestionCard.accepted { border-color: #2f80b7; background: #eaf5fc; }
.suggestionCard.rejected, .suggestionCard.skipped { opacity: 0.66; }
.suggestionCardHead { display: flex; gap: 8px; align-items: center; justify-content: space-between; color: #4b5865; font-size: 13px; }
.suggestionCategory { font-weight: 700; }
.suggestionCard p { margin: 0; white-space: pre-wrap; line-height: 1.45; }
.suggestionActions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.blockRemoveRow { display: flex; justify-content: flex-end; }
.blockRemoveButton { padding: 8px 10px; font-size: 14px; }
