:root {
  /* Marshall University brand colors (marsha.marshall.edu design system) */
  --mu-green: #00ac3e;
  --mu-green-dark: #007129;
  --mu-green-darker: #046a38;
  --mu-black: #131716;

  --bg: #f0f2f5;
  --panel: #ffffff;
  --border: #dde1e7;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: var(--mu-green);
  --primary-dark: var(--mu-green-dark);
  --danger: #dc2626;
  --warn-bg: #fff4e5;
  --warn-border: #f0b429;
  --struck-bg: #f3f4f6;
  --vacant-bg: #fafafa;
  --col-w: 236px;
  --radius: 8px;
}

* { box-sizing: border-box; }

/* safety net: never let a component's own CSS accidentally override the
   native "hidden" attribute (bit us once already — keep this rule) */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ---- top bar ---- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: var(--mu-green-darker);
  border-bottom: 3px solid var(--mu-black);
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

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

.logo-img { height: 34px; width: auto; display: block; }
.logo-fallback {
  height: 34px;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 2px solid #fff;
  border-radius: 6px;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.topbar h1 { font-size: 17px; margin: 0; white-space: nowrap; color: #fff; font-weight: 600; }

.topbar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.whoami { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #e5f7ea; }
.whoami input { width: 130px; }

/* ---- tabs ---- */

.tabbar {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  background: var(--mu-black);
  overflow-x: auto;
  flex-shrink: 0;
  min-height: 38px;
}

.tab-btn {
  border: none;
  background: transparent;
  color: #cbd5c9;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab-btn:hover { color: #fff; }
.tab-btn.active { color: #fff; border-bottom-color: var(--mu-green); }

input, textarea, select {
  font-family: inherit;
  font-size: 13.5px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

#duty-filter { width: 200px; }

textarea { resize: vertical; }

.btn {
  border: none;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13.5px;
  cursor: pointer;
  background: #e5e7eb;
  color: var(--text);
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn.ghost { background: transparent; border: 1px solid var(--border); }

.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 4px 7px;
}
.icon-btn.remove-btn { color: var(--danger); }
.icon-btn.strike-btn.active { background: var(--warn-bg); border-color: var(--warn-border); }
.icon-btn.delete-duty { color: var(--danger); border-color: #fecaca; white-space: nowrap; }

.error { color: var(--danger); font-size: 12.5px; min-height: 16px; margin: 4px 0 0; }
.muted { color: var(--muted); }
.muted.small { font-size: 12px; font-weight: normal; }

/* ---- legend ---- */

.legend-panel {
  background: #fffbea;
  border-bottom: 1px solid var(--warn-border);
  padding: 10px 18px;
  flex-shrink: 0;
}
.legend-panel ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: #374151; }

/* ---- board ---- */

.board {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  overflow-x: auto;
  overflow-y: hidden;
}

.board-column {
  flex: 0 0 var(--col-w);
  width: var(--col-w);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 90px);
}

.board-column.drag-over { outline: 2px solid var(--primary); outline-offset: -2px; }
.board-column.unassigned { border-color: #cbd5e1; }

.column-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: inherit;
  border-radius: var(--radius) var(--radius) 0 0;
}

.column-header-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.column-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-name.vacant-name { color: #b45309; font-style: italic; font-weight: 500; }
.column-count {
  font-size: 11px;
  background: #e5e7eb;
  border-radius: 999px;
  padding: 1px 7px;
  color: #374151;
  flex-shrink: 0;
}
.column-add-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 11.5px;
  padding: 3px 10px;
  text-align: left;
}
.column-add-btn:hover { text-decoration: underline; }

.column-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 60px;
}

.duty-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: grab;
  font-size: 12.5px;
}
.duty-card:active { cursor: grabbing; }
.duty-card.dragging { opacity: 0.4; }
.duty-card.conflict { border-color: var(--warn-border); background: var(--warn-bg); }
.duty-card.struck-primary .duty-card-title { text-decoration: line-through; color: var(--muted); }

.duty-card-title-row { display: flex; }
.duty-card-title { font-weight: 600; font-size: 13px; }
.duty-card-desc {
  margin: 2px 0;
  color: #374151;
  font-size: 11.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.duty-card-badges { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.duty-card-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }

/* generic "vacant" text treatment used anywhere a person's name is shown
   (Board column headers, Workload names, By Duty / By Manager name lists) */
.vacant-name { color: #b45309; font-style: italic; }

.badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e5e7eb;
  white-space: nowrap;
}
.badge.conflict { background: #fde68a; color: #78350f; font-weight: 600; }
.badge.tag-backup { background: #dbeafe; color: #1e3a8a; }
.badge.tag-supervisor { background: #ede9fe; color: #4c1d95; }
.badge.tag-struck { background: #fee2e2; color: #991b1b; }

/* ---- modals ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 10px;
  padding: 20px 22px;
  width: 100%;
  max-width: 480px;
}
.modal h2 { margin: 0 0 12px; font-size: 17px; }
.modal h3 { margin: 14px 0 6px; font-size: 13px; }

.modal-header-row { display: flex; justify-content: space-between; align-items: center; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: #374151; }
.field-row { display: flex; gap: 10px; }
.field-row label { flex: 1; }
.char-counter { font-weight: normal; color: var(--muted); float: right; }

.stack-row { display: flex; gap: 6px; margin-top: 6px; }
.stack-row input { flex: 1; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.assignment-editor { margin-top: 6px; }
.assignment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.assignment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
}
.assignment-item.struck .assignment-person { text-decoration: line-through; color: var(--muted); }
.assignment-person { flex: 1; }
.assignment-reason { font-size: 11.5px; color: var(--danger); font-style: italic; }
.assignment-buttons { display: flex; gap: 4px; }

@media (max-width: 700px) {
  .field-row { flex-direction: column; }
}

/* ---- views / pages ---- */

.view {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
}

#view-board {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

/* ---- all-staff shared column ---- */

.board-column.shared { border-color: var(--mu-green); background: #f0fbf3; }
.shared-tag {
  display: inline-block;
  margin-top: 3px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mu-green-dark);
  background: #d9f5e3;
  padding: 1px 6px;
  border-radius: 4px;
}
.badge.tag-shared { background: #d9f5e3; color: var(--mu-green-dark); }

/* ---- data tables (By Duty / Workload) ---- */

.table-panel { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--panel);
}
.data-table th, .data-table td {
  text-align: left;
  padding: 5px 9px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  background: var(--panel);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.data-table th.num, .data-table td.num { text-align: right; }
.data-table th.sorted::after { content: ' \25BE'; }
.data-table th.sorted.desc::after { content: ' \25B4'; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #f9fafb; }
.data-table tbody tr.conflict-row { background: var(--warn-bg); }
.data-table .desc-cell { color: var(--muted); font-size: 12px; max-width: 240px; }

.load-bar-track {
  background: #e5e7eb;
  border-radius: 999px;
  height: 8px;
  width: 140px;
  overflow: hidden;
}
.load-bar-fill { background: var(--mu-green); height: 100%; border-radius: 999px; }

/* ---- by-manager grouped view ---- */

.manager-group {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.manager-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: #f3f4f6;
  border-bottom: 1px solid var(--border);
}
.manager-group-header h2 { margin: 0; font-size: 14px; }
.manager-group-stats { font-size: 11.5px; color: var(--muted); }
.manager-group-empty { padding: 8px 12px; font-size: 13px; color: var(--muted); }

/* ---- conflicts / disputes view ---- */

.conflict-card {
  background: var(--panel);
  border: 1px solid var(--warn-border);
  border-left: 4px solid var(--warn-border);
  border-radius: 7px;
  padding: 7px 12px;
  margin-bottom: 6px;
  cursor: pointer;
}
.conflict-card h3 { margin: 0 0 3px; font-size: 14px; }
.conflict-card .muted.small { display: block; margin-top: 2px; }

/* ---- manage staff / procedure owners modal ---- */

.modal-wide { max-width: 620px; }
.roster-list { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.roster-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
}
.roster-name-input { flex: 1; border: 1px solid transparent; background: transparent; padding: 3px 6px; }
.roster-name-input:focus { border-color: var(--border); background: #fff; }
.roster-name-input.vacant-name { color: #b45309; font-style: italic; }
.roster-vacant-label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: normal; }
