:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #eef4fb;
  --text: #132238;
  --muted: #5d6b80;
  --line: #d7e0ea;
  --primary: #0f5bd8;
  --primary-deep: #0b3f94;
  --success: #188a52;
  --danger: #c33939;
  --amber: #c98512;
  --slate: #31445b;
  --radius: 18px;
  --shadow: 0 20px 45px rgba(15, 40, 74, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Segoe UI, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15,91,216,0.12), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0d1e38 0%, #132c52 100%);
  color: #fff;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand-block { display: flex; gap: 14px; align-items: center; margin-bottom: 32px; }
.brand-block img { width: 54px; height: 54px; background: rgba(255,255,255,0.08); border-radius: 16px; padding: 10px; }
.brand-block h1 { margin: 4px 0 0; font-size: 1.2rem; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; color: #7f96ba; }
.nav-links { display: grid; gap: 8px; }
.nav-links a {
  padding: 13px 16px;
  border-radius: 14px;
  color: #dce6f8;
  transition: 0.2s ease;
}
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,0.11); color: #fff; transform: translateX(4px); }

.main-panel {
  padding: 28px;
  min-width: 0;
  overflow-x: hidden;
}
.topbar {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 22px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow);
}
.topbar h2 { margin: 4px 0 0; }
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}
.notification-shell {
  position: relative;
}
.notification-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.notification-btn:hover {
  transform: translateY(-1px) scale(1.03);
  border-color: var(--primary);
  box-shadow: 0 12px 24px rgba(15, 91, 216, 0.18);
}
.notification-btn.has-alert .notification-bell {
  animation: bell-ring 1.6s ease-in-out infinite;
}
.notification-bell {
  font-size: 1.2rem;
}
.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 44px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 50;
  overflow: hidden;
}
.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #eef2f7;
}
.notification-view-all {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.84rem;
}
.notification-list {
  max-height: 340px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
}
.notification-item {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f4fa;
  transition: background 0.2s ease;
}
.notification-item:hover {
  background: #f7fbff;
}
.notification-item:last-child {
  border-bottom: 0;
}
.notification-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.76rem;
}
.notification-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #edf4ff;
  color: var(--primary);
  font-weight: 700;
}
.notification-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.notification-item small {
  color: var(--muted);
  font-size: 0.75rem;
}
.notification-empty {
  padding: 18px 16px;
  color: var(--muted);
  text-align: center;
}
@keyframes bell-ring {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(12deg); }
  30% { transform: rotate(-9deg); }
  45% { transform: rotate(7deg); }
  60% { transform: rotate(-4deg); }
}
.user-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--panel-soft);
  padding: 10px 14px;
  border-radius: 14px;
}
.user-pill span { color: var(--muted); font-size: 0.85rem; }
.page-content {
  margin-top: 24px;
  display: grid;
  gap: 20px;
  min-width: 0;
}
.hero-panel, .card {
  background: var(--panel);
  border: 1px solid rgba(215,224,234,0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.hero-panel {
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}
.hero-panel > div:first-child {
  min-width: 0;
}
.hero-panel h3 { margin: 6px 0 0; max-width: 760px; }
.card { padding: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.section-head h3 { margin: 0; }
.with-top-gap { margin-top: 28px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  min-width: 0;
}
.compact-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.expert-metrics { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.expert-metrics .stat-card { min-width: 0; }
.stat-card {
  padding: 20px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
}
.stat-card-button {
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.stat-card-button:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}
.stat-card-button.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 110, 234, 0.14), var(--shadow);
}
.live-stat-button {
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.live-stat-button:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}
.stat-link { transition: 0.2s ease; }
.stat-link:hover { border-color: var(--primary); transform: translateY(-2px); }
.stat-card span { color: var(--muted); }
.stat-card strong { font-size: 1.9rem; }
.stat-card .auto-fit-value {
  display: block;
  line-height: 1.12;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  min-height: 2.2em;
}
.accent-blue { border-top: 5px solid var(--primary); }
.accent-green { border-top: 5px solid var(--success); }
.accent-red { border-top: 5px solid var(--danger); }
.accent-amber { border-top: 5px solid var(--amber); }
.accent-slate { border-top: 5px solid var(--slate); }

.content-grid.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
  min-width: 0;
}
.content-grid.two-col.approval-layout {
  grid-template-columns: minmax(0, 6fr) minmax(0, 4fr);
}
.content-grid.approval-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  min-width: 0;
}
.approval-layout > .card {
  min-width: 0;
}
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.action-tile, .list-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fff;
}
.action-tile:hover, .list-row:hover { border-color: var(--primary); transform: translateY(-1px); }
.list-stack { display: grid; gap: 12px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.list-row strong, .thread-card strong { display: block; }
.list-row span, .thread-card span, .detail-block p { color: var(--muted); }
.static-row { cursor: default; }
.attachment-stack {
  display: grid;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.attachment-stack strong,
.attachment-stack span {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.attachment-actions-under {
  margin-top: 4px;
  align-items: center;
}
.row-end { display: flex; align-items: center; gap: 14px; }
.empty-state, .empty-cell { padding: 22px; text-align: center; color: var(--muted); }

.form-grid, .filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group.full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: 0.92rem; }
input, select, textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fbfdff;
  color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }
.stack-form { display: grid; gap: 12px; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.inline-end { justify-content: flex-end; }
.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), #2c79f5); color: #fff; }
.btn-secondary { background: #e8eef8; color: var(--text); }
.btn-danger { background: #ffe7e7; color: var(--danger); }
.btn-block { width: 100%; text-align: center; display: inline-block; }
.ghost-btn { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.ghost-btn.danger { color: var(--danger); }

.search-shell { position: relative; }
.search-results {
  position: absolute; z-index: 3; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-top: 8px; box-shadow: var(--shadow);
}
.result-item {
  width: 100%; border: 0; background: transparent; text-align: left; padding: 14px 16px; display: grid; gap: 4px; cursor: pointer;
}
.result-item + .result-item { border-top: 1px solid var(--line); }
.approver-stage { display: grid; gap: 12px; margin-top: 14px; }
.approver-card {
  display: flex; justify-content: space-between; gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 16px;
}
.approver-card p { margin: 4px 0 0; color: var(--muted); }
.inline-actions { display: flex; gap: 8px; }
.inline-form { margin: 0; display: inline-flex; }
.inline-form .btn { height: 100%; }
.step-chip, .status-pill {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 6px 10px; font-size: 0.8rem; font-weight: 700;
}
.step-chip { background: #e8eef8; margin-right: 10px; }
.status-pill { background: #ecf1f8; color: var(--slate); }
.status-approved { background: #e7f7ef; color: var(--success); }
.status-rejected { background: #fdeaea; color: var(--danger); }
.status-pending, .status-approval, .status-clarification, .status-expert, .status-draft { background: #fff4df; color: var(--amber); }

.timeline { display: grid; gap: 16px; }
.timeline-item { display: grid; grid-template-columns: 16px 1fr; gap: 12px; align-items: start; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #c5ced8; margin-top: 6px; }
.dot.approved { background: var(--success); }
.dot.rejected { background: var(--danger); }
.dot.pending, .dot.waiting { background: var(--amber); }
.detail-block { padding: 14px 0; border-bottom: 1px solid #eef2f7; }
.detail-block:last-child { border-bottom: 0; }
.detail-block h4 { margin: 0 0 6px; }
.rich-text-display { white-space: pre-wrap; line-height: 1.6; margin: 0; }
.rich-text-table-wrap { margin: 8px 0; overflow-x: auto; }
.rich-text-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
}
.rich-text-table th,
.rich-text-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.rich-text-table th {
  background: #f4f7fb;
  font-weight: 700;
}
.thread-card { padding: 16px; border-radius: 16px; background: #f9fbfe; border: 1px solid var(--line); }
.response-note { margin-top: 10px; padding: 12px; border-radius: 12px; background: #eef7ff; }
.attachment-group { margin-top: 12px; }
.attachment-group small { display: block; margin-bottom: 8px; color: var(--muted); font-weight: 600; }
.attachment-list { display: grid; gap: 8px; }
.attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.attachment-item .inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.attachment-item .inline-actions .btn {
  white-space: nowrap;
}
.attachment-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.text-format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.text-format-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  margin-right: 4px;
}
.text-format-toolbar .ghost-btn {
  padding: 7px 11px;
}
.rich-text-hidden {
  display: none !important;
}
.rich-text-editor {
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  overflow: auto;
  line-height: 1.5;
}
.rich-text-editor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(12, 113, 206, 0.12);
}
.rich-text-editor p {
  margin: 0 0 8px;
}
.rich-text-editor p:last-child {
  margin-bottom: 0;
}
.rich-text-editor .rich-text-table-wrap {
  margin: 6px 0;
}
.rich-text-live-preview {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
}
.rich-text-live-preview p {
  margin: 0 0 8px;
  line-height: 1.5;
}
.rich-text-live-preview p:last-child {
  margin-bottom: 0;
}
.rich-text-preview-empty {
  color: var(--muted);
}
.file-preview-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.upload-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  align-items: center;
  padding: 0 2px;
  color: var(--muted);
  font-size: 0.9rem;
}
.upload-summary strong {
  color: var(--text);
}
.upload-file-list {
  display: grid;
  gap: 8px;
}
.upload-file-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.upload-file-meta {
  display: grid;
  gap: 2px;
}
.upload-file-meta span {
  color: var(--muted);
  font-size: 0.82rem;
}
.upload-file-item .inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.upload-file-item .inline-actions .btn {
  white-space: nowrap;
}
.toggle-panel.hidden { display: none; }
.hidden { display: none !important; }
.accordion-shell { margin-top: 18px; }
.view-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 18px;
}
.admin-view-toggle.active {
  background: linear-gradient(135deg, var(--primary), #2c79f5);
  color: #fff;
}
.metric-insight-description {
  margin: -8px 0 14px;
  color: var(--muted);
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 27, 43, 0.55);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-card {
  width: min(1200px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
body.modal-open {
  overflow: hidden;
}
.monitoring-embed-shell {
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.monitoring-embed-frame {
  width: 100%;
  height: 75vh;
  border: 0;
  display: block;
}

.table { width: 100%; border-collapse: collapse; }
.modern-table th, .modern-table td { padding: 14px 12px; border-bottom: 1px solid #eef2f7; text-align: left; }
.modern-table th { color: var(--muted); font-size: 0.84rem; text-transform: uppercase; letter-spacing: 0.04em; }
.comment-cell { max-width: 420px; white-space: pre-wrap; }
.rating-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff4df;
  color: var(--amber);
  font-weight: 700;
}
.star-rating {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 8px;
}
.star-rating input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.star-label {
  font-size: 2.2rem;
  line-height: 1;
  color: #cfd8e6;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}
.star-label:hover,
.star-label:hover ~ .star-label {
  color: #f2b01e;
  transform: translateY(-1px);
}
.star-rating input:checked ~ .star-label {
  color: #f2b01e;
}
.rating-caption {
  color: var(--muted);
  font-weight: 600;
  margin-top: -4px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.flash-stack { display: grid; gap: 10px; margin: 18px 0; }
.flash-stack.compact { margin: 0 0 14px; }
.flash { padding: 14px 16px; border-radius: 14px; }
.flash-success { background: #e8f7ef; color: var(--success); }
.flash-error { background: #fdeaea; color: var(--danger); }

.login-body { min-height: 100vh; }
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 460px;
  gap: 26px;
  align-items: stretch;
  padding: 32px;
}
.single-card { grid-template-columns: minmax(320px, 720px); justify-content: center; }
.login-hero, .login-card {
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.login-hero { padding: 56px; display: grid; align-content: end; background: linear-gradient(160deg, #102746, #0f5bd8); color: #fff; }
.login-hero .eyebrow, .login-hero .hero-copy { color: rgba(255,255,255,0.78); }
.login-hero h1 { font-size: 3rem; line-height: 1.05; margin: 12px 0; }
.login-card { padding: 42px; display: grid; align-content: center; }
.login-logo { width: 90px; margin: 0 auto 20px; display: block; }
.login-card h2 { margin: 0; }
.login-subtitle, .hero-copy { color: var(--muted); }
.divider { text-align: center; color: var(--muted); margin: 18px 0; position: relative; }
.divider span { background: #fff; padding: 0 10px; position: relative; }
.divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.wide-card { max-width: 720px; width: 100%; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.template-card {
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.template-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.template-card h3, .template-card p { margin: 0; }
.table-shell { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
.table-shell {
  -webkit-overflow-scrolling: touch;
}
.department-mapping-stack {
  display: grid;
  gap: 20px;
}
.mapping-intro {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
}
.mapping-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.mapping-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 20px;
  align-items: stretch;
}
.department-picker,
.hod-picker {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.department-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.department-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--slate);
  font-size: 0.88rem;
  white-space: nowrap;
}
.department-select-all input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
}
.department-list-shell {
  max-height: 164px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fbfdff;
  display: grid;
  gap: 8px;
}
.hod-picker {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  align-content: start;
  min-height: 246px;
}
.hod-picker .form-actions {
  margin-top: 4px;
}
.department-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.department-option:hover {
  border-color: #cbd9eb;
  background: #f6faff;
}
.department-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}
.department-option span {
  overflow-wrap: anywhere;
}
.mapping-summary-strip {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.mapping-table-shell {
  max-height: 430px;
  overflow: auto;
}
.mapping-table-shell .modern-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbff;
}
.mapping-table-shell .modern-table th,
.mapping-table-shell .modern-table td {
  vertical-align: top;
}
.mapping-hod-cell,
.mapping-email-cell {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.mapping-hod-cell {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  min-width: 170px;
}
.mapping-email-cell {
  white-space: normal;
  min-width: 260px;
}
.mapping-action-cell {
  min-width: 300px;
  white-space: normal;
}
.mapping-manage-cell {
  min-width: 180px;
  white-space: nowrap;
}
.mapping-update-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .45rem;
  margin: 0 0 .5rem 0;
}
.mapping-delete-form {
  margin: 0;
}
.mapping-manage-form {
  margin: 0 0 .35rem 0;
}
.mapping-email-input {
  width: 100%;
  min-width: 0;
  margin-right: 0;
}
.mapping-search-shell {
  width: 100%;
}
.mapping-update-form .btn,
.mapping-delete-form .btn {
  width: 100%;
}
.mapping-change-btn,
.mapping-delete-btn {
  width: 100%;
  min-height: 40px;
}
.mapping-change-btn {
  margin-top: 0;
}
.mapping-delete-form {
  margin-top: 0;
}
.mapping-hod-results {
  max-height: 180px;
  overflow-y: auto;
}
.reports-table-shell {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.reports-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.reports-table th:nth-child(1),
.reports-table td:nth-child(1) {
  width: 190px;
  white-space: normal;
}
.reports-table th,
.reports-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.reports-table th:last-child,
.reports-table td:last-child,
.reports-table .pdf-cell { white-space: nowrap; width: 54px; text-align: center; }
.reports-table .btn-report-pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: 120px;
  padding: 10px 14px;
}
.reports-table .btn-report-pdf-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border-radius: 10px;
}
.reports-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
  flex-wrap: wrap;
}
.reports-actions .btn { white-space: nowrap; }
.selection-table th:first-child, .selection-table td:first-child { width: 90px; }
.selection-table input[type="checkbox"] { width: 18px; height: 18px; }
.stage-track {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.stage-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.stage-step.active { border-color: var(--primary); background: #f4f8ff; }
.stage-step.complete { border-color: #cbe9d7; background: #f4fbf7; }
.stage-step.locked { opacity: 0.72; }
.stage-step .stage-label {
  min-width: 72px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stage-step .stage-copy p { margin: 4px 0 0; }
.timeline-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid var(--line);
}
.summary-row strong { display: block; }
.summary-row span { color: var(--muted); }
.chart-card { display: grid; gap: 12px; }
.bar-list { display: grid; gap: 12px; }
.bar-row { display: grid; gap: 6px; }
.dept-bar-link {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.dept-bar-link:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.bar-row-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #ebf0f7;
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #70a4ff); }
.line-chart-shell {
  min-height: 290px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 12px;
}
.line-chart-svg {
  width: 100%;
  height: 240px;
}
.line-axis {
  stroke: #d8e2ef;
  stroke-width: 1.4;
}
.line-grid {
  stroke: #eef3f9;
  stroke-width: 1;
}
.line-path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line-tick-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.axis-title {
  fill: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.line-chart-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
}
.line-chart-meta strong {
  color: var(--text);
}
.matrix-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 320px;
}
.department-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  grid-auto-rows: 1fr;
  gap: 16px;
  min-width: 0;
  align-items: stretch;
}
.section-head.compact {
  margin-bottom: 0;
}
.matrix-block h4 { margin: 0; }
.dept-chart {
  display: grid;
  gap: 12px;
  flex: 1;
  align-content: center;
}
.dept-chart-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #edf2f8;
  overflow: hidden;
}
.dept-chart-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #73a8ff);
}
.dept-chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dept-chart-meta strong {
  font-size: 2rem;
  line-height: 1;
}
.dept-chart-meta span {
  color: var(--muted);
}
.admin-table td, .admin-table th { vertical-align: top; }
.record-subject { display: grid; gap: 4px; }
.record-subject small { color: var(--muted); }
.admin-scroll {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.admin-scroll .modern-table {
  margin-top: 0;
  min-width: 1200px;
  width: 100%;
}
.admin-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}
.standalone-admin-page {
  min-height: 100vh;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(15,91,216,0.08), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}
.standalone-admin-shell {
  width: min(1400px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}
.admin-mini-hero {
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.standalone-scroll {
  max-height: calc(100vh - 220px);
  -webkit-overflow-scrolling: touch;
}
.admin-mini-hero > div:first-child {
  flex: 1 1 360px;
  min-width: 0;
}
.admin-mini-hero .inline-actions {
  flex: 0 1 auto;
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: 100%;
}
.admin-mini-hero .inline-actions .btn {
  white-space: nowrap;
}
.standalone-scroll .modern-table {
  min-width: 980px;
  width: 100%;
  table-layout: auto;
}
.standalone-scroll .modern-table th,
.standalone-scroll .modern-table td {
  vertical-align: top;
}
.standalone-scroll .modern-table th:nth-child(1),
.standalone-scroll .modern-table td:nth-child(1) {
  width: 17ch;
  white-space: nowrap;
}
.standalone-scroll .modern-table th:nth-child(2),
.standalone-scroll .modern-table td:nth-child(2) {
  width: auto;
  min-width: 280px;
}
.standalone-scroll .modern-table th:nth-child(3),
.standalone-scroll .modern-table td:nth-child(3) {
  width: 13rem;
  white-space: nowrap;
}
.standalone-scroll .modern-table th:nth-child(4),
.standalone-scroll .modern-table td:nth-child(4) {
  width: 10rem;
  white-space: nowrap;
}
.standalone-scroll .modern-table th:nth-child(5),
.standalone-scroll .modern-table td:nth-child(5) {
  width: 6rem;
  white-space: nowrap;
}
.standalone-scroll .modern-table th:nth-child(6),
.standalone-scroll .modern-table td:nth-child(6) {
  width: 11rem;
}
.standalone-scroll .modern-table th:nth-child(7),
.standalone-scroll .modern-table td:nth-child(7) {
  width: 8rem;
  text-align: center;
}
.standalone-scroll .record-subject {
  display: block;
  width: 100%;
}
.standalone-scroll .record-subject strong,
.standalone-scroll .record-subject small {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.standalone-scroll .record-subject strong {
  line-height: 1.25;
}
.standalone-scroll .modern-table td:nth-child(7) .btn {
  padding: 10px 14px;
  min-width: 92px;
  justify-content: center;
}
.standalone-scroll .modern-table td:nth-child(1) a {
  display: inline-block;
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .stats-grid, .content-grid.two-col, .form-grid, .filter-grid, .login-shell { grid-template-columns: 1fr; }
  .mapping-form-grid { grid-template-columns: 1fr; }
  .standalone-admin-page { padding: 16px; }
}

@media (max-width: 900px) {
  .topbar,
  .hero-panel {
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .main-panel { padding: 16px; }
  .topbar, .hero-panel, .card { padding: 18px; }
  .topbar, .hero-panel, .list-row, .approver-card, .form-actions { flex-direction: column; align-items: stretch; }
  .admin-mini-hero .inline-actions {
    margin-left: 0;
    justify-content: stretch;
  }
  .admin-mini-hero .inline-actions .btn {
    width: 100%;
  }
  .row-end, .inline-actions, .topbar-actions { flex-wrap: wrap; }
  .notification-panel {
    right: -6px;
    width: min(360px, calc(100vw - 38px));
  }
  .reports-actions {
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .reports-actions .btn {
    width: 100%;
  }
  .standalone-scroll .modern-table {
    min-width: 920px;
  }
  .attachment-item {
    grid-template-columns: 1fr;
  }
  .attachment-item .inline-actions {
    justify-content: flex-start;
  }
  .attachment-item .inline-actions .btn {
    width: auto;
  }
  .star-label { font-size: 2rem; }
  .login-shell { padding: 16px; }
  .login-hero { min-height: 260px; }
  .login-hero h1 { font-size: 2.2rem; }
  .mapping-summary-strip {
    justify-content: flex-start;
  }
  .department-list-shell {
    max-height: 164px;
  }
  .department-picker-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .mapping-table-shell .modern-table {
    min-width: 760px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .nav-links a:hover,
  .notification-btn:hover,
  .stat-card-button:hover,
  .live-stat-button:hover,
  .stat-link:hover,
  .action-tile:hover,
  .list-row:hover,
  .template-card:hover,
  .dept-bar-link:hover {
    transform: none;
    box-shadow: inherit;
  }

  .topbar,
  .notification-btn,
  .template-card,
  .dept-bar-link,
  .stat-card-button,
  .live-stat-button {
    transition: none;
  }

  .topbar {
    backdrop-filter: none;
  }
}
