:root {
  --sidebar: #15202b;
  --sidebar-2: #213547;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-hover: #f1f5f9;
  --canvas: #f5f7fb;
  --line: #dbe3ef;
  --line-strong: #c8d4e3;
  --text: #18222f;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --teal: #0f766e;
  --info: #0369a1;
  --info-soft: #f0f9ff;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --amber: #b45309;
  --warning-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fff1f2;
  --focus-ring: rgba(37, 99, 235, 0.2);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
}

html {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --sidebar: #08111f;
  --sidebar-2: #13243a;
  --surface: #111827;
  --surface-soft: #0f172a;
  --surface-hover: #172033;
  --canvas: #0b1220;
  --line: #263449;
  --line-strong: #3a4a62;
  --text: #e5edf7;
  --muted: #9aa8bc;
  --primary: #60a5fa;
  --primary-soft: #102443;
  --teal: #2dd4bf;
  --info: #38bdf8;
  --info-soft: #10283c;
  --success: #4ade80;
  --success-soft: #102b1b;
  --amber: #fbbf24;
  --warning-soft: #33260d;
  --danger: #f87171;
  --danger-soft: #351318;
  --focus-ring: rgba(96, 165, 250, 0.24);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18), 0 6px 18px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible,
.page-link:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  color: #fff;
  filter: brightness(0.92);
}

.btn-outline-primary {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
  background: var(--primary);
  color: #fff;
}

.btn-outline-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible,
.btn-light {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--line);
}

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

.btn-danger:hover,
.btn-danger:focus-visible {
  color: #fff;
  filter: brightness(0.9);
}

.btn-sm {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 0.85rem;
}

.w-100 { width: 100%; }
.mt-2 { margin-top: 0.5rem; }

.form-control,
.form-select {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.form-control:hover,
.form-select:hover {
  border-color: var(--line-strong);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
  background: transparent;
}

.pagination {
  display: flex;
  gap: 6px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.page-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  justify-content: center;
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.page-link:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.message-stack {
  display: grid;
  gap: 10px;
  width: min(760px, 100%);
  margin: 0 0 20px;
}

.alert {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 11px;
  min-height: 60px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.alert-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1rem;
}

.alert-content {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.alert-info {
  border-color: #bae6fd;
  border-left-color: var(--info);
  background: var(--info-soft);
}

.alert-info .alert-icon {
  background: #e0f2fe;
  color: #075985;
}

.alert-success {
  border-color: #bbf7d0;
  border-left-color: var(--success);
  background: var(--success-soft);
}

.alert-success .alert-icon {
  background: #dcfce7;
  color: #166534;
}

.alert-warning {
  border-color: #fde68a;
  border-left-color: var(--amber);
  background: var(--warning-soft);
}

.alert-warning .alert-icon {
  background: #fef3c7;
  color: #92400e;
}

.alert-error,
.alert-danger {
  border-color: #fecaca;
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.alert-error .alert-icon,
.alert-danger .alert-icon {
  background: #fee2e2;
  color: #991b1b;
}

.btn-close {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  transform: translateY(-50%);
  cursor: pointer;
}

.btn-close::before {
  content: "\00d7";
  font-size: 1.5rem;
  line-height: 1;
}

.alert .btn-close {
  position: static;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  transform: none;
  opacity: 0.72;
}

.alert .btn-close:hover,
.alert .btn-close:focus-visible {
  background: rgba(100, 116, 139, 0.12);
  opacity: 1;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: var(--sidebar);
  color: #fff;
  padding: 18px 14px;
  z-index: 30;
  transition: width 180ms ease, padding 180ms ease;
}

.sidebar-toggle {
  position: absolute;
  top: 28px;
  right: -15px;
  z-index: 31;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.sidebar-toggle:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(1.05);
}

.sidebar-toggle:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 8px 10px 22px;
  transition: padding 180ms ease, gap 180ms ease;
}

.brand:hover { color: #fff; }

.brand > span {
  min-width: 0;
  white-space: nowrap;
  transition: width 180ms ease, opacity 120ms ease;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #14b8a6;
  color: #062d2a;
  font-weight: 800;
}

.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 5px;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
}

.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  transition: padding 180ms ease, gap 180ms ease, background 160ms ease, color 160ms ease;
}

.sidebar-nav a > i {
  flex: 0 0 auto;
  font-size: 1.05rem;
}

.sidebar-nav a > span {
  white-space: nowrap;
}

.sidebar-nav a:hover {
  background: var(--sidebar-2);
  color: #fff;
}

.sidebar-nav a.is-active {
  background: var(--sidebar-2);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--teal);
}

.app-main {
  margin-left: 260px;
  min-height: 100vh;
  transition: margin-left 180ms ease;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.global-search {
  position: relative;
  width: min(460px, 100%);
}

.global-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.global-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px 0 40px;
}

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

.language-switcher select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  font-weight: 700;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.notification-dot {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  display: grid;
  place-items: center;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.user-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.user-avatar-empty {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  font-size: 1rem;
}

.user-avatar-large {
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
}

.profile-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.identity-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  line-height: 1.05;
}

.identity-text strong {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 750;
}

.role-pill {
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.content-wrap {
  padding: 28px;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 750;
}

.page-heading-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.delete-confirmation {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.delete-confirmation h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.delete-confirmation p {
  margin: 5px 0;
}

.delete-confirmation form {
  grid-column: 1 / -1;
}

.delete-confirmation-icon {
  color: var(--danger);
  font-size: 2rem;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card,
.panel,
.table-shell,
.form-surface,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.kpi-card {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.kpi-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.kpi-card strong {
  font-size: 2rem;
  line-height: 1;
}

.kpi-card.danger strong { color: var(--danger); }

.online-summary {
  grid-template-columns: minmax(200px, 280px);
}

.online-window-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -8px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.online-users-table {
  min-width: 720px;
}

.online-identity {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}

.online-presence-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.14);
}

.online-ip,
.online-last-activity {
  white-space: nowrap;
}

.online-hostname {
  overflow-wrap: anywhere;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.activity-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel h2 {
  font-size: 1rem;
  margin: 0 0 14px;
}

.panel canvas {
  width: 100%;
  max-height: 280px;
}

.filter-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.filter-bar-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding-bottom: 12px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.filter-bar-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

.filter-bar-title i {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.filter-bar-wide {
  grid-template-columns: 1fr minmax(180px, 240px) auto;
}

.filter-bar-applications {
  grid-template-columns: 1fr minmax(130px, 170px) minmax(130px, 170px) minmax(160px, 220px) auto;
}

.filter-bar-inventory {
  grid-template-columns: 1fr repeat(2, minmax(140px, 180px)) repeat(2, minmax(150px, 200px)) auto;
}

.filter-bar-actions {
  grid-template-columns: 1fr minmax(160px, 220px) minmax(145px, 180px) minmax(220px, 320px) auto;
}

.filter-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.filter-actions .btn {
  min-height: 42px;
}

.filter-actions button[type="submit"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.14);
}

.filter-actions button[type="submit"]:hover,
.filter-actions button[type="submit"]:focus-visible {
  color: #fff;
  filter: brightness(0.94);
}

.filter-check-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  min-width: 0;
  margin: 0;
  border-radius: 10px;
  background: var(--surface-soft);
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 8px;
  margin: 0;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.filter-check:hover {
  border-color: var(--line-strong);
}

.filter-check:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.filter-check:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.filter-check input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.table-shell {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--line-strong) var(--surface-soft);
}

.table-shell:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.table-shell > .table {
  min-width: 720px;
}

.table {
  margin: 0;
}

.table thead {
  background: var(--surface-soft);
}

.table thead th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-soft);
}

.table thead th.sortable-header {
  padding: 0;
}

.table-sort-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 14px 16px;
  color: var(--muted);
  white-space: nowrap;
}

.table-sort-link:hover,
.table-sort-link:focus-visible,
.sortable-header.is-sorted .table-sort-link {
  color: var(--primary);
  background: var(--primary-soft);
}

.sortable-header.is-sorted .table-sort-link {
  box-shadow: inset 0 -2px 0 var(--primary);
}

.table-sort-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -3px;
}

.table-sort-icon {
  flex: 0 0 auto;
  font-size: 0.78rem;
  opacity: 0.55;
}

.sortable-header.is-sorted .table-sort-icon {
  opacity: 1;
}

.table td,
.table th {
  padding: 13px 16px;
  vertical-align: middle;
}

.table tbody td {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background-color 140ms ease;
}

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

.table tbody tr:hover > td {
  background: var(--surface-hover);
}

.table tbody td > a:not(.btn) {
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 700;
  font-size: 0.8rem;
}

.status-badge-neutral {
  background: #e2e8f0;
  color: #334155;
}

.status-badge-info {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-badge-progress {
  background: #ccfbf1;
  color: #0f766e;
}

.status-badge-success {
  background: #dcfce7;
  color: #166534;
}

.status-badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.status-badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.priority-badge-low {
  background: #e0f2fe;
  color: #075985;
}

.priority-badge-medium {
  background: #fef3c7;
  color: #92400e;
}

.priority-badge-high {
  background: #ffedd5;
  color: #9a3412;
}

.priority-badge-critical {
  background: #fee2e2;
  color: #991b1b;
}

.priority-badge-neutral {
  background: #e2e8f0;
  color: #334155;
}

.deadline-cell {
  display: inline-grid;
  min-width: 0;
  gap: 5px;
}

.deadline-date-change {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 24rem;
  padding: 0;
  margin: 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
}

.previous-deadline-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.previous-deadline-date {
  color: var(--muted);
  text-decoration-line: line-through;
  text-decoration-thickness: 2px;
}

.current-deadline-date {
  color: var(--text);
  white-space: nowrap;
}

.deadline-date-arrow {
  color: var(--muted);
}

.deadline-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.deadline-badge-muted,
.deadline-badge-closed {
  background: #e2e8f0;
  color: #334155;
}

.deadline-badge-later {
  background: #dbeafe;
  color: #1d4ed8;
}

.deadline-badge-soon {
  background: #fef3c7;
  color: #92400e;
}

.deadline-badge-today {
  background: #ffedd5;
  color: #9a3412;
}

.deadline-badge-overdue {
  background: #fee2e2;
  color: #991b1b;
}

.table tbody tr.row-danger > td {
  background: var(--danger-soft);
}

.table tbody tr.row-complete > td {
  background: var(--surface-soft);
  color: #64748b;
}

.table tbody tr.row-danger:hover > td {
  background: #ffe4e6;
}

.table tbody tr.row-complete:hover > td {
  background: #e9eef5;
}

.row-complete a {
  color: #475569;
}

.table-actions {
  text-align: right;
  white-space: nowrap;
}

.table-actions a {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.table-actions a:hover,
.table-actions a:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: 0;
  transform: translateY(-1px);
}

.table-actions a + a {
  margin-left: 6px;
}

.danger-link {
  color: var(--danger);
}

.table-actions a.danger-link {
  color: var(--danger);
}

.table-actions a.danger-link:hover,
.table-actions a.danger-link:focus-visible {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 42px 24px !important;
}

.form-surface {
  padding: 22px;
}

.profile-password-form {
  margin-top: 18px;
}

.compact-heading {
  margin-bottom: 16px;
}

.compact-heading h1 {
  font-size: 1.2rem;
}

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

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

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field label {
  font-weight: 700;
  color: #334155;
}

.field-label-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subaction-editor {
  display: grid;
  gap: 8px;
}

.subaction-form-list {
  display: grid;
}

.subaction-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: start;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

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

.subaction-form-dates,
.subaction-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 0.82rem;
}

.subaction-remove {
  width: 42px;
  height: 42px;
  color: var(--danger);
}

.form-field input,
.form-field select,
.form-field textarea,
.stack-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 8px 11px;
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled {
  background: #f8fafc;
  color: var(--muted);
}

.field-error {
  color: var(--danger);
  font-size: 0.85rem;
}

.form-field-choice-list > div:not(.field-error) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.form-field-choice-list > div:not(.field-error) > div label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.form-field-choice-list > div:not(.field-error) > div label:hover {
  border-color: #94a3b8;
}

.form-field-choice-list > div:not(.field-error) > div label:has(input:checked) {
  border-color: var(--teal);
  background: #ecfdf5;
  color: #0f766e;
}

.form-field-choice-list input[type="checkbox"] {
  width: auto;
  min-height: auto;
  padding: 0;
  accent-color: var(--teal);
}

.tag-entry {
  font-weight: 700;
}

.tag-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
}

.tag-preview span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 800;
}

.form-field-radio-list {
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 420px);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.form-field-radio-list > label {
  margin: 0;
}

.form-field-radio-list > div:not(.field-error) {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
}

.form-field-radio-list > div:not(.field-error) > div label {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-weight: 800;
  cursor: pointer;
}

.form-field-radio-list > div:not(.field-error) > div label:has(input:checked) {
  border-color: var(--teal);
  background: #ecfdf5;
  color: #0f766e;
}

.form-field-radio-list input[type="radio"] {
  width: auto;
  min-height: auto;
  padding: 0;
  accent-color: var(--teal);
}

.form-field-radio-list small,
.form-field-radio-list .field-error {
  grid-column: 1 / -1;
}

.audit-checklist-section {
  gap: 12px;
  padding-top: 6px;
}

.audit-checklist-section h2 {
  margin: 0;
  font-size: 1rem;
  color: #334155;
}

.audit-checklist-grid {
  display: grid;
  gap: 10px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.detail-grid > div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.detail-grid > div > span:first-child {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.compact-list,
.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.compact-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.compact-list strong {
  min-width: 0;
  max-width: 70%;
  text-align: right;
  overflow-wrap: anywhere;
}

.secret-field {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.secret-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.secret-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.secret-toggle:hover {
  border-color: #94a3b8;
  color: var(--primary);
}

.tag-list {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.tag-list-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-list li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: #f8fafc;
}

.checklist-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.checklist-result-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.checklist-result-list-compact {
  gap: 6px;
}

.checklist-result-list-compact li {
  padding: 6px 8px;
  font-size: 0.86rem;
}

.checklist-choice {
  min-width: 48px;
  text-align: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #e2e8f0;
  color: #334155;
}

.checklist-choice-yes {
  background: #dcfce7;
  color: #166534;
}

.checklist-choice-no {
  background: #fee2e2;
  color: #991b1b;
}

.checklist-choice-na {
  background: #f1f5f9;
  color: #475569;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.history-list li {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.history-list li.empty-state {
  display: block;
  border-left-width: 1px;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.history-meta strong {
  color: var(--text);
}

.history-meta time {
  font-weight: 700;
}

.history-list li.history-current {
  border-left-color: var(--primary);
}

.history-comment {
  margin: 0;
  white-space: pre-wrap;
}

.subaction-list {
  list-style-position: inside;
  margin: 0;
  padding: 0;
}

.subaction-list li {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.subaction-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.subaction-list li:last-child {
  padding-bottom: 0;
}

.subaction-list li.empty-state {
  list-style: none;
}

.subaction-list p {
  display: inline;
  margin: 0;
  white-space: pre-wrap;
}

.subaction-dates {
  margin-top: 7px;
  padding-left: 22px;
}

.notification-list {
  display: grid;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.notification-panel {
  padding: 0;
  overflow: hidden;
}

.notification-item {
  --notification-accent: var(--info);
  --notification-soft: var(--info-soft);
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid transparent;
  background: var(--surface);
  transition: background-color 160ms ease;
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item:hover {
  background: var(--surface-hover);
}

.notification-item.is-unread {
  border-left-color: var(--notification-accent);
  background: var(--notification-soft);
}

.notification-type-warning {
  --notification-accent: var(--amber);
  --notification-soft: var(--warning-soft);
}

.notification-type-critical {
  --notification-accent: var(--danger);
  --notification-soft: var(--danger-soft);
}

.notification-type-success {
  --notification-accent: var(--success);
  --notification-soft: var(--success-soft);
}

.notification-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--notification-soft);
  color: var(--notification-accent);
  font-size: 1.1rem;
}

.notification-copy {
  min-width: 0;
}

.notification-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.notification-title-row strong {
  color: var(--text);
  font-size: 0.98rem;
}

.notification-state,
.notification-type-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  min-height: 23px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.notification-state {
  background: var(--primary-soft);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.notification-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.notification-type-label {
  background: var(--notification-soft);
  color: var(--notification-accent);
}

.notification-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.8rem;
}

.notification-meta time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
}

.notification-links {
  margin-top: 11px;
}

.notification-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.notification-list p {
  margin: 5px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.notification-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 210px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.notification-empty i {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 1.35rem;
}

.app-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
  margin: 32px auto 0;
  padding: 18px 16px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.app-footer span {
  max-width: 920px;
}

.error-body {
  min-height: 100vh;
  background: #f5f7fb;
}

.error-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.error-panel {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  text-align: center;
}

.error-logo {
  width: 132px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 18px;
}

.error-code {
  display: inline-grid;
  place-items: center;
  min-width: 70px;
  height: 38px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 800;
  margin-bottom: 14px;
}

.error-panel h1 {
  margin: 0 0 10px;
  font-size: 1.8rem;
}

.error-panel p {
  margin: 0 auto 22px;
  color: var(--muted);
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.error-panel footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

.success-panel {
  width: min(620px, 100%);
  margin: 40px auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  text-align: center;
}

.success-panel > i {
  color: var(--teal);
  font-size: 3rem;
}

.success-panel h1 {
  margin: 12px 0 8px;
}

.success-panel p {
  color: var(--muted);
}

.auth-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(430px, 100%);
}

.login-panel {
  padding: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-brand h1 {
  font-size: 1.5rem;
  margin: 0;
}

.login-logo {
  width: 72px;
  height: 48px;
  object-fit: contain;
}

.login-language {
  margin-bottom: 18px;
}

.login-language select {
  width: 100%;
}

.auth-preferences {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 18px;
}

.auth-preferences .login-language {
  margin-bottom: 0;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.login-ticket-link {
  margin-top: 12px;
}

html[data-theme="dark"] .topbar {
  background: rgba(17, 24, 39, 0.94);
}

html[data-theme="dark"] .error-body {
  background: var(--canvas);
}

html[data-theme="dark"] .brand-logo,
html[data-theme="dark"] .login-logo,
html[data-theme="dark"] .error-logo {
  background: #fff;
  border-radius: 8px;
  padding: 5px;
}

html[data-theme="dark"] .global-search input,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .filter-check-group,
html[data-theme="dark"] .language-switcher select,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .user-chip,
html[data-theme="dark"] .secret-toggle,
html[data-theme="dark"] .form-field input,
html[data-theme="dark"] .form-field select,
html[data-theme="dark"] .form-field textarea,
html[data-theme="dark"] .stack-form input {
  background: #0f172a;
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

html[data-theme="dark"] .filter-check {
  background: #111b2e;
  border-color: var(--line);
}

html[data-theme="dark"] .filter-check:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

html[data-theme="dark"] .global-search input::placeholder,
html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #748398;
}

html[data-theme="dark"] .form-field label,
html[data-theme="dark"] .audit-checklist-section h2 {
  color: #d6deeb;
}

html[data-theme="dark"] .form-field input:disabled,
html[data-theme="dark"] .form-field select:disabled,
html[data-theme="dark"] .form-field textarea:disabled {
  background: #101827;
  color: var(--muted);
}

html[data-theme="dark"] .detail-grid > div,
html[data-theme="dark"] .form-field-choice-list > div:not(.field-error),
html[data-theme="dark"] .form-field-radio-list,
html[data-theme="dark"] .checklist-result-list li,
html[data-theme="dark"] .history-list li,
html[data-theme="dark"] .error-panel,
html[data-theme="dark"] .success-panel {
  background: var(--surface);
  border-color: var(--line);
}

html[data-theme="dark"] .form-field-choice-list > div:not(.field-error) > div label,
html[data-theme="dark"] .form-field-radio-list > div:not(.field-error) > div label,
html[data-theme="dark"] .tag-preview span,
html[data-theme="dark"] .tag-list li {
  background: #0f172a;
  color: #d6deeb;
  border-color: var(--line);
}

html[data-theme="dark"] .form-field-choice-list > div:not(.field-error) > div label:has(input:checked),
html[data-theme="dark"] .form-field-radio-list > div:not(.field-error) > div label:has(input:checked) {
  background: #123a35;
  color: #99f6e4;
  border-color: var(--teal);
}

html[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
  --bs-table-striped-color: var(--text);
  --bs-table-hover-color: var(--text);
}

html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th {
  border-color: var(--line);
}

html[data-theme="dark"] .status-badge {
  background: #123554;
  color: #bfdbfe;
}

html[data-theme="dark"] .status-badge-neutral,
html[data-theme="dark"] .priority-badge-neutral,
html[data-theme="dark"] .deadline-badge-muted,
html[data-theme="dark"] .deadline-badge-closed {
  background: #1e293b;
  color: #cbd5e1;
}

html[data-theme="dark"] .status-badge-info,
html[data-theme="dark"] .priority-badge-low,
html[data-theme="dark"] .deadline-badge-later {
  background: #123554;
  color: #bfdbfe;
}

html[data-theme="dark"] .status-badge-progress {
  background: #123a35;
  color: #99f6e4;
}

html[data-theme="dark"] .status-badge-success {
  background: #14351f;
  color: #bbf7d0;
}

html[data-theme="dark"] .status-badge-warning,
html[data-theme="dark"] .priority-badge-medium,
html[data-theme="dark"] .deadline-badge-soon {
  background: #422f10;
  color: #fde68a;
}

html[data-theme="dark"] .priority-badge-high,
html[data-theme="dark"] .deadline-badge-today {
  background: #44230f;
  color: #fed7aa;
}

html[data-theme="dark"] .status-badge-danger,
html[data-theme="dark"] .priority-badge-critical,
html[data-theme="dark"] .deadline-badge-overdue {
  background: #42161a;
  color: #fecdd3;
}

html[data-theme="dark"] .error-code {
  background: #123554;
  color: #bfdbfe;
}

html[data-theme="dark"] .row-danger td {
  background: #3b1218;
}

html[data-theme="dark"] .row-complete td {
  background: #172033;
  color: #93a4b8;
}

html[data-theme="dark"] .row-complete a {
  color: #cbd5e1;
}

html[data-theme="dark"] .table tbody tr.row-danger:hover > td {
  background: #48171d;
}

html[data-theme="dark"] .table tbody tr.row-complete:hover > td {
  background: #1c2940;
}

html[data-theme="dark"] .checklist-choice {
  background: #1e293b;
  color: #d6deeb;
}

html[data-theme="dark"] .checklist-choice-yes {
  background: #14351f;
  color: #bbf7d0;
}

html[data-theme="dark"] .checklist-choice-no {
  background: #42161a;
  color: #fecdd3;
}

html[data-theme="dark"] .checklist-choice-na {
  background: #172033;
  color: #cbd5e1;
}

html[data-theme="dark"] .btn-light {
  background: #1f2937;
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] .btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-primary:focus-visible {
  background: var(--primary);
  color: #06111f;
}

html[data-theme="dark"] .filter-actions button[type="submit"],
html[data-theme="dark"] .filter-actions button[type="submit"]:hover,
html[data-theme="dark"] .filter-actions button[type="submit"]:focus-visible {
  border-color: var(--primary);
  background: var(--primary);
  color: #06111f;
}

html[data-theme="dark"] .btn-outline-secondary {
  color: var(--text);
  border-color: var(--line-strong);
}

html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-secondary:focus-visible {
  background: var(--surface-hover);
  color: var(--text);
}

html[data-theme="dark"] .alert {
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] .alert-info {
  border-left-color: var(--info);
  background: var(--info-soft);
}

html[data-theme="dark"] .alert-success {
  border-left-color: var(--success);
  background: var(--success-soft);
}

html[data-theme="dark"] .alert-warning {
  border-left-color: var(--amber);
  background: var(--warning-soft);
}

html[data-theme="dark"] .alert-error,
html[data-theme="dark"] .alert-danger {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

html[data-theme="dark"] .alert-info .alert-icon,
html[data-theme="dark"] .alert-success .alert-icon,
html[data-theme="dark"] .alert-warning .alert-icon,
html[data-theme="dark"] .alert-error .alert-icon,
html[data-theme="dark"] .alert-danger .alert-icon {
  background: rgba(15, 23, 42, 0.45);
}

html[data-theme="dark"] .alert-info .alert-icon {
  color: var(--info);
}

html[data-theme="dark"] .alert-success .alert-icon {
  color: var(--success);
}

html[data-theme="dark"] .alert-warning .alert-icon {
  color: var(--amber);
}

html[data-theme="dark"] .alert-error .alert-icon,
html[data-theme="dark"] .alert-danger .alert-icon {
  color: var(--danger);
}

html[data-theme="dark"] .notification-item {
  background: var(--surface);
  border-bottom-color: var(--line);
  border-left-color: transparent;
}

html[data-theme="dark"] .notification-item:hover {
  background: var(--surface-hover);
}

html[data-theme="dark"] .notification-item.is-unread {
  border-left-color: var(--notification-accent);
  background: var(--notification-soft);
}

html[data-theme="dark"] .btn-close {
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar,
  .app-main,
  .sidebar-toggle,
  .brand,
  .brand > span,
  .sidebar-nav a,
  .sidebar-nav a > span,
  .btn,
  .form-control,
  .form-select,
  .page-link,
  .filter-check,
  .table tbody td,
  .table-actions a,
  .notification-item {
    transition: none;
  }
}

@media (min-width: 981px) {
  html.sidebar-is-collapsed .app-sidebar {
    width: 84px;
    padding-right: 12px;
    padding-left: 12px;
  }

  html.sidebar-is-collapsed .app-main {
    margin-left: 84px;
  }

  html.sidebar-is-collapsed .brand {
    justify-content: center;
    gap: 0;
    padding-right: 0;
    padding-left: 0;
  }

  html.sidebar-is-collapsed .brand > span {
    width: 0;
    overflow: hidden;
    opacity: 0;
  }

  html.sidebar-is-collapsed .sidebar-nav a {
    justify-content: center;
    gap: 0;
    padding-right: 0;
    padding-left: 0;
  }

  html.sidebar-is-collapsed .sidebar-nav a > span {
    position: absolute;
    top: 50%;
    left: calc(100% + 12px);
    z-index: 40;
    padding: 7px 10px;
    border-radius: 7px;
    background: var(--sidebar-2);
    color: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
    opacity: 0;
    clip-path: inset(50%);
    pointer-events: none;
    transform: translate(-4px, -50%);
    transition: opacity 140ms ease, transform 140ms ease;
  }

  html.sidebar-is-collapsed .sidebar-nav a:hover > span,
  html.sidebar-is-collapsed .sidebar-nav a:focus-visible > span {
    opacity: 1;
    clip-path: inset(0);
    transform: translate(0, -50%);
  }
}

@media (max-width: 1280px) {
  .filter-bar-applications > .filter-actions,
  .filter-bar-inventory > .filter-actions,
  .filter-bar-actions > .filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .sidebar-toggle {
    display: none;
  }

  .app-sidebar {
    position: static;
    width: 100%;
    min-height: auto;
  }

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

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .kpi-grid,
  .dashboard-grid,
  .activity-grid,
  .settings-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .filter-bar-applications {
    grid-template-columns: 1fr 1fr;
  }

  .filter-bar-inventory {
    grid-template-columns: 1fr 1fr;
  }

  .filter-bar-actions {
    grid-template-columns: 1fr 1fr;
  }

  .filter-bar-wide {
    grid-template-columns: 1fr 1fr;
  }

  .filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .content-wrap {
    padding: 18px;
  }

  .page-heading,
  .filter-bar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar {
    padding: 14px;
  }

  .filter-bar-heading {
    padding-bottom: 10px;
  }

  .page-heading-actions {
    justify-content: flex-start;
  }

  .filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-actions .btn {
    width: 100%;
  }

  .pagination {
    justify-content: center;
  }

  .alert {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 9px;
    padding: 10px;
  }

  .alert-icon,
  .alert .btn-close {
    width: 32px;
    height: 32px;
  }

  .notification-item {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    padding: 14px;
  }

  .notification-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .notification-actions {
    grid-column: 2;
    justify-content: stretch;
  }

  .notification-actions .btn {
    width: 100%;
  }

  .app-footer {
    padding-right: 0;
    padding-left: 0;
    font-size: 0.82rem;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .identity-text strong {
    max-width: 120px;
  }

  .form-field-radio-list {
    grid-template-columns: 1fr;
  }

  .form-field-radio-list > div:not(.field-error) {
    grid-template-columns: 1fr;
  }

  .field-label-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .field-label-actions .btn {
    align-self: flex-start;
  }

  .subaction-dates {
    padding-left: 0;
  }
}

.email-config-summary code {
  color: var(--primary);
  overflow-wrap: anywhere;
}

.email-settings-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.email-settings-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.email-config-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
}

.email-config-form {
  margin: 0;
}

.email-config-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  cursor: pointer;
}

.email-config-switch input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--teal);
}

.email-config-summary {
  display: grid;
  gap: 16px;
}

.email-config-summary h2 {
  margin-bottom: 0;
}

.email-config-summary dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.email-config-summary dl > div {
  display: grid;
  gap: 5px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.email-config-summary dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.email-config-summary dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  overflow-wrap: anywhere;
}

.email-config-help {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.email-config-help p,
.email-test-form p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.email-config-help i {
  margin-right: 6px;
  color: var(--teal);
}

.email-test-form {
  display: grid;
  gap: 10px;
}

.email-test-form .btn {
  width: 100%;
}

@media (max-width: 980px) {
  .email-config-layout {
    grid-template-columns: 1fr;
  }

  .email-settings-card {
    align-items: flex-start;
    flex-direction: column;
  }
}
/* Refined, responsive filter cards. */
.filter-bar {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  margin-bottom: 20px;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.filter-bar::before {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--teal));
  content: "";
  pointer-events: none;
}

.filter-bar-wide,
.filter-bar-applications,
.filter-bar-inventory,
.filter-bar-actions {
  grid-template-columns: minmax(0, 1fr);
}

.filter-bar-heading {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--primary-soft) 0%, transparent 75%);
}

.filter-bar-title {
  gap: 10px;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.filter-bar-title i {
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-radius: 10px;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--primary) 12%, transparent);
}

.filter-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  min-width: 0;
  padding: 18px;
}

.filter-field {
  display: grid;
  align-content: end;
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.filter-field-label {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.filter-field.is-active .filter-field-label,
.filter-field:focus-within .filter-field-label {
  color: var(--primary);
}

.filter-field.is-active .filter-field-label::after {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  content: "";
}

.filter-bar .form-control,
.filter-bar .form-select {
  min-width: 0;
  min-height: 46px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.025);
}

.filter-search-control {
  position: relative;
  min-width: 0;
}

.filter-search-control > i {
  position: absolute;
  top: 50%;
  left: 14px;
  z-index: 1;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.filter-search-control .form-control {
  padding-left: 40px;
}

.filter-field.is-active .form-control,
.filter-field.is-active .form-select,
.filter-field.is-active .filter-check-group {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.filter-check-group {
  flex-wrap: wrap;
  align-content: center;
  min-height: 46px;
  padding: 7px;
  overflow: visible;
  border-radius: 12px;
  background: var(--surface);
}

.filter-check {
  min-height: 32px;
  padding: 3px 10px;
}

.filter-actions {
  grid-column: 1 / -1;
  width: 100%;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.filter-actions .btn {
  min-height: 42px;
  padding: 8px 15px;
  border-radius: 11px;
  white-space: nowrap;
}

.filter-actions .btn-outline-secondary {
  background: var(--surface);
}

html[data-theme="dark"] .filter-bar {
  background: linear-gradient(180deg, var(--surface) 0%, #0d1626 100%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .filter-bar .form-control,
html[data-theme="dark"] .filter-bar .form-select,
html[data-theme="dark"] .filter-check-group {
  background: #0f172a;
}

html[data-theme="dark"] .filter-actions {
  background: #0d1626;
}

html[data-theme="dark"] .filter-actions .btn-outline-secondary {
  background: var(--surface);
}

@media (max-width: 560px) {
  .filter-bar-heading {
    padding: 15px 14px 12px;
  }

  .filter-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .filter-actions {
    gap: 8px;
    padding: 12px 14px 14px;
  }

  .filter-actions .btn {
    width: 100%;
  }
}
