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

:root,
[data-bs-theme="light"] {
  --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Manrope", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --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.66);
  --glass-bg-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-edge: rgba(255, 255, 255, 0.92);
  --glass-surface: linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.52) 52%, rgba(245, 251, 255, 0.44));
  --glass-surface-strong: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(248, 253, 255, 0.66));
  --glass-highlight: linear-gradient(145deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.14) 46%, transparent 78%);
  --glass-shadow: 0 1.4rem 3rem rgba(11, 15, 25, 0.11), 0 0.35rem 1rem rgba(11, 15, 25, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.76);
  --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(17, 28, 39, 0.68);
  --glass-bg-strong: rgba(17, 28, 39, 0.86);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-edge: rgba(255, 255, 255, 0.18);
  --glass-surface: linear-gradient(145deg, rgba(29, 45, 61, 0.84), rgba(14, 24, 36, 0.66) 58%, rgba(11, 17, 29, 0.62));
  --glass-surface-strong: linear-gradient(145deg, rgba(37, 56, 75, 0.9), rgba(17, 28, 39, 0.74));
  --glass-highlight: linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04) 42%, transparent 76%);
  --glass-shadow: 0 1.45rem 3.2rem rgba(0, 0, 0, 0.38), 0 0.35rem 1rem rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --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;
  font-optical-sizing: auto;
  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);
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  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);
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

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-family: var(--font-display);
  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: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: 0.75rem;
  width: min(100%, 184px);
  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 span {
  line-height: 1;
}

.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-family: var(--font-display);
  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 {
  position: relative;
  isolation: isolate;
  color: var(--body-color);
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(175%);
  -webkit-backdrop-filter: blur(24px) saturate(175%);
}

.ohs-card::before,
.kpi-card::before,
.dashboard-card::before,
.assignment-card::before,
.empty-state::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background: var(--glass-highlight);
  border-radius: inherit;
  box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.ohs-card > *,
.kpi-card > *,
.dashboard-card > *,
.assignment-card > *,
.empty-state > * {
  position: relative;
  z-index: 1;
}

.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(255, 255, 255, 0.24);
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.12);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.card-title {
  margin: 0;
  color: var(--on-surface);
  font-family: var(--font-display);
  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-family: var(--font-display);
  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: center;
  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);
}

.ohs-table td.table-value-center,
.ohs-table td.summary-value,
.ohs-table td.entry-row-total {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ohs-table td.table-value-center .mini-note {
  text-align: center;
}

.ohs-table td.table-value-center .inline-kpi {
  justify-content: center;
}

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

.table-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.table-actions > * {
  flex: 0 0 auto;
}

.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: var(--glass-surface-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
}

.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-family: var(--font-display);
  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;
}

.access-accordion-list {
  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: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.assignment-category-header::-webkit-details-marker {
  display: none;
}

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

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

.assignment-category-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-category-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.assignment-category-header input {
  flex: 0 0 auto;
  margin: 0;
}

.access-accordion-icon {
  color: var(--text-muted);
  transition: transform 0.16s ease;
}

.access-accordion-group[open] .access-accordion-icon {
  transform: rotate(180deg);
}

.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(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(175%);
  -webkit-backdrop-filter: blur(24px) saturate(175%);
}

.login-hero {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(330px, 1fr) auto;
  gap: 20px;
  min-height: 620px;
  overflow: hidden;
  padding: 38px 44px 34px;
  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: relative;
  z-index: 1;
  min-height: 340px;
  pointer-events: none;
}

.login-hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  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;
}

.chart-ribbon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(640px, calc(100% + 60px));
  height: 360px;
  opacity: 0.78;
  transform: translate(-50%, -50%);
}

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

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

.chart-ribbon-mid {
  stroke: rgba(var(--secondary-rgb), 0.16);
  animation-duration: 15s;
}

.chart-ribbon-front {
  stroke: rgba(8, 145, 178, 0.14);
  animation-duration: 18s;
}

.chart-ribbon-pulse {
  stroke: var(--primary);
  stroke-width: 4;
  stroke-dasharray: 76 620;
  stroke-dashoffset: 0;
  opacity: 0.4;
  animation: chart-pulse-run 4.8s ease-in-out infinite;
}

.chart-ribbon-dot {
  fill: #fff;
  stroke: var(--primary);
  stroke-width: 4;
  opacity: 0.72;
  transform-box: fill-box;
  transform-origin: center;
  animation: chart-dot-pulse 4.8s ease-in-out infinite;
}

.chart-ribbon-dot.dot-b {
  animation-delay: -1.1s;
}

.chart-ribbon-dot.dot-c {
  animation-delay: -2.2s;
}

.chart-stage {
  position: absolute;
  top: 52%;
  left: 50%;
  width: min(350px, calc(100% - 160px));
  min-height: 280px;
  padding: 16px 16px 14px;
  color: var(--on-surface);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(var(--primary-rgb), 0.14);
  border-radius: 18px;
  box-shadow: 0 24px 52px rgba(15, 111, 191, 0.12);
  transform: translate3d(-50%, -50%, 0);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  animation: chart-stage-float 9s ease-in-out infinite;
}

.chart-stage::after {
  content: "";
  position: absolute;
  inset: 1px;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 0 36%, rgba(255, 255, 255, 0.4) 44%, transparent 52%);
  border-radius: inherit;
  opacity: 0.42;
  transform: translateX(-38%);
  animation: chart-gloss 6.8s ease-in-out infinite;
}

.chart-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart-stage-header strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--secondary);
  font-size: 0.68rem;
}

.chart-stage-header strong::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--secondary);
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(var(--secondary-rgb), 0.44);
  animation: live-dot 2.4s ease-in-out infinite;
}

.chart-stage-canvas {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid-lines path {
  fill: none;
  stroke: rgba(var(--primary-rgb), 0.11);
  stroke-width: 1;
}

.chart-area {
  fill: rgba(var(--primary-rgb), 0.1);
  animation: chart-area-breathe 5.8s ease-in-out infinite;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-shadow {
  stroke: rgba(var(--primary-rgb), 0.12);
  stroke-width: 12;
}

.chart-line-main {
  stroke: var(--primary);
  stroke-width: 5;
  stroke-dasharray: 430;
  stroke-dashoffset: 430;
  animation: chart-line-draw 5.8s ease-in-out infinite;
}

.chart-points circle {
  fill: #fff;
  stroke: var(--primary);
  stroke-width: 4;
  transform-box: fill-box;
  transform-origin: center;
  animation: chart-point-pop 5.8s ease-in-out infinite;
}

.chart-points circle:nth-child(2) {
  animation-delay: -0.8s;
}

.chart-points circle:nth-child(3) {
  stroke: var(--secondary);
  animation-delay: -1.6s;
}

.chart-points circle:nth-child(4) {
  animation-delay: -2.4s;
}

.chart-stage-bars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  align-items: end;
  height: 48px;
  margin-top: 4px;
  padding: 0 10px 4px;
}

.chart-stage-bars i {
  display: block;
  height: 46%;
  min-height: 12px;
  background: linear-gradient(180deg, var(--secondary), var(--primary));
  border-radius: 5px 5px 2px 2px;
  transform-origin: bottom;
  animation: chart-bar-rise 3.8s ease-in-out infinite;
}

.chart-stage-bars i:nth-child(1) { height: 38%; animation-delay: -0.2s; }
.chart-stage-bars i:nth-child(2) { height: 58%; animation-delay: -0.7s; }
.chart-stage-bars i:nth-child(3) { height: 46%; animation-delay: -1.2s; }
.chart-stage-bars i:nth-child(4) { height: 82%; animation-delay: -1.7s; }
.chart-stage-bars i:nth-child(5) { height: 64%; animation-delay: -2.2s; }
.chart-stage-bars i:nth-child(6) { height: 92%; animation-delay: -2.7s; }

.chart-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;
}

.chart-panel-main {
  right: 26px;
  top: 10px;
  width: 198px;
}

.chart-panel-side {
  left: 24px;
  top: 116px;
  width: 168px;
  animation-delay: -2.2s;
}

.chart-panel-mini {
  right: 56px;
  bottom: 30px;
  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;
}

.chart-panel-donut {
  left: 62px;
  bottom: 52px;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 176px;
  animation-delay: -5.4s;
}

.donut-chart {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.96) 0 48%, transparent 49%),
    conic-gradient(var(--secondary) 0 42%, var(--primary) 42% 78%, rgba(var(--primary-rgb), 0.12) 78% 100%);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.08);
  animation: donut-spin 8s linear infinite;
}

.donut-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.donut-copy strong {
  color: var(--on-surface);
  font-size: 1.28rem;
  line-height: 1;
}

.donut-copy em {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.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;
}

.chart-heatmap {
  position: absolute;
  right: 42px;
  top: 178px;
  display: grid;
  grid-template-columns: repeat(3, 17px);
  gap: 6px;
  opacity: 0.68;
  animation: heatmap-drift 6.4s ease-in-out infinite;
}

.chart-heatmap i {
  width: 17px;
  height: 17px;
  background: rgba(var(--primary-rgb), 0.16);
  border-radius: 5px;
  animation: heatmap-cell 3.4s ease-in-out infinite;
}

.chart-heatmap i:nth-child(2),
.chart-heatmap i:nth-child(6),
.chart-heatmap i:nth-child(8) {
  background: rgba(var(--secondary-rgb), 0.28);
}

.chart-heatmap i:nth-child(3),
.chart-heatmap i:nth-child(5) {
  background: rgba(var(--primary-rgb), 0.3);
}

.chart-heatmap i:nth-child(2) { animation-delay: -0.4s; }
.chart-heatmap i:nth-child(3) { animation-delay: -0.8s; }
.chart-heatmap i:nth-child(4) { animation-delay: -1.2s; }
.chart-heatmap i:nth-child(5) { animation-delay: -1.6s; }
.chart-heatmap i:nth-child(6) { animation-delay: -2s; }
.chart-heatmap i:nth-child(7) { animation-delay: -2.4s; }
.chart-heatmap i:nth-child(8) { animation-delay: -2.8s; }
.chart-heatmap i:nth-child(9) { animation-delay: -3.2s; }
}

.login-hero-copy {
  position: relative;
  z-index: 3;
  max-width: 590px;
}

.login-hero-copy::before {
  content: none;
}

@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 chart-ribbon-drift {
  to { stroke-dashoffset: -84; }
}

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

@keyframes chart-dot-pulse {
  0%, 100% { opacity: 0.42; transform: scale(0.86); }
  50% { opacity: 0.9; transform: scale(1.08); }
}

@keyframes chart-stage-float {
  0%, 100% { transform: translate3d(-50%, -50%, 0); }
  50% { transform: translate3d(-50%, -53%, 0); }
}

@keyframes chart-gloss {
  0%, 22% { transform: translateX(-48%); opacity: 0; }
  46% { opacity: 0.42; }
  72%, 100% { transform: translateX(48%); opacity: 0; }
}

@keyframes live-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--secondary-rgb), 0.44); }
  50% { box-shadow: 0 0 0 8px rgba(var(--secondary-rgb), 0); }
}

@keyframes chart-area-breathe {
  0%, 100% { opacity: 0.52; }
  50% { opacity: 0.82; }
}

@keyframes chart-line-draw {
  0% { stroke-dashoffset: 430; opacity: 0.28; }
  24%, 76% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -430; opacity: 0.28; }
}

@keyframes chart-point-pop {
  0%, 100% { transform: scale(0.82); opacity: 0.58; }
  48% { transform: scale(1.12); opacity: 1; }
}

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

@keyframes donut-spin {
  to { transform: rotate(360deg); }
}

@keyframes heatmap-drift {
  0%, 100% { transform: translate3d(-8px, 0, 0); }
  50% { transform: translate3d(12px, -6px, 0); }
}

@keyframes heatmap-cell {
  0%, 100% { transform: scale(0.9); opacity: 0.58; }
  50% { transform: scale(1); opacity: 1; }
}

@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%; }
}

.login-brand-word {
  max-width: 440px;
  margin-bottom: 16px;
  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 {
  position: relative;
  z-index: 3;
  margin-top: 0;
  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-family: var(--font-display);
  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;
  grid-template-columns: auto auto auto;
  width: auto;
  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"] .card-header-ohs {
  background: rgba(255, 255, 255, 0.05);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .portal-command {
  background: var(--glass-surface-strong);
  border-color: var(--glass-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"] .chart-stage,
[data-bs-theme="dark"] .chart-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"] .chart-panel-mini {
  color: var(--primary-light);
}

[data-bs-theme="dark"] .donut-chart {
  background:
    radial-gradient(circle, rgba(17, 28, 39, 0.96) 0 48%, transparent 49%),
    conic-gradient(var(--secondary) 0 42%, var(--primary) 42% 78%, rgba(var(--primary-rgb), 0.16) 78% 100%);
}

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

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

[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,
  .chart-ribbon-line,
  .chart-ribbon-pulse,
  .chart-ribbon-dot,
  .chart-stage,
  .chart-stage::after,
  .chart-stage-header strong::before,
  .chart-area,
  .chart-line-main,
  .chart-points circle,
  .chart-stage-bars i,
  .chart-panel,
  .donut-chart,
  .chart-heatmap,
  .chart-heatmap i,
  .panel-bars i,
  .panel-progress::before {
    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;
  }
}
