:root {
  --appbar-height: 64px;
  --topnav-height: 64px;
  --app-button-height: 48px;
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.md-bg {
  background: var(--app-bg);
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", "Poppins", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: inherit;
}

body {
  -webkit-tap-highlight-color: transparent;
}

body.md-lock-scroll {
  overflow: hidden;
  touch-action: none;
}

button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
  min-height: var(--app-button-height);
}

button,
.md-appbar-link,
.md-appbar-button,
.md-topnav-trigger,
.md-topnav-link {
  touch-action: manipulation;
}

.md-appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.35rem;
  background: linear-gradient(92deg, var(--app-primary-dark), var(--app-primary));
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: var(--appbar-height);
  color: var(--app-on-primary, #ffffff);
  box-shadow: 0 14px 34px var(--floating-shadow-strong);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.md-appbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: inherit;
  letter-spacing: 0.015em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
}

.md-appbar-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  padding: 0.3rem;
  object-fit: contain;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
  flex-shrink: 0;
}

.md-appbar-toggle {
  background: var(--app-on-primary-subtle);
  border: none;
  padding: 0.5rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  margin-right: 0.85rem;
  cursor: pointer;
  transition: background 0.3s ease;
  min-height: var(--app-button-height);
  width: var(--app-button-height);
  align-items: center;
}

.md-appbar-toggle span {
  width: 22px;
  height: 2px;
  background: var(--app-surface-alt);
  display: block;
}

.md-appbar-toggle:hover,
.md-appbar-toggle:focus {
  background: var(--app-on-primary-soft);
}

.md-appbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex: 1 0 100%;
  flex-wrap: wrap;
}

@media (min-width: 1025px) {
  .md-appbar {
    flex-wrap: nowrap;
    gap: 1rem;
  }

  .md-appbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }
}

.md-topnav {
  position: sticky;
  top: var(--appbar-height);
  z-index: 950;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 255, 0.72));
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  margin: 1.35rem auto 1.75rem;
  padding: 0.85rem 1.4rem;
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: stretch;
  min-height: var(--topnav-height);
  outline: none;
  gap: 0.5rem;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.md-topnav:hover,
.md-topnav:focus-within {
  box-shadow: 0 28px 55px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
}

.md-topnav::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  opacity: 1;
  pointer-events: none;
}

.md-topnav > * {
  position: relative;
  z-index: 1;
}

.md-topnav-list {
  list-style: none;
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  width: 100%;
}

.md-topnav-item {
  position: relative;
  display: flex;
  align-items: stretch;
}

.md-topnav-item.is-active > .md-topnav-trigger,
.md-topnav-item.is-open > .md-topnav-trigger {
  background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-primary-dark) 100%);
  color: var(--md-on-primary);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18);
}

.md-topnav-trigger {
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.08);
  color: var(--app-on-surface-strong);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.1rem;
  border-radius: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  min-height: var(--app-button-height);
  text-align: left;
}

.md-topnav-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  line-height: 1.2;
  flex: 1 1 auto;
  min-width: 0;
}

.md-topnav-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: inherit;
}

.md-topnav-desc {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--app-on-surface-muted);
  font-weight: 500;
}

.md-topnav-item.is-active > .md-topnav-trigger .md-topnav-desc,
.md-topnav-item.is-open > .md-topnav-trigger .md-topnav-desc,
.md-topnav-trigger:hover .md-topnav-desc,
.md-topnav-trigger:focus-visible .md-topnav-desc {
  color: rgba(255, 255, 255, 0.75);
}

.md-topnav-trigger:hover,
.md-topnav-trigger:focus-visible {
  background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-primary-dark) 100%);
  color: var(--md-on-primary);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
  outline: none;
  border-color: rgba(255, 255, 255, 0.2);
}

.md-topnav-chevron {
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-left: 0.25rem;
}

.md-topnav-item.is-open > .md-topnav-trigger .md-topnav-chevron,
.md-topnav-item:focus-within > .md-topnav-trigger .md-topnav-chevron {
  transform: rotate(-135deg);
}

.md-topnav-submenu {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 0;
  display: none;
  flex-direction: column;
  min-width: 240px;
  background: linear-gradient(145deg, var(--app-surface), rgba(248, 250, 255, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16);
  padding: 0.75rem 0.6rem;
  z-index: 980;
  gap: 0.35rem;
}

@media (hover: hover) {
  .md-topnav-submenu::before {
    content: "";
    position: absolute;
    top: -0.6rem;
    left: 0;
    right: 0;
    height: 0.6rem;
    display: block;
  }
}

.md-topnav-item.is-open > .md-topnav-submenu,
.md-topnav-item:focus-within > .md-topnav-submenu {
  display: flex;
}

@media (hover: hover) {
  .md-topnav-item:hover > .md-topnav-submenu {
    display: flex;
  }

  .md-topnav-item:hover > .md-topnav-trigger .md-topnav-chevron {
    transform: rotate(-135deg);
  }
}

.md-topnav-submenu li {
  list-style: none;
}

.md-topnav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  color: var(--app-on-surface-strong);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  min-height: calc(var(--app-button-height) - 4px);
  width: 100%;
  gap: 1rem;
}

.md-topnav-link:hover,
.md-topnav-link:focus-visible,
.md-topnav-link.active {
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
  outline: none;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.md-topnav-link-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  line-height: 1.25;
  flex: 1 1 auto;
  min-width: 0;
}

.md-topnav-link-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: inherit;
}

.md-topnav-link-desc {
  font-size: 0.78rem;
  color: var(--app-on-surface-muted);
  letter-spacing: 0.015em;
}

.md-topnav-link.active .md-topnav-link-desc,
.md-topnav-link:hover .md-topnav-link-desc,
.md-topnav-link:focus-visible .md-topnav-link-desc {
  color: var(--app-primary-dark);
}

.md-topnav-link-icon {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--app-on-surface-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.md-topnav-link:hover .md-topnav-link-icon,
.md-topnav-link:focus-visible .md-topnav-link-icon,
.md-topnav-link.active .md-topnav-link-icon {
  transform: translateX(4px);
  color: var(--app-primary-dark);
}

.md-topnav-link--external .md-topnav-link-icon {
  font-size: 1rem;
}

.md-topnav-mobile-header {
  display: none;
}

.md-topnav-mobile-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--app-on-surface-strong);
}

.md-topnav-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--app-input-bg);
  color: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  min-height: var(--app-button-height);
}

.md-topnav-close:hover,
.md-topnav-close:focus-visible {
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
  border-color: var(--app-primary-soft);
}

.md-status-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  border: none;
  cursor: pointer;
  font: inherit;
  appearance: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: var(--app-button-height);
}

.md-status-indicator:focus-visible {
  outline: 2px solid var(--status-info, #2563eb);
  outline-offset: 2px;
}

.md-status-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--status-success);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.md-status-label {
  font-size: 0.85rem;
}

.md-status-indicator.is-offline {
  background: rgba(255, 140, 0, 0.18);
}

.md-status-indicator.is-offline .md-status-dot {
  background: var(--status-warning);
  box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.35);
}

.md-appbar-button {
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  font-weight: 600;
  padding: 0 1.05rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.3s ease, opacity 0.2s ease;
  min-height: var(--app-button-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.md-appbar-button:hover,
.md-appbar-button:focus {
  background: var(--app-on-primary-soft);
}

.md-appbar-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.md-appbar-button.is-loading::after {
  content: "";
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-left: 0.5rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-top-color: rgba(255, 255, 255, 0.2);
  animation: md-appbar-spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes md-appbar-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.md-appbar-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  padding: 0 1rem;
  border-radius: 999px;
  transition: background 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--app-button-height);
}

.md-appbar-link:hover,
.md-appbar-link:focus {
  background: var(--app-on-primary-soft);
}

.md-lang-switch a {
  margin: 0 0.15rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.3s ease, color 0.3s ease;
}

.md-lang-switch a.active,
.md-lang-switch a:hover {
  background: var(--app-on-primary-soft);
  color: var(--app-on-primary, #ffffff);
}

.md-shell {
  position: relative;
  width: 100%;
  padding: 1.35rem 1.35rem 2.5rem;
}

.md-topnav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 940;
  touch-action: none;
}

html.has-js .md-topnav-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (pointer: coarse) {
  .md-appbar-button,
  .md-appbar-link,
  .md-appbar-toggle,
  .md-topnav-trigger,
  .md-topnav-link {
    min-height: calc(var(--app-button-height) + 4px);
  }

  .md-appbar-button {
    padding: 0 1.25rem;
  }

  .md-topnav-trigger {
    padding: 0.85rem 1.25rem;
  }

  .md-topnav-link {
    padding: 0.85rem 1.25rem;
  }

  .md-status-indicator {
    padding: 0 1.25rem;
  }
}

.md-drawer {
  width: 260px;
  background: var(--app-surface);
  position: fixed;
  top: var(--appbar-height);
  left: 0;
  bottom: 0;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  box-shadow: 14px 0 38px var(--app-primary-soft);
  padding-bottom: 2rem;
  overflow-y: auto;
  z-index: 1200;
  border-right: 1px solid var(--app-border);
}

.md-drawer.open {
  transform: translateX(0);
}

.md-drawer-header {
  padding: 1.35rem 1.2rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--app-border);
  background: linear-gradient(140deg, var(--app-primary-soft), transparent);
}

.md-drawer-title {
  font-weight: 700;
  color: var(--app-primary);
  letter-spacing: 0.01em;
}

.md-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  padding: 1.1rem 0.75rem 1.5rem;
}

.md-drawer-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.md-drawer-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--brand-primary-darker);
  padding: 0 0.75rem;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.md-drawer-link {
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  color: var(--app-on-surface-strong);
  text-decoration: none;
  display: block;
  font-weight: 500;
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.md-drawer-link:hover,
.md-drawer-link:focus,
.md-drawer-link.active {
  background: var(--app-secondary-soft);
  color: var(--app-primary-dark);
  transform: translateX(4px);
}

.md-main {
  margin-left: 0;
  padding: 1.2rem 0;
  transition: margin-left 0.3s ease;
  min-height: calc(100vh - var(--appbar-height) - var(--topnav-height));
}

.md-section {
  display: grid;
  gap: 1rem;
  margin-top: 0.9rem;
}

.md-page-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-radius: 18px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  box-shadow: 0 18px 32px rgba(31, 42, 68, 0.1);
  overflow: hidden;
}

.md-page-header::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(32, 115, 191, 0.12), rgba(15, 169, 223, 0.05));
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.md-page-header__content {
  position: relative;
  z-index: 1;
  max-width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.md-page-title {
  margin: 0;
  font-size: clamp(1.65rem, 1.3rem + 1vw, 2.1rem);
  font-weight: 600;
  color: var(--app-on-surface-strong);
  letter-spacing: -0.01em;
}

.md-page-subtitle {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--app-on-surface-muted);
  max-width: 60ch;
}

body.theme-dark .md-page-header {
  background: rgba(19, 28, 43, 0.82);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.55);
}

body.theme-dark .md-page-header::after {
  background: linear-gradient(135deg, rgba(32, 115, 191, 0.3), rgba(15, 169, 223, 0.15));
}

.md-card {
  border-radius: 16px;
  overflow: hidden;
  background: var(--app-surface);
  box-shadow: var(--app-shadow-soft);
  border: 1px solid var(--app-border);
  position: relative;
  padding-top: calc(1.35rem + 4px);
  padding-bottom: 1.35rem;
}

.md-card > *:not(.md-card-body) {
  padding-left: 1.35rem;
  padding-right: 1.35rem;
}

.md-card > .md-card-body:first-child {
  padding-top: 0;
}

.md-card > :not(:first-child):not(.md-card-body) {
  margin-top: 0.85rem;
}

.md-card > .md-card-title,
.md-card > .md-card-title-row {
  padding-top: 0;
  margin-top: 0;
}

.md-card .md-table,
.md-card .md-table-responsive {
  margin-bottom: 0.5rem;
}

.md-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.md-card-title-row .md-card-title {
  margin-bottom: 0;
}

.md-card-action {
  border-radius: 999px;
  font-weight: 600;
  padding-inline: 1.25rem;
  white-space: nowrap;
}

.md-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--app-primary), var(--app-secondary));
}

.md-card > * {
  position: relative;
  z-index: 1;
}

.md-card-body {
  padding: 1.25rem 1.35rem;
}

.md-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.md-inline-form > * {
  flex: 1 1 180px;
  min-width: 150px;
}

.md-inline-form input[type="date"],
.md-inline-form input[type="password"],
.md-inline-form input[type="text"],
.md-inline-form select {
  width: 100%;
}

.md-inline-form button {
  flex: 0 0 auto;
  align-self: center;
}

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

.md-table-responsive .md-table {
  min-width: 960px;
}

.md-empty-state {
  margin: 0.5rem 0 0;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  background: var(--app-primary-soft);
  color: var(--app-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}

body.theme-dark .md-empty-state {
  background: var(--app-secondary-soft);
  color: var(--app-surface-highlight);
}

.md-user-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  position: relative;
}

.md-user-grid.is-hidden {
  display: none;
}

.md-user-grid::before,
.md-user-list::before {
  content: attr(data-empty-message);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem;
  color: var(--app-muted-light);
  font-style: italic;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.md-user-grid[data-has-results="false"]::before,
.md-user-list[data-has-results="false"]::before {
  opacity: 1;
}

.md-user-toggle {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.md-user-view-btn.is-active {
  background: var(--app-primary);
  color: var(--md-on-primary);
  border-color: transparent;
  box-shadow: var(--app-shadow-soft);
}

.md-user-view-btn.is-active:hover,
.md-user-view-btn.is-active:focus-visible {
  background: var(--app-primary-dark);
}

.md-user-card {
  background: var(--app-surface);
  border-radius: 18px;
  border: 1px solid var(--app-border);
  box-shadow: 0 16px 36px var(--app-primary-soft);
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.md-user-card--hidden {
  display: none;
}

.md-user-card--highlight {
  border-color: var(--app-primary);
  box-shadow: 0 18px 40px rgba(31, 91, 155, 0.22);
}

.md-user-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px var(--app-primary-soft);
}

body.theme-dark .md-user-card {
  background: var(--app-surface);
  border-color: var(--app-secondary-soft);
  box-shadow: 0 18px 46px var(--floating-shadow);
}

.md-user-card__header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.md-user-avatar {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  box-shadow: 0 8px 18px var(--app-primary-soft);
  text-transform: uppercase;
}

body.theme-dark .md-user-avatar {
  background: var(--app-secondary-soft);
  color: var(--app-surface-highlight);
  box-shadow: 0 10px 26px var(--floating-shadow-strong);
}

.md-user-card__heading h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--app-muted);
}

body.theme-dark .md-user-card__heading h3 {
  color: var(--app-surface-highlight);
}

.md-user-card__heading p {
  margin: 0.2rem 0 0;
  color: var(--app-muted-light);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}

.md-user-chip {
  margin-left: auto;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
  box-shadow: inset 0 0 0 1px var(--app-primary-softer);
}

.md-user-chip.status-active {
  background: var(--status-success-soft);
  color: var(--status-success-text);
  box-shadow: inset 0 0 0 1px var(--status-success-soft);
}

.md-user-chip.status-pending {
  background: var(--status-warning-soft);
  color: var(--status-warning-text);
  box-shadow: inset 0 0 0 1px var(--status-warning-soft);
}

.md-user-chip.status-disabled {
  background: var(--status-danger-soft);
  color: var(--status-danger-text);
  box-shadow: inset 0 0 0 1px var(--status-danger-soft);
}

body.theme-dark .md-user-chip {
  background: var(--app-secondary-soft);
  color: var(--app-surface-highlight);
  box-shadow: inset 0 0 0 1px var(--app-secondary-soft);
}

body.theme-dark .md-user-chip.status-active {
  background: var(--status-success-soft);
  color: var(--status-success-surface);
  box-shadow: inset 0 0 0 1px var(--status-success-soft);
}

body.theme-dark .md-user-chip.status-pending {
  background: var(--status-warning-soft);
  color: var(--status-warning-surface);
  box-shadow: inset 0 0 0 1px var(--status-warning-soft);
}

body.theme-dark .md-user-chip.status-disabled {
  background: var(--status-danger-soft);
  color: var(--status-danger-surface);
  box-shadow: inset 0 0 0 1px var(--status-danger-soft);
}

.md-user-meta {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 0;
}

.md-user-meta div {
  background: var(--app-primary-soft);
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
}

body.theme-dark .md-user-meta div {
  background: var(--app-secondary-soft);
}

.md-user-meta dt {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-primary-darker);
  font-weight: 600;
}

body.theme-dark .md-user-meta dt {
  color: var(--app-surface-alt);
}

.md-user-meta dd {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--app-muted);
  word-break: break-word;
}

body.theme-dark .md-user-meta dd {
  color: var(--app-text-inverse);
}

.md-user-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: stretch;
}

.md-user-list {
  margin-top: 1.5rem;
  overflow-x: auto;
  position: relative;
}

.md-user-list.is-hidden {
  display: none;
}

.md-user-list tr.is-hidden {
  display: none;
}

.md-user-table th,
.md-user-table td {
  white-space: nowrap;
}

.md-user-list-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.md-user-manage {
  padding-inline: 1rem;
}

.md-user-action-button {
  min-width: clamp(8rem, 18vw, 10.5rem);
  --app-button-height: 44px;
  padding-inline: 1.25rem;
}

.md-user-update-form {
  flex: 1 1 320px;
  display: grid;
  gap: 0.85rem;
}

.md-user-form-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.md-field.md-field--compact span {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.md-field.md-field--compact input,
.md-field.md-field--compact select {
  padding: 0.55rem 0.7rem;
  background: var(--app-input-bg);
}

body.theme-dark .md-field.md-field--compact input,
body.theme-dark .md-field.md-field--compact select {
  background: var(--app-input-bg);
}

.md-user-form-actions {
  display: flex;
  justify-content: flex-end;
}

.md-user-delete-form {
  align-self: flex-end;
}

.md-user-delete-form .md-user-action-button {
  min-width: clamp(8rem, 18vw, 10.5rem);
}

@media (max-width: 720px) {
  .md-user-card__footer {
    flex-direction: column;
  }

  .md-user-delete-form {
    align-self: stretch;
  }

  .md-user-delete-form .md-user-action-button {
    width: 100%;
  }
}

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

.md-form-grid > .md-button {
  justify-self: start;
}

.md-form-grid > .md-form-actions {
  grid-column: 1 / -1;
}

.md-field.md-field-inline {
  align-items: flex-start;
}
.md-phone-input {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.md-phone-flag {
  font-size: 1.6rem;
  line-height: 1;
  filter: drop-shadow(0 3px 8px var(--app-primary-soft));
}

.md-phone-country {
  flex: 0 0 160px;
  width: auto;
  min-width: 140px;
}

.md-phone-local {
  flex: 1 1 200px;
}

.md-phone-input input[type='text'] {
  letter-spacing: 0.02em;
}

@media (max-width: 600px) {
  .md-phone-input {
    flex-direction: column;
    align-items: stretch;
  }
  .md-phone-country,
  .md-phone-local {
    flex: 1 1 auto;
    width: 100%;
  }
  .md-phone-flag {
    align-self: flex-start;
  }
}


.md-color-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.md-color-picker input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 16px;
  box-shadow: 0 6px 18px var(--app-primary-soft);
  cursor: pointer;
}

.md-color-picker input[type="color"]::-webkit-color-swatch,
.md-color-picker input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 16px;
}

.md-color-value {
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  font-size: 0.9rem;
  color: var(--app-muted);
  letter-spacing: 0.03em;
}

.md-field-hint {
  margin-top: -0.2rem;
  font-size: 0.8rem;
  color: var(--app-muted-light);
}

.md-help-bubble {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
  font-weight: 700;
  font-size: 0.75rem;
  margin-left: 0.45rem;
  cursor: help;
  box-shadow: 0 6px 16px var(--app-primary-soft);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
  flex-shrink: 0;
}

.md-help-bubble::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.6rem);
  transform: translate(-50%, 0.4rem);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  min-width: 12rem;
  max-width: min(22rem, calc(100vw - 3rem));
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: var(--app-surface, #ffffff);
  color: var(--app-on-surface-strong, #1f2933);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  line-height: 1.4;
  text-align: left;
  z-index: 80;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.md-help-bubble::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.15rem);
  transform: translateX(-50%);
  border-width: 0.45rem 0.45rem 0;
  border-style: solid;
  border-color: var(--app-surface, #ffffff) transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease;
  z-index: 79;
}

.md-help-bubble:hover,
.md-help-bubble:focus-visible {
  box-shadow: 0 10px 22px var(--app-primary-soft);
  transform: translateY(-1px);
  outline: none;
}

.md-help-bubble:hover::after,
.md-help-bubble:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.md-help-bubble:hover::before,
.md-help-bubble:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

.md-help-bubble--standalone {
  margin-left: 0;
}

.md-help-icon {
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}

.md-help-note {
  display: flex;
  align-items: center;
  margin: 0.35rem 0 0.6rem;
}

body.theme-dark .md-help-bubble {
  background: rgba(255, 255, 255, 0.14);
  color: var(--app-on-surface-strong, #f1f5f9);
  box-shadow: none;
}

body.theme-dark .md-help-bubble:hover,
body.theme-dark .md-help-bubble:focus-visible {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.42);
}

body.theme-dark .md-help-bubble::after {
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.48);
}

body.theme-dark .md-help-bubble::before {
  border-color: rgba(15, 23, 42, 0.94) transparent transparent transparent;
}

.md-field select,
.md-field input,
.md-field textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--app-primary-softer);
  border-radius: 12px;
  background: var(--app-surface-alt);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.md-field textarea {
  resize: vertical;
  min-height: 120px;
}

.md-field span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--app-muted);
}

.md-field input[type="file"] {
  padding: 0.6rem 0.8rem;
  border: 1px dashed var(--app-primary-softer);
  border-radius: 12px;
  background: var(--app-surface-alt);
  cursor: pointer;
}

.md-field input[type="file"]::file-selector-button,
.md-field input[type="file"]::-webkit-file-upload-button {
  background: var(--app-primary);
  color: var(--app-on-primary, #ffffff);
  border: none;
  border-radius: 10px;
  padding: 0.45rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.md-field input[type="file"]:hover::file-selector-button,
.md-field input[type="file"]:hover::-webkit-file-upload-button {
  background: var(--app-primary-dark);
  box-shadow: 0 4px 12px var(--app-primary-soft);
}

.branding-logo-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.branding-logo-preview img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 22px;
  background: var(--app-surface);
  padding: 0.6rem;
  box-shadow: 0 12px 28px var(--app-primary-soft);
}

.branding-logo-preview .md-hint {
  margin-bottom: 0.35rem;
}

.md-field--required > span::after {
  content: ' *';
  color: var(--app-danger);
  font-weight: 700;
}

.md-field input:focus,
.md-field select:focus,
.md-field textarea:focus {
  outline: none;
  border-color: var(--app-secondary);
  background: var(--app-surface);
  box-shadow: 0 0 0 3px var(--app-secondary-soft);
}

.md-control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.2rem;
}

.md-control label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--app-muted);
}

.md-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--app-secondary);
}

.md-sso-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.md-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 26px;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 38px var(--app-primary-soft);
  margin-bottom: 0.75rem;
}

.md-sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  text-align: center;
}

.md-sso-btn.google {
  background: var(--app-surface);
  border: 1px solid var(--app-border-strong);
  color: var(--app-primary-dark);
}

.md-sso-btn.microsoft {
  background: var(--app-surface);
  border: 1px solid var(--app-border-strong);
  color: var(--app-primary-dark);
}

.md-sso-btn.google:hover,
.md-sso-btn.microsoft:hover {
  background: var(--app-input-bg);
}


.md-button.md-outline {
  background: transparent;
  border: 1px solid var(--app-border);
  color: var(--app-primary);
  box-shadow: none;
}

.md-button--wide {
  min-width: 10rem;
}

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

.md-login.md-login--simple {
  width: min(960px, 100%);
  margin: clamp(2rem, 6vh, 4rem) auto;
  border-radius: 28px;
  overflow: hidden;
}

.md-login-simple {
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 4vw, 3rem);
  padding: clamp(2rem, 5vw, 3.25rem);
  background: linear-gradient(135deg, rgba(247, 249, 255, 0.92), #ffffff);
}

.md-login-simple__header {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2rem);
}

.md-login-simple__logo {
  width: clamp(72px, 12vw, 92px);
  height: clamp(72px, 12vw, 92px);
  border-radius: 20px;
  object-fit: contain;
  background: rgba(35, 87, 166, 0.08);
  padding: 0.65rem;
  box-shadow: 0 16px 34px rgba(31, 75, 146, 0.15);
}

.md-login-simple__titles {
  display: grid;
  gap: 0.5rem;
}

.md-login-simple__eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--app-muted-light);
}

.md-login-simple__titles h1 {
  margin: 0;
  font-size: clamp(1.85rem, 3vw, 2.4rem);
  color: var(--app-primary-dark);
}

.md-login-simple__intro {
  margin: 0;
  color: var(--app-muted);
  line-height: 1.65;
}

.md-login-simple__body {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1fr);
  align-items: start;
}

.md-login-simple__copy h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 2.6vw, 2rem);
  color: var(--app-primary-dark);
}

.md-login-simple__copy p {
  margin: 0;
  color: var(--app-muted);
  line-height: 1.65;
}

.md-login-simple__list {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.md-login-simple__list li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  color: var(--app-muted);
}

.md-login-simple__bullet {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
  box-shadow: 0 0 0 4px rgba(53, 102, 200, 0.12);
  flex-shrink: 0;
  margin-top: 0.35rem;
}

.md-login-simple__body .md-alert {
  margin-bottom: 0;
}

.md-login-simple__footer {
  display: grid;
  gap: 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(16, 53, 108, 0.08);
  font-size: 0.9rem;
  color: var(--app-muted);
}

.md-login-footer-label {
  display: block;
  font-weight: 600;
  color: var(--app-muted-light);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  margin-bottom: 0.25rem;
}

.md-login-footer-value {
  display: block;
  color: var(--app-muted);
}

.md-login-recovery {
  margin-top: 0.75rem;
}

.md-login-footer-link {
  color: var(--app-primary);
  font-weight: 600;
  text-decoration: none;
}

.md-login-footer-link:hover,
.md-login-footer-link:focus-visible {
  text-decoration: underline;
}

.md-login-footer-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--app-muted);
}

.md-login-footer-locale {
  display: inline-flex;
  gap: 0.75rem;
}

.md-login-footer-locale a {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.md-login-footer-locale a:hover,
.md-login-footer-locale a:focus-visible {
  color: var(--app-primary);
}

@media (max-width: 840px) {
  .md-login.md-login--simple {
    margin: clamp(1rem, 4vh, 2rem) auto;
    border-radius: 22px;
  }

  .md-login-simple__body {
    grid-template-columns: 1fr;
  }

  .md-login-simple__header {
    flex-direction: column;
    text-align: center;
  }

  .md-login-simple__logo {
    margin-bottom: 0.5rem;
  }

  .md-login-simple__footer {
    justify-items: center;
    text-align: center;
  }
}
.md-button.md-compact {
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  box-shadow: none;
}

.md-button.md-compact:hover {
  transform: none;
}


.md-button.md-outline:hover {
  background: var(--app-primary-soft);
  box-shadow: var(--app-shadow-soft);
}

.md-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.md-form-actions--center {
  justify-content: center;
}

.md-form-actions--stack {
  flex-direction: column;
  align-items: stretch;
}

@media (min-width: 640px) {
  .md-form-actions--stack {
    flex-direction: row;
    align-items: center;
  }
}

.email-template-block {
  border: 1px solid var(--md-border-color, rgba(0, 0, 0, 0.12));
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0 1.5rem;
  background: var(--md-surface-alt, rgba(0, 0, 0, 0.02));
}

.email-template-block h4.md-subhead {
  margin-top: 0;
}

.email-template-block .md-field {
  margin-top: 0.75rem;
}

.email-template-block textarea {
  min-height: 160px;
  font-family: inherit;
}

.email-template-placeholders {
  margin: 0.5rem 0 0.75rem;
}

.email-template-placeholders ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.email-template-placeholders code {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

body.theme-dark .email-template-block {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

body.theme-dark .email-template-placeholders code {
  background: rgba(255, 255, 255, 0.08);
}

.md-login-actions {
  margin-top: 1.25rem;
}

.md-login-actions .md-button {
  min-width: 9rem;
}

.md-radar-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.md-radar-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.md-radar-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.md-radar-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--app-muted-light);
}

.md-radar-canvas {
  position: relative;
  width: 100%;
  height: 280px;
}

@media (min-width: 768px) {
  .md-radar-canvas {
    height: 320px;
  }
}

.md-radar-canvas canvas {
  width: 100% !important;
  height: 100% !important;
}

.md-assessment-form {
  padding-bottom: 5rem;
}

.md-floating-save-draft {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 1200;
  border-radius: 999px;
  padding: 0.75rem 1.45rem;
  background: var(--app-surface);
  border: 1px solid var(--app-primary-softer);
  color: var(--app-primary-dark);
  box-shadow: 0 18px 44px var(--floating-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.md-floating-save-draft:hover,
.md-floating-save-draft:focus {
  transform: translateY(-2px);
  box-shadow: 0 22px 54px var(--floating-shadow-strong);
}

body.theme-dark .md-floating-save-draft {
  background: var(--app-surface);
  border-color: var(--app-secondary-soft);
  color: var(--app-surface-highlight);
  box-shadow: 0 18px 46px var(--floating-shadow-strong);
}

@media (max-width: 640px) {
  .md-floating-save-draft {
    left: 1rem;
    right: 1rem;
    width: calc(100% - 2rem);
    text-align: center;
  }
}

@media print {
  .md-floating-save-draft {
    display: none !important;
  }
}

.md-alert {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--app-warning-soft));
  color: var(--status-warning-text);
  border-left: 5px solid var(--app-warning));
  margin-bottom: 1.1rem;
}

.md-alert.success {
  background: var(--app-secondary-soft));
  color: var(--app-primary-dark);
  border-left-color: var(--app-secondary);
}

.md-alert.error {
  background: var(--app-danger-soft));
  color: var(--status-danger-text);
  border-left-color: var(--app-danger));
}

.md-alert.warning {
  background: var(--app-warning-soft));
  color: var(--status-warning-text);
  border-left-color: var(--app-warning));
}

.md-offline-banner {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 1.5rem);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  background: var(--app-surface);
  color: var(--app-text-primary);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.md-offline-banner.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.md-offline-banner[data-state="offline"] {
  background: var(--app-danger);
  color: var(--app-on-primary);
  box-shadow: 0 22px 45px rgba(220, 38, 38, 0.25);
}

body.theme-dark .md-offline-banner[data-state="offline"] {
  background: #b91c1c;
}

.md-offline-banner[data-state="online"] {
  background: var(--app-primary);
  color: var(--app-on-primary);
  box-shadow: 0 22px 45px rgba(30, 64, 175, 0.25);
}

.md-offline-banner__message {
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

.md-offline-banner__dismiss {
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  font-weight: 600;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.md-offline-banner__dismiss:hover,
.md-offline-banner__dismiss:focus {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

body.theme-dark .md-offline-banner__dismiss {
  background: rgba(15, 23, 42, 0.35);
}

body.theme-dark .md-offline-banner__dismiss:hover,
body.theme-dark .md-offline-banner__dismiss:focus {
  background: rgba(15, 23, 42, 0.5);
}

.md-offline-draft {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(29, 78, 216, 0.2);
  background: rgba(29, 78, 216, 0.08);
  color: #1f2937;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body.theme-dark .md-offline-draft {
  border-color: rgba(96, 165, 250, 0.25);
  background: rgba(30, 64, 175, 0.25);
  color: #e5edff;
}

.md-offline-draft[data-state="queued"],
.md-offline-draft[data-state="reminder"] {
  border-color: rgba(217, 119, 6, 0.4);
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

body.theme-dark .md-offline-draft[data-state="queued"],
body.theme-dark .md-offline-draft[data-state="reminder"] {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(217, 119, 6, 0.25);
  color: #fde68a;
}

.md-offline-draft[data-state="error"] {
  border-color: rgba(220, 38, 38, 0.45);
  background: rgba(248, 113, 113, 0.15);
  color: #7f1d1d;
}

body.theme-dark .md-offline-draft[data-state="error"] {
  border-color: rgba(252, 165, 165, 0.5);
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}

.md-draft-alert {
  margin-top: 1rem;
}

.md-draft-list {
  margin: 0.65rem 0 0;
  padding-left: 1.15rem;
}

.md-draft-list li {
  margin-bottom: 0.35rem;
}

.md-draft-list a {
  color: var(--app-primary);
  font-weight: 600;
  text-decoration: none;
}

.md-draft-list a:hover,
.md-draft-list a:focus {
  text-decoration: underline;
}

body.theme-dark .md-appbar {
  box-shadow: 0 14px 34px var(--app-shadow-strong);
}

body.theme-dark .md-appbar-logo {
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
}

body.theme-dark .md-drawer {
  background: var(--app-surface);
  box-shadow: 14px 0 38px var(--app-shadow-strong);
  border-right: 1px solid var(--app-border);
}

body.theme-dark .md-drawer-header {
  background: linear-gradient(140deg, var(--app-secondary-soft), transparent);
}

body.theme-dark .md-drawer-title {
  color: var(--app-surface-highlight);
}

body.theme-dark .md-drawer-label {
  color: var(--app-text-secondary);
  font-weight: 600;
}

body.theme-dark .md-drawer-link {
  color: var(--app-surface-highlight);
}

body.theme-dark .md-drawer-link:hover,
body.theme-dark .md-drawer-link:focus,
body.theme-dark .md-drawer-link.active {
  background: var(--app-secondary-soft);
  color: var(--app-text-inverse);
}

body.theme-dark .md-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow-soft);
  color: inherit;
}

body.theme-dark .md-field select,
body.theme-dark .md-field input,
body.theme-dark .md-field textarea {
  background: var(--app-input-bg));
  border: 1px solid var(--app-border));
  color: inherit;
}

body.theme-dark .md-field input:focus,
body.theme-dark .md-field select:focus,
body.theme-dark .md-field textarea:focus {
  background: var(--app-input-bg);
  border-color: var(--app-secondary);
  box-shadow: 0 0 0 3px var(--app-secondary-soft));
}

body.theme-dark .md-alert {
  background: var(--app-secondary-soft));
  color: var(--app-surface-highlight);
  border-left-color: var(--app-secondary);
}

body.theme-dark .md-alert.error {
  background: var(--app-danger-soft));
  color: var(--status-danger-surface);
  border-left-color: var(--app-danger));
}

body.theme-dark .md-alert.success {
  background: var(--app-secondary-soft));
  color: var(--app-surface-highlight);
}

body.theme-dark .md-logo {
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
}

body.theme-dark .md-table tbody tr {
  border-bottom-color: var(--app-table-stripe);
}

body.theme-dark .md-table thead {
  color: var(--app-surface-highlight);
}

body.theme-dark .md-table td,
body.theme-dark .md-table th {
  border-color: var(--app-table-stripe);
}

body.theme-dark .md-button {
  color: inherit;
}

body.theme-dark .md-button.md-outline {
  border-color: var(--app-border));
  color: var(--app-secondary));
}

body.theme-dark .md-button.md-outline:hover {
  background: var(--app-secondary-soft));
}

body.theme-dark .md-button.md-primary {
  background: var(--app-secondary);
  color: var(--app-on-primary);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--app-surface);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--app-shadow-soft);
}

.md-table th,
.md-table td {
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid var(--app-primary-soft);
}

.md-table--stacked {
  position: relative;
}

.md-table--stacked tbody tr:last-child td {
  border-bottom: none;
}

.md-table th {
  text-align: left;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--app-text-secondary);
  background: var(--app-secondary-soft);
}

.md-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--app-muted-light);
}

.md-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--app-secondary-soft);
  color: var(--app-primary-dark);
  font-weight: 600;
}

@media (max-width: 768px) {
  .md-table--stacked {
    background: transparent;
    box-shadow: none;
    border: 0;
    overflow: visible;
  }

  .md-table--stacked thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    border: 0;
    padding: 0;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    overflow: hidden;
  }

  .md-table--stacked tbody {
    display: grid;
    gap: 1rem;
  }

  .md-table--stacked tbody tr {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    border-radius: 18px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    box-shadow: 0 14px 28px var(--app-primary-soft);
  }

  body.theme-dark .md-table--stacked tbody tr {
    border-color: var(--app-primary-soft);
    background: var(--app-surface-alt);
  }

  .md-table--stacked td {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0;
    border: 0;
  }

  .md-table--stacked td + td {
    border-top: 1px solid var(--app-primary-soft);
    padding-top: 0.9rem;
  }

  .md-table--stacked td:first-child {
    border-top: 0;
    padding-top: 0;
  }

  body.theme-dark .md-table--stacked td + td {
    border-top-color: rgba(255, 255, 255, 0.12);
  }

  .md-table--stacked td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--app-text-secondary);
    font-weight: 600;
  }

  .md-table--stacked td > * {
    max-width: 100%;
  }

  .md-table--stacked .md-inline-form,
  .md-table--stacked form {
    width: 100%;
  }

  .md-table--stacked .md-inline-actions {
    justify-content: flex-start;
  }

  .md-table-responsive {
    overflow: visible;
  }

  .md-table-responsive .md-table {
    min-width: 0;
  }
}

.md-footer {
  padding: 2.8rem 1.35rem 2.5rem;
  background: linear-gradient(160deg, var(--app-on-surface-strong) 0%, var(--app-on-surface-strong) 55%, var(--app-on-surface-muted) 100%);
  color: var(--app-surface-alt);
  position: relative;
  overflow: hidden;
}

.md-footer::before {
  content: "";
  position: absolute;
  inset: -40% -30% auto -30%;
  height: 420px;
  background: radial-gradient(circle at top, var(--app-secondary-soft), transparent 60%);
  opacity: 0.75;
  pointer-events: none;
}

.md-footer-inner {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
  z-index: 1;
}

.md-footer a {
  color: var(--app-surface-highlight);
  text-decoration: none;
  font-weight: 500;
}

.md-footer a:hover,
.md-footer a:focus {
  color: var(--app-text-inverse);
  text-decoration: underline;
}

.md-footer-brand {
  font-weight: 700;
  letter-spacing: 0.06em;
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: center;
}

.md-footer-brand-short {
  font-size: 0.75rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--app-surface-highlight);
}

.md-footer-brand-name {
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.md-footer-meta {
  font-size: 0.85rem;
  opacity: 0.82;
}

.md-footer-links {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.85rem;
  opacity: 0.92;
  position: relative;
  z-index: 1;
}

.md-footer-links span {
  opacity: 0.4;
  color: var(--app-surface-highlight);
}

@media (min-width: 960px) {
  .md-shell {
    padding: 1.75rem 2.25rem 2.75rem;
  }

  .md-topnav {
    margin-top: 1.75rem;
  }

  .md-main {
    padding: 0;
    min-height: calc(100vh - var(--appbar-height) - var(--topnav-height) - 3rem);
  }

  .md-appbar-toggle {
    display: none;
  }

  .md-footer-inner {
    text-align: left;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .md-footer-brand {
    align-items: flex-start;
  }

  .md-footer-links {
    justify-content: flex-end;
  }
}

@media (min-width: 1025px) {
  .md-topnav-backdrop {
    display: none;
  }
}

@media (max-width: 1024px) {
  .md-shell {
    padding: 1.1rem 1rem 2.2rem;
  }

  .md-topnav {
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: 1.25rem 1.25rem 2rem;
    border-radius: 0;
    border: none;
    gap: 1.1rem;
  }

  .md-topnav::before {
    opacity: 0.9;
  }

  .md-topnav-list {
    flex-direction: column;
    gap: 0.75rem;
  }

  .md-topnav-item {
    width: 100%;
  }

  .md-topnav-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 0.9rem 0.75rem;
    font-size: 1.05rem;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .md-topnav-label {
    gap: 0.35rem;
  }

  .md-topnav-submenu {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    border-radius: 16px;
    padding: 0.85rem 0.65rem 0.85rem 0.85rem;
    margin: 0.35rem 0 0.25rem 0.15rem;
    background: var(--app-surface-elevated, rgba(248, 250, 255, 0.82));
    gap: 0.6rem;
  }

  .md-topnav-item.is-open > .md-topnav-submenu,
  .md-topnav-item:focus-within > .md-topnav-submenu {
    display: flex;
  }

  .md-topnav-submenu li,
  .md-topnav-link {
    width: 100%;
  }

  .md-topnav-link {
    padding: 0.9rem 0.85rem;
    font-size: 1rem;
    justify-content: flex-start;
    align-items: flex-start;
  }

  .md-topnav-link-icon {
    margin-top: 0.25rem;
  }

  html.has-js .md-topnav {
    position: fixed;
    top: calc(var(--appbar-height) + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.25);
    transform: translateY(-12%);
    opacity: 0;
    pointer-events: none;
    padding: calc(1.35rem + env(safe-area-inset-top, 0px)) 1.35rem calc(3rem + env(safe-area-inset-bottom, 0px));
    background: var(--app-surface);
    gap: 1rem;
    overflow-y: auto;
    max-height: calc(100vh - var(--appbar-height) - env(safe-area-inset-top, 0px));
    -webkit-overflow-scrolling: touch;
    transition: transform 0.28s ease, opacity 0.28s ease;
    z-index: 1200;
  }

  html.has-js .md-topnav::before {
    display: none;
  }

  html.has-js .md-topnav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  html.has-js .md-topnav-list {
    gap: 0.75rem;
  }

  html.has-js .md-topnav-backdrop {
    display: block;
  }

  .md-topnav-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--app-border);
  }
}

.likert-scale {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.likert-scale__option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: var(--app-secondary-soft);
  min-width: 110px;
}

.likert-scale__option input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
}

.likert-scale__option span {
  font-size: 0.85rem;
  text-align: center;
  color: var(--app-muted);
}

@media (max-width: 640px) {
  .likert-scale {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .likert-scale__option {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
    padding: 0.75rem 0.85rem;
  }

  .likert-scale__option span {
    text-align: left;
  }
}

.trend-chart-wrap {
  width: 100%;
  max-width: 100%;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 320px;
}

.trend-chart-wrap canvas,
.trend-chart-wrap img {
  display: block;
  max-width: 100%;
  height: 100%;
}

.trend-chart-wrap canvas {
  width: 100%;
  max-width: 820px;
  height: 320px;
}

.md-chart-container {
  position: relative;
  width: 100%;
  min-height: 320px;
  margin-bottom: 1.25rem;
}

.md-chart-container::before {
  content: attr(data-empty-message);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: var(--app-muted);
  font-style: italic;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.md-chart-container[data-has-data="false"]::before {
  opacity: 1;
}

.md-chart-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.md-dashboard-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: stretch;
}

.md-dashboard-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.md-upgrade-surface {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.md-upgrade-overview-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.md-upgrade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: 14px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  box-shadow: 0 10px 20px rgba(31, 42, 68, 0.07);
}

.md-upgrade-card--accent {
  background: var(--app-primary-soft);
  border-color: rgba(32, 115, 191, 0.35);
  color: var(--app-on-surface);
}

body.theme-dark .md-upgrade-card {
  background: rgba(19, 28, 43, 0.65);
  border-color: rgba(255, 255, 255, 0.06);
}

body.theme-dark .md-upgrade-card--accent {
  background: rgba(32, 115, 191, 0.24);
  border-color: rgba(32, 115, 191, 0.5);
}

.md-upgrade-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-on-surface-strong);
}

.md-upgrade-card--accent .md-upgrade-heading,
.md-upgrade-card--accent .md-upgrade-emphasis span,
.md-upgrade-card--accent .md-upgrade-meta {
  color: var(--app-on-surface);
}

.md-upgrade-emphasis {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--app-on-surface-strong);
}

.md-upgrade-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
}

.md-upgrade-chip.success {
  background: var(--status-success-soft);
  color: var(--status-success-text);
}

.md-upgrade-chip.error {
  background: var(--status-danger-soft);
  color: var(--status-danger-text);
}

.md-upgrade-chip.warning {
  background: var(--status-warning-soft);
  color: var(--status-warning-text);
}

.md-upgrade-chip.small {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
}

.md-upgrade-meta {
  font-size: 0.85rem;
  color: var(--app-on-surface-muted);
  line-height: 1.45;
}

.md-upgrade-meta--strong {
  font-weight: 600;
  color: var(--app-on-surface-strong);
}

.md-upgrade-meta--inline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.75rem;
  font-size: 0.8rem;
}

.md-upgrade-link {
  color: inherit;
  text-decoration: underline;
}

.md-upgrade-link:hover,
.md-upgrade-link:focus {
  text-decoration: none;
}

.md-upgrade-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}

.md-upgrade-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.md-upgrade-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.md-upgrade-field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--app-on-surface-muted);
}

.md-upgrade-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.md-upgrade-input:focus {
  outline: none;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(32, 115, 191, 0.15);
}

.md-upgrade-submit {
  align-self: flex-start;
}


.md-upgrade-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.md-upgrade-inline-actions form {
  display: flex;
  flex: 1 1 180px;
}

.md-upgrade-action-button {
  width: 100%;
  justify-content: center;
}

.md-upgrade-log-block {
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 0.75rem;
  background: var(--app-surface-muted);
  margin-top: 0.75rem;
}

.md-upgrade-log-block pre {
  margin-top: 0.5rem;
  max-height: 220px;
  overflow: auto;
}

.md-upgrade-restore-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.md-upgrade-select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  padding-right: 2.75rem;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-on-surface);
  font-size: 0.95rem;
  line-height: 1.4;
  box-shadow: 0 6px 14px rgba(31, 42, 68, 0.07);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--app-on-surface-muted) 50%),
    linear-gradient(135deg, var(--app-on-surface-muted) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    right 1.2rem center,
    right 0.85rem center,
    right 1rem center;
  background-size: 8px 8px, 8px 8px, 2.6rem 100%;
  background-repeat: no-repeat;
}

.md-upgrade-select:focus {
  outline: none;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(32, 115, 191, 0.18);
}

body.theme-dark .md-upgrade-select {
  background: rgba(19, 28, 43, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(226, 232, 240, 0.75) 50%),
    linear-gradient(135deg, rgba(226, 232, 240, 0.75) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
}

.md-upgrade-select option {
  color: var(--app-on-surface-strong);
}

.md-upgrade-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--app-on-surface-muted);
}

.md-upgrade-backup-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.md-upgrade-backup-toolbar .md-button {
  flex: 1 1 160px;
  justify-content: center;
}

.md-upgrade-hidden-form {
  display: none;
}

.md-upgrade-progress {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1200;
}

.md-upgrade-progress.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.md-upgrade-progress__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.md-upgrade-progress__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.25rem 2rem;
  border-radius: 18px;
  background: var(--app-surface);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.28);
  text-align: center;
  max-width: min(90vw, 360px);
  width: 100%;
}

body.theme-dark .md-upgrade-progress__dialog {
  background: rgba(21, 32, 48, 0.96);
  color: var(--app-on-surface);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}

.md-upgrade-progress__spinner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 6px solid rgba(32, 115, 191, 0.18);
  border-top-color: var(--app-primary);
  animation: md-upgrade-progress-spin 0.95s linear infinite;
}

.md-upgrade-progress__message {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--app-on-surface-strong);
}

body.theme-dark .md-upgrade-progress__message {
  color: var(--app-on-surface);
}

@keyframes md-upgrade-progress-spin {
  to {
    transform: rotate(360deg);
  }
}
.md-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--app-secondary-soft);
  color: var(--app-primary-dark);
  font-weight: 600;
}

.md-status-badge.success {
  background: var(--status-success-soft);
  color: var(--status-success-text);
}

.md-status-badge.warning {
  background: var(--status-warning-soft);
  color: var(--status-warning-text);
}

.md-status-badge.danger {
  background: var(--status-danger-soft);
  color: var(--status-danger-text);
}

.md-status-badge a {
  color: inherit;
  text-decoration: underline;
}

.md-status-badge a:focus,
.md-status-badge a:hover {
  text-decoration: none;
}

.md-button-block {
  width: 100%;
  justify-content: center;
}

.md-work-function-hint {
  margin-top: 0.25rem;
  color: var(--app-text-secondary, var(--md-muted));
}

.md-work-function-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .md-work-function-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

.md-work-function-card {
  background: color-mix(in srgb, var(--md-surface) 96%, transparent);
  border: 1px solid color-mix(in srgb, var(--app-text-secondary, #475569) 14%, transparent);
  border-radius: var(--md-radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

body.theme-dark .md-work-function-card {
  background: color-mix(in srgb, var(--md-surface) 90%, transparent);
  border-color: color-mix(in srgb, var(--app-text-secondary, #d1d5f9) 18%, transparent);
}

.md-work-function-heading h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--app-heading, var(--md-primary-dark));
}

.md-work-function-heading p {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--app-text-secondary, var(--md-muted));
}

.md-work-function-select {
  width: 100%;
  min-height: 8rem;
}

.md-work-function-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.md-work-function-actions .md-button {
  flex: 0 0 auto;
}

.md-work-function-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.md-work-function-search {
  position: relative;
  flex: 1 1 220px;
}

.md-work-function-search input[type="search"] {
  width: 100%;
  border: 1px solid var(--app-border, #d0d5dd);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font-size: 0.95rem;
  background: var(--app-surface, #ffffff);
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.md-work-function-search input[type="search"]:focus {
  outline: none;
  border-color: var(--md-primary, #2563eb);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-primary) 18%, transparent);
}

body.theme-dark .md-work-function-search input[type="search"] {
  background: color-mix(in srgb, var(--md-surface) 88%, transparent);
  border-color: color-mix(in srgb, var(--app-border, #94a3b8) 60%, transparent);
}

.md-work-function-options {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.md-work-function-option {
  border: 1px solid var(--app-border, #d0d5dd);
  border-radius: 10px;
  background: color-mix(in srgb, var(--md-surface) 97%, transparent);
  padding: 0.6rem 0.75rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.md-work-function-option[hidden] {
  display: none !important;
}

.md-work-function-option:hover {
  border-color: color-mix(in srgb, var(--md-primary, #2563eb) 35%, transparent);
  background: color-mix(in srgb, var(--md-primary, #2563eb) 6%, var(--md-surface) 94%);
}

body.theme-dark .md-work-function-option {
  background: color-mix(in srgb, var(--md-surface) 90%, transparent);
  border-color: color-mix(in srgb, var(--app-border, #94a3b8) 45%, transparent);
}

.md-work-function-option label {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.md-work-function-option input[type="checkbox"] {
  margin-top: 0.35rem;
}

.md-checkbox.md-checkbox-stacked {
  align-items: flex-start;
}

.md-questionnaire-copy {
  display: block;
  flex: 1 1 auto;
}

.md-questionnaire-title {
  display: block;
  font-weight: 600;
  color: var(--app-heading, var(--md-primary-dark));
}

.md-questionnaire-desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--app-text-secondary, var(--md-muted));
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.md-work-function-filter-empty {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--app-text-secondary, var(--md-muted));
}

.md-work-function-manage {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.md-work-function-add-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.md-work-function-add .md-field {
  flex: 1 1 240px;
  margin-bottom: 0;
}

.md-work-function-add .md-button {
  align-self: flex-start;
  white-space: nowrap;
}

.md-work-function-catalog {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
}

.md-work-function-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 12px;
  background: color-mix(in srgb, var(--md-surface) 98%, transparent);
}

body.theme-dark .md-work-function-row {
  border-color: rgba(255, 255, 255, 0.14);
  background: color-mix(in srgb, var(--md-surface) 90%, transparent);
}

.md-work-function-row-main {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.md-work-function-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--app-text-secondary, var(--md-muted));
}

body.theme-dark .md-work-function-row-meta {
  color: rgba(229, 231, 235, 0.85);
}

.md-work-function-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.md-work-function-row-actions .md-button {
  min-width: 0;
}

.md-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}



.md-help-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.md-help-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.md-help-dialog {
  background: var(--app-surface, #ffffff);
  color: var(--app-text-primary, #111827);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.35);
  max-width: 560px;
  width: calc(100% - 2.5rem);
  padding: 1.5rem 1.75rem;
  transform: translateY(16px);
  transition: transform 0.2s ease;
}

.md-help-overlay.is-visible .md-help-dialog {
  transform: translateY(0);
}

.md-help-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.md-help-dialog__header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.md-help-close {
  appearance: none;
  border: 1px solid transparent;
  background: var(--app-input-bg);
  color: var(--app-muted, #4b5563);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--app-button-height);
  padding: 0 1.1rem;
  border-radius: 999px;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.md-help-close:focus,
.md-help-close:hover {
  color: var(--app-primary-dark);
  background: var(--app-primary-soft);
  border-color: var(--app-primary-soft);
}

.md-help-dialog__body {
  max-height: 60vh;
  overflow-y: auto;
}

.md-help-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.md-help-list li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--app-muted, #475467);
}

.md-help-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--app-primary, #2563eb);
  font-size: 1.2rem;
  line-height: 1;
}
