:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --surface-2: #f1f3f5;
  --border: #dfe3e8;
  --border-strong: #c8ced6;
  --text: #373a3c;
  --text-strong: #231f20;
  --text-muted: #66707a;
  --primary: #b93221;
  --primary-strong: #8f241b;
  --primary-soft: #f9e8e6;
  --warm: #c8641f;
  --green: #2f8f4e;
  --sidebar: #fff;
  --radius: 8px;
  --shadow: 0 16px 36px rgba(35,31,32,.08);
  --shadow-soft: 0 8px 22px rgba(35,31,32,.06);
  --font: "Roboto","Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,Arial,sans-serif;
  --bs-font-sans-serif: var(--font);
  --bs-body-font-family: var(--font);
  --bs-body-font-weight: 400;
  --bs-btn-font-weight: 400;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.82) 0, rgba(245,246,248,0) 240px),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body * {
  font-synthesis: none;
  font-weight: 400 !important;
}

b,
strong,
th,
label,
legend,
.fw-bold,
.fw-semibold,
.fw-bolder,
.fw-medium,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6,
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 400 !important;
}

html,
body,
button,
input,
select,
textarea,
.form-control,
.form-select,
.btn,
.dropdown-menu,
.modal,
.popover,
.tooltip,
.table,
.card,
.badge,
.pagination,
.dt-container,
.dataTables_wrapper,
.flatpickr-calendar {
  font-family: var(--font) !important;
  font-synthesis: none;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.app-shell .btn,
.public-page .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius);
  box-shadow: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.app-shell .btn:hover,
.public-page .btn:hover {
  transform: translateY(-1px);
}

.app-shell .btn:active,
.public-page .btn:active {
  transform: translateY(0);
}

.app-shell .btn.disabled:hover,
.app-shell .btn:disabled:hover,
.public-page .btn.disabled:hover,
.public-page .btn:disabled:hover {
  transform: none;
}

.app-shell .btn-sm,
.public-page .btn-sm {
  min-height: 34px;
  gap: 6px;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-strong);
  --bs-btn-hover-border-color: var(--primary-strong);
  --bs-btn-active-bg: var(--primary-strong);
  --bs-btn-active-border-color: var(--primary-strong);
  --bs-btn-focus-shadow-rgb: 185,50,33;
}
.app-shell .btn-primary,
.public-page .btn-primary {
  box-shadow: 0 8px 18px rgba(185,50,33,.18);
}
.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-active-bg: var(--primary-strong);
  --bs-btn-active-border-color: var(--primary-strong);
}
.btn-soft-primary {
  color: var(--primary);
  background: var(--primary-soft);
}
.btn-soft-primary:hover {
  color: #fff;
  background: var(--primary);
  border-color: rgba(185,50,33,.18);
}
.btn-soft-secondary {
  color: var(--text);
  background: #fff;
  border-color: var(--border);
}
.btn-soft-secondary:hover {
  color: var(--text-strong);
  background: #f7f8fa;
  border-color: var(--border-strong);
}
.form-check-input:checked {
  background-color: var(--primary);
}
.app-shell .form-control,
.app-shell .form-select,
.app-shell .input-group-text,
.public-page .form-control,
.public-page .form-select,
.public-page .input-group-text {
  border-color: var(--border-strong);
  border-radius: var(--radius);
}
.app-shell .form-control,
.app-shell .form-select,
.public-page .form-control,
.public-page .form-select {
  min-height: 42px;
  background-color: #fff;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.app-shell .input-group .form-control,
.app-shell .input-group .input-group-text,
.public-page .input-group .form-control,
.public-page .input-group .input-group-text {
  min-height: 46px;
}
.app-shell .input-group-text,
.public-page .input-group-text {
  color: var(--primary);
  background: #fafbfc;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(185,50,33,.16);
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(145deg, rgba(185,50,33,.12), transparent 34%),
    linear-gradient(320deg, rgba(35,31,32,.06), transparent 30%),
    var(--bg);
}
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}
.login-shell { width: min(100%, 480px); }
.login-panel {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px;
}
.login-brand-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.login-brand-wrap img { width: 164px; }
.login-copyright {
  margin: 14px 0 0;
  color: #858b93;
  font-size: .82rem;
  text-align: center;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0,1fr);
  min-height: 100vh;
}
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  box-shadow: 10px 0 28px rgba(35,31,32,.06);
  z-index: 12;
  overflow-y: auto;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 30px 24px 24px;
  color: var(--text-strong);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #fbfcfd);
}
.brand img {
  width: 156px;
  max-width: 100%;
  margin-bottom: 8px;
  align-self: center;
}
.brand strong {
  font-size: 1.06rem;
  line-height: 1.25;
}
.brand span {
  color: var(--primary);
  font-size: .78rem;
  text-transform: uppercase;
  line-height: 1.35;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 18px 12px 24px;
  gap: 12px;
}
.nav-module {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nav-module-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 7px 12px 5px;
  color: var(--text-muted);
  font-size: .75rem;
  line-height: 1.25;
  text-transform: uppercase;
}
.nav-module-title i {
  width: 18px;
  color: var(--primary);
  text-align: center;
}
.nav-module-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 21px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.nav-section {
  color: var(--text-muted);
  font-size: .74rem;
  text-transform: uppercase;
  padding: 16px 12px 7px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.nav-link i {
  flex: 0 0 20px;
  width: 20px;
  color: var(--primary);
  text-align: center;
}
.nav-link span {
  min-width: 0;
}
.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(185,50,33,.12);
}
.nav-link:hover {
  transform: translateX(2px);
}
.app-main { min-width: 0; }
.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding: 16px 32px;
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 8;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 18px rgba(35,31,32,.04);
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
}
.topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.topbar-avatar {
  width: 40px;
  height: 40px;
  color: var(--primary);
  background: #fff;
  border: 1px solid rgba(185,50,33,.28);
  border-radius: 999px;
  font-size: 1.28rem;
}
.topbar-user-copy {
  min-width: 0;
}
.topbar-user-main {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.topbar-department {
  display: block;
  color: var(--text-muted);
  font-size: .9rem;
}
.role-pill,
.status-pill,
.module-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.logout-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  background: #fff;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.logout-link:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(185,50,33,.18);
}
.content-wrap {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 30px 32px 52px;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.page-title {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(1.6rem, 2.2vw, 2.2rem);
  letter-spacing: 0;
  line-height: 1.15;
}
.page-subtitle {
  color: var(--text-muted);
  margin: 7px 0 0;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.panel-pad { padding: 24px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  position: relative;
  min-height: 110px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,1)),
    var(--surface);
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: transparent;
}
.stat-card-alert::before {
  background: var(--primary);
  opacity: .86;
}
.stat-card-alert {
  background:
    linear-gradient(180deg, rgba(255,255,255,1), rgba(249,232,230,.86)),
    var(--surface);
}
.stat-card span {
  display: block;
  max-width: 160px;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.35;
}
.stat-card strong {
  display: block;
  margin-top: 12px;
  color: var(--text-strong);
  font-size: 2.15rem;
  line-height: 1;
}
.filters {
  display: grid;
  grid-template-columns: 180px 180px minmax(220px,1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  background: rgba(255,255,255,.82);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(35,31,32,.04);
}
.stats-filters {
  grid-template-columns: 180px 180px minmax(220px, 360px) auto;
  align-items: end;
}
.stats-filters .form-label {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--text-muted);
  font-size: .84rem;
}
.statistics-loader {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245,246,248,.86);
  backdrop-filter: blur(8px);
  transition: opacity .18s ease, visibility .18s ease;
}
.statistics-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.statistics-loader-card {
  min-width: min(100% - 32px, 320px);
  padding: 28px;
  border: 1px solid rgba(185,50,33,.16);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}
.statistics-loader-card strong {
  display: block;
  margin-top: 14px;
  color: var(--text-strong);
  font-size: 1.05rem;
}
.statistics-loader-card span:last-child {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .9rem;
}
.statistics-spinner {
  width: 42px;
  height: 42px;
  display: inline-block;
  border-radius: 999px;
  border: 4px solid rgba(185,50,33,.16);
  border-top-color: var(--primary);
  animation: statisticsSpin .72s linear infinite;
}
@keyframes statisticsSpin {
  to { transform: rotate(360deg); }
}
.stats-data-table {
  width: 100% !important;
}
.dt-container .dt-search input,
.dt-container .dt-length select {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 10px;
  outline: none;
}
.dt-container .dt-paging .dt-paging-button {
  border-radius: 8px !important;
}
.stats-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stats-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stats-overview-card {
  position: relative;
  min-height: 124px;
  padding: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #fbfcfd);
}
.stats-overview-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: #e3e7ec;
}
.stats-overview-primary::after {
  background: var(--primary);
}
.stats-overview-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(185,50,33,.14);
  border-radius: 8px;
}
.stats-overview-card > span:not(.stats-overview-icon) {
  display: block;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.35;
}
.stats-overview-card strong {
  display: block;
  margin-top: 9px;
  color: var(--text-strong);
  font-size: 2rem;
  line-height: 1;
}
.stats-overview-card .stats-overview-date {
  font-size: 1.28rem;
  line-height: 1.2;
}
.stats-chart-panel {
  padding: 26px;
}
.stats-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.stats-period-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(185,50,33,.14);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: .84rem;
  line-height: 1.2;
  white-space: nowrap;
}
.chart-wrap {
  position: relative;
  min-height: 380px;
  padding: 18px 12px 8px;
  background:
    linear-gradient(180deg, #fbfcfd, #fff);
  border: 1px solid #eef0f2;
  border-radius: var(--radius);
}
.staff-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.staff-overview-card {
  position: relative;
  min-height: 118px;
  padding: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #fbfcfd);
}
.staff-overview-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: #e3e7ec;
}
.staff-overview-primary::after {
  background: var(--primary);
}
.staff-overview-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(185,50,33,.14);
  border-radius: 8px;
}
.staff-overview-card > span:not(.staff-overview-icon) {
  display: block;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.35;
}
.staff-overview-card strong {
  display: block;
  margin-top: 9px;
  color: var(--text-strong);
  font-size: 1.9rem;
  line-height: 1;
}
.staff-table-toolbar,
.staff-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}
.staff-table-toolbar {
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}
.staff-table-footer {
  border-top: 1px solid var(--border);
  background: #fff;
}
.staff-table-search,
.staff-table-length {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-muted);
  font-size: .92rem;
}
.staff-table-search {
  flex: 1 1 360px;
}
.staff-table-search .input-group {
  width: min(420px, 100%);
}
.staff-table-length {
  flex: 0 0 auto;
  white-space: nowrap;
}
.staff-table-length .form-select {
  width: 92px;
}
.staff-table-info {
  color: var(--text-muted);
  font-size: .92rem;
}
.staff-table-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.staff-page-btn {
  min-height: 36px;
  min-width: 36px;
  padding: 6px 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.staff-page-btn:hover:not(:disabled),
.staff-page-btn.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.staff-page-btn:disabled {
  color: var(--text-muted);
  background: #f3f4f6;
  cursor: not-allowed;
}
.staff-table {
  width: 100% !important;
  min-width: 1120px;
}
.staff-table th:nth-child(2),
.staff-table td:nth-child(2),
.staff-table th:nth-child(4),
.staff-table td:nth-child(4),
.staff-table th:nth-child(5),
.staff-table td:nth-child(5),
.staff-table th:nth-child(6),
.staff-table td:nth-child(6) {
  overflow-wrap: normal;
  white-space: nowrap;
}
.staff-module-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.staff-module-chip {
  font-size: .78rem;
}
.role-pill {
  border: 1px solid transparent;
  padding: 6px 10px;
  font-size: .78rem;
  line-height: 1.2;
}
.role-admin {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(185,50,33,.18);
}
.role-staff {
  color: #245076;
  background: #e5f0fa;
  border-color: #c9deef;
}
.user-status-active {
  color: #17633b;
  background: #e7f6ed;
  border-color: #ccebd8;
}
.user-status-inactive {
  color: #91500e;
  background: #fff0dd;
  border-color: #f5d8b3;
}
.user-status-archived {
  color: #66707a;
  background: #eef0f2;
  border-color: #dde2e7;
}
.table-panel {
  overflow: hidden;
  background: #fff;
}
.request-table {
  margin: 0;
  table-layout: fixed;
  min-width: 1240px;
}
.request-table.request-table-empty {
  min-width: 100%;
}
.request-table.request-table-empty col {
  width: auto;
}
.request-table .col-request-id { width: 88px; }
.request-table .col-request-module { width: 198px; }
.request-table .col-request-patron { width: 180px; }
.request-table .col-request-subject { width: auto; }
.request-table .col-request-status { width: 112px; }
.request-table .col-request-assigned { width: 150px; }
.request-table .col-request-date { width: 198px; }
.request-table .col-request-actions { width: 178px; }
.request-table th {
  color: var(--text-muted);
  background: #f8f9fb;
  font-size: .78rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0;
  padding: 13px 14px;
}
.request-table td {
  border-color: var(--border);
  padding: 16px 14px;
  transition: background-color 1.2s ease;
  vertical-align: middle;
}
.request-table tbody tr {
  transition: background-color .16s ease;
}
.request-table tbody tr:hover td {
  background: #fbfcfd;
}
.request-table th,
.request-table td {
  overflow-wrap: anywhere;
}
.request-table th:first-child,
.request-table td:first-child,
.request-table th:nth-child(5),
.request-table td:nth-child(5),
.request-table th:nth-child(8),
.request-table td:nth-child(8) {
  overflow-wrap: normal;
  white-space: nowrap;
}
.request-date-main {
  white-space: nowrap;
}
@keyframes requestRowArrive {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
.request-row-arriving {
  opacity: 0;
  transform: translateY(-10px);
}
.request-row-arriving-visible {
  animation: requestRowArrive .48s cubic-bezier(.2,.8,.2,1) forwards;
}
.request-row-highlight td {
  background: var(--primary-soft);
}
.request-row-highlight:not(.request-row-highlight-fading) td {
  transition: none;
}
.request-row-highlight-fading td {
  background: transparent;
  transition: background-color 1.5s ease;
}
.new-count-pulse {
  display: inline-block;
  animation: newCountPulse .72s ease-out;
}
.stat-value-pulse {
  animation: newCountPulse .72s ease-out;
}
@keyframes newCountPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.request-title {
  display: block;
  color: var(--text-strong);
  text-decoration: none;
  line-height: 1.35;
}
.request-title:hover { color: var(--primary); }
.table-subtext {
  display: block;
  color: var(--text-muted);
  font-size: .86rem;
  margin-top: 3px;
}
.attachment-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(185,50,33,.14);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: .78rem;
  line-height: 1.2;
}
.attachment-download-link {
  color: var(--primary);
  text-decoration: none;
}
.attachment-download-link:hover {
  color: var(--primary-strong);
  text-decoration: none;
}
.table-actions {
  width: 178px;
  white-space: nowrap;
}
.table-actions .btn {
  min-width: 112px;
  white-space: nowrap;
}
.inline-action-form {
  display: inline-flex;
  margin: 0;
}
.module-chip {
  background: #f6f7f9;
  color: var(--text-strong);
  border: 1px solid #e7eaee;
  padding: 6px 9px;
  font-size: .82rem;
  max-width: 100%;
  line-height: 1.2;
}
.module-chip i { color: var(--primary); }
.status-pill {
  border: 1px solid transparent;
  padding: 6px 10px;
  font-size: .78rem;
  line-height: 1.2;
}
.status-new { color: #17633b; background: #e7f6ed; border-color: #ccebd8; }
.status-claimed { color: #91500e; background: #fff0dd; border-color: #f5d8b3; }
.status-answered { color: #245076; background: #e5f0fa; border-color: #c9deef; }
.status-deleted,
.status-muted { color: #66707a; background: #eef0f2; border-color: #dde2e7; }
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 42px !important;
}
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) 372px;
  gap: 20px;
  align-items: start;
}
.detail-section + .detail-section { margin-top: 20px; }
.section-title {
  font-size: 1rem;
  color: var(--text-strong);
  margin: 0 0 14px;
  line-height: 1.3;
}
.field-list {
  display: grid;
  gap: 0;
}
.field-row {
  display: grid;
  grid-template-columns: 136px minmax(0,1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #eef0f2;
}
.field-row:first-child {
  border-top: 0;
  padding-top: 0;
}
.field-row dt {
  color: var(--text-muted);
  font-size: .84rem;
}
.field-row dd {
  margin: 0;
  min-width: 0;
}
.request-body,
.answer-body {
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--text-strong);
}
.answer-body { white-space: normal; }
.workflow-note {
  color: var(--text-muted);
  background: #fbfcfd;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.rich-editor {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(35,31,32,.04);
}
.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 9px;
  background: #f8f9fb;
  border-bottom: 1px solid var(--border);
}
.rich-format {
  width: 136px;
  min-height: 36px;
}
.rich-tool,
.rich-color {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.rich-tool:hover,
.rich-color:hover {
  color: var(--primary);
  border-color: rgba(185,50,33,.4);
  background: var(--primary-soft);
}
.rich-color {
  position: relative;
  cursor: pointer;
  margin: 0;
}
.rich-color input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.rich-editor-area {
  min-height: 280px;
  padding: 18px;
  line-height: 1.7;
  outline: none;
  background: #fff;
}
.rich-editor-area:focus {
  box-shadow: inset 0 0 0 .2rem rgba(185,50,33,.12);
}
.rich-editor-invalid {
  border-color: #dc3545;
}
.rich-editor-area:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
}
.rich-editor-area blockquote {
  border-left: 4px solid var(--primary);
  margin: 12px 0;
  padding: 4px 0 4px 14px;
  color: var(--text-muted);
}
.rich-editor-area pre {
  background: #f3f4f6;
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
}
.answer-submit-row {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
}
.answer-attachments {
  flex: 1 1 360px;
  margin: 0;
}
.answer-submit-btn {
  min-height: 38px;
  white-space: nowrap;
}
.note-item {
  border-top: 1px solid var(--border);
  padding: 14px 0 0;
  margin-top: 14px;
}
.note-meta {
  color: var(--text-muted);
  font-size: .84rem;
  margin-bottom: 4px;
}
.alert-with-icon {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: var(--radius);
}
.alert-icon { line-height: 1.4; }
.flatpickr-calendar {
  z-index: 1090;
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(35,31,32,.16);
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  background: var(--primary);
  border-color: var(--primary);
}
.public-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.public-panel {
  width: min(100%, 760px);
  padding: 34px;
  text-align: center;
}
.public-panel img {
  width: 160px;
  margin-bottom: 24px;
}
.public-panel h1 {
  color: var(--text-strong);
  font-weight: 900;
}
.settings-panel {
  max-width: 980px;
}
.settings-form .form-label {
  display: block;
  width: 100%;
}
.settings-form .form-control,
.settings-form .form-select {
  width: 100%;
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .stats-overview { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .staff-overview { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: static;
    height: auto;
    box-shadow: none;
  }
  .brand {
    align-items: flex-start;
  }
  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    padding-top: 14px;
    align-items: start;
  }
  .nav-module-links {
    margin-left: 12px;
    padding-left: 8px;
  }
  .brand { padding: 20px; }
  .topbar {
    position: static;
    justify-content: space-between;
    padding: 14px 18px;
  }
  .topbar-user { text-align: left; }
  .topbar-user-main { justify-content: flex-start; }
  .content-wrap { padding: 22px 16px 40px; }
  .filters { grid-template-columns: 1fr; }
  .filters .btn {
    width: 100%;
  }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stats-overview { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .staff-overview { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sidebar-nav { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .field-row { grid-template-columns: 1fr; }
  .answer-submit-row { align-items: stretch; }
  .answer-attachments,
  .answer-submit-btn { width: 100%; }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .logout-link {
    width: 100%;
    justify-content: center;
  }
  .stats-grid {
    gap: 10px;
  }
  .stat-card {
    min-height: 98px;
    padding: 15px;
  }
  .stat-card strong {
    font-size: 1.75rem;
  }
  .stats-overview-card {
    min-height: 112px;
    padding: 15px;
  }
  .stats-overview-card strong {
    font-size: 1.65rem;
  }
  .stats-overview-card .stats-overview-date {
    font-size: 1.05rem;
  }
  .staff-overview-card {
    min-height: 108px;
    padding: 15px;
  }
  .staff-overview-card strong {
    font-size: 1.55rem;
  }
  .staff-table-toolbar,
  .staff-table-footer {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }
  .staff-table-search,
  .staff-table-length,
  .staff-table-search .input-group,
  .staff-table-length .form-select,
  .staff-table-pagination {
    width: 100%;
  }
  .staff-table-length {
    align-items: stretch;
    flex-direction: column;
    white-space: normal;
  }
  .staff-table-pagination {
    justify-content: flex-start;
  }
  .stats-chart-head {
    flex-direction: column;
  }
  .stats-period-pill {
    width: 100%;
    justify-content: center;
  }
}
