/* ================================
   Design Tokens
   ================================ */
:root {
  /* Brand */
  --navy: #0f2444;
  --navy-700: #1a3560;
  --navy-600: #1e3a6e;
  --navy-500: #2a4d85;
  --teal: #32ba9a;
  --teal-600: #27997e;
  --teal-100: #e6f7f4;

  /* Surface */
  --bg: #f0f4f8;
  --panel: #ffffff;
  --panel-alt: #f7f9fc;
  --panel-hover: #eef6f4;
  --border: #dde3ed;

  /* Text */
  --text: #1a2540;
  --muted: #5a6a85;
  --subtle: #8a9ab5;

  /* Status */
  --focus: #7ec8bc;

  /* Layout */
  --sidebar-w: 260px;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 36, 68, 0.07), 0 1px 2px rgba(15, 36, 68, 0.05);
  --shadow: 0 4px 12px rgba(15, 36, 68, 0.08), 0 1px 3px rgba(15, 36, 68, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 36, 68, 0.1), 0 2px 6px rgba(15, 36, 68, 0.06);

  /* Type */
  --font-body: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-display: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

/* ================================
   Reset & Base
   ================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ================================
   Name Prompt Modal
   ================================ */
.name-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.name-modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.name-modal {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: modalIn 0.35s cubic-bezier(0.22, 0.68, 0, 1.2) both;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.name-modal .modal-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.name-modal .modal-logo img {
  height: 3rem;
  width: auto;
}

.name-modal h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--navy);
  margin: 0 0 8px;
}

.name-modal p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 24px;
}

.name-modal input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--panel-alt);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  margin-bottom: 16px;
}

.name-modal input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(50, 186, 154, 0.18);
}

.name-modal button {
  width: 100%;
  padding: 12px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.name-modal button:hover {
  background: var(--navy-600);
}

/* ================================
   Top Bar
   ================================ */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 64px;
  background: var(--navy);
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  z-index: 500;
  box-shadow: var(--shadow-sm);
}

.topbar .page-label {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  flex: 1;
}

.topbar .user-pill,
.topbar .user-pill span,
.topbar .user-pill strong,
.topbar .user-pill i {
  color: #fff;
}

/* Page title in main body is now redundant — topbar carries it */
.page-title {
  display: none;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--teal);
  color: #fff;
  padding: 7px 14px 7px 10px;
  border-radius: 99px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
}

.user-pill i {
  color: #fff;
  font-size: 0.95rem;
}

/* ================================
   Sidebar
   ================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.sidebar-header img {
  height: 3.6rem;
  width: auto;
}

.sidebar-header .brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}

.sidebar-header .brand-sub {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-section {
  padding: 20px 12px 0;
  flex: 1;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition:
    background 0.15s,
    color 0.15s;
}

.nav-links a i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-links a.active,
.nav-links a.active.admin-link,
.nav-links a.active.users-link {
  background: var(--teal) !important;
  color: #fff !important;
  font-weight: 600;
  opacity: 1 !important;
}

.nav-links a.active i,
.nav-links a.active.admin-link i,
.nav-links a.active.users-link i {
  opacity: 1 !important;
  color: #fff !important;
}

.sidebar-footer {
  padding: 16px 12px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  transition:
    background 0.15s,
    color 0.15s;
}

.sidebar-footer a i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
}

.sidebar-footer a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Mobile close button */
.close-btn {
  display: none;
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile hamburger */
.menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  z-index: 1100;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
}

/* ================================
   Main Content
   ================================ */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: 64px;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 36px 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--navy);
  margin: 0 0 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ================================
   Stat Cards (Dashboard)
   ================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--panel);
  padding: 22px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--teal);
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card h2 {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  line-height: 1;
}

.target-number {
  font-size: 0.78rem;
  color: var(--subtle);
  margin: 6px 0 0;
}

/* ================================
   Summary Cards (Admin)
   ================================ */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.summary-card {
  background: var(--panel);
  padding: 20px 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.summary-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--teal);
  border-radius: var(--radius) var(--radius) 0 0;
}

.summary-card h3 {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.summary-card .value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--navy);
}

/* ================================
   Tables
   ================================ */
.table-section {
  margin-top: 8px;
}

.table-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.table-wrapper {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--navy);
}

thead th {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 13px 16px;
  text-align: left;
}

tbody td {
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:nth-child(even) td {
  background: var(--panel-alt);
}

tbody tr:hover td {
  background: var(--panel-hover);
}

/* ================================
   Filters
   ================================ */
.filters-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.filter-group label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* All filter controls share identical height/padding/border */
.filter-group input,
.filter-group select,
.filter-group .btn-reset {
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--panel-alt);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(50, 186, 154, 0.15);
}

.filter-group .btn-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--panel-alt);
  color: var(--muted);
  border-color: var(--border);
  cursor: pointer;
  font-weight: 600;
  transition:
    background 0.2s,
    color 0.2s,
    border-color 0.2s;
  white-space: nowrap;
  width: 100%;
}

.filter-group .btn-reset:hover {
  background: #fce8e8;
  color: #c0392b;
  border-color: #e8b4b4;
}

.filter-search {
  min-width: 200px;
  max-width: 280px;
}

/* ================================
   Buttons
   ================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--navy-600);
}
.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--teal-100);
  color: var(--teal-600);
  border: 1.5px solid var(--teal);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #d0f0ea;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

/* ================================
   Forms (Add PD Entry)
   ================================ */
.form-card {
  background: var(--panel);
  padding: 32px 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.pd-form {
  display: grid;
  gap: 6px;
}

.field-group {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
}

.field-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.field-group .field-hint {
  font-size: 0.78rem;
  color: var(--subtle);
  margin-top: 2px;
}

.required-star {
  color: var(--teal-600);
  margin-left: 2px;
}

.pd-form input[type="text"],
.pd-form input[type="date"],
.pd-form input[type="number"],
.pd-form input[type="file"],
.pd-form select,
.pd-form textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.925rem;
  color: var(--text);
  background: var(--panel-alt);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.pd-form input:focus,
.pd-form select:focus,
.pd-form textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(50, 186, 154, 0.15);
  background: #fff;
}

.pd-form textarea {
  resize: vertical;
  min-height: 110px;
}

.pd-form .two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-submit-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.form-submit-row .btn-primary {
  padding: 12px 28px;
  font-size: 1rem;
}

/* ================================
   Focus visible
   ================================ */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ================================
   Overlay
   ================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  z-index: 900;
}

.overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ================================
   Description col — hidden on screen
   ================================ */
.description-col {
  display: none;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .topbar {
    left: 0;
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
  }
  .close-btn {
    display: flex;
  }

  .pd-form .two-cols {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 24px 16px;
  }

  .form-card {
    padding: 24px 20px;
  }
}

@media (max-width: 600px) {
  .filters {
    flex-direction: column;
  }
  .filter-group {
    min-width: 100%;
  }
}

/* ================================
   Print
   ================================ */
@media print {
  @page {
    size: landscape;
  }

  .sidebar,
  .topbar,
  .menu-toggle,
  .close-btn,
  .filters-card,
  .button-row,
  .name-modal-backdrop,
  .overlay {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }
  .container {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  body {
    background: #fff;
  }

  .description-col {
    display: table-cell;
  }

  thead {
    background: var(--navy) !important;
    -webkit-print-color-adjust: exact;
  }
}

/* ================================
   Auth Page (auth.html)
   ================================ */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--navy);
}

.auth-wrapper {
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.auth-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-logo img {
  height: 3.5rem;
  width: auto;
}

.auth-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition:
    color 0.2s,
    border-color 0.2s;
}

.auth-tab.active {
  color: var(--navy);
  border-bottom-color: var(--teal);
}

.auth-tab:hover {
  color: var(--navy);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .field-group {
  margin-bottom: 0;
}

.auth-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 5px;
}

.auth-form input,
.auth-form select {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.925rem;
  color: var(--text);
  background: var(--panel-alt);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6a85' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.auth-form select {
  padding-right: 36px;
}

.auth-form input:focus,
.auth-form select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(50, 186, 154, 0.15);
  background-color: #fff;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 44px;
}

.toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.toggle-pw:hover {
  color: var(--navy);
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 1rem;
  margin-top: 4px;
}

.forgot-link {
  text-align: center;
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.forgot-link a {
  color: var(--teal-600, #2c9f82);
  text-decoration: none;
  font-weight: 500;
}

.forgot-link a:hover {
  text-decoration: underline;
}

.auth-alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.auth-alert.hidden {
  display: none;
}

.auth-alert.error {
  background: #fde8e8;
  color: #c0392b;
  border: 1px solid #f5c6c6;
}

.auth-alert.success {
  background: var(--teal-100);
  color: var(--teal-600);
  border: 1px solid #a8dfd4;
}

@media (max-width: 500px) {
  .auth-card {
    padding: 28px 20px;
  }
}

/* ================================
   Print / PDF — My PD Log
   ================================ */
@media print {
  /* Print header with logo and staff details */
  .print-header {
    display: flex !important;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #0f2444;
  }

  .print-header img {
    height: 3rem;
    width: auto;
  }

  .print-header-text {
    display: flex;
    flex-direction: column;
  }

  .print-header-name {
    font-size: 1rem;
    font-weight: 700;
    color: #0f2444;
  }

  .print-header-meta {
    font-size: 0.8rem;
    color: #555;
  }

  /* Reduce table font size for print */
  tbody td {
    font-size: 0.75rem !important;
    padding: 7px 10px !important;
  }

  thead th {
    font-size: 0.7rem !important;
    padding: 8px 10px !important;
  }

  /* Show description column */
  .description-col {
    display: table-cell !important;
  }

  /* Page title for print */
  .print-title {
    font-size: 1.1rem !important;
    font-weight: 700;
    color: #0f2444;
    margin: 0 0 16px;
    display: block !important;
  }
}

/* Hide print-only elements on screen */
.print-header,
.print-title {
  display: none;
}

/* ================================
   Profile page
   ================================ */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 960px;
}

@media (max-width: 760px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================
   Shared form card (profile, users)
   ================================ */
.form-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.card-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-heading i {
  color: var(--teal);
}

/* field-group inputs, selects and textareas — consistent styling */
.field-group select,
.field-group input:not([type="file"]),
.field-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--panel-alt);
  box-sizing: border-box;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.field-group select,
.field-group input:not([type="file"]) {
  height: 40px;
  padding: 0 12px;
  appearance: none;
  -webkit-appearance: none;
}

.field-group textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

.field-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6a85' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.field-group select:focus,
.field-group input:not([type="file"]):focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(50, 186, 154, 0.15);
  background-color: #fff;
}

.input-disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
  background: var(--bg) !important;
}

.field-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.form-actions {
  margin-top: 8px;
}

/* ================================
   Form alert (profile / users)
   ================================ */
.form-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.form-alert.hidden {
  display: none;
}
.form-alert.success {
  background: #d1fae5;
  color: #065f46;
}
.form-alert.error {
  background: #fee2e2;
  color: #991b1b;
}

/* ================================
   Auth page heading helpers
   ================================ */
.auth-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
}

.auth-subheading {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 24px;
}

/* ================================
   Inline table inputs (users.html)
   ================================ */
.inline-select,
.inline-input {
  height: 34px;
  padding: 0 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.85rem;
  background: var(--panel-alt);
  color: var(--text);
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.inline-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6a85' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
  min-width: 140px;
}

.inline-select:focus,
.inline-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(50, 186, 154, 0.15);
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
  font-size: 0.9rem;
}

/* Admin/Users links hidden by default; .visible class shows them */
a.admin-link {
  display: none;
}
a.admin-link.visible {
  display: flex;
}
a.users-link {
  display: none;
}
a.users-link.visible {
  display: flex;
}

/* ================================
   Toast notifications
   ================================ */
#toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 380px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  pointer-events: all;
  animation: toast-in 0.25s ease;
}

.toast.success {
  background: #059669;
}
.toast.error {
  background: #dc2626;
}
.toast.info {
  background: var(--navy);
}

.toast i {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0 0 6px;
  flex-shrink: 0;
}

.toast-close:hover {
  color: #fff;
}

.toast.toast-out {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

@media (max-width: 600px) {
  #toast-container {
    bottom: 16px;
    right: 12px;
    left: 12px;
  }
  .toast {
    max-width: 100%;
  }
}

/* ================================
   Auth alert info type
   ================================ */
.auth-alert.info {
  background: #dbeafe;
  color: #1e3a8a;
}

/* ================================
   Users page layout
   ================================ */
.users-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1000px) {
  .users-layout {
    grid-template-columns: 1fr;
  }
}

.invite-card {
  position: sticky;
  top: 24px;
}

.card-subtext {
  font-size: 0.85rem;
  color: var(--muted);
  margin: -12px 0 20px;
}

.two-col-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.users-list-section {
  min-width: 0;
}

.users-filters {
  grid-template-columns: 1fr 140px 180px auto auto !important;
}

.req {
  color: #dc2626;
}

/* Archive row styling */
.row-archived td {
  opacity: 0.5;
}

.badge-archived {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: #fee2e2;
  color: #991b1b;
  padding: 1px 7px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Icon buttons (save / archive) */
.btn-icon {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.btn-icon:hover {
  background: var(--panel-alt);
  color: var(--navy);
}

.btn-icon-archive:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-icon-restore:hover {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}

/* Checkbox label inline */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  accent-color: var(--teal);
  cursor: pointer;
}

/* ================================
   Profile page — read-only display
   ================================ */
.profile-readonly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .profile-readonly-grid {
    grid-template-columns: 1fr;
  }
}

.profile-field {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.profile-field:nth-child(even) {
  border-right: none;
}
.profile-field:nth-last-child(-n + 2) {
  border-bottom: none;
}

/* If odd number of fields, last one spans full width */
.profile-field:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  border-right: none;
}

.profile-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.profile-value {
  font-size: 0.95rem;
  color: var(--text);
  text-transform: capitalize;
}

.profile-contact-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.profile-contact-note i {
  color: var(--teal);
  flex-shrink: 0;
}
.profile-contact-note a {
  color: var(--teal);
  font-weight: 600;
}

/* ================================
   Edit User Modal
   ================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-card > *:not(.modal-header) {
  overflow-y: auto;
  padding: 0 28px 28px;
}

.modal-card > .modal-header {
  padding: 28px 28px 16px;
  flex-shrink: 0;
}

.modal-card > form {
  overflow-y: auto;
  padding: 0 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--navy);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close:hover {
  background: var(--panel-alt);
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ================================
   Users page — full width layout
   ================================ */
.page-header-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.users-filters-full {
  grid-template-columns: 1fr 140px 200px auto auto !important;
}

.users-table {
  table-layout: auto;
}

.users-table th,
.users-table td {
  white-space: nowrap;
}

.users-table td:nth-child(2) {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================
   Profile — fix border and casing
   ================================ */
.profile-field:last-child:nth-child(odd) {
  border-bottom: 1px solid var(--border);
}

.profile-value {
  text-transform: none;
}

/* ================================
   Evidence download button & display
   ================================ */
.btn-evidence {
  background: none;
  border: none;
  color: var(--teal);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-evidence:hover {
  color: var(--navy);
}

.current-evidence {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 6px;
}

.current-evidence.hidden {
  display: none;
}

/* ================================
   Evidence download link
   ================================ */
.evidence-link,
.btn-evidence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--teal);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.evidence-link:hover,
.btn-evidence:hover {
  text-decoration: underline;
}

.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.current-evidence {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 6px;
}

/* ================================
   Unit selector button & modal
   ================================ */
.btn-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  min-height: 42px;
}

.btn-selector:hover,
.btn-selector:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(50, 186, 154, 0.15);
}

.btn-selector i {
  color: var(--muted);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.btn-selector.has-selection {
  border-color: var(--teal);
}
.btn-selector.has-selection i {
  color: var(--teal);
}
.btn-selector span {
  color: var(--muted);
}
.btn-selector.has-selection span {
  color: var(--text);
  font-weight: 500;
}

.modal-card-wide {
  max-width: 680px;
}

.units-search-wrap {
  margin-bottom: 12px;
}
.units-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.9rem;
}

.units-list {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 0;
}

.units-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 10px 14px 4px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.unit-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}

.unit-item:last-child {
  border-bottom: none;
}
.unit-item:hover {
  background: var(--panel-hover);
}

.unit-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.unit-item-text {
  line-height: 1.4;
}
.unit-code {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--navy);
}
.unit-title {
  font-size: 0.9rem;
  color: var(--text);
}

.unit-item.hidden-search {
  display: none;
}

/* ── Two-level unit selector ── */
.unit-l1-item {
  cursor: pointer;
  justify-content: space-between;
}
.unit-l1-item:hover {
  background: var(--panel-hover);
}

.unit-back-btn {
  cursor: pointer;
  color: var(--teal);
  font-weight: 600;
  font-size: 0.9rem;
  gap: 8px;
  border-bottom: 2px solid var(--border);
  background: var(--panel-alt);
}
.unit-back-btn:hover {
  background: var(--panel-hover);
}

/* ── Danger button ── */
.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-danger:hover {
  background: #b91c1c;
}

/* ── Clickable table rows ── */
tr.pd-row-clickable {
  cursor: pointer;
  transition: background 0.15s;
}
tr.pd-row-clickable:hover {
  background: var(--panel-hover) !important;
}

/* ── Entry detail grid (admin popup) ── */
.entry-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

@media (max-width: 600px) {
  .entry-detail-grid {
    grid-template-columns: 1fr;
  }
}

.detail-field {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  grid-column: span 1;
}

.detail-field:nth-child(even) {
  border-right: none;
}

/* Full-width fields (description, reflection, improvement) */
.detail-field.full-width {
  grid-column: 1 / -1;
  border-right: none;
}

.detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 3px;
}

.detail-value {
  font-size: 0.9rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── View button ── */
.btn-icon.btn-view:hover,
.btn-view-entry:hover {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}
