/* TransPlan Web — styles */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  background: #f5f5f5;
  color: #222;
  min-height: 100vh;
}

/* ===== Header ===== */
.site-header {
  background: #1a3a6c;
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-brand   { display: flex; align-items: baseline; gap: 12px; }
.site-title   { font-size: 18px; font-weight: 700; }
.site-subtitle { font-size: 12px; opacity: .75; }
.site-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}
.site-user-name  { font-size: 13px; font-weight: 600; }
.site-user-email { font-size: 11px; opacity: .75; }

/* ===== Flash messages ===== */
.flash {
  padding: 10px 20px;
  font-size: 13px;
  border-left: 4px solid;
}
.flash-success { background: #e8f5e9; border-color: #4caf50; }
.flash-error   { background: #fdecea; border-color: #f44336; }
.flash-warning { background: #fff8e1; border-color: #ffc107; }
/* ===== User-created modal ===== */
.modal-user-created { width: 400px; padding: 0; overflow: hidden; text-align: center; }
.muc-header {
  background: #1a3a6c; color: #fff;
  padding: 28px 24px 22px;
}
.muc-check {
  font-size: 36px; line-height: 1;
  width: 56px; height: 56px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.muc-title { font-size: 20px; font-weight: 700; margin: 0; color: #fff; }
.muc-body  { padding: 24px; }
.muc-name  { font-size: 16px; font-weight: 700; color: #1a1a1a; margin-bottom: 4px; }
.muc-email { font-size: 13px; color: #888; margin-bottom: 0; }
.muc-divider { border: none; border-top: 1px solid #eee; margin: 20px 0; }
.muc-url-label {
  font-size: 11px; font-weight: 600; color: #888;
  text-transform: uppercase; letter-spacing: .05em;
  text-align: left; margin-bottom: 6px;
}
.muc-url-row { display: flex; gap: 6px; margin-bottom: 20px; }
.muc-url-input {
  flex: 1; min-width: 0; font-size: 12px; font-family: monospace;
  padding: 6px 8px; border: 1px solid #ddd; border-radius: 4px;
  background: #f5f7fa; cursor: pointer; color: #333;
}
.muc-url-input:focus { outline: none; }
.btn-clipboard {
  flex-shrink: 0; padding: 6px 10px; font-size: 15px; line-height: 1;
  background: #f5f7fa; border: 1px solid #ddd; border-radius: 4px; cursor: pointer;
}
.btn-clipboard:hover { background: #e8ecf2; }
.muc-ok { width: 100%; }

/* ===== Main content ===== */
main { padding: 20px; }

.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.page-header h1 { font-size: 20px; font-weight: 600; }
.back-link { font-size: 12px; color: #666; text-decoration: none; display: block; margin-bottom: 2px; }
.back-link:hover { color: #1a3a6c; }

/* ===== Buttons ===== */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger, .btn-warning, .btn-generate, .btn-save, .btn-success {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 14px; border-radius: 4px;
  border: none; cursor: pointer; font-size: 13px; font-weight: 500;
  text-decoration: none; line-height: 1.4;
}
.btn-success       { background: #2e7d32; color: #fff; }
.btn-success:hover { background: #1b5e20; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary   { background: #1a3a6c; color: #fff; }
.btn-primary:hover   { background: #14306a; }
.btn-secondary { background: #e0e7ef; color: #1a3a6c; }
.btn-secondary:hover { background: #cdd7e7; }
.btn-ghost     { background: transparent; color: #555; border: 1px solid #ccc; }
.btn-ghost:hover     { background: #eee; }
.btn-danger    { background: #d32f2f; color: #fff; }
.btn-danger:hover    { background: #b71c1c; }
.btn-warning   { background: #f9a825; color: #1a1a1a; }
.btn-warning:hover   { background: #f57f17; }
.btn-generate  { background: #2e7d32; color: #fff; padding: 10px 24px; font-size: 15px; width: 100%; }
.btn-generate:hover  { background: #1b5e20; }
.btn-save      { background: #1565c0; color: #fff; padding: 6px 18px; }
.btn-save:hover      { background: #0d47a1; }

/* ===== Tab navigation ===== */
.tab-nav { display: flex; border-bottom: 2px solid #ddd; margin-bottom: 16px; gap: 0; }
.tab {
  padding: 8px 20px; text-decoration: none; color: #555; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: #1a3a6c; }
.tab.active { color: #1a3a6c; border-bottom-color: #1a3a6c; font-weight: 600; }

/* ===== Dashboard program list ===== */
.program-list { width: 100%; border-collapse: collapse; }
.program-list th { background: #f0f3f8; color: #1a3a6c; text-align: left; padding: 8px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.program-list td { padding: 8px 12px; border-bottom: 1px solid #eee; }
.program-list tr:last-child td { border-bottom: none; }
.actions { display: flex; gap: 6px; }

/* ===== Generate tab layout ===== */
.generate-layout {
  display: grid;
  grid-template-columns: 1fr 260px 220px;
  gap: 16px;
  align-items: start;
  max-width: 80rem;
}
.quarter-blocks-column {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.pane {
  background: #fff; border-radius: 6px; padding: 14px; overflow: hidden;
}
.pane h2 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

/* ===== Requirement table ===== */
.req-table-wrapper { overflow-x: auto; max-height: 70vh; overflow-y: auto; }
.req-table {
  border-collapse: collapse; width: 100%; font-size: 13px;
}
.req-table th {
  position: sticky; top: 0; z-index: 2;
  background: #e8edf3; text-align: left; padding: 6px 8px;
  border-bottom: 2px solid #c5cfe0; white-space: nowrap;
}
.req-table td { padding: 4px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.req-editable .col-desc,
.req-readonly  .col-desc { position: relative; }
.req-readonly .col-type    { width: 1%; }
.req-readonly .col-courses { width: 160px; }
.req-readonly .col-count   { width: 1%; white-space: nowrap; }
.tree-lines {
  position: absolute; top: 0; left: 0; right: 0; bottom: -1px;
  pointer-events: none;
}

/* Row type colours (mirror xlsx scheme) */
.row-section      { background: #1F3864; color: #fff; font-weight: 700; }
.row-requirement  { background: #fff; }
.row-exception    { background: #fce4d6; }
.row-choice-group { background: #bdd7ee; }
.row-option       { background: #ddebf7; }
.row-pool         { background: #ebf3fb; }
.row-note         { background: #f2f2f2; color: #595959; font-style: italic; }
.row-block        { background: #e8e0f0; color: #4a235a; font-weight: 600; }
.row-if           { background: #fff2cc; color: #7d5f00; font-weight: 600; }
.row-else-if      { background: #ffe699; color: #7d5f00; }
.row-else         { background: #ffd966; color: #7d5f00; }

/* Indent via CSS custom property --indent */
.col-desc { padding-left: calc(var(--indent, 0) * 14px + 6px) !important; }
.col-type  { white-space: nowrap; }

/* ===== Mappings pane ===== */
.mappings-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mappings-table th { text-align: left; padding: 4px 6px; color: #555; font-weight: 600; }
.mappings-table td { padding: 3px 6px; }
.mappings-table-sm { width: 100%; border-collapse: collapse; font-size: 12px; }
.mappings-table-sm td { padding: 2px 4px; }
.arrow { color: #888; text-align: center; padding: 0 4px; }
.mapping-note { font-size: 12px; color: #888; margin-top: 8px; font-style: italic; }
.mappings-aside { margin-bottom: 12px; font-size: 13px; }
.mappings-aside summary { cursor: pointer; font-weight: 600; color: #555; padding: 4px 0; }

/* Generate button pane */
.pane-generate p { font-size: 13px; color: #555; margin-bottom: 16px; line-height: 1.5; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: #fff; border-radius: 8px; padding: 24px; max-width: 420px; width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 10px; }
.modal p  { font-size: 13px; color: #444; line-height: 1.5; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== Block table headers ===== */
.block-table-header {
  display: flex; align-items: center; justify-content: space-between;
  background: #f0e8f8; padding: 6px 10px; border-left: 3px solid #9c4dcc;
  gap: 12px; margin-bottom: 10px;
}
.pane-block {
  border-top: 3px solid #9c4dcc;
}
.block-header-fields { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.block-header-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.block-header-label { font-size: 12px; color: #555; display: flex; align-items: center; gap: 4px; }
.block-id-input   { width: 120px; font-size: 12px; padding: 2px 5px; border: 1px solid #ccc; border-radius: 3px; font-family: monospace; }
.block-name-input { width: 240px; font-size: 12px; padding: 2px 5px; border: 1px solid #ccc; border-radius: 3px; }
.btn-merge-block {
  background: #fff8e1; color: #795548; border: 1px solid #f9a825;
  border-radius: 4px; padding: 3px 10px; font-size: 12px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.btn-merge-block:hover { background: #f9a825; color: #fff; }

.btn-delete-block {
  background: #fdecea; color: #c62828; border: 1px solid #f44336;
  border-radius: 4px; padding: 3px 10px; font-size: 12px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.btn-delete-block:hover { background: #f44336; color: #fff; }

.add-block-bar { padding: 10px 0; }
.btn-add-block {
  background: #ede7f6; color: #4a235a; border: 1px solid #9c4dcc;
  border-radius: 4px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.btn-add-block:hover { background: #9c4dcc; color: #fff; }

/* ===== Refine tab ===== */
.refine-layout { display: flex; flex-direction: column; gap: 10px; }

.refine-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; padding: 8px 14px; border-radius: 6px;
  position: sticky; top: 0; z-index: 5;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
}
.refined-at  { font-size: 12px; color: #888; }
.toolbar-right { display: flex; align-items: center; gap: 12px; }
.dirty-indicator { font-size: 12px; color: #e65100; }

.col-ctrl  { width: 60px; }
.col-valid { width: 36px; text-align: center; font-weight: 700; }
.col-constraints { font-size: 11px; color: #666; }
.valid   { color: #2e7d32; }
.invalid { color: #c62828; }

.row-controls { display: flex; gap: 4px; }
.ctrl-btn {
  background: #fff; border: 1px solid #ccc; border-radius: 3px;
  cursor: pointer; font-size: 13px; padding: 1px 5px; line-height: 1;
}
.ctrl-btn:hover        { background: #e8f5e9; border-color: #388e3c; color: #000; }
.ctrl-delete:hover     { background: #fdecea; border-color: #f44336; color: #000; }
.ctrl-indent           { display: flex; margin-left: 2px; border-left: 1px solid #ddd; padding-left: 4px; }
.ctrl-indent-btn       { border-radius: 0; padding: 1px 3px; font-size: 11px; }
.ctrl-indent-btn:first-child { border-radius: 3px 0 0 3px; }
.ctrl-indent-btn:last-child  { border-radius: 0 3px 3px 0; margin-left: -1px; }
.ctrl-indent-btn:disabled    { opacity: .3; cursor: default; }
.ctrl-indent-btn:disabled:hover { background: #fff; border-color: #ccc; color: inherit; }

/* Inline edit inputs */
.req-editable td input[type="text"],
.req-editable td textarea,
.req-editable td select {
  width: 100%; font-size: 13px; padding: 2px 4px;
  border: 1px solid #90caf9; border-radius: 3px; outline: none;
  font-family: inherit;
}
.req-editable td input[type="text"]:focus,
.req-editable td textarea:focus,
.req-editable td select:focus { border-color: #1565c0; }

.req-editable .col-courses { width: 160px; }
.req-editable td textarea.input-courses,
.req-editable td textarea.input-desc {
  resize: none; field-sizing: content;
  min-height: 1.8em; max-height: 12em;
}

/* Count input rendered as plain text when not in edit mode */
.req-editable td input.input-as-text,
.req-editable td input.input-as-text:focus {
  background: transparent; border-color: transparent; cursor: default;
}

.constraint-hazard { color: #c62828; font-weight: 600; }
.constraint-share  { color: #e65100; }
.constraint-cond   { color: #6a1b9a; font-style: italic; }

.save-result {
  padding: 10px 16px; border-radius: 6px; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
}
.save-ok   { background: #e8f5e9; color: #2e7d32; }
.save-warn { background: #fff8e1; color: #e65100; }
.save-err  { background: #fdecea; color: #c62828; }

/* ===== Admin panel ===== */
.admin-section { background: #fff; border-radius: 6px; padding: 16px; }
.admin-section h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.admin-section h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.admin-table th { background: #e8edf3; text-align: left; padding: 6px 10px; }
.admin-table td { padding: 6px 10px; border-bottom: 1px solid #f0f0f0; }
.admin-table tr.row-self td { background: #fffde7; }
.admin-table tbody + tbody > tr:first-child > td { border-top: 2px solid #e8edf3; }
.path { font-family: monospace; font-size: 11px; color: #555; }

/* ===== Users tab inner tabs ===== */
.inner-tab-nav { display: flex; border-bottom: 1px solid #ddd; margin-bottom: 12px; }
.inner-tab {
  padding: 5px 14px; background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px; font-size: 13px; color: #555; cursor: pointer; font-family: inherit;
}
.inner-tab:hover { color: #1a3a6c; }
.inner-tab.active { color: #1a3a6c; border-bottom-color: #1a3a6c; font-weight: 600; }
.user-expand-td { background: #f5f7fa !important; padding: 8px 14px !important; }
.user-expand-section { margin-bottom: 8px; }
.user-expand-section:last-child { margin-bottom: 0; }
.user-expand-label {
  font-size: 11px; font-weight: 600; color: #666; margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.utab-toolbar {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.utab-toolbar .assign-search-wrap { margin-bottom: 0; flex: 1; margin-right: 12px; }
.modal-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.modal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.modal-form input {
  padding: 7px 10px; border: 1px solid #ccc; border-radius: 4px;
  font-size: 13px; font-family: inherit;
}
.modal-form input:focus { outline: none; border-color: #1a3a6c; box-shadow: 0 0 0 2px rgba(26,58,108,.15); }

.create-form { border-top: 1px solid #eee; padding-top: 16px; display: flex; flex-direction: column; gap: 8px; max-width: 480px; }
.create-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.create-form input[type="text"], .create-form input[type="file"] {
  padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px;
}

/* Programs tab — side-by-side action forms */
.program-forms-row { display: flex; gap: 16px; margin-top: 16px; align-items: flex-start; }
.program-form-card { flex: 1; background: #f5f7fa; border-radius: 8px; padding: 16px; }
.program-form-card .create-form { border-top: none; padding-top: 0; max-width: none; }

.hint { font-size: 12px; color: #888; font-style: italic; }
.muted { color: #888; }
.muted-sm { font-size: 12px; color: #888; margin-bottom: 8px; }

/* ===== Assignments tab ===== */
.assign-search-wrap { margin-bottom: 12px; }
.assign-search-input {
  padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px;
  font-size: 13px; width: 100%; max-width: 360px;
}

.assign-table { width: 100%; border-collapse: collapse; }
.assign-table th {
  background: #e8edf3; text-align: left; padding: 6px 10px; font-size: 13px;
}
.assign-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.assign-user-cell { width: 180px; white-space: nowrap; font-size: 13px; }

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

.assign-label {
  display: inline-flex; align-items: center;
  background: #e3f2fd; border: 1px solid #90caf9; border-radius: 12px;
  padding: 2px 8px; font-size: 12px; font-weight: 500; color: #1565c0;
  cursor: default; white-space: nowrap; transition: background 0.15s;
}
.assign-label--hovered { background: #bbdefb; }

.assign-label-remove {
  max-width: 0; overflow: hidden; opacity: 0;
  background: none; border: none; cursor: pointer;
  color: #c62828; font-size: 14px; font-weight: 700; padding: 0; line-height: 1;
  transition: max-width 0.15s ease, opacity 0.15s ease, padding-right 0.15s ease;
}
.assign-label--hovered .assign-label-remove { max-width: 20px; opacity: 1; padding-right: 3px; }

.assign-add-wrap { position: relative; display: inline-flex; }
.assign-add-btn {
  background: #fff; border: 1px dashed #aaa; border-radius: 12px;
  cursor: pointer; font-size: 14px; padding: 1px 8px; color: #555; line-height: 1.6;
}
.assign-add-btn:hover { background: #e8f5e9; border-color: #388e3c; color: #1b5e20; }

.assign-dropdown {
  position: absolute; z-index: 50; left: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid #ccc; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  min-width: 180px; max-height: 220px; overflow: hidden;
  display: flex; flex-direction: column;
}
.assign-drop-search {
  padding: 6px 8px; border: none; border-bottom: 1px solid #eee;
  font-size: 13px; outline: none; font-family: inherit; flex-shrink: 0;
}
.assign-drop-list { list-style: none; overflow-y: auto; flex: 1; padding: 4px 0; margin: 0; }
.assign-drop-list li { padding: 6px 12px; font-size: 13px; cursor: pointer; }
.assign-drop-list li:hover { background: #e3f2fd; }
.assign-drop-empty { color: #888; font-style: italic; cursor: default !important; }
.assign-drop-empty:hover { background: none !important; }

/* Mappings editor */
.mappings-table-editor { border-collapse: collapse; width: 100%; font-size: 13px; }
.mappings-table-editor th {
  background: #e8edf3; text-align: left; padding: 6px 8px;
  border-bottom: 2px solid #c5cfe0; white-space: nowrap;
}
.mappings-table-editor td { padding: 4px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.mappings-table-editor .col-sem { width: 1%; white-space: nowrap; }
.mappings-table-editor .col-arrow { width: 30px; text-align: center; color: #888; font-weight: 600; }
.mappings-table-editor td input[type="text"] {
  width: 100%; font-size: 13px; padding: 2px 4px;
  border: 1px solid #90caf9; border-radius: 3px; outline: none; font-family: inherit;
}
.mappings-table-editor td input[type="text"]:focus { border-color: #1565c0; }
.mappings-table-editor td input.input-as-text,
.mappings-table-editor td input.input-as-text:focus {
  background: transparent; border-color: transparent; cursor: default;
}
.mappings-actions { display: flex; gap: 10px; margin-top: 12px; }

/* ===== Course hover popup ===== */
.course-popup {
  position: fixed; z-index: 200; max-width: 340px;
  background: #fff; border: 1px solid #c5cfe0; border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15); padding: 12px 14px;
  font-size: 13px; pointer-events: none;
}
.popup-code   { font-family: monospace; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.popup-title  { font-weight: 600; margin-bottom: 6px; }
.popup-credits{ color: #888; font-size: 12px; margin-bottom: 4px; }
.popup-desc   { color: #444; line-height: 1.5; margin-bottom: 6px; font-size: 12px; max-height: 80px; overflow-y: auto; }
.popup-prereq { font-size: 11px; color: #666; border-top: 1px solid #eee; padding-top: 6px; }
.course-code  { cursor: default; border-bottom: 1px dotted #888; }

/* Item 21 — "Needs Description" flash animation */
@keyframes desc-flash {
    0%, 100% { box-shadow: none; }
    /* spread radius 1000px > any realistic cell width, fills the cell without affecting layout */
    50%       { box-shadow: inset 0 0 0 1000px rgba(255, 243, 163, 0.7); }
}
td.desc-flash {
    animation: desc-flash 0.6s ease-in-out 3;
}
td.desc-flash > span {
    font-style: italic;
    color: #b4884d;
}

/* Item 22 — missing catalog entry placeholder */
.desc-missing { color: #888; }

/* ===== Dashboard section cards ===== */
.dashboard-card {
  background: #fff; border-radius: 6px; border: 1px solid #c5cfe0;
  margin-bottom: 20px;
}
.dashboard-card-header {
  padding: 12px 16px; border-bottom: 1px solid #c5cfe0;
  font-size: 15px; font-weight: 600; color: #1a3a6c;
}
.dashboard-card-body { padding: 14px 16px; }
.dashboard-card-body--table { padding: 14px 16px 0; }
.dashboard-card-desc {
  font-size: 13px; color: #444; line-height: 1.6;
  margin-bottom: 14px;
  background: #e8f0fb; border-radius: 6px; padding: 10px 14px;
}

/* ===== Mapper subjects card (dashboard) ===== */
.subjects-card {
  background: #fff; border-radius: 6px; padding: 14px 16px;
  margin-bottom: 16px; border: 1px solid #c5cfe0;
}
.subjects-card-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; color: #1a3a6c; }
.subjects-card-body  { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.subject-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.subject-chip {
  background: #e3f2fd; color: #1565c0; border-radius: 4px;
  padding: 3px 10px; font-size: 12px; font-weight: 600; font-family: monospace;
}

/* ===== Pending mapping update badge ===== */
.badge-pending-update {
  display: inline-block; margin-left: 6px;
  background: #fff8e1; color: #b45309;
  border: 1px solid #fcd34d; border-radius: 4px;
  font-size: 11px; padding: 1px 6px; font-weight: 600;
  text-decoration: none; vertical-align: middle;
}
.badge-pending-update:hover { background: #fef3c7; }

/* ===== Pending update / baseline banners ===== */
.banner-pending-update {
  background: #fff8e1; border-left: 4px solid #ffc107;
  padding: 10px 16px; margin-bottom: 14px; border-radius: 0 4px 4px 0;
  font-size: 13px;
}
.banner-no-baseline {
  background: #f0f9ff; border-left: 4px solid #38bdf8;
  padding: 10px 16px; margin-bottom: 14px; border-radius: 0 4px 4px 0;
  font-size: 13px;
}
.locked-indicator {
  color: #b45309; font-size: 13px; font-style: italic;
}

/* ===== Diff view ===== */
.diff-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start;
}
.diff-column-title {
  font-size: 14px; font-weight: 600; margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 2px solid #ddd;
}
.diff-column-left  .diff-column-title { color: #555; }
.diff-column-right .diff-column-title { color: #1a3a6c; }
.diff-block-name { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #444; }
.diff-row.diff-added       { background: #e8f5e9; }
.diff-row.diff-removed     { background: #fdecea; opacity: .7; }
.diff-row.diff-changed     { background: #fff8e1; }
.diff-row.diff-conflict    { background: #fce7f3; }
.diff-row.diff-placeholder { background: transparent; opacity: 0; pointer-events: none; }

/* ===== Mapping changes before/after table ===== */
.mapping-changes-table-wrap { margin-bottom: 16px; }
.mapping-changes-table {
  border-collapse: collapse; font-size: 13px; background: #fff;
  border-radius: 6px; overflow: hidden;
}
.mapping-changes-table th {
  background: #e8edf3; text-align: left; padding: 5px 12px;
  border-bottom: 2px solid #c5cfe0; white-space: nowrap;
}
.mapping-changes-table td { padding: 5px 12px; border-bottom: 1px solid #f0f0f0; }
.mapping-changes-table tr:last-child td { border-bottom: none; }
.mapping-changes-table .map-old  { color: #b91c1c; }
.mapping-changes-table .map-new  { color: #166534; }
.mapping-changes-table .map-arrow { color: #666; padding: 5px 4px; }

/* ===== Diff legend ===== */
.diff-legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-bottom: 14px; font-size: 12px;
}
.diff-legend-item { display: flex; align-items: center; gap: 5px; }
.diff-legend-item.diff-added    { color: #2e7d32; }
.diff-legend-item.diff-removed  { color: #c62828; }
.diff-legend-item.diff-changed  { color: #b45309; }
.diff-legend-item.diff-conflict { color: #9c2777; }
.diff-legend-item.diff-unchanged { color: #888; }

/* ===== Conflicts box ===== */
.conflicts-box {
  background: #fce7f3; border-left: 4px solid #ec4899;
  padding: 12px 16px; margin-bottom: 16px; border-radius: 0 4px 4px 0;
  font-size: 13px;
}

/* ===== Subject mapper editor ===== */
.subject-section { margin-bottom: 16px; }
.subject-section-title {
  font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 8px 0; color: #1a3a6c; list-style: none;
}
/* Remove WebKit's built-in triangle too */
.subject-section-title::-webkit-details-marker { display: none; }
/* Rotating arrow indicator */
.subject-section-title::before {
  content: '▶';
  display: inline-block;
  margin-right: 7px;
  font-size: 11px;
  color: #1a3a6c;
  transition: transform 0.15s ease;
}
details[open] > .subject-section-title::before {
  transform: rotate(90deg);
}
.subject-entry-count { color: #888; font-weight: 400; font-size: 12px; margin-left: 6px; }
.mappings-actions-small { margin-top: 8px; }

/* ===== Preview modal (wide variant) ===== */
.modal-wide {
  max-width: 700px;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
/* Scrollable body: sits between the h3 and .modal-actions. */
.modal-wide .modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;    /* required: flex children don't shrink below content size otherwise */
}
.modal-loading { color: #666; font-style: italic; padding: 16px 0; }

/* ===== Refine locked message ===== */
.locked-indicator {
  display: inline-block; color: #92400e; font-size: 12px;
  background: #fef3c7; padding: 3px 10px; border-radius: 4px;
}

[x-cloak] { display: none !important; }

/* ===== Help tab ===== */
.help-layout { display: flex; flex-direction: column; gap: 12px; }

.help-overview {
  background: #fff; border-radius: 6px; padding: 14px 18px;
  border: 1px solid #c5cfe0; font-size: 13px; color: #444; line-height: 1.6;
}
.help-overview p + p { margin-top: 8px; }

.help-transform {
  background: #fff; border-radius: 6px; padding: 18px 20px;
  border: 1px solid #c5cfe0;
}
.help-transform h3 {
  font-size: 15px; font-weight: 600; color: #1a3a6c;
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.help-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: #1a3a6c; color: #fff; font-size: 11px; font-weight: 700;
}
.help-desc { font-size: 13px; color: #444; line-height: 1.55; margin-bottom: 8px; }
.help-trigger {
  font-size: 12px; color: #555; background: #f5f7fa;
  border-left: 3px solid #c5cfe0; padding: 6px 10px; border-radius: 0 4px 4px 0;
  margin-bottom: 16px;
}

.help-example { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.help-mapping-col { flex: 0 0 190px; min-width: 190px; }
.help-col-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: #888; margin-bottom: 5px;
}
.help-mapping-note { font-size: 11px; color: #888; font-style: italic; margin-top: 6px; }

.help-grid-pair { display: flex; gap: 12px; flex: 1; min-width: 0; }
.help-grid-pair > div { flex: 1; min-width: 0; }
.help-grid-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: #888; margin-bottom: 4px;
}
.help-grid-wrapper { overflow-x: auto; }
.help-explainer {
  font-size: 12px; color: #555; line-height: 1.55;
  margin-top: 12px; padding: 8px 12px;
  background: #f5f7fa; border-radius: 4px;
  border-left: 3px solid #c5cfe0;
}
.help-condition-types {
  font-size: 13px; color: #444; line-height: 1.55;
  margin: 6px 0 10px 18px;
}
.help-condition-types li { margin-bottom: 4px; }

/* ===== Landing page ===== */
.landing-page {
  max-width: 560px; margin: 0 auto; padding: 0 16px;
}
.landing-wordmark {
  font-size: 48px; font-weight: 700; color: #fff;
  margin-bottom: 24px; text-align: center;
}
.landing-hero {
  text-align: center; margin-bottom: 28px;
}
.landing-heading {
  font-size: 22px; font-weight: 700; color: #1a3a6c; margin-bottom: 10px;
}
.landing-lead {
  font-size: 14px; color: #555; line-height: 1.65; max-width: 480px; margin: 0 auto;
}
.landing-card {
  background: #fff; border-radius: 8px; padding: 28px 32px;
  border: 1px solid #c5cfe0; box-shadow: 0 2px 8px rgba(0,0,0,.06);
  margin-bottom: 20px;
}
.landing-input-label {
  font-size: 11px; font-weight: 600; color: #555;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.landing-input-hint {
  font-size: 13px; color: #666; margin-bottom: 12px; line-height: 1.5;
}
.landing-input-row { display: flex; gap: 8px; }
.landing-url-input {
  flex: 1; min-width: 0; padding: 8px 10px;
  border: 1px solid #ccc; border-radius: 4px; font-size: 13px;
  font-family: monospace;
}
.landing-url-input:focus {
  outline: none; border-color: #1a3a6c;
  box-shadow: 0 0 0 2px rgba(26,58,108,.15);
}
.landing-note { font-size: 12px; margin-top: 8px; }
.landing-divider { border: none; border-top: 1px solid #eee; margin: 20px 0; }
.landing-contact { font-size: 13px; color: #666; line-height: 1.5; }

.landing-features {
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px;
}
.landing-feature {
  display: flex; gap: 14px; align-items: flex-start;
  background: #fff; border-radius: 6px; padding: 14px 16px;
  border: 1px solid #e0e7ef;
}
.landing-feature-icon {
  font-size: 16px; color: #1a3a6c; flex-shrink: 0; margin-top: 1px;
  width: 22px; text-align: center;
}
.landing-feature-title {
  font-size: 13px; font-weight: 600; color: #1a3a6c; margin-bottom: 3px;
}
.landing-feature-desc {
  font-size: 13px; color: #555; line-height: 1.5;
}
.landing-footer {
  text-align: center; font-size: 12px; color: rgba(255,255,255,.5);
}

/* ===== PDF export (browser print via exportRefinePdf()) ===== */
/* Rules are gated on html.pdf-export so a plain Ctrl+P is unaffected. */
@media print {
  html.pdf-export,
  html.pdf-export body { background: #fff; }

  /* Hide interactive/navigation chrome */
  html.pdf-export .site-header,
  html.pdf-export .tab-nav,
  html.pdf-export .back-link,
  html.pdf-export .refine-toolbar,
  html.pdf-export .mappings-aside,
  html.pdf-export .add-block-bar,
  html.pdf-export .save-result,
  html.pdf-export .col-ctrl,
  html.pdf-export .block-header-actions,
  html.pdf-export .banner-pending-update,
  html.pdf-export .banner-no-baseline,
  html.pdf-export .course-popup,
  html.pdf-export .page-header button,
  html.pdf-export .page-header a { display: none !important; }

  /* Show all rows — remove scroll caps and overflow clipping */
  html.pdf-export .req-table-wrapper { max-height: none !important; overflow: visible !important; }
  html.pdf-export .pane              { overflow: visible !important; }

  /* Don't stick table headers when the whole page is one long canvas */
  html.pdf-export .req-table th { position: static !important; }

  /* Preserve row-type background colours in print output */
  html.pdf-export,
  html.pdf-export * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Keep each row intact if the browser paginates (non-Chromium fallback) */
  html.pdf-export .req-table tr { break-inside: avoid; }
}
