/* Quality & Patient Safety Portal shared styles, adapted from the OHS visual system. */

:root,
[data-bs-theme="light"] {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
  --primary: #0f6fbf;
  --primary-dark: #0b4f8a;
  --primary-light: #48a6d9;
  --primary-rgb: 15, 111, 191;
  --secondary: #14b8a6;
  --secondary-rgb: 20, 184, 166;
  --sidebar-bg: #0b263f;
  --surface: #ffffff;
  --surface-low: #f1f8fb;
  --surface-mid: #e4f0f7;
  --background: #eef6fb;
  --on-surface: #0b1220;
  --body-color: #2d4054;
  --text-muted: #64748b;
  --border: #cfdce8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --cyan: #0891b2;
  --indigo: #0f6fbf;
  --glass-bg: rgba(255, 255, 255, 0.76);
  --glass-bg-strong: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-shadow: 0 1rem 2.5rem rgba(11, 15, 25, 0.08), 0 0.25rem 0.75rem rgba(11, 15, 25, 0.04);
  --radius-lg: 8px;
  --radius-xl: 16px;
  --sidebar-width: 286px;
  --focus-ring: rgba(var(--primary-rgb), 0.22);
  color-scheme: light;
}

[data-bs-theme="dark"] {
  --primary: #7dd3fc;
  --primary-dark: #38bdf8;
  --primary-light: #bae6fd;
  --primary-rgb: 125, 211, 252;
  --secondary: #2dd4bf;
  --secondary-rgb: 45, 212, 191;
  --sidebar-bg: #071827;
  --surface: #111c27;
  --surface-low: #172636;
  --surface-mid: #223549;
  --background: #07111d;
  --on-surface: #ffffff;
  --body-color: #d9deea;
  --text-muted: #a8afc2;
  --border: rgba(255, 255, 255, 0.14);
  --glass-bg: rgba(21, 25, 35, 0.74);
  --glass-bg-strong: rgba(21, 25, 35, 0.9);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.32), 0 0.25rem 0.75rem rgba(0, 0, 0, 0.22);
  --focus-ring: rgba(var(--primary-rgb), 0.24);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--body-color);
  background-color: var(--background);
  background-image: url("../img/menu_bg.png");
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
  font-family: var(--font-sans);
  letter-spacing: 0;
}

[data-bs-theme="dark"] body {
  background-image:
    linear-gradient(135deg, rgba(11, 15, 25, 0.76), rgba(11, 15, 25, 0.9)),
    url("../img/menu_bg.png");
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-sans);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

.material-symbols-outlined {
  font-size: 1.25rem;
  line-height: 1;
  vertical-align: middle;
}

.ohs-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 18px 12px;
  overflow-y: auto;
  background:
    radial-gradient(circle at top left, rgba(var(--primary-rgb), 0.34), transparent 34%),
    radial-gradient(circle at 80% 12%, rgba(var(--secondary-rgb), 0.16), transparent 30%),
    var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
}

.brand-logo {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  padding: 5px;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 0.5rem 1.125rem rgba(11, 15, 25, 0.06);
}

.brand-title {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.18;
}

.brand-sub {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  line-height: 1.25;
}

.sidebar-nav {
  flex: 1;
  padding: 2px 0;
}

.ohs-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0.62rem 0.75rem;
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.83rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  border-radius: var(--radius-lg);
  transition: color 0.16s ease, background 0.16s ease;
}

.ohs-sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.ohs-sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(var(--primary-rgb), 0.9), rgba(var(--secondary-rgb), 0.46));
  box-shadow: 0 0.275rem 0.75rem -0.0625rem rgba(0, 0, 0, 0.2);
}

.sidebar-footer {
  padding-top: 14px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.user-avatar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  background: var(--primary);
  border-radius: 50%;
}

.user-name {
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
}

.user-role {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
}

.theme-switch-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px 12px;
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 178px;
  padding: 0.52rem 1rem;
  color: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.mode-switch input {
  width: 2.875rem;
  height: 1.5rem;
  margin: 0;
  cursor: pointer;
  background-color: var(--primary);
  background-image: radial-gradient(circle, #fff 0 0.45rem, transparent 0.48rem);
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 1.5rem 1.5rem;
  border: 0;
  border-radius: 999px;
  appearance: none;
  transition: background-position 0.2s ease-in-out;
}

.mode-switch input:checked {
  background-position: right center;
}

.ohs-sidebar .logout-link {
  color: rgba(255, 255, 255, 0.62);
}

.ohs-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.ohs-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
  padding: 0 28px;
  background: var(--glass-bg-strong);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 0.125rem 0.5rem rgba(11, 15, 25, 0.03);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
}

.topbar-title {
  color: var(--on-surface);
  font-size: 1.08rem;
  font-weight: 800;
}

.topbar-subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ohs-content {
  flex: 1;
  width: 100%;
  padding: 28px;
}

.ohs-card,
.kpi-card,
.dashboard-card,
.assignment-card,
.empty-state {
  color: var(--body-color);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.ohs-card {
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header-ohs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(243, 246, 255, 0.58);
  border-bottom: 1px solid var(--border);
}

.card-title {
  margin: 0;
  color: var(--on-surface);
  font-size: 0.96rem;
  font-weight: 800;
}

.card-subtitle {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.card-body-ohs {
  padding: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
}

.kpi-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
}

.kpi-icon.blue { color: var(--cyan); background: rgba(14, 165, 183, 0.12); }
.kpi-icon.green { color: var(--success); background: rgba(34, 197, 94, 0.12); }
.kpi-icon.amber { color: var(--warning); background: rgba(245, 158, 11, 0.14); }
.kpi-icon.red { color: var(--danger); background: rgba(239, 68, 68, 0.12); }
.kpi-icon.primary,
.kpi-icon.indigo { color: var(--primary); background: rgba(var(--primary-rgb), 0.12); }

.kpi-value {
  margin-bottom: 4px;
  color: var(--on-surface);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.kpi-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-ohs-primary,
.btn-ohs-ghost,
.btn-ohs-danger,
.btn-ohs-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.48rem 1rem;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.btn-ohs-primary {
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: 0 0.5rem 1.125rem -0.5rem rgba(var(--primary-rgb), 0.85);
}

.btn-ohs-primary:hover {
  color: #fff;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-ohs-ghost {
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--border);
}

.btn-ohs-ghost:hover {
  color: var(--primary-dark);
  background: rgba(var(--primary-rgb), 0.07);
  border-color: rgba(var(--primary-rgb), 0.24);
}

.btn-ohs-primary:focus-visible,
.btn-ohs-ghost:focus-visible,
.btn-ohs-danger:focus-visible,
.btn-ohs-success:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn-ohs-danger {
  color: #fff;
  background: var(--danger);
  border: 1px solid var(--danger);
}

.btn-ohs-success {
  color: #fff;
  background: var(--success);
  border: 1px solid var(--success);
}

.btn-sm-ohs {
  min-height: 30px;
  padding: 0.3rem 0.72rem;
  font-size: 0.76rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-group {
  margin-bottom: 16px;
}

label,
.ohs-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--on-surface);
  font-size: 0.78rem;
  font-weight: 700;
}

.form-control,
.form-select,
textarea {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0.625rem 0.875rem;
  color: var(--on-surface);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.35;
  outline: 0;
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: rgba(var(--primary-rgb), 0.55);
  box-shadow: 0 0 0 0.25rem var(--focus-ring);
}

.form-control:focus-visible,
.form-select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-help {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.ohs-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  color: var(--body-color);
  font-size: 0.84rem;
}

.ohs-table th {
  padding: 0.72rem 0.9rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: left;
  text-transform: uppercase;
  background: var(--surface-low);
  border-bottom: 1px solid var(--border);
}

.ohs-table td {
  padding: 0.82rem 0.9rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.ohs-table tr:last-child td {
  border-bottom: 0;
}

.ohs-table tr:hover td {
  background: rgba(var(--primary-rgb), 0.045);
}

.compact-table {
  min-width: 540px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.badge-ohs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  border-radius: 999px;
}

.badge-approved { color: #146c43; background: rgba(34, 197, 94, 0.14); }
.badge-not_started { color: var(--text-muted); background: var(--surface-mid); }
.badge-admin { color: var(--primary-dark); background: rgba(var(--primary-rgb), 0.12); }
.badge-pending { color: #9a6700; background: rgba(245, 158, 11, 0.16); }
.badge-info { color: #0e7490; background: rgba(14, 165, 183, 0.12); }

.alert-ohs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 16px;
  font-size: 0.84rem;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
}

.alert-ohs-warning { color: #9a6700; background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.2); }
.alert-ohs-danger { color: #b42318; background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.2); }
.alert-ohs-info { color: #0e7490; background: rgba(14, 165, 183, 0.12); border-color: rgba(14, 165, 183, 0.18); }
.alert-ohs-success { color: #047857; background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.22); }

.portal-command {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 24px;
  align-items: center;
  margin-bottom: 18px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(241, 248, 251, 0.88) 48%, rgba(225, 241, 249, 0.82)),
    var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.portal-command::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.74;
  background-image:
    linear-gradient(rgba(var(--primary-rgb), 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--primary-rgb), 0.07) 1px, transparent 1px),
    linear-gradient(118deg, transparent 0 21%, rgba(var(--secondary-rgb), 0.12) 21.2% 21.8%, transparent 22% 56%, rgba(var(--primary-rgb), 0.12) 56.2% 56.8%, transparent 57%),
    linear-gradient(32deg, transparent 0 62%, rgba(8, 145, 178, 0.1) 62.2% 62.8%, transparent 63%);
  background-position: center;
  background-size: 34px 34px, 34px 34px, 320px 100%, 280px 100%;
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.28), #000 42%, rgba(0, 0, 0, 0.52));
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.28), #000 42%, rgba(0, 0, 0, 0.52));
}

.portal-command::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: 20px;
  z-index: 0;
  width: min(460px, 46%);
  height: 74px;
  background: linear-gradient(90deg, rgba(var(--primary-rgb), 0), rgba(var(--primary-rgb), 0.38), rgba(var(--secondary-rgb), 0.26), rgba(var(--primary-rgb), 0));
  clip-path: polygon(0 58%, 14% 58%, 20% 44%, 27% 74%, 36% 38%, 46% 58%, 56% 58%, 63% 24%, 72% 70%, 81% 46%, 100% 46%, 100% 57%, 84% 57%, 73% 82%, 63% 40%, 57% 68%, 45% 68%, 37% 52%, 28% 88%, 20% 58%, 14% 68%, 0 68%);
  opacity: 0.52;
}

.portal-command > * {
  position: relative;
  z-index: 1;
}

.portal-command-main {
  min-width: 0;
}

.portal-command-kicker {
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-command-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.portal-command h1 {
  margin: 0;
  color: var(--on-surface);
  font-size: 1.45rem;
  line-height: 1.12;
  font-weight: 900;
}

.portal-command p {
  max-width: 760px;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.48;
}

.portal-command-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 10px;
}

.portal-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  row-gap: 1px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(var(--primary-rgb), 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 0.5rem 1.2rem rgba(15, 111, 191, 0.06);
}

.portal-stat .material-symbols-outlined {
  grid-row: span 2;
  color: var(--primary);
}

.portal-stat strong {
  min-width: 0;
  color: var(--on-surface);
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.1;
}

.portal-stat span:last-child {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.2;
}

.portal-command-search {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(var(--primary-rgb), 0.12);
}

.portal-search-field {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.portal-search-field > .material-symbols-outlined {
  position: absolute;
  left: 13px;
  top: 50%;
  color: var(--text-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.portal-search-field .form-control {
  padding-left: 42px;
  padding-right: 46px;
}

.portal-search-field input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

.portal-search-field input[type="search"]::-webkit-search-cancel-button,
.portal-search-field input[type="search"]::-webkit-search-decoration,
.portal-search-field input[type="search"]::-webkit-search-results-button,
.portal-search-field input[type="search"]::-webkit-search-results-decoration {
  display: none;
  -webkit-appearance: none;
}

.portal-search-field input[type="search"]::-ms-clear,
.portal-search-field input[type="search"]::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

.portal-search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text-muted);
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: var(--radius-lg);
  transform: translateY(-50%);
}

.portal-search-clear:hover {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.portal-search-clear:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.portal-search-count {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.usage-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
  align-items: start;
}

.dashboard-search-empty {
  margin-bottom: 16px;
}

.dashboard-search-results {
  margin-bottom: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.dashboard-accordion-list {
  display: grid;
  gap: 16px;
}

.dashboard-accordion {
  overflow: hidden;
  color: var(--body-color);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.dashboard-accordion-summary {
  appearance: none;
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 16px 20px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  background: rgba(243, 246, 255, 0.58);
}

.dashboard-accordion-summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.dashboard-accordion-summary .material-symbols-outlined {
  pointer-events: none;
}

.dashboard-accordion-summary::-webkit-details-marker {
  display: none;
}

.dashboard-accordion.open .dashboard-accordion-summary {
  border-bottom-color: var(--border);
}

.dashboard-accordion-title,
.dashboard-accordion-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.dashboard-accordion-title {
  min-width: 0;
  color: var(--on-surface);
  font-size: 0.98rem;
  font-weight: 850;
}

.dashboard-accordion-title .material-symbols-outlined {
  color: var(--primary);
}

.dashboard-accordion-meta {
  flex-shrink: 0;
}

.accordion-chevron {
  color: var(--text-muted);
  transition: transform 0.18s ease;
}

.dashboard-accordion.open .accordion-chevron {
  transform: rotate(180deg);
}

.dashboard-accordion-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.32s ease, opacity 0.24s ease;
}

.dashboard-accordion-body-inner {
  padding: 18px 18px 26px;
}

.dashboard-accordion.open .dashboard-accordion-body {
  opacity: 1;
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  min-height: 235px;
  padding: 20px;
}

.dashboard-category {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 14px;
}

.dashboard-card h2 {
  margin: 0 0 8px;
  color: var(--on-surface);
  font-size: 1.05rem;
  line-height: 1.3;
}

.dashboard-card p {
  flex: 1;
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.assignment-layout {
  display: grid;
  grid-template-columns: minmax(220px, 310px) 1fr;
  gap: 20px;
  align-items: start;
}

.assignment-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: rgba(243, 246, 255, 0.58);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.assignment-filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.assignment-select-all {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--on-surface);
  font-size: 0.86rem;
  font-weight: 800;
}

.assignment-select-all input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.assignment-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.assignment-categories {
  display: grid;
  gap: 12px;
}

.assignment-category-group {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.4);
}

.assignment-category-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  cursor: pointer;
}

.assignment-category-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--on-surface);
  font-size: 0.86rem;
  font-weight: 800;
}

.assignment-category-title .material-symbols-outlined {
  color: var(--primary);
}

.assignment-category-meta {
  margin-left: auto;
}

.assignment-category-header input {
  margin-left: 6px;
}

.assignment-category-group .assignment-list {
  padding: 0 12px 12px;
}

.assignment-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px;
}

.assignment-card input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.assignment-title {
  color: var(--on-surface);
  font-size: 0.92rem;
  font-weight: 800;
}

.assignment-desc {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.empty-state {
  padding: 34px;
  text-align: center;
}

.empty-state .material-symbols-outlined {
  width: 52px;
  height: 52px;
  padding: 13px;
  margin-bottom: 12px;
  color: var(--cyan);
  background: rgba(14, 165, 183, 0.12);
  border-radius: 16px;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--on-surface);
  font-size: 1.05rem;
}

.empty-state p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) 420px;
  gap: 28px;
  align-items: stretch;
  width: 100%;
  max-width: 1120px;
}

.login-hero,
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(18, 24, 38, 0.08);
}

.login-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 620px;
  overflow: hidden;
  padding: 44px;
  isolation: isolate;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(238, 246, 251, 0.9) 48%, rgba(220, 240, 249, 0.82)),
    var(--surface);
}

.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(var(--primary-rgb), 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--primary-rgb), 0.07) 1px, transparent 1px),
    linear-gradient(118deg, transparent 0 28%, rgba(var(--secondary-rgb), 0.13) 28.2% 28.7%, transparent 29% 62%, rgba(var(--primary-rgb), 0.12) 62.2% 62.7%, transparent 63%);
  background-size: 38px 38px, 38px 38px, 360px 100%;
  animation: login-grid-drift 18s linear infinite;
}

.login-hero::after {
  content: "";
  position: absolute;
  right: -45%;
  bottom: 92px;
  z-index: 0;
  width: 150%;
  height: 86px;
  background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.18), rgba(var(--secondary-rgb), 0.14), transparent);
  transform: rotate(-9deg);
  animation: login-light-sweep 7s ease-in-out infinite;
}

.login-hero > * {
  position: relative;
  z-index: 2;
}

.login-hero-visual {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.login-hero-visual::before {
  content: "";
  position: absolute;
  inset: 26px;
  opacity: 0.42;
  background:
    linear-gradient(90deg, rgba(var(--primary-rgb), 0.14), transparent 28%, transparent 72%, rgba(var(--secondary-rgb), 0.12)),
    repeating-linear-gradient(135deg, transparent 0 34px, rgba(var(--primary-rgb), 0.06) 35px, transparent 36px);
  border: 1px solid rgba(var(--primary-rgb), 0.08);
  border-radius: 18px;
}

.quality-flow {
  position: absolute;
  left: -52px;
  top: -18px;
  width: calc(100% + 120px);
  height: 430px;
  opacity: 0.82;
}

.flow-line,
.flow-pulse {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-line {
  stroke-width: 2;
  stroke: rgba(var(--primary-rgb), 0.16);
  stroke-dasharray: 7 14;
  animation: flow-drift 12s linear infinite;
}

.flow-line-b {
  stroke: rgba(var(--secondary-rgb), 0.15);
  animation-duration: 15s;
}

.flow-line-c {
  stroke: rgba(8, 145, 178, 0.13);
  animation-duration: 18s;
}

.flow-pulse {
  stroke: var(--primary);
  stroke-width: 4;
  stroke-dasharray: 72 620;
  stroke-dashoffset: 0;
  opacity: 0.38;
  animation: quality-pulse-run 4.8s ease-in-out infinite;
}

.quality-panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  color: var(--on-surface);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(var(--primary-rgb), 0.14);
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(15, 111, 191, 0.1);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  animation: panel-float 8s ease-in-out infinite;
}

.quality-panel-main {
  right: 46px;
  top: 22px;
  width: 198px;
}

.quality-panel-side {
  left: 42px;
  top: 126px;
  width: 168px;
  animation-delay: -2.2s;
}

.quality-panel-mini {
  right: 62px;
  bottom: 214px;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 900;
  animation-delay: -4.4s;
}

.panel-eyebrow {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel-value {
  color: var(--on-surface);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.panel-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  align-items: end;
  height: 38px;
  margin-top: 2px;
}

.panel-bars i {
  display: block;
  min-height: 10px;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 4px 4px 2px 2px;
  animation: metric-rise 3.4s ease-in-out infinite;
}

.panel-bars i:nth-child(1) { height: 44%; animation-delay: -0.4s; }
.panel-bars i:nth-child(2) { height: 68%; animation-delay: -1s; }
.panel-bars i:nth-child(3) { height: 54%; animation-delay: -1.6s; }
.panel-bars i:nth-child(4) { height: 86%; animation-delay: -2.2s; }

.panel-progress {
  position: relative;
  display: block;
  height: 8px;
  overflow: hidden;
  background: rgba(var(--primary-rgb), 0.12);
  border-radius: 999px;
}

.panel-progress::before {
  content: "";
  position: absolute;
  top: 0;
  right: 42%;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: inherit;
  animation: progress-breathe 4s ease-in-out infinite;
}

.quality-shield {
  position: absolute;
  left: 50%;
  top: 118px;
  width: 158px;
  height: 158px;
  opacity: 0.42;
  transform: translateX(-50%);
  filter: drop-shadow(0 16px 30px rgba(var(--primary-rgb), 0.12));
}

.quality-shield-body,
.quality-shield-check {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quality-shield-body {
  fill: rgba(255, 255, 255, 0.5);
  stroke: rgba(var(--primary-rgb), 0.72);
  stroke-width: 4;
}

.quality-shield-check {
  stroke: var(--primary);
  stroke-width: 11;
  stroke-dasharray: 112;
  stroke-dashoffset: 112;
  animation: quality-check-draw 4.6s ease-in-out infinite;
}

.quality-signal {
  position: absolute;
  left: 44px;
  right: 54px;
  bottom: 300px;
  width: auto;
  height: 64px;
  opacity: 0.46;
  background: linear-gradient(90deg, rgba(var(--primary-rgb), 0), rgba(var(--primary-rgb), 0.36), rgba(var(--secondary-rgb), 0.3), rgba(var(--primary-rgb), 0));
  clip-path: polygon(0 54%, 16% 54%, 22% 39%, 29% 76%, 38% 26%, 49% 54%, 59% 54%, 66% 18%, 76% 72%, 86% 43%, 100% 43%, 100% 54%, 89% 54%, 77% 84%, 66% 36%, 60% 66%, 48% 66%, 39% 42%, 30% 90%, 22% 54%, 16% 66%, 0 66%);
  animation: signal-sweep 5.6s ease-in-out infinite;
}

.login-hero-copy {
  position: relative;
  max-width: 570px;
  margin-top: auto;
}

.login-hero-copy::before {
  content: "";
  position: absolute;
  inset: -24px -42px -28px -26px;
  z-index: -1;
  background:
    radial-gradient(ellipse at left center, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.86) 54%, rgba(255, 255, 255, 0) 82%);
  border-radius: 18px;
}

@keyframes login-grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 38px 38px, 38px 38px; }
}

@keyframes login-light-sweep {
  0%, 100% { transform: translateX(-8%) rotate(-9deg); opacity: 0.25; }
  50% { transform: translateX(8%) rotate(-9deg); opacity: 0.52; }
}

@keyframes flow-drift {
  to { stroke-dashoffset: -84; }
}

@keyframes quality-pulse-run {
  0% { stroke-dashoffset: 360; opacity: 0; }
  18% { opacity: 0.48; }
  72% { opacity: 0.48; }
  100% { stroke-dashoffset: -360; opacity: 0; }
}

@keyframes quality-check-draw {
  0% { stroke-dashoffset: 112; opacity: 0; }
  18% { opacity: 1; }
  46%, 78% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

@keyframes panel-float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -8px, 0); }
}

@keyframes metric-rise {
  0%, 100% { transform: scaleY(0.86); opacity: 0.72; }
  50% { transform: scaleY(1); opacity: 1; }
}

@keyframes progress-breathe {
  0%, 100% { right: 42%; }
  50% { right: 22%; }
}

@keyframes signal-sweep {
  0%, 100% { transform: translateX(-10px); opacity: 0.28; }
  50% { transform: translateX(16px); opacity: 0.58; }
}

.login-brand-word {
  max-width: 440px;
  margin-bottom: 34px;
  color: var(--primary-dark);
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-hero h1 {
  margin: 0 0 12px;
  color: var(--on-surface);
  font-size: 34px;
  line-height: 1.08;
  font-weight: 900;
}

.login-hero p {
  max-width: 520px;
  margin: 0;
  color: #4b5368;
  font-size: 15px;
  line-height: 1.55;
}

.login-footnote {
  margin-top: 30px;
  color: #4b5368;
  font-size: 12px;
}

.login-card-footnote {
  display: none;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.login-card {
  align-self: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  padding: 36px;
}

.login-card-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  margin-bottom: 16px;
}

.login-card h2 {
  margin: 0 0 2px;
  color: var(--on-surface);
  font-size: 22px;
  font-weight: 900;
}

.login-sub {
  margin-bottom: 28px;
  color: var(--text-muted);
  font-size: 13px;
}

.login-mode {
  position: fixed;
  top: 18px;
  right: 18px;
  min-width: auto;
  color: var(--body-color);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(18, 24, 38, 0.08);
}

.login-mode span:first-child {
  color: var(--on-surface);
}

.login-mode span:last-child {
  color: var(--text-muted);
}

.mobile-menu-btn {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 64px;
  color: var(--primary);
  cursor: pointer;
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 0.125rem 0.4rem rgba(11, 15, 25, 0.05);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: none;
  pointer-events: none;
  background: rgba(11, 15, 25, 0.58);
  opacity: 0;
  transition: opacity 0.24s ease;
}

.sidebar-overlay.active {
  pointer-events: auto;
  opacity: 1;
}

[data-bs-theme="dark"] .card-header-ohs,
[data-bs-theme="dark"] .dashboard-accordion-summary,
[data-bs-theme="dark"] .assignment-toolbar,
[data-bs-theme="dark"] .assignment-category-group,
[data-bs-theme="dark"] .ohs-topbar,
[data-bs-theme="dark"] .mobile-menu-btn {
  background: rgba(21, 25, 35, 0.9);
  border-color: var(--border);
}

[data-bs-theme="dark"] .portal-command {
  background:
    linear-gradient(135deg, rgba(17, 28, 39, 0.96), rgba(15, 35, 51, 0.92) 52%, rgba(10, 48, 61, 0.86)),
    var(--glass-bg);
  border-color: var(--border);
}

[data-bs-theme="dark"] .portal-command::before {
  opacity: 0.5;
}

[data-bs-theme="dark"] .portal-command::after {
  opacity: 0.36;
}

[data-bs-theme="dark"] .portal-stat {
  background: rgba(17, 28, 39, 0.76);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] textarea {
  background: var(--surface-low);
  border-color: var(--border);
}

[data-bs-theme="dark"] .badge-admin {
  color: var(--primary-light);
}

[data-bs-theme="dark"] .ohs-table tr:hover td {
  background: rgba(255, 255, 255, 0.035);
}

[data-bs-theme="dark"] .login-hero {
  background:
    linear-gradient(135deg, rgba(var(--primary-rgb), 0.18), rgba(var(--secondary-rgb), 0.12) 48%, rgba(14, 165, 183, 0.1)),
    var(--surface);
}

[data-bs-theme="dark"] .login-hero::before {
  opacity: 0.35;
}

[data-bs-theme="dark"] .quality-panel {
  background: rgba(17, 28, 39, 0.74);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .quality-panel-mini {
  color: var(--primary-light);
}

[data-bs-theme="dark"] .quality-shield-body {
  fill: rgba(17, 28, 39, 0.52);
  stroke: rgba(var(--primary-rgb), 0.72);
}

[data-bs-theme="dark"] .quality-flow {
  opacity: 0.5;
}

[data-bs-theme="dark"] .login-brand-word {
  color: var(--primary-light);
}

[data-bs-theme="dark"] .login-hero-copy::before {
  background:
    radial-gradient(ellipse at left center, rgba(21, 25, 35, 0.95) 0%, rgba(21, 25, 35, 0.76) 54%, rgba(21, 25, 35, 0) 78%);
}

[data-bs-theme="dark"] .login-hero p,
[data-bs-theme="dark"] .login-footnote {
  color: #c8cedb;
}

@media (prefers-reduced-motion: reduce) {
  .login-hero::before,
  .login-hero::after,
  .flow-line,
  .flow-pulse,
  .quality-shield-check,
  .quality-panel,
  .panel-bars i,
  .panel-progress::before,
  .quality-signal {
    animation: none;
  }
}

@media (max-width: 900px) {
  .login-shell {
    max-width: 480px;
    grid-template-columns: 1fr;
  }

  .login-hero {
    display: none;
  }

  .login-card-logo {
    display: block;
    margin-right: auto;
    margin-left: auto;
  }

  .login-card h2,
  .login-sub {
    text-align: center;
  }

  .login-card-footnote {
    display: block;
  }
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }

  .ohs-sidebar {
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .ohs-sidebar.open {
    transform: translateX(0);
    box-shadow: 0.625rem 0 2rem rgba(0, 0, 0, 0.28);
  }

  .sidebar-overlay {
    display: block;
  }

  .sidebar-brand {
    order: 1;
  }

  .sidebar-footer {
    order: 2;
    padding: 0 0 14px;
    margin-top: 0;
    border-top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar-nav {
    order: 3;
    flex: 1;
    padding-top: 10px;
  }

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

  .mobile-menu-btn {
    display: flex;
  }

  .ohs-topbar {
    min-height: 64px;
    padding: 0 16px 0 80px;
  }

  .topbar-title {
    font-size: 0.96rem;
  }

  .topbar-subtitle {
    display: none;
  }

  .ohs-content {
    padding: 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .kpi-card {
    gap: 10px;
    padding: 14px 12px;
  }

  .kpi-value {
    font-size: 1.35rem;
  }

  .card-header-ohs {
    flex-wrap: wrap;
    gap: 8px;
  }

  .portal-command {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .portal-command-search {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-search-count {
    flex-shrink: 1;
  }

  .dashboard-accordion-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .assignment-layout,
  .assignment-filter-form,
  .usage-grid {
    grid-template-columns: 1fr;
  }

  .assignment-category-header {
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .assignment-category-meta {
    margin-left: 0;
    margin-right: 4px;
    margin-top: 2px;
  }
}

@media (max-width: 480px) {
  .ohs-sidebar {
    width: min(var(--sidebar-width), 88vw);
  }

  .ohs-content {
    padding: 12px;
  }

  .ohs-topbar {
    padding: 0 12px 0 76px;
  }

  .kpi-grid,
  .dashboard-grid,
  .assignment-list {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 28px 22px;
  }

  .login-mode {
    top: 10px;
    right: 10px;
  }

  .portal-command {
    padding: 14px;
  }

  .portal-command h1 {
    font-size: 1.25rem;
  }

  .portal-command-stats {
    grid-template-columns: 1fr;
  }
}
