/* -------------------------------------------------------------------------- */
/*  Core design tokens                                                        */
/* -------------------------------------------------------------------------- */

:root {
  --app-max-width: 1120px;
  --app-gutter: clamp(1rem, 4vw, 3.2rem);
  --app-radius: clamp(1.2rem, 3vw, 2.4rem);
  --app-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
  --app-shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.1);
  --color-bg: #eef2ff;
  --color-surface: rgba(255, 255, 255, 0.94);
  --color-surface-strong: #ffffff;
  --color-border: rgba(148, 163, 184, 0.28);
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-primary: #6366f1;
  --color-primary-strong: #4338ca;
  --color-secondary: #0ea5e9;
  --color-success: #22c55e;
  --transition-base: 0.18s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 62.5%;
  color-scheme: light;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.6rem;
  line-height: 1.6;
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.95) 0%, rgba(248, 250, 252, 0.98) 45%, #ffffff 100%);
  color: var(--color-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding: clamp(0.4rem, 2.4vw, 1.8rem);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* -------------------------------------------------------------------------- */
/*  Application shell                                                          */
/* -------------------------------------------------------------------------- */

.app-shell {
  width: min(var(--app-max-width), calc(100% - 2 * var(--app-gutter)));
  margin: clamp(0.8rem, 3vw, 3.2rem) auto;
  background: var(--color-surface);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  border: 1px solid var(--color-border);
  backdrop-filter: blur(14px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.app-shell__header {
  padding: clamp(1.6rem, 4vw, 2.8rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(129, 140, 248, 0.16) 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.app-shell__brand {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.app-shell__brand-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--color-primary-strong);
  letter-spacing: -0.02em;
}

.app-shell__brand-page {
  font-size: clamp(1.2rem, 2.8vw, 1.4rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-muted);
}

.app-shell__menu-button {
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(255, 255, 255, 0.85);
  color: var(--color-primary-strong);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.18);
  transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.app-shell__menu-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 46px rgba(99, 102, 241, 0.24);
}

.app-shell__menu-button:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.35);
  outline-offset: 3px;
}

.app-shell__menu-icon {
  position: relative;
  width: 1.8rem;
  height: 0.2rem;
  background: currentColor;
  border-radius: 999px;
  transition: transform var(--transition-base), background var(--transition-base), opacity var(--transition-base);
}

.app-shell__menu-icon::before,
.app-shell__menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 1.8rem;
  height: 0.2rem;
  border-radius: 999px;
  background: currentColor;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.app-shell__menu-icon::before {
  top: -0.55rem;
}

.app-shell__menu-icon::after {
  top: 0.55rem;
}

.app-shell__menu-button[aria-expanded="true"] .app-shell__menu-icon {
  background: transparent;
}

.app-shell__menu-button[aria-expanded="true"] .app-shell__menu-icon::before {
  transform: translateY(0.55rem) rotate(45deg);
}

.app-shell__menu-button[aria-expanded="true"] .app-shell__menu-icon::after {
  transform: translateY(-0.55rem) rotate(-45deg);
}

.app-shell__nav {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.12);
  position: relative;
  transition: all var(--transition-base);
}

.app-shell__nav-collapse-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  z-index: 10;
}

.app-shell__nav-collapse-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: scale(1.1);
}

.app-shell__nav-collapse-btn svg {
  transition: transform var(--transition-base);
}

.app-shell__nav[data-collapsed="false"] .collapse-icon-expand {
  display: none;
}

.app-shell__nav[data-collapsed="true"] .collapse-icon-collapse {
  display: none;
}

.app-shell__nav-list {
  list-style: none;
  margin: 0;
  padding: clamp(1rem, 3.5vw, 1.8rem) clamp(1.6rem, 4vw, 2.8rem);
  display: flex;
  gap: clamp(1.2rem, 3vw, 2rem);
  flex-wrap: wrap;
  transition: all var(--transition-base);
}

.app-shell__nav[data-collapsed="true"] .app-shell__nav-list {
  gap: clamp(0.8rem, 2vw, 1.2rem);
}

.app-shell__nav-category {
  flex: 0 0 auto;
  min-width: 0;
  transition: all var(--transition-base);
}

.app-shell__nav-category-title {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 0.6rem;
  padding: 0 0.4rem;
  cursor: pointer;
  transition: all var(--transition-base);
}

.app-shell__nav[data-collapsed="true"] .app-shell__nav-category-title {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.app-shell__nav-category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 1000px;
  overflow: hidden;
  transition: max-height var(--transition-base), opacity var(--transition-base), margin var(--transition-base);
  opacity: 1;
}

.app-shell__nav[data-collapsed="true"] .app-shell__nav-category-list {
  max-height: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

.app-shell__nav-item {
  flex: 0 0 auto;
}

.app-shell__nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
  color: var(--color-text-muted);
  background: rgba(99, 102, 241, 0.08);
  transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base), color var(--transition-base);
  min-width: 160px;
}

.app-shell__nav-link:hover {
  transform: translateX(2px);
  background: rgba(99, 102, 241, 0.16);
  color: var(--color-primary-strong);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.22);
}

.app-shell__nav-link.is-active {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(79, 70, 229, 0.35);
  font-weight: 600;
}

.app-shell__main {
  padding: clamp(2rem, 5vw, 3.4rem);
  background: rgba(248, 250, 252, 0.92);
  display: flex;
  gap: clamp(1.8rem, 4vw, 2.8rem);
}

.surface-panel {
  background: var(--color-surface-strong);
  border-radius: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: var(--app-shadow-soft);
  padding: clamp(1.6rem, 4vw, 2.4rem);
}

.surface-panel.deviceslayout {
  padding: clamp(0.8rem, 2vw, 1.2rem);
}

@media (max-width: 960px) {
  .app-shell {
    width: 100%;
    margin: clamp(0.6rem, 4vw, 1.8rem) auto;
    border-radius: clamp(1rem, 5vw, 1.8rem);
  }

  .app-shell__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-shell__menu-button {
    align-self: stretch;
    justify-content: center;
  }

  .app-shell__nav {
    max-height: 600px;
    transition: max-height var(--transition-base), opacity var(--transition-base);
  }

  .app-shell__nav[data-open="false"] {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
  }

  .app-shell__nav-list {
    flex-direction: column;
    gap: 1.4rem;
  }

  .app-shell__nav-category-list {
    gap: 0.4rem;
  }

  .app-shell__nav-link {
    justify-content: flex-start;
    width: 100%;
  }

  .app-shell__nav-link:hover {
    transform: translateX(4px);
  }
}

@media (min-width: 961px) {
  .app-shell__menu-button {
    display: none;
  }
}

@media (max-width: 960px) {
  .app-shell__nav-collapse-btn {
    display: none;
  }
}

/* Vocable assignment admin */
.va-page {
  max-width: 1200px;
  margin: 2rem auto;
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
  color: #0f172a;
}

.va-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.6rem;
  padding: 2rem;
  background: #ffffffdd;
  border-radius: 1.6rem;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
}

.va-header h1 {
  font-size: 2.4rem;
  margin-bottom: 0.6rem;
  color: #1f2937;
}

.va-subline {
  color: #6b7280;
  font-size: 1.4rem;
}

.va-button {
  border: none;
  border-radius: 1.2rem;
  padding: 1.1rem 1.6rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  background: #e2e8f0;
  color: #1f2937;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.va-button.primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
}

.va-button.danger {
  background: #ef4444;
  color: #fff;
}

.va-button.small {
  padding: 0.6rem 1.2rem;
  font-size: 1.2rem;
}

.va-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(99, 102, 241, 0.25);
}

.va-button:disabled,
.va-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.va-grid {
  display: grid;
  grid-template-columns: minmax(280px, 320px) 1fr;
  gap: 2.4rem;
}

.va-sidebar {
  position: sticky;
  top: 2rem;
  align-self: flex-start;
}

.va-form {
  background: #ffffffee;
  border-radius: 1.6rem;
  box-shadow: 0 18px 46px rgba(79, 70, 229, 0.18);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.va-field {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.va-field label {
  font-weight: 600;
  color: #1f2937;
}

.va-field input,
.va-field select,
.va-field textarea {
  padding: 0.9rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid #d1d5db;
  font-size: 1.4rem;
  color: #111827;
  background: #f9fafb;
}

.va-field textarea {
  resize: vertical;
  min-height: 6rem;
}

.va-field-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
}

.va-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.va-checkbox {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: rgba(226, 232, 240, 0.55);
  border-radius: 1rem;
  padding: 0.8rem 1rem;
}

.va-checkbox input[type="checkbox"] {
  transform: scale(1.15);
}

.va-form-actions {
  display: flex;
  gap: 1rem;
}

.va-status {
  min-height: 1.6rem;
  font-size: 1.3rem;
  color: #6b7280;
}

.va-table-section {
  background: #ffffffee;
  border-radius: 1.6rem;
  box-shadow: 0 18px 46px rgba(148, 163, 184, 0.18);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.va-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.2rem;
}

.va-filter label {
  display: block;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 0.4rem;
}

.va-filter select {
  padding: 0.6rem 1rem;
  border-radius: 0.8rem;
  border: 1px solid #d1d5db;
  font-size: 1.4rem;
}

.va-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.35rem;
}

.va-table thead {
  background: #eff2ff;
  color: #312e81;
}

.va-table th,
.va-table td {
  padding: 1.2rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(209, 213, 219, 0.6);
}

.va-table tbody tr:nth-child(even) {
  background: rgba(226, 232, 240, 0.45);
}

.va-table tbody tr:hover {
  background: rgba(226, 232, 240, 0.45);
}

.va-actions {
  display: flex;
  gap: 0.8rem;
}

.va-empty {
  text-align: center;
  color: #6b7280;
  padding: 2rem 1rem;
}

.va-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  font-size: 1.2rem;
  font-weight: 600;
  text-transform: capitalize;
}

.va-status-pill.status-pending {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
}

.va-status-pill.status-completed {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

.va-status-pill.status-failed {
  background: rgba(239, 68, 68, 0.18);
  color: #b91c1c;
}

.va-status-pill.status-expired {
  background: rgba(251, 191, 36, 0.25);
  color: #b45309;
}

@media (max-width: 960px) {
  .va-grid {
    grid-template-columns: 1fr;
  }

  .va-sidebar {
    position: static;
  }

  .va-form-actions {
    flex-wrap: wrap;
  }

  .va-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.login-form,
.register-form {
  width: min(100%, 420px);
  margin: clamp(1.6rem, 8vw, 4rem) auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: min(60vh, 520px);
  font-size: 1.6rem;
}

.login-form form,
.register-form form {
  width: 100%;
  background: var(--color-surface-strong);
  border-radius: clamp(1.2rem, 3vw, 2.2rem);
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: clamp(2rem, 5vw, 3.2rem);
  box-shadow: var(--app-shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.form-control {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.form-title {
  font-size: clamp(2.2rem, 5vw, 2.8rem);
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.form-subtitle {
  font-size: 1.4rem;
  color: var(--color-text-muted);
  margin: 0 0 0.6rem;
}

.page-title {
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 1.2rem;
  letter-spacing: -0.015em;
}

.page-subtitle {
  font-size: 1.5rem;
  color: var(--color-text-muted);
  margin: 0;
  max-width: 65ch;
}

.form-control label {
  font-weight: 600;
  color: var(--color-text);
}

.form-control input {
  padding: 1.1rem 1.4rem;
  width: 100%;
  font-size: 1.5rem;
  line-height: 1.5;
  border-radius: 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(248, 250, 252, 0.96);
  transition: border var(--transition-base), box-shadow var(--transition-base);
}

.form-control input:focus-visible {
  outline: none;
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
  border: none;
  padding: 1rem 1.8rem;
  border-radius: 1.2rem;
  color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(99, 102, 241, 0.26);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 44px rgba(99, 102, 241, 0.32);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.26);
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  color: var(--color-primary-strong);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.deviceslayout {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.8rem, 2vw, 1.2rem);
  align-items: stretch;
}

.device_item {
  flex: 0 0 auto;
  width: clamp(140px, 15%, 180px);
}

.device_item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.6rem, 1.5vw, 0.8rem);
  padding: clamp(0.8rem, 2vw, 1.2rem);
  background: var(--color-surface-strong);
  border-radius: clamp(0.8rem, 2vw, 1.2rem);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: var(--app-shadow-soft);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.device_item:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 42px rgba(15, 23, 42, 0.16);
}

.device_info {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.smartphone {
  position: relative;
  width: clamp(35px, 8vw, 50px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.smartphoneItem {
  position: relative;
  left: 0;
  top: 0;
  width: 100%;
  cursor: pointer;
  transition: transform var(--transition-base);
}

.device_item:hover .smartphoneItem {
  transform: translateY(-3px) rotate(-1deg);
}

.smartphoneDot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  position: absolute;
  right: clamp(4px, 1.2vw, 10px);
  top: clamp(10px, 2.5vw, 14px);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.9);
}

.online {
  background-color: var(--color-success);
}

.offline {
  background-color: #ef4444;
}

.smart_name {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}

.smart_name a {
  color: var(--color-secondary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  margin-left: 0.4rem;
}

.smart_ip,
.smart_secondssinceupdate {
  font-size: 1.35rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

#popup {
  position: fixed;
  display: inline-flex;
  flex-direction: column;
  cursor: default;
  visibility: hidden;
  background: var(--color-surface-strong);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: clamp(1.2rem, 4vw, 2.4rem);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(800px, calc(100vw - 4rem));
  height: min(600px, calc(100vh - 4rem));
  max-width: calc(100vw - 2.4rem);
  max-height: calc(100vh - 2.4rem);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  z-index: 1010;
}

#popup p {
  border: none;
  margin: 0;
}

#popup.show {
  visibility: visible;
  -webkit-animation: fadeIn 0.35s ease;
  animation: fadeIn 0.35s ease;
}

#popup_header {
  flex: 0 0 auto;
  width: 100%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(37, 99, 235, 0.22) 100%);
  color: var(--color-text);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#popup_body {
  flex: 1 1 auto;
  padding: clamp(1.2rem, 3vw, 2rem);
  overflow: auto;
  background: rgba(248, 250, 252, 0.9);
}

#expand_diagram {
  background: rgba(99, 102, 241, 0.12);
  border-radius: 0.8rem;
  padding: 0.8rem 1.2rem;
  border: none;
  font-weight: 600;
  color: var(--color-primary-strong);
  transition: background var(--transition-base);
}

#expand_diagram[open] {
  background: rgba(34, 197, 94, 0.18);
}

#popup_diagram {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-out;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

#popup_diagram[open] {
  max-height: clamp(320px, 60vh, 460px);
}

#popup_buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

#popup_close {
  height: 5%;
  min-height: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
}


fieldset {
  border-radius: 10px;
}

fieldset input {
  width: 100%;
}

fieldset input[type='checkbox'] {
  width: auto;
}

.Device {
  display: block;
  width: min(100%, 520px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.6rem;
  background: var(--color-surface-strong);
  box-shadow: var(--app-shadow-soft);
  padding: clamp(1.4rem, 4vw, 2.4rem);
  margin: clamp(1rem, 4vw, 2.4rem) auto;
}

.Hidden {
  visibility: hidden;
  height: 0;
}

.DetailsContainer,
.SettingsContainer {
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 1.2rem;
  margin: 0 0 1.4rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.Titel {
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.9) 0%, rgba(148, 163, 184, 0.65) 100%);
  color: var(--color-text);
  padding: 0.9rem 1.4rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.Name {
  border-radius: 1rem;
  background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
  color: #ffffff;
  padding: 0.9rem 1.4rem;
  margin-bottom: 0.8rem;
  font-weight: 600;
}

/* Dialog/Modal Popup Styles */
dialog.popup {
  padding: 0;
  margin: auto;
  border-radius: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: var(--color-surface-strong);
  box-shadow: 0 28px 64px rgba(15, 23, 42, 0.28);
  max-height: calc(100vh - 3.6rem);
  width: min(520px, calc(100vw - 3.6rem));
  overflow: visible;
  display: revert !important;
}

dialog.popup[open] {
  display: block !important;
}

dialog.popup::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

dialog.popup > div {
  max-height: calc(100vh - 3.6rem);
  overflow-y: auto;
}

/* Non-dialog popup fallback */
div.popup {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: clamp(1.4rem, 4vw, 2.4rem);
  border-radius: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: var(--color-surface-strong);
  box-shadow: 0 28px 64px rgba(15, 23, 42, 0.28);
  max-height: calc(100vh - 3.6rem);
  width: min(520px, calc(100vw - 3.6rem));
  overflow-y: auto;
  display: none;
  z-index: 1050;
}

.popup.show {
  display: block;
}

@media (max-width: 768px) {
  .popup {
    width: calc(100vw - 2.8rem);
    max-height: calc(100vh - 2.8rem);
  }
}

.battery-item {
  height: 60px;
}

.battery-container {
  width: 200px;
  height: 50px;
  border: 2px solid black;
  border-radius: 5px;
  position: relative;
  background-color: #ccc;
  margin: 0 auto;
}

.battery-level {
  height: 100%;
  background-color: green;
  border-radius: 5px 0 0 5px;
  width: 0%;
  transition: width 0.5s ease;
}

.battery-tip {
  width: 10px;
  height: 25px;
  background-color: black;
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  border-radius: 2px;
}

.battery-text {
  text-align: center;
  margin-top: 10px;
  position: relative;
  top: -45px;
}

.volume-control {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: conic-gradient(
      #00bfff 0% 0%,
      #00bfff var(--volume-percent, 0%),
      #ccc var(--volume-percent, 0%) 100%
  );
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
  cursor: pointer;
}

.volume-knob {
  width: 100px;
  height: 100px;
  background-color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.volume-text {
  font-size: 1.5em;
  font-weight: bold;
}

.volume-label {
  margin-top: 20px;
  text-align: center;
}

.vols {
  display: flex;
  gap: 20px;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
}

.tab {
  display: flex;
  overflow: auto;
  border: 1px solid #ccc;
  background-color: #f1f1f1;
  height: 50px;
}

.tab::-webkit-scrollbar {
  width: 0 !important;
  display: none;
}

/* Style the buttons that are used to open the tab content */
.tab button {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 16px;
  transition: 0.3s;
}

/* Change background color of buttons on hover */
.tab button:hover {
  background-color: #ddd;
}

/* Create an active/current tablink class */
.tab button.active {
  background-color: #ccc;
}

/* Style the tab content */
.tabcontent {
  display: none;
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-top: none;
}

.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0px 10% 0px 5px;
}

ul[role="tree"] {
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}

ul[role="tree"] li {
  margin: 0;
  padding: 0;
  list-style: none;
}

[role="treeitem"][aria-expanded="false"] + [role="group"] {
  display: none;
}

[role="treeitem"][aria-expanded="true"] + [role="group"] {
  display: block;
}

[role="treeitem"].doc::before {
  background-image: url("../icons/file.svg");
  display: inline-block;
  content: "";
  width: 8px;
  height: 16px;
  display: inline-block;
  padding-right: 2px;
  padding-left: 5px;
  vertical-align: middle;
  background-size: cover;
}

[role="treeitem"][aria-expanded="false"] > ul {
  display: none;
}

[role="treeitem"][aria-expanded="true"] > ul {
  display: block;
}

[role="treeitem"][aria-expanded="false"] > span::before {
  background-image: url("../icons/folder-48.svg");
  display: inline-block;
  content: "";
  width: 1em;
  height: 1em;
  padding-right: 3px;
  vertical-align: middle;
  background-size: cover;
}

[role="treeitem"][aria-expanded="true"] > span::before {
  background-image: url("../icons/opened-folder-48.svg");
  display: inline-block;
  content: "";
  width: 1em;
  height: 1em;
  padding-right: 3px;
  vertical-align: middle;
  background-size: cover;
}

[role="treeitem"],
[role="treeitem"] span {
  /*width: 9em;*/
  margin: 0;
  padding: 0.125em;
  display: block;
}

/* disable default keyboard focus styling for treeitems
   Keyboard focus is styled with the following CSS */
[role="treeitem"]:focus {
  outline: 0;
}

[role="treeitem"][aria-selected="true"] {
  padding-left: 4px;
  border-left: 5px solid #005a9c;
}

[role="treeitem"].focus,
[role="treeitem"] span.focus {
  border-color: black;
  background-color: #eee;
}

[role="treeitem"].hover,
[role="treeitem"] span:hover {
  padding-left: 4px;
  background-color: #ddd;
  border-left: 5px solid #333;
}

.play_btn {
  width: 32px;
  height: 32px;
}

.FileContainer {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.FileList {
  display: flex;
  flex-direction: column;

}

.audioicon {
  position: absolute;
  width: 32px;
  height: 32px;
  top: 30px;
  left: 55px;
}

.displayicon {
  position: absolute;
  width: 92px;
  height: 112px;
  top: 27px;
  left: 4px;
  background-color: black;
  opacity: 0.5;
}

.FileButton {
  display: flex;
  border: 1px solid black;
  width: 100%;
  flex-wrap: wrap;
  justify-content: space-between;
}

.FileList {
  padding: 10 2 5 2;
}

.FileList div:nth-child(odd) {
  background-color: #4C8BF522;
}

.listitem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #ccc;
}

.listbuttons {
  display: flex;
  gap: 10px;
}

.message_Container {
  position: fixed;
  right: clamp(1rem, 4vw, 2.4rem);
  top: clamp(1rem, 4vw, 2.4rem);
  visibility: visible;
  min-width: min(340px, 90vw);
  border-radius: clamp(1.2rem, 3vw, 2rem);
  padding: 1.4rem 1.8rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: var(--color-surface-strong);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
  display: flex;
  gap: 1.2rem;
  align-items: center;
  color: var(--color-text);
  z-index: 1100;
}

.message_Container .overlay_text {
  font-size: 1.4rem;
  line-height: 1.4;
  max-width: 100%;
}

.error_Container {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.92) 0%, rgba(239, 68, 68, 0.98) 100%);
  color: #fff;
  border-color: rgba(248, 113, 113, 0.65);
}

.info_Container {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.92) 0%, rgba(37, 99, 235, 0.98) 100%);
  color: #fff;
  border-color: rgba(37, 99, 235, 0.6);
}

.success_Container {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.92) 0%, rgba(22, 163, 74, 0.98) 100%);
  color: #fff;
  border-color: rgba(34, 197, 94, 0.6);
  min-width: auto !important;
  min-height: auto !important;
  justify-content: center;
}

.overlay {
  visibility: hidden;
  position: absolute;
  display: flex;
  background-color: #FF0000AA;
  left: 1vw;
  top: 1vh;
  height: 2em;
  align-items: center;
  border-radius: 15px;
  padding-left: 4px;
  transition: width 2s;
}

.overlay_short {
  width: 24px;
  height: 24px;
}

.overlay_long {
  width: 10em;
}

.overlay_led {
  width: 16px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  margin-right: 10px;
  margin-left: 0px;
  background-color: green;
}

.overlay_text {
  overflow: hidden;
  max-width: 8em;
}

/* �berlagerungsstil */
.fileoverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Dialog-Stil */
.modal {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  min-width: 300px;
}

.modal h2 {
  margin-top: 0;
}

.modal button {
  margin-top: 10px;
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.modal button:hover {
  background-color: #0056b3;
}

/* Versteckte �berlagerung */
.fileoverlay.hidden {
  display: none;
}

/* --- Benutzerverwaltung UI ------------------------------------------------ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.user-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  color: #1f2937;
}

.user-admin__panel {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.25);
  flex: 1 1 320px;
  backdrop-filter: blur(3px);
}

.user-admin__panel--list {
  flex: 2 1 520px;
}

.user-admin__panel--form {
  flex: 1 1 320px;
  max-width: 420px;
}

.user-admin__panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.user-admin__panel-header h2 {
  font-size: 2.4rem;
  color: #111827;
  margin-bottom: 4px;
}

.user-admin__subtitle {
  color: #4b5563;
  font-size: 1.4rem;
}

.user-admin__action {
  font-size: 1.6rem;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.user-admin__action:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.35);
}

.user-admin__table-wrapper {
  overflow-x: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06);
}

.user-table thead {
  background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
  color: #f9fafb;
}

.user-table th,
.user-table td {
  padding: 14px 16px;
  text-align: left;
  font-size: 1.5rem;
}

.user-table tbody tr {
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  transition: background 0.15s ease;
}

.user-table tbody tr:hover {
  background: rgba(243, 244, 246, 0.95);
}

.user-table__row--active {
  box-shadow: inset 4px 0 0 #2563eb;
}

.user-table__empty td {
  text-align: center;
  color: #6b7280;
  font-style: italic;
}

.user-table__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  font-weight: 600;
  font-size: 1.3rem;
}

.user-table__status--warning {
  background: rgba(249, 115, 22, 0.2);
  color: #c2410c;
}

.user-table__status--info {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

.user-table__actions {
  white-space: nowrap;
  text-align: right;
}

.btn.primary {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-color: transparent;
}

.btn.secondary {
  background: rgba(17, 24, 39, 0.85);
  border-color: transparent;
}

.btn.secondary:hover {
  background: rgba(17, 24, 39, 1);
}

.btn.table-btn {
  font-size: 1.4rem;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(30, 64, 175, 0.12);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.3);
  margin-left: 8px;
}

.btn.table-btn:hover {
  background: rgba(30, 64, 175, 0.2);
}

.btn.table-btn.danger {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.3);
  color: #b91c1c;
}

.btn.table-btn.danger:hover {
  background: rgba(220, 38, 38, 0.22);
}

.user-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.user-form__row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-form__row label {
  font-weight: 600;
  color: #111827;
}

.user-form__row input,
.user-form__row select {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(17, 24, 39, 0.3);
  font-size: 1.5rem;
  color: #111827;
  background: rgba(249, 250, 251, 0.95);
}

.user-form__row input:focus,
.user-form__row select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.user-form__help {
  font-size: 1.2rem;
  color: #6b7280;
}

.user-form__buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.user-form__message {
  min-height: 28px;
  margin-top: 4px;
  font-size: 1.4rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
}

.user-form__message[data-state='success'] {
  background: rgba(34, 197, 94, 0.16);
  color: #15803d;
}

.user-form__message[data-state='warning'] {
  background: rgba(249, 115, 22, 0.2);
  color: #c2410c;
}

.user-form__message[data-state='error'] {
  background: rgba(239, 68, 68, 0.18);
  color: #b91c1c;
}

.user-form__message[data-state='info'] {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

@media (max-width: 960px) {
  .user-admin {
    flex-direction: column;
  }

  .user-admin__panel {
    width: 100%;
  }

  .user-table__actions {
    text-align: left;
  }
}

/* -------------------------------------------------------------------------- */
/*  Stats Charts Styles                                                       */
/* -------------------------------------------------------------------------- */

.stats-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--color-surface);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.stats-controls label {
  font-weight: 600;
  color: var(--color-text);
  font-size: 1.4rem;
  white-space: nowrap;
}

.stats-controls select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-strong);
  color: var(--color-text);
  font-size: 1.4rem;
  cursor: pointer;
  transition: var(--transition-base);
  min-width: 160px;
}

.stats-controls select:hover {
  border-color: var(--color-primary);
}

.stats-controls select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.stats-controls button {
  padding: 8px 16px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  white-space: nowrap;
}

.stats-controls button:hover {
  background: var(--color-primary-strong);
  transform: translateY(-1px);
}

.stats-controls button:active {
  transform: translateY(0);
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-item {
  background: var(--color-surface);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  box-shadow: var(--app-shadow-soft);
}

.stat-label {
  display: block;
  font-size: 1.3rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-value {
  display: block;
  font-size: 2.0rem;
  font-weight: 700;
  color: var(--color-primary);
}

.chart-container {
  background: var(--color-surface);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  margin-bottom: 24px;
  box-shadow: var(--app-shadow-soft);
  overflow: hidden;
}

.chart-container h4 {
  margin: 0 0 16px 0;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-text);
}

.chart-container svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.stats-loading,
.stats-error {
  padding: 40px;
  text-align: center;
  background: var(--color-surface);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  margin: 20px 0;
}

.stats-loading p {
  color: var(--color-text-muted);
  font-size: 1.6rem;
  margin: 0;
}

.stats-error p {
  color: #ef4444;
  font-size: 1.6rem;
  margin: 0;
  font-weight: 600;
}

/* D3 Chart Styling */
#battery-level-chart text,
#battery-temp-voltage-chart text,
#display-activity-chart text,
#display-sessions-chart text {
  font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
  font-size: 11px;
  fill: var(--color-text);
}

#battery-level-chart .domain,
#battery-temp-voltage-chart .domain,
#display-activity-chart .domain,
#display-sessions-chart .domain {
  stroke: var(--color-border);
}

#battery-level-chart .tick line,
#battery-temp-voltage-chart .tick line,
#display-activity-chart .tick line,
#display-sessions-chart .tick line {
  stroke: var(--color-border);
}

/* View Toggle Buttons */
.view-toggle {
  padding: 8px 16px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
}

.view-toggle:hover {
  background: var(--color-surface-strong);
  border-color: var(--color-primary);
}

.view-toggle.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Data Table Styles */
.table-container {
  background: var(--color-surface);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  overflow-x: auto;
  box-shadow: var(--app-shadow-soft);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.4rem;
}

.data-table thead {
  background: var(--color-surface-strong);
  border-bottom: 2px solid var(--color-border);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: var(--transition-base);
}

.data-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.05);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table td {
  padding: 10px 16px;
  color: var(--color-text);
}

.data-table .status-charging {
  color: var(--color-success);
  font-weight: 600;
}

.data-table .status-discharging {
  color: var(--color-text-muted);
}

.data-table .status-on {
  color: var(--color-success);
  font-weight: 600;
}

.data-table .status-off {
  color: var(--color-text-muted);
}

/* Refresh Button */
.refresh-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
  padding: 0 8px;
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.btn-refresh:hover {
  background: var(--color-primary-strong);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-refresh:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
}

.btn-refresh svg {
  width: 20px;
  height: 20px;
  transition: transform 0.6s ease;
}

.btn-refresh:hover svg {
  transform: rotate(180deg);
}

