/* =========================================================
   CSJMU Duty Chart — IBM Carbon-inspired design tokens
   ========================================================= */
:root {
  --cds-white: #ffffff;
  --cds-black: #161616;
  --cds-gray-10: #f4f4f4;
  --cds-gray-20: #e0e0e0;
  --cds-gray-30: #c6c6c6;
  --cds-gray-50: #8d8d8d;
  --cds-gray-60: #6f6f6f;
  --cds-gray-70: #525252;
  --cds-gray-80: #393939;
  --cds-gray-90: #262626;
  --cds-blue-10: #edf5ff;
  --cds-blue-20: #d0e2ff;
  --cds-blue-60: #0f62fe;
  --cds-blue-70: #0043ce;
  --cds-red-10: #fff1f1;
  --cds-red-60: #da1e28;
  --cds-green-60: #198038;
  --cds-yellow-30: #fcf4d6;
  --cds-yellow-60: #8e6a00;
  --cds-purple-10: #f6f2ff;
  --cds-purple-60: #8a3ffc;
  --cds-font: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --cds-mono: 'IBM Plex Mono', monospace;
  --cds-header-height: 48px;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--cds-font);
  font-size: 14px;
  line-height: 1.43;
  letter-spacing: 0.16px;
  color: var(--cds-black);
  background: var(--cds-white);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--cds-blue-60);
  color: #fff;
  padding: 12px 16px;
  z-index: 999;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ============================ Header ============================ */
.cds-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--cds-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--cds-black);
  color: var(--cds-gray-10);
  padding-left: 16px;
  border-bottom: 1px solid var(--cds-gray-80);
}

.cds-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-mark { font-weight: 600; font-size: 14px; letter-spacing: 0.32px; white-space: nowrap; }
.brand-divider { width: 1px; height: 16px; background: var(--cds-gray-60); }
.brand-title {
  font-size: 14px;
  color: var(--cds-gray-30);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cds-header__action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 16px;
  background: transparent;
  border: none;
  color: var(--cds-gray-10);
  font-size: 14px;
  letter-spacing: 0.16px;
  cursor: pointer;
}
.cds-header__action:hover { background: var(--cds-gray-80); }
.cds-header__action:focus-visible { outline: 2px solid var(--cds-white); outline-offset: -2px; }

/* ============================ Layout ============================ */
main {
  max-width: 1056px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.32px;
  text-transform: uppercase;
  color: var(--cds-gray-60);
  margin-bottom: 8px;
}

h1#publicTitle {
  font-size: 42px;
  font-weight: 400;
  line-height: 1.19;
  letter-spacing: 0;
  margin-bottom: 16px;
}

.lede {
  font-size: 16px;
  line-height: 1.5;
  color: var(--cds-gray-70);
  max-width: 640px;
}

/* ============================ Search ============================ */
.search-block {
  margin-top: 40px;
  max-width: 640px;
}

.cds-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.32px;
  color: var(--cds-gray-70);
  margin-bottom: 8px;
}

.search-field { position: relative; }

.cds-text-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: none;
  border-bottom: 1px solid var(--cds-gray-50);
  background: var(--cds-gray-10);
  font-family: inherit;
  font-size: 16px;
  color: var(--cds-black);
  outline: none;
  transition: background-color .11s, border-color .11s;
}
.cds-text-input::placeholder { color: var(--cds-gray-60); }
.cds-text-input:hover { background: var(--cds-gray-20); }
.cds-text-input:focus { outline: 2px solid var(--cds-blue-60); outline-offset: -2px; }

.cds-helper {
  margin-top: 8px;
  font-size: 12px;
  color: var(--cds-gray-60);
}

/* Suggestions dropdown */
.suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--cds-white);
  border: 1px solid var(--cds-gray-20);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .12);
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.suggestions.is-open { display: block; }

.suggestion {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--cds-gray-20);
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover,
.suggestion.is-active { background: var(--cds-blue-10); }
.suggestion__name { font-size: 14px; font-weight: 600; color: var(--cds-black); }
.suggestion__meta { font-size: 12px; color: var(--cds-gray-60); }
.suggestion--empty {
  cursor: default;
  color: var(--cds-gray-60);
  font-size: 13px;
}
.suggestion--empty:hover { background: transparent; }

/* ============================ Result ============================ */
#resultArea { margin-top: 40px; }

.teacher-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: var(--cds-gray-10);
  border-left: 3px solid var(--cds-blue-60);
  margin-bottom: 24px;
}
.teacher-summary h2 {
  font-size: 24px;
  font-weight: 400;
  line-height: 1.33;
  margin-bottom: 8px;
}
.teacher-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--cds-gray-70);
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--cds-gray-50); }

.teacher-summary__stat { text-align: right; flex-shrink: 0; }
.stat-value {
  display: block;
  font-size: 40px;
  font-weight: 300;
  line-height: 1;
  color: var(--cds-blue-60);
}
.stat-label {
  font-size: 12px;
  letter-spacing: 0.32px;
  text-transform: uppercase;
  color: var(--cds-gray-60);
}

/* ============================ Table ============================ */
.cds-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--cds-gray-20);
}
.cds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.cds-table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--cds-gray-20);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.32px;
  color: var(--cds-black);
  border-bottom: 1px solid var(--cds-gray-30);
  white-space: nowrap;
}
.cds-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--cds-gray-20);
  vertical-align: middle;
}
.cds-table tbody tr:hover { background: var(--cds-gray-10); }
.cds-table tbody tr:last-child td { border-bottom: none; }

.table-actions { text-align: right; white-space: nowrap; }
.danger-text { color: var(--cds-red-60); }
.danger-text:hover { background: var(--cds-red-10) !important; }

/* ============================ Tags ============================ */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16px;
  line-height: 18px;
  white-space: nowrap;
}
.tag--blue { background: var(--cds-blue-20); color: var(--cds-blue-70); }
.tag--yellow { background: var(--cds-yellow-30); color: var(--cds-yellow-60); }
.tag--purple { background: var(--cds-purple-10); color: var(--cds-purple-60); border: 1px solid var(--cds-purple-60); }
.tag--gray { background: var(--cds-gray-20); color: var(--cds-gray-70); }

.venue-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.venue-desc { color: var(--cds-gray-60); font-size: 12px; }

/* ============================ Buttons ============================ */
.cds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.16px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .11s, color .11s, border-color .11s;
}
.cds-btn:focus-visible { outline: 2px solid var(--cds-blue-60); outline-offset: 2px; }
.cds-btn:disabled { opacity: .5; cursor: not-allowed; }

.cds-btn--primary { background: var(--cds-blue-60); color: #fff; }
.cds-btn--primary:hover { background: var(--cds-blue-70); }

.cds-btn--ghost { background: transparent; border-color: var(--cds-blue-60); color: var(--cds-blue-60); }
.cds-btn--ghost:hover { background: var(--cds-blue-60); color: #fff; }

.cds-btn--tertiary { background: transparent; color: var(--cds-blue-60); }
.cds-btn--tertiary:hover { background: var(--cds-blue-10); }

.cds-btn--danger { background: var(--cds-red-60); color: #fff; }
.cds-btn--danger:hover { background: #a2191f; }

.cds-btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ============================ Tabs ============================ */
.cds-tabs {
  display: flex;
  border-bottom: 1px solid var(--cds-gray-20);
  margin: 24px 0;
}
.cds-tab {
  height: 48px;
  padding: 0 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  letter-spacing: 0.16px;
  color: var(--cds-gray-70);
  cursor: pointer;
}
.cds-tab:hover { background: var(--cds-gray-10); }
.cds-tab.is-active {
  color: var(--cds-black);
  border-bottom-color: var(--cds-blue-60);
  font-weight: 600;
}

/* ============================ Admin ============================ */
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-topbar h1 { font-size: 32px; font-weight: 400; line-height: 1.25; }

.toolbar {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar__search { flex: 1 1 280px; max-width: 380px; }
.toolbar__search .cds-text-input { height: 40px; font-size: 14px; }

/* ============================ Modal ============================ */
.cds-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 22, 22, .5);
  animation: fadeIn .12s ease-out;
}
.cds-modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .3);
}
.cds-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.cds-modal__head h2 { font-size: 20px; font-weight: 400; line-height: 1.4; }
.cds-modal__close {
  padding: 4px;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--cds-gray-70);
  cursor: pointer;
}
.cds-modal__close:hover { color: var(--cds-black); }
.cds-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
}
.modal-body-text { font-size: 14px; line-height: 1.5; color: var(--cds-gray-70); }

/* ============================ Forms ============================ */
.field { margin-bottom: 20px; }
.field .cds-text-input { height: 40px; font-size: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.cds-select {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 16px;
  appearance: none;
  border: none;
  border-bottom: 1px solid var(--cds-gray-50);
  background-color: var(--cds-gray-10);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='%23161616'%3E%3Cpath d='M8 11L3 6l.7-.7L8 9.6l4.3-4.3.7.7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  font-family: inherit;
  font-size: 14px;
  color: var(--cds-black);
  cursor: pointer;
  outline: none;
}
.cds-select:hover { background-color: var(--cds-gray-20); }
.cds-select:focus { outline: 2px solid var(--cds-blue-60); outline-offset: -2px; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 4px 0 8px;
  cursor: pointer;
}
.checkbox input { width: 16px; height: 16px; accent-color: var(--cds-blue-60); }

.form-error {
  margin-top: 12px;
  font-size: 12px;
  color: var(--cds-red-60);
}

/* ============================ Feedback ============================ */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  background: var(--cds-gray-10);
  color: var(--cds-gray-60);
  font-size: 14px;
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  min-width: 280px;
  padding: 12px 16px;
  background: #fff;
  border-left: 3px solid var(--cds-blue-60);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  font-size: 14px;
  color: var(--cds-black);
  animation: slideIn .16s ease-out;
}
.toast--success { border-left-color: var(--cds-green-60); }
.toast--error { border-left-color: var(--cds-red-60); }

/* ============================ Footer ============================ */
.cds-footer {
  border-top: 1px solid var(--cds-gray-20);
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--cds-gray-60);
}

/* ============================ Animations ============================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================ Responsive ============================ */
@media (max-width: 672px) {
  main { padding: 32px 16px 64px; }
  h1#publicTitle { font-size: 32px; }
  .brand-title { display: none; }
  .teacher-summary { flex-direction: column; align-items: flex-start; gap: 16px; }
  .teacher-summary__stat { text-align: left; }
  .field-row { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; }
  .toolbar__search { max-width: none; }
}
/* ============================ Additions (API version) ============================ */
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.picker { position: relative; }
.picker .suggestions { top: calc(100% + 1px); }
.field-hint { margin-top: 6px; font-size: 12px; color: var(--cds-gray-60); }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.pager__nav { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--cds-gray-70); }

.banner {
  margin-top: 24px;
  padding: 16px;
  background: var(--cds-red-10);
  border-left: 3px solid var(--cds-red-60);
  color: var(--cds-black);
  font-size: 14px;
}
.loading-row { padding: 32px 16px; text-align: center; color: var(--cds-gray-60); }
.toast--info { border-left-color: var(--cds-blue-60); }
@media (max-width: 672px) { .admin-actions { width: 100%; } }
