:root {
  --navy-blue: #1e3a8a;
  --green: #16a34a;
  --green-hover: #15803d;
  --text: #1f2328;
  --text-muted: #e4e6e7;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #d9dce1;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none;
}

body {
  margin: 0;
  font: 16px/1.5 system-ui, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

h1 {
  margin: 0 0 8px;
  font-weight: 600;
}

/* Navbar */

.navbar {
  background: var(--navy-blue);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 24px;
  height: 56px;
}

.navbar-brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  color: #fff;
}

.navbar-links {
  display: flex;
  gap: 8px;
  height: 100%;
}

.navbar-link {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  font-size: 15px;
  opacity: 0.85;
  border-bottom: 3px solid transparent;
}

.navbar-link:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.navbar-link.active {
  opacity: 1;
  border-bottom-color: var(--green);
}

.navbar-dropdown {
  position: relative;
  height: 100%;
}

.navbar-dropdown-toggle {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  gap: 4px;
}

.caret {
  font-size: 11px;
}

.navbar-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.15);
  overflow: hidden;
  z-index: 50;
}

.navbar-dropdown-menu.open {
  display: block;
}

.navbar-dropdown-item {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.navbar-dropdown-item:hover {
  background: var(--bg);
}

.navbar-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.navbar-auth-email {
  color: #fff;
  font-size: 14px;
  opacity: 0.9;
}

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

/* Pages */

.page {
  width: 100%;
  padding: 32px 40px;
}

.page.hidden {
  display: none;
}

.placeholder-page {
  color: var(--text-muted);
  font-size: 15px;
}

/* Login page — single column, inputs/button roughly 2x the normal form's size */

.login-page-wrap {
  max-width: 640px;
  margin: 40px auto 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px;
}

.login-form-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form-field label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.login-form-field input {
  height: 80px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 28px;
  color: var(--text);
  background: var(--surface);
}

.login-form-field input:focus {
  outline: 2px solid var(--navy-blue);
  outline-offset: -1px;
}

.login-submit-btn {
  height: 80px;
  font-size: 28px;
}

/* Form */

.erst-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-field select,
.form-field input[type='text'] {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
}

.form-field select:focus,
.form-field input[type='text']:focus {
  outline: 2px solid var(--navy-blue);
  outline-offset: -1px;
}

.form-field-action {
  justify-content: flex-end;
}

.btn {
  height: 40px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #fff;
  background: var(--navy-blue);
}

.btn:hover {
  background: var(--green-hover);
}

.btn-upload {
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-with-template {
  display: flex;
  align-items: center;
  gap: 10px;
}

.template-link {
  margin-bottom: 0;
  white-space: nowrap;
  font-size: 13px;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 20;
}

.form-error {
  color: #b42318;
  font-size: 14px;
  margin: 0;
}

.form-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.result-group {
  margin-top: 28px;
}

.result-group-heading {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
  color: #ffffff;
  background: #228b22;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  width: fit-content;
  max-width: 100%;
}

.result-group-heading:hover {
  background: #1b6e1b;
}

.collapse-caret {
  display: inline-block;
  width: 14px;
  font-size: 12px;
}

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

.table-scroll.collapsed {
  display: none;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13px;
}

.results-table th,
.results-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
}

.results-table thead th {
  background: var(--navy-blue);
  color: #fff;
  font-weight: 600;
}

.results-table td:nth-child(1),
.results-table td:nth-child(2) {
  text-align: left;
}

/* Issues detail table (opened via the eye icon, both Department and College
   view share this same table) — fixed column widths. Headers are always
   allowed to wrap so a label doesn't force its column wider than specified;
   data cells stay single-line except Missing/Status and Reason, which wrap. */
#issues-detail-container .results-table th {
  white-space: normal;
}

#issues-detail-container .results-table th:nth-child(1),
#issues-detail-container .results-table td:nth-child(1) {
  width: 60px; /* S/N */
}

#issues-detail-container .results-table th:nth-child(2),
#issues-detail-container .results-table td:nth-child(2) {
  width: 100px; /* Registration No */
}

#issues-detail-container .results-table th:nth-child(3),
#issues-detail-container .results-table td:nth-child(3) {
  width: 250px; /* Name */
}

#issues-detail-container .results-table th:nth-child(4),
#issues-detail-container .results-table td:nth-child(4) {
  width: 80px; /* Module Code */
}

#issues-detail-container .results-table th:nth-child(5),
#issues-detail-container .results-table td:nth-child(5) {
  width: 160px; /* Module Name */
}

#issues-detail-container .results-table th:nth-child(6),
#issues-detail-container .results-table td:nth-child(6) {
  width: 60px; /* Issue */
}

#issues-detail-container .results-table th:nth-child(7),
#issues-detail-container .results-table td:nth-child(7) {
  width: 120px; /* Semester */
}

#issues-detail-container .results-table th:nth-child(8),
#issues-detail-container .results-table td:nth-child(8) {
  width: 200px; /* Missing / Status */
  white-space: normal;
  overflow-wrap: break-word;
}

#issues-detail-container .results-table th:nth-child(9),
#issues-detail-container .results-table td:nth-child(9) {
  width: 400px; /* Reason */
  white-space: normal;
  overflow-wrap: break-word;
}

#issues-detail-container .results-table th:nth-child(10),
#issues-detail-container .results-table td:nth-child(10) {
  width: 60px; /* Reason */
  white-space: normal;
  overflow-wrap: break-word;
}

.aggregate-row td {
  background: rgba(255, 153, 19, 0.25);
  font-weight: 700;
}

.percent-row td {
  background: rgba(255, 153, 19, 0.12);
  font-weight: 600;
  font-style: italic;
}

.submit-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

.sortable-header {
  cursor: pointer;
  user-select: none;
}

.sortable-header:hover {
  background: var(--green-hover);
}

.issues-cell {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.issue-icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.issue-icon-btn:hover {
  background: var(--bg);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-panel {
  background: var(--surface);
  border-radius: 10px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.modal-panel-wide {
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
}

.module-description-text {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 14px;
}

.modal-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.password-input-wrap {
  display: flex;
  gap: 8px;
}

.password-input-wrap input {
  flex: 1;
}

.password-toggle-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 0 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.password-toggle-btn:hover {
  background: var(--bg);
}

.modal-status {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--navy-blue);
  font-size: 14px;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.issues-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.issues-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-field select {
  height: 36px;
  min-width: 180px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
}

.filter-field select:focus {
  outline: 2px solid var(--navy-blue);
  outline-offset: -1px;
}

.reason-input {
  width: 100%;
  min-width: 160px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
}

.reason-input:focus {
  outline: 2px solid var(--navy-blue);
  outline-offset: -1px;
}

.reason-input-error {
  border-color: #b42318;
}
