/* Tema-farger: lastes fra egne filer (én for mørk, én for lys). Se docs/THEME_COLORS.md. */
@import url('css/theme-dark.css');
@import url('css/theme-light.css');

/* Lys modus: primærknapper og aktiv topbar-knapp bruker accent fra tema */
html.theme-light .btn-primary,
html.theme-light .btn.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
html.theme-light .btn-primary:hover,
html.theme-light .btn.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}
/* Primærknapp (Lagre osv.) bruker alltid standard knappestil (var(--btn)), ikke accent */
html.theme-light .topbar-btn.active {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

* { box-sizing: border-box; }

/* Dark mode scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--bg);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--bg);
}

*::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--btnHover);
}

html {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  max-width: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}

/* Global responsive: entire application (portal, admin, login, etc.) */
body.admin-page {
  overflow-x: hidden;
  max-width: 100%;
}

/* All main content wrappers: no horizontal overflow */
#content,
#main,
.main-content,
.container,
.content-wrapper,
[role="main"] {
  max-width: 100%;
  box-sizing: border-box;
}

/* Tables: scroll horizontally inside wrapper instead of page (use .table-responsive on parent) */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

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

/* Modals and dialogs: fit viewport on small screens */
.modal-content,
.admin-modal-content,
.customer-switch-modal-content {
  max-width: min(100vw - 32px, 560px);
  box-sizing: border-box;
}

.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  flex: 1;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  transition: opacity 0.3s ease;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
}

.card.fade-out {
  opacity: 0;
}

h1 { margin: 0 0 6px 0; font-size: 22px; }

.customer-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.customer-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 8px;
  display: block;
}

.customer-logo[src=""],
.customer-logo:not([src]) {
  display: none;
}

/* Theme-aware customer logos: show light or dark version by theme */
.logo-dark {
  display: none !important;
}
html.theme-dark .logo-light {
  display: none !important;
}
html.theme-dark .logo-dark {
  display: block !important;
}

.customer-header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.customer-title {
  margin: 0;
  font-size: 22px;
}
h2 { margin: 0 0 10px 0; font-size: 16px; }
.admin-section-title { margin-top: 24px; margin-bottom: 10px; font-size: 16px; }
.admin-section-title:first-of-type { margin-top: 0; }
.muted { color: var(--muted); }

/* Auth card (login / simple register) scoped form styles */
.page .card label { display:block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.page .card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
}
.page .card button {
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--text);
  cursor: pointer;
}
.page .card button:hover { background: var(--btnHover); }

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--danger);
  color: var(--text);
  background: rgba(var(--danger-rgb), 0.08);
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.row--centered {
  justify-content: center;
}

.auth-link {
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
}

.auth-link:hover {
  color: var(--text);
}

.signin-btn-wrap {
  position: relative;
  width: 100%;
  margin-top: 14px;
  border-radius: 10px;
  overflow: visible;
}

/* Subtle pulsing border around the button (no spinner fill) */
.signin-btn-wrap.ready::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  border: 1px solid rgba(34, 197, 94, 0.7);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35);
  background: transparent;
  animation: signin-border-pulse 1.8s ease-out infinite;
  z-index: 0;
}

@keyframes signin-border-pulse {
  0% {
    opacity: 0;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35);
  }
  40% {
    opacity: 1;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0);
  }
  100% {
    opacity: 0;
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
}

.signin-btn-wrap.ready button {
  position: relative;
  z-index: 1;
  margin-top: 0;
  border-radius: 8px;
  background: var(--btn);
  border: 1px solid var(--line);
}

.signin-btn-wrap button.loading {
  position: relative;
  color: transparent;
}

.signin-btn-wrap button.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid var(--text);
  border-top-color: transparent;
  border-radius: 50%;
  animation: signin-spin 0.8s linear infinite;
}

@keyframes signin-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.login-page-container {
  width: 100%;
  max-width: min(100vw - 32px, 420px);
  margin: 2rem auto 0;
  padding: 0 16px;
  box-sizing: border-box;
}
.login-back-wrap {
  margin: 0 0 1rem 0;
}
.login-back-wrap--above {
  margin-top: 0;
  margin-bottom: 0.75rem;
  text-align: left;
}
.login-back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
}
.login-back-link:hover {
  color: var(--text);
  text-decoration: none;
}

.login-page-footer {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  gap: 16px;
}

.login-footer-left {
  flex-shrink: 0;
}

.login-footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.login-footer-version {
  flex-shrink: 0;
}

.login-lang-dropdown {
  position: relative;
}

.login-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.login-lang-trigger:hover {
  border-color: var(--text);
  color: var(--text);
}

.login-lang-chevron {
  flex-shrink: 0;
  opacity: 0.7;
}

.login-lang-menu {
  position: absolute;
  right: 0;
  bottom: 100%;
  margin-bottom: 6px;
  min-width: 140px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  padding: 6px;
  z-index: 50;
  display: none;
}

.login-lang-menu[aria-hidden="false"] {
  display: block;
}

.login-lang-option-form {
  margin: 0;
  display: block;
}

.login-lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  margin: 0;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}

.login-lang-option:hover {
  background: var(--hover);
}

.login-lang-option--current {
  color: var(--muted);
  cursor: default;
}

.login-lang-option .user-menu-lang-flag svg,
.login-lang-trigger .user-menu-lang-flag svg {
  width: 18px;
  height: 14px;
  border-radius: 2px;
}

.login-lang-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.login-lang-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-lang-form {
  display: inline;
  margin: 0;
}

.login-lang-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  color: var(--link);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}

.login-lang-link:hover {
  text-decoration: underline;
}

.login-lang-link .user-menu-lang-flag svg,
.login-lang-current .user-menu-lang-flag svg {
  width: 18px;
  height: 14px;
  border-radius: 2px;
}

.login-lang {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.login-lang .user-menu-lang-flag svg {
  width: 18px;
  height: 14px;
  border-radius: 2px;
}

.card button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card button[type="submit"].ready {
  cursor: pointer;
}

.card .signin-btn-wrap.ready button:hover {
  background: var(--btn);
  filter: brightness(1.08);
}

a { color: var(--text); }
a.link { text-decoration: none; color: var(--muted); }
a.link:hover { color: var(--text); }

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  color: var(--text);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  min-height: 56px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 56px;
  flex-shrink: 0;
}

/* Brand link: goes to dashboard/admin/main home – no hover highlight */
a.brand-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
}
a.brand-link:hover,
a.brand-link:focus {
  background: transparent !important;
  color: inherit !important;
  text-decoration: none !important;
  opacity: 1;
}

.brand {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  color: var(--text);
}

.brand-tenant-sep {
  opacity: 0.6;
  margin: 0 6px;
  font-weight: 400;
}

.brand-tenant-name {
  font-weight: 500;
  color: var(--muted);
}

/* Tenant: support/impersonation active – visible only to Owner and Administrator */
.support-session-banner {
  background: var(--warning-bg, #fef3c7);
  color: var(--warning-text, #92400e);
  padding: 8px 16px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 1px solid var(--warning-border, #f59e0b);
}

.support-session-banner-icon {
  flex-shrink: 0;
}
.support-session-banner-icon .ti {
  font-size: 1.15rem;
}

.support-session-banner-text {
  font-weight: 500;
}

.support-session-banner-exit {
  margin-left: auto;
  padding: 4px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
  border: 1px solid currentColor;
  border-radius: 6px;
  white-space: nowrap;
}
.support-session-banner-exit:hover {
  opacity: 0.9;
}

.trial-banner {
  background: rgba(var(--success-rgb, 34, 197, 94), 0.12);
  color: var(--success, rgb(var(--success-rgb, 34, 197, 94)));
  border-bottom-color: rgba(var(--success-rgb, 34, 197, 94), 0.3);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Global search in topbar: icon opens search field (after menu buttons) */
.topbar-search-wrap {
  position: relative;
  margin-left: 8px;
  display: flex;
  align-items: center;
}

.topbar-search-trigger {
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-search-inner {
  display: none;
  position: relative;
  align-items: center;
  gap: 6px;
  min-width: 260px;
  max-width: 320px;
}

.topbar-search-wrap.is-open .topbar-search-inner {
  display: flex;
}

.topbar-search-wrap.is-open .topbar-search-trigger {
  display: none !important;
}

.topbar-search-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 0.9rem;
}

.topbar-search-input::placeholder {
  color: var(--muted);
}

.topbar-search-input:focus {
  outline: none;
  border-color: var(--muted);
}

.topbar-search-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-search-close:hover {
  background: var(--btn);
  color: var(--text);
}

.topbar-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow-strong);
  z-index: 1000;
  padding: 8px;
}

.search-result-group {
  margin-bottom: 8px;
}

.search-result-group:last-child {
  margin-bottom: 0;
}

.search-result-group strong {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
}

.search-result-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-result-group li {
  padding: 0;
}

.search-result-group a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.search-result-group a:hover {
  background: var(--btn);
}

.search-result-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Single theme toggle (sun/moon) left of avatar */
.topbar-theme-toggle {
  display: inline-flex;
  align-items: center;
}

.topbar-theme-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  line-height: 0;
}

.topbar-theme-btn:hover {
  color: var(--text);
  background: var(--btn);
  border-color: var(--line);
}

.topbar-theme-btn .theme-icon-system,
.topbar-theme-btn .theme-icon-sun,
.topbar-theme-btn .theme-icon-moon {
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.topbar-theme-btn .theme-icon-system svg,
.topbar-theme-btn .theme-icon-sun svg,
.topbar-theme-btn .theme-icon-moon svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

body[data-theme="system"] .topbar-theme-btn .theme-icon-system {
  display: flex;
}

body[data-theme="light"] .topbar-theme-btn .theme-icon-sun {
  display: flex;
}

body[data-theme="dark"] .topbar-theme-btn .theme-icon-moon {
  display: flex;
}

/* Theme in user menu: icon reflects current mode */
.user-menu-item--theme .theme-icon-system,
.user-menu-item--theme .theme-icon-sun,
.user-menu-item--theme .theme-icon-moon {
  display: none;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.user-menu-item--theme .theme-icon-system svg,
.user-menu-item--theme .theme-icon-sun svg,
.user-menu-item--theme .theme-icon-moon svg {
  width: 16px;
  height: 16px;
  display: block;
}

body[data-theme="system"] .user-menu-item--theme .theme-icon-system {
  display: flex;
}

body[data-theme="light"] .user-menu-item--theme .theme-icon-sun {
  display: flex;
}

body[data-theme="dark"] .user-menu-item--theme .theme-icon-moon {
  display: flex;
}

.topbar-right .topbar-customer-name {
  display: flex;
  align-items: center;
  min-height: 36px;
  line-height: 1;
}

.topbar-right .customer-picker-wrapper,
/* Mobile: right group (avatar + burger) – hidden on desktop */
.topbar-mobile-right {
  display: none;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.topbar-burger:hover {
  background: var(--btnHover);
  border-color: var(--line);
}

.topbar-burger-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

body.mobile-nav-open .topbar-burger .topbar-burger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.mobile-nav-open .topbar-burger .topbar-burger-bar:nth-child(2) {
  opacity: 0;
}
body.mobile-nav-open .topbar-burger .topbar-burger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav overlay and drawer */
.topbar-mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.topbar-mobile-menu.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.topbar-mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.topbar-mobile-menu.is-open .topbar-mobile-menu-backdrop {
  opacity: 1;
}

.topbar-mobile-menu-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(320px, 85vw);
  max-width: 100%;
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 24px var(--shadow-strong);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
}

.topbar-mobile-menu.is-open .topbar-mobile-menu-drawer {
  transform: translateX(0);
}

body.mobile-nav-open {
  overflow: hidden;
}

.topbar-mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.topbar-mobile-menu-header-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar-mobile-menu-header .brand {
  font-size: 16px;
}

.topbar-mobile-menu-header-customer {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.topbar-mobile-menu-close {
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}

.topbar-mobile-menu-close:hover {
  background: var(--btn);
}

.topbar-mobile-menu-nav {
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  gap: 4px;
}

.topbar-mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  transition: background 0.2s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.topbar-mobile-menu-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--muted);
}

.topbar-mobile-menu-link.active .topbar-mobile-menu-link-icon {
  color: var(--accent);
}

.topbar-mobile-menu-link:hover:not(.topbar-mobile-menu-link--disabled) {
  background: var(--btn);
}

.topbar-mobile-menu-link.active {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  font-weight: 600;
}

.topbar-mobile-menu-link--disabled {
  color: var(--muted);
  cursor: default;
}

.topbar-mobile-menu-link--btn {
  font: inherit;
}

.topbar-mobile-menu-search {
  padding: 8px 20px;
  border-top: 1px solid var(--line);
}

.topbar-mobile-menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}

.topbar-mobile-menu-btn:hover {
  background: var(--btnHover);
}

.topbar-mobile-menu-customer {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}

.topbar-mobile-menu-customer-name {
  font-size: 13px;
  color: var(--muted);
}

.topbar-mobile-menu-footer {
  margin-top: auto;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar-right .user-avatar-wrapper {
  display: inline-flex;
  align-items: center;
}

.topbar-right .user-avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0;
}

.topbar-btn {
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--btn);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--line);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  box-sizing: border-box;
}

.topbar-btn:hover {
  background: var(--btnHover);
  border-color: var(--btnHover);
  color: var(--text);
}

.topbar-btn.active {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--focus-ring);
}

.topbar-btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: auto;
}

.topbar-btn--with-tooltip,
.has-tooltip {
  position: relative;
}

.topbar-btn--with-tooltip {
  display: inline-flex;
}

.has-tooltip {
  display: inline-flex;
}

.topbar-btn svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-right: 6px;
}

/* Global tooltip (Projects, Service desk, theme button, etc.) */
.topbar-btn--with-tooltip .tooltip,
.has-tooltip .tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 12px var(--shadow);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.topbar-btn--with-tooltip:hover .tooltip,
.topbar-btn--with-tooltip:focus .tooltip,
.has-tooltip:hover .tooltip,
.has-tooltip:focus-within .tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.topbar-btn--with-tooltip .tooltip::after,
.has-tooltip .tooltip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--card);
}

.topbar-btn--with-tooltip .tooltip::before,
.has-tooltip .tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-bottom-color: var(--line);
  margin-bottom: -1px;
}

/* Customer picker (dropdown like avatar) */
.customer-picker-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.customer-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--btn);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 180px;
  box-sizing: border-box;
  line-height: 1;
}

.customer-picker-btn:hover {
  background: var(--btnHover);
  border-color: var(--btnHover);
}

.customer-picker-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-picker-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s;
}

.customer-picker-wrapper:has(.customer-menu.open) .customer-picker-chevron {
  transform: rotate(180deg);
}

.customer-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow-strong);
  min-width: 200px;
  max-width: 280px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.customer-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.customer-menu-search {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.customer-menu-search-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
}

.customer-menu-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.customer-menu-list {
  overflow-y: auto;
  padding: 0;
}

.customer-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 10px 14px;
  margin: 0;
  border: none;
  border-radius: 0;
  border-bottom: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
  box-sizing: border-box;
}

.customer-menu-item:last-child {
  border-bottom: none;
}

.customer-menu-item:hover {
  background: var(--btn);
  color: var(--text);
}

.customer-menu-item-text {
  flex: 1;
  text-align: left;
}

.customer-menu-item-check {
  flex-shrink: 0;
  color: var(--success);
}

.customer-menu-item--active {
  font-weight: 500;
}

.customer-menu-item--disabled {
  cursor: default;
  opacity: 0.6;
}

.customer-menu-item--disabled:hover {
  background: transparent;
}

.topbar-customer-name {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 12px;
}

/* Admin Icon Button (for Recent Actions) */
.admin-icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  margin-right: 12px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
  height: 36px;
  width: 36px;
  flex-shrink: 0;
}

.admin-icon-btn:hover {
  background: var(--btn);
  border-color: var(--btnHover);
  color: var(--text);
  transform: translateY(-1px);
}

.admin-icon-btn svg {
  display: block;
  width: 18px;
  height: 18px;
}

/* User Avatar */
.user-avatar-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.user-avatar-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
  margin: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--avatar-gradient-start) 0%, var(--avatar-gradient-end) 100%);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  border: 2px solid var(--line);
  transition: all 0.2s;
}

.user-avatar-btn:hover .user-avatar {
  border-color: var(--btnHover);
  transform: scale(1.05);
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow-strong);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  margin-top: 0;
  overflow: hidden;
}

/* User menu when attached to topbar (shared for desktop + mobile) */
.topbar {
  position: relative;
}

.user-menu-topbar {
  top: calc(100% + 8px);
  right: 16px;
  left: auto;
}

.user-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.user-menu-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.user-menu-email {
  font-size: 12px;
  color: var(--muted);
}

.user-menu-divider {
  height: 1px;
  background: var(--line);
  margin: 10px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.user-menu-item + .user-menu-item {
  margin-top: 2px;
}

.user-menu-item:hover {
  background: var(--btn);
  color: var(--text);
}

.user-menu-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.user-menu-item:hover svg {
  color: var(--text);
}

.user-menu-item--customer-switch {
  font-weight: 500;
  border-radius: 0;
}

.user-menu-item-wrapper {
  position: relative;
}

.user-menu-item-wrapper--lang .user-menu-item--lang-trigger {
  cursor: pointer;
}

.user-menu-lang-flag {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.user-menu-lang-flag svg {
  width: 18px;
  height: 14px;
  border-radius: 2px;
}

.user-menu-submenu {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  min-width: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 1001;
  margin-top: 2px;
}

.user-menu-item-wrapper.user-menu-submenu-open .user-menu-submenu {
  opacity: 1;
  visibility: visible;
}

.user-menu-lang-form {
  margin: 0;
  display: block;
}

.user-menu-submenu-item,
.user-menu-lang-option {
  border-radius: 6px;
  margin: 4px;
  width: calc(100% - 8px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.user-menu-lang-option:hover,
.user-menu-submenu-item:hover {
  background: var(--hover);
}

.about-update-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-left: auto;
  flex-shrink: 0;
  animation: about-pulse 2s ease-in-out infinite;
}

@keyframes about-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.about-section {
  margin-bottom: 24px;
}

.about-section:last-child {
  margin-bottom: 0;
}

.about-section h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.about-version {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.about-update-indicator {
  display: inline-block;
  margin-left: 12px;
  color: var(--success);
  font-weight: 500;
}

.about-muted {
  margin: 8px 0 0 0;
  font-size: 14px;
  color: var(--muted);
}

.about-link {
  color: var(--link);
  text-decoration: none;
}

.about-link:hover {
  text-decoration: underline;
}

.about-admin-section {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 20px;
}

.update-status {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: var(--btn);
}

.update-status p {
  margin: 0;
  font-size: 14px;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  box-sizing: border-box;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 32px;
  flex: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#main-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  flex: 1;
  overflow-x: hidden;
}

/* Prevent content from causing horizontal scroll */
#main-content img,
#main-content video,
#main-content iframe,
.main-content pre,
.main-content .table-responsive {
  max-width: 100%;
  height: auto;
}
.main-content pre {
  overflow-x: auto;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-top: 14px;
}

/* Systemmeldinger panel (above Oversikt on facility; top on dashboard) */
.systemmeldinger-panel {
  margin-bottom: 20px;
}
.systemmeldinger-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px 0;
  font-size: 1rem;
  font-weight: 600;
}
.systemmeldinger-panel-icon {
  flex-shrink: 0;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.systemmeldinger-panel-icon svg {
  display: block;
}
.systemmeldinger-panel--facility {
  margin-bottom: 16px;
}

/* Dashboard widgets grid */
.dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.dashboard-widget {
  min-width: 0;
}

.dashboard-widget h2 {
  margin: 0 0 12px 0;
  font-size: 1rem;
}

.quick-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.quick-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.quick-stat-card:hover {
  border-color: var(--muted);
  background: var(--btn);
}

.quick-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.quick-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.announcement-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.announcement-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.announcement-item:first-child {
  border-top: 0;
}

.announcement-item-icon {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 2px;
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
}
.announcement-item-icon svg {
  display: block;
}
.announcement-item-content {
  flex: 1;
  min-width: 0;
}
.announcement-item--pinned .announcement-item-content {
  padding-left: 8px;
  border-left: 3px solid var(--muted);
}

.announcement-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.announcement-meta {
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.announcement-pin-badge {
  margin-left: 8px;
  padding: 2px 6px;
  background: var(--btn);
  border-radius: 4px;
  font-size: 0.7rem;
}

.announcement-body {
  font-size: 0.9rem;
  line-height: 1.5;
}

.list { list-style: none; padding: 0; margin: 10px 0 0 0; }
.list-item { padding: 10px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-title { font-weight: 600; }

/* Shared footer wrapper (Portal and all non-admin pages) – matches admin footer, stable so it doesn’t “refresh” */
.site-footer-wrapper {
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
  min-height: 100px;
  border-top: 1px solid var(--line);
  background: var(--footer-bg);
  color: var(--text);
  contain: layout style;
}

.site-footer-wrapper .footer {
  margin: 0;
  padding: 24px 0;
  background: transparent;
  border: none;
  width: 100%;
  max-width: 100%;
}

.footer {
  position: static;
  margin-top: auto;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  background: var(--footer-bg);
  color: var(--text);
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
}

/* Toast Messages */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease-out;
  min-width: 300px;
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.toast-success {
  border-color: var(--toast-success-border);
  background: var(--toast-success-bg);
}

.toast-error {
  border-color: var(--toast-error-border);
  background: var(--toast-error-bg);
}

.toast-warning {
  border-color: var(--toast-warning-border);
  background: var(--toast-warning-bg);
}

.toast-info {
  border-color: var(--toast-info-border);
  background: var(--toast-info-bg);
}

/* Form Buttons – compact, same height on one line, width by content */
/* Buttons: no underline on hover */
.form-btn:hover,
.form-btn:focus,
.btn:hover,
.btn:focus,
.topbar-btn:hover,
.topbar-btn:focus,
.admin-btn-sm:hover,
.admin-btn-sm:focus {
  text-decoration: none !important;
}

.form-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 36px;
  height: 36px;
  box-sizing: border-box;
  white-space: nowrap;
  width: auto;
  min-width: 0;
  flex-shrink: 0;
  vertical-align: middle;
  margin: 0;
}

.form-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 32, 107, 196), 0.25);
}

.form-btn-primary {
  background: var(--accent, #206bc4);
  border-color: var(--accent, #206bc4);
  color: var(--on-accent, #fff);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

.form-btn-primary:hover {
  background: var(--accent-hover, #1a56a0);
  border-color: var(--accent-hover, #1a56a0);
  color: var(--on-accent, #fff);
}

.form-btn-secondary {
  background: var(--card, #fff);
  border-color: var(--line);
  color: var(--text);
}

.form-btn-secondary:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--muted);
}

/* Outlined variant (e.g. Search in admin) – same as secondary */
.form-btn-outlined,
.admin-toolbar .form-btn-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  min-width: 0;
}

.admin-toolbar .form-btn-secondary:hover,
.form-btn-outlined:hover {
  background: transparent;
  color: var(--text);
  border-color: var(--muted);
}

/* Portal facility: Admin as gear icon only */
.facility-admin-gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  min-width: 36px;
}
.facility-admin-gear-btn svg {
  display: block;
}

.facility-open-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.facility-open-admin-btn svg {
  flex-shrink: 0;
}

/* --- Default app button style (from /datasheets/ "Se datablad" / "Last ned PDF") ---
   Use .btn .btn-primary (filled) or .btn .btn-secondary (outline) for all actions.
   Excluded: footer links, avatar menu, breadcrumb back, danger/delete buttons. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.875rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  border: 1px solid transparent;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.2;
  font-family: inherit;
  box-sizing: border-box;
}
a.btn { color: inherit; }
button.btn { width: auto; margin: 0; -webkit-appearance: none; appearance: none; }
.btn-primary,
.btn.btn-primary {
  background: var(--btn);
  color: var(--text);
  border-color: var(--line);
}
.btn-primary:hover,
.btn.btn-primary:hover {
  background: var(--btnHover);
}
.btn-secondary,
.btn.btn-secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.btn-secondary:hover,
.btn.btn-secondary:hover {
  color: var(--text);
  border-color: var(--muted);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
  min-height: 32px;
  height: auto;
}

/* Admin Modal (for Recent Actions) */
.admin-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal-content {
  background: var(--card);
  border: none;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
}

.admin-modal-header h2 {
  margin: 0;
  padding: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.admin-modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.admin-modal-close:hover {
  background: var(--btn);
  color: var(--text);
}

.admin-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.recent-actions-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recent-action-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  transition: all 0.2s;
}

.recent-action-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--btnHover);
}

.recent-action-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent-rgb), 0.1);
  border-radius: 8px;
  color: var(--accent);
}

.recent-action-icon svg {
  width: 16px;
  height: 16px;
}

.recent-action-content {
  flex: 1;
  min-width: 0;
}

.recent-action-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.recent-action-text a {
  color: var(--accent);
  text-decoration: none;
}

.recent-action-text a:hover {
  text-decoration: underline;
}

.recent-action-time {
  color: var(--muted);
  font-size: 12px;
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

@media (max-width: 640px) {
  .footer-content {
    padding: 0 24px;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .footer-content {
    flex-direction: column;
    align-items: stretch;
    padding: 24px 20px;
    gap: 24px;
  }

  .footer-section {
    padding-bottom: 0;
  }

  .footer-section-right {
    align-items: stretch;
    text-align: left;
  }
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.footer-text {
  font-size: 12px;
  color: var(--muted);
}

.footer-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  margin-top: 4px;
}

.footer-link:hover {
  color: var(--text);
}

.footer-section-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  text-align: left;
}

.footer-about-btn,
.footer-link-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: color 0.2s ease;
  line-height: 1.5;
}

.footer-link-btn:hover {
  color: var(--text);
}

.footer-lang-trigger:hover {
  color: var(--text);
}

.footer-about-btn svg,
.footer-link-btn svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.footer-changelog {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  max-height: 150px;
  overflow-y: auto;
}

/* Footer language dropdown (under Changelog) */
.footer-lang-dropdown {
  position: relative;
}
.footer-lang-trigger {
  font-family: inherit;
}
.footer-lang-trigger .user-menu-lang-flag { display: inline-flex; }
.footer-lang-trigger .user-menu-lang-flag svg { width: 14px; height: 14px; }
.footer-lang-label { margin-right: 2px; }
.footer-lang-chevron { flex-shrink: 0; opacity: 0.7; transition: transform 0.2s; }
.footer-lang-dropdown.open .footer-lang-chevron { transform: rotate(180deg); }
.footer-lang-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 6px;
  min-width: 140px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 100;
}
.footer-lang-dropdown.open .footer-lang-menu { display: block; }
.footer-lang-option-form { display: block; margin: 0; }
.footer-lang-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s;
}
.footer-lang-option:hover { background: var(--btn); }
.footer-lang-option .user-menu-lang-flag svg { width: 16px; height: 16px; }


/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--card);
  border: none;
  border-radius: 14px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.changelog-modal-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.changelog-modal-title-main {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}

.changelog-modal-title-version {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.modal-close:hover {
  background: var(--btn);
  color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.changelog-section-wrap,
.full-changelog-section {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  transition: opacity 0.2s ease;
}

@media (max-width: 640px) {
  #changelogModal .modal-content {
    max-height: 85vh;
  }
  #changelogModal .modal-body {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  #changelogModal .changelog-section-wrap,
  #changelogModal .full-changelog-section {
    max-height: 50vh;
    min-height: 120px;
  }
}

.changelog-section-wrap.changelog-fade-out,
.full-changelog-section.changelog-fade-out {
  opacity: 0;
}

.changelog-section-wrap.changelog-fade-in,
.full-changelog-section.changelog-fade-in {
  opacity: 1;
}

.changelog-section {
  margin-bottom: 16px;
}

.changelog-content {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  background: var(--input-bg);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

/* Release notes popup (first visit after final release) */
.release-notes-modal .modal-content {
  max-width: 520px;
}
.release-notes-body {
  white-space: pre-line;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 20px 0;
}
.release-notes-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  gap: 10px;
}
.release-notes-actions .form-btn-primary {
  order: 1;
}
.release-notes-actions .form-btn-secondary {
  order: 2;
}

.modal-actions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.modal-actions .modal-btn {
  width: auto;
  min-width: 0;
  flex-shrink: 0;
  min-height: 36px;
  height: 36px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-btn {
  padding: 8px 14px;
  font-size: 0.875rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  box-sizing: border-box;
  vertical-align: middle;
}

.modal-btn:hover {
  background: var(--btnHover);
}

#toggleFullChangelogBtn.changelog-btn-animate {
  animation: changelog-btn-pulse 0.4s ease;
}

@keyframes changelog-btn-pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.9; }
  100% { transform: scale(1); opacity: 1; }
}

/* Profile Settings Layout */
.profile-layout {
  display: flex;
  gap: 32px;
  margin-top: 24px;
}

.profile-sidebar {
  flex-shrink: 0;
  width: 240px;
  position: sticky;
  top: 72px;
  align-self: flex-start;
}

.profile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 14px;
  border: 1px solid transparent;
}

.profile-nav-item:hover {
  background: var(--btn);
  color: var(--text);
  border-color: var(--line);
}

.profile-nav-item.active {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

.profile-nav-item-danger {
  color: var(--danger);
}

.profile-nav-item-danger:hover {
  background: rgba(var(--danger-rgb), 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

.profile-nav-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.profile-nav-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

.profile-content {
  flex: 1;
  min-width: 0;
}

.profile-section {
  display: none;
}

.profile-section.active {
  display: block;
}

.profile-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-section-header h1 {
  margin: 0;
}

.profile-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--btn);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.profile-edit-btn:hover,
.profile-edit-btn.active {
  background: var(--btnHover);
  border-color: var(--line);
  color: var(--text);
}

.account-info-view {
  padding: 4px 0;
}

.account-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.account-info-row:last-child {
  border-bottom: none;
}

.account-info-row strong {
  flex-shrink: 0;
  color: var(--muted);
  font-weight: 500;
}

.account-edit-field {
  margin-bottom: 16px;
}

.account-edit-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.account-edit-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* Profile page: responsive layout so sidebar + content work on narrow screens */
@media (max-width: 768px) {
  .profile-layout {
    flex-direction: column;
    gap: 24px;
    margin-top: 16px;
  }

  .profile-sidebar {
    width: 100%;
    flex-shrink: 0;
    position: static;
    top: auto;
  }

  .profile-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .profile-nav-item {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    padding: 10px 14px;
    font-size: 13px;
  }

  .profile-nav-item svg {
    display: none;
  }

  .profile-nav-divider {
    flex-basis: 100%;
    width: 100%;
    height: 1px;
    margin: 8px 0;
  }

  .profile-content {
    min-width: 0;
    width: 100%;
  }

  .profile-section-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .profile-section-header h1 {
    font-size: 1.25rem;
  }
}

.panel-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.panel-footer-item {
  display: block;
}

/* Danger Zone Styling */
.modal-content-danger {
  box-shadow: 0 4px 20px var(--shadow-strong), 0 0 0 1px rgba(var(--danger-rgb), 0.4);
}

.modal-header-danger {
  border-bottom-color: var(--danger);
  background: rgba(var(--danger-rgb), 0.12);
}

.danger-zone {
  text-align: center;
  padding: 8px 0;
}

.danger-zone-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--danger);
}

.danger-zone h3 {
  color: var(--danger);
  margin-bottom: 16px;
  font-size: 18px;
}

.danger-zone p {
  color: var(--text);
  margin-bottom: 12px;
  text-align: left;
}

.danger-list {
  text-align: left;
  margin: 16px 0;
  padding-left: 24px;
  color: var(--text);
}

.danger-list li {
  margin-bottom: 8px;
}

.form-btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
}

.form-btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: var(--on-danger);
}

.form-btn-danger:disabled {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: rgba(255, 255, 255, 0.7);
  cursor: not-allowed;
  opacity: 0.8;
}

.admin-btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
  padding: 8px 12px;
  min-width: auto;
  width: auto;
}

.admin-btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: var(--on-danger);
}


/* ===== Custom admin app (/admin) ===== */
/* Breadcrumb row: back button left, breadcrumb trail right */
.breadcrumb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.breadcrumb-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.breadcrumb-back-btn:hover {
  background: var(--line);
  border-color: var(--text);
  color: var(--text);
}
.breadcrumb-back-btn:focus {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.admin-breadcrumb {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 0;
}

.admin-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.admin-breadcrumb a:hover {
  color: var(--text);
}

.admin-breadcrumb .breadcrumb-sep {
  margin: 0 6px;
}

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-page-title {
  margin: 0 0 16px 0;
  font-size: 22px;
  font-weight: 600;
}

/* ── Admin welcome banner ── */
.admin-welcome-banner {
  background: linear-gradient(135deg, rgba(var(--accent-rgb, 32, 107, 196), 0.08) 0%, rgba(var(--accent-rgb, 32, 107, 196), 0.02) 100%);
  border: 1px solid rgba(var(--accent-rgb, 32, 107, 196), 0.15);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.admin-welcome-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.admin-welcome-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}
.admin-welcome-quick-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  white-space: nowrap;
}
.admin-welcome-stat strong {
  color: var(--text);
  font-weight: 600;
}
.admin-welcome-stat-sep {
  color: var(--line);
}
@media (max-width: 600px) {
  .admin-welcome-banner { flex-direction: column; padding: 1.25rem; }
  .admin-welcome-quick-stats { gap: 0.75rem; }
}

.admin-home-h1 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.admin-home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.admin-home-grid-two {
  grid-template-columns: repeat(2, 1fr);
}

.admin-home-grid-three {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
  .admin-home-grid-three {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .admin-home-grid,
  .admin-home-grid-two,
  .admin-home-grid-three {
    grid-template-columns: 1fr;
  }
}

.admin-home-panel {
  padding: 20px 24px;
  transition: border-color 0.18s ease;
}

.admin-home-panel:hover {
  border-color: var(--accent, #206bc4);
}

.admin-home-panel-heading {
  margin: 0 0 10px 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
}

.admin-home-panel-heading > .ti {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(var(--accent-rgb, 32, 107, 196), 0.08);
  color: var(--accent);
  font-size: 1.1rem;
  margin-right: 0.6rem !important;
}

.admin-home-panel-desc {
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0 0 12px 0;
}

.admin-home-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-home-links li + li {
  margin-top: 2px;
}

.admin-home-link {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: background 0.12s ease, color 0.12s ease;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-home-link::before {
  content: "\203a";
  margin-right: 8px;
  color: var(--muted);
  font-size: 1.1em;
  line-height: 1;
  transition: color 0.12s ease, transform 0.12s ease;
  transition: color 0.15s ease;
}

.admin-home-link:hover {
  background: rgba(var(--accent-rgb, 32, 107, 196), 0.08);
  color: var(--accent);
  padding-left: 16px;
}

.admin-home-link:hover::before {
  color: var(--accent);
  transform: translateX(2px);
}

/* Backup & Restore page */
.admin-backup-intro {
  color: var(--muted);
  margin: 0 0 24px 0;
  max-width: 640px;
}

.admin-backup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .admin-backup-grid {
    grid-template-columns: 1fr;
  }
}

.admin-backup-panel {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 12px);
}

.admin-backup-panel-spacer {
  flex: 1;
  min-height: 16px;
}

.admin-backup-panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.admin-backup-panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(var(--accent-rgb), 0.15);
  border-radius: 8px;
  font-size: 18px;
}

.admin-backup-panel-desc {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.admin-backup-form {
  margin-top: 0;
}

.admin-backup-form-inline {
  margin-bottom: 0;
}

/* Softer, diffuse button colors on backup page only */
.admin-backup-panel .form-btn-primary {
  background: rgba(var(--accent-rgb), 0.45);
  border-color: rgba(var(--accent-rgb), 0.55);
  color: rgba(255, 255, 255, 0.95);
}

.admin-backup-panel .form-btn-primary:hover {
  background: rgba(var(--accent-rgb), 0.6);
  border-color: rgba(var(--accent-rgb), 0.7);
  color: var(--on-accent);
}

.admin-backup-panel .form-btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
}

.admin-backup-panel .form-btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: var(--on-danger);
}

.admin-backup-restore-modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.admin-backup-restore-modal-actions .form-btn {
  width: auto;
  min-width: 0;
  flex-shrink: 0;
  min-height: 36px;
  height: 36px;
  max-height: 36px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.admin-backup-file-wrap {
  margin-bottom: 16px;
}

.admin-backup-file-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.admin-backup-file-input {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
}

.admin-backup-btn {
  min-width: 160px;
}

.admin-backup-note {
  margin-top: 32px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
}

.admin-backup-note code {
  font-size: 12px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* System customization page */
.admin-customize-intro {
  color: var(--muted);
  margin: 0 0 20px 0;
  max-width: 640px;
  line-height: 1.5;
}

.admin-customize-actions-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-customize-reset-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.admin-customize-reset-btn {
  font-size: 13px;
  padding: 8px 14px;
}

.admin-customize-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .admin-customize-grid {
    grid-template-columns: 1fr;
  }
}

.admin-customize-panel {
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 12px);
  display: flex;
  flex-direction: column;
}

.admin-customize-panel-dark {
  border-left: 4px solid var(--accent);
}

.admin-customize-panel-light {
  border-left: 4px solid var(--muted);
}

.admin-customize-panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.admin-customize-panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
}

.admin-customize-panel-icon-dark {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent);
}

.admin-customize-panel-icon-light {
  background: rgba(0, 0, 0, 0.08);
  color: var(--muted);
}

html.theme-light .admin-customize-panel-icon-light {
  background: rgba(0, 0, 0, 0.1);
}

.admin-customize-panel-desc {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px 0;
  line-height: 1.4;
}

.admin-customize-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 20px;
}

.admin-customize-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 4px;
}

.admin-customize-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-customize-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  padding: 8px 10px;
}

.admin-customize-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.admin-customize-actions-bottom {
  margin-bottom: 20px;
}

.admin-customize-note {
  margin-top: 0;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
}

.admin-customize-note code {
  font-size: 12px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.admin-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

.admin-message {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--text);
}

.admin-message-success {
  background: rgba(var(--success-rgb), 0.1);
  border-color: rgba(var(--success-rgb), 0.3);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.admin-toolbar--single-row {
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.admin-toolbar-form {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

/* Toolbar: label above each control (search input, filters), all vertically centered */
.admin-search-wrap {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 16px;
  flex-shrink: 0;
}

/* Group = label on top, control below */
.admin-search-group,
.admin-filter-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
}

.admin-search-label,
.admin-filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0;
  line-height: 1;
  white-space: nowrap;
}

.admin-search-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: nowrap;
}

.admin-toolbar .form-input,
.admin-toolbar .form-btn {
  height: 36px;
  min-height: 36px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.25;
  box-sizing: border-box;
}

.admin-toolbar .form-input {
  width: auto;
  min-width: 160px;
}

.admin-search-input {
  min-width: 220px;
  width: 220px;
}

.admin-search-btn {
  min-width: 0;
  width: auto;
  padding-left: 14px;
  padding-right: 14px;
  height: 36px;
  min-height: 36px;
  align-self: flex-end;
  margin-bottom: 0;
}

/* "Add" / secondary action button – same as datasheet "Last ned PDF" (outline) */
.admin-toolbar-add-btn {
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.admin-toolbar-add-btn:hover {
  background: transparent;
  color: var(--text);
  border-color: var(--muted);
}

/* Filled primary variant when emphasis needed */
.admin-toolbar-add-btn.admin-btn-primary {
  background: var(--btn);
  border-color: var(--line);
  color: var(--text);
}

.admin-toolbar-add-btn.admin-btn-primary:hover {
  background: var(--btnHover);
  border-color: var(--line);
  color: var(--text);
}

/* Global modal close button – fixed size, never stretch */
.rack-modal-close,
.facility-modal-close {
  width: 32px;
  min-width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

@media (max-width: 900px) {
  .admin-toolbar--single-row {
    flex-wrap: wrap;
  }
  .admin-toolbar-form {
    flex-wrap: wrap;
  }
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 10px 14px;
  font-size: 13px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

/* Actions column: far right, vertically centered */
.admin-table th.admin-table-actions,
.admin-table td.admin-table-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.admin-table td.admin-table-actions .admin-btn-sm {
  margin-left: 6px;
}

.admin-table td.admin-table-actions .admin-btn-sm:first-child {
  margin-left: 0;
}

/* Global table row actions dropdown (avatar-style, top layer, click-outside close) */
.admin-row-actions-dropdown {
  position: relative;
  display: inline-block;
}
.admin-row-actions-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.admin-row-actions-trigger:hover {
  background: var(--btn);
  border-color: var(--muted);
}
.admin-row-actions-trigger svg {
  display: block;
}
.admin-row-actions-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 200px;
  padding: 6px 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow-strong);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.admin-row-actions-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.admin-row-actions-menu[hidden] {
  display: none !important;
}
.admin-row-actions-menu a,
.admin-row-actions-form .admin-row-actions-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  font-size: 13px;
  text-align: left;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.admin-row-actions-menu a:hover,
.admin-row-actions-form .admin-row-actions-item:hover {
  background: var(--btnHover);
  color: var(--text);
}
.admin-row-actions-menu a.admin-row-actions-item--danger:hover,
.admin-row-actions-form .admin-row-actions-item--danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}
.admin-row-actions-menu .admin-row-actions-icon,
.admin-row-actions-form .admin-row-actions-item .admin-row-actions-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.admin-row-actions-form {
  margin: 0;
  padding: 0;
}
.admin-row-actions-form .admin-row-actions-item {
  color: var(--text);
}
.admin-row-actions-form .admin-row-actions-item--danger {
  color: var(--danger);
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.admin-table a {
  color: var(--text);
  text-decoration: none;
}

.admin-table a:hover {
  color: var(--accent);
}

.admin-table a.admin-btn-sm:not(.admin-btn-danger):hover {
  background: var(--btnHover);
  border-color: var(--line);
  color: var(--text);
}

.admin-notification-unread td {
  background: rgba(var(--accent-rgb), 0.06);
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.2);
  color: var(--accent-light);
  margin-left: 8px;
}

.admin-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  width: max-content;
  max-width: 100%;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--text);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  box-sizing: border-box;
  white-space: nowrap;
  line-height: 1;
  font-family: inherit;
}

button.admin-btn-sm {
  margin: 0;
  cursor: pointer;
}

.admin-table .admin-btn-sm:not(.admin-btn-danger):hover {
  background: var(--btnHover);
  border-color: var(--line);
  color: var(--text);
}

.admin-btn-sm.admin-btn-danger {
  padding: 0 12px;
  min-width: auto;
  width: auto;
  border-color: var(--danger);
  background: var(--danger);
  color: var(--on-danger);
}

.admin-btn-sm.admin-btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: var(--on-danger);
}

.admin-btn-sm:not(.admin-btn-danger):hover {
  background: var(--btnHover);
  border-color: var(--line);
}

.admin-btn-primary {
  background: var(--btn);
  border-color: var(--line);
  color: var(--text);
}

.admin-btn-primary:hover {
  background: var(--btnHover);
  border-color: var(--line);
  color: var(--text);
}

.admin-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.admin-pagination a,
.admin-pagination span {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

.admin-pagination a:hover {
  background: var(--btn);
}

.admin-pagination .current {
  background: var(--btn);
  border-color: var(--line);
  color: var(--text);
}

.admin-count {
  font-size: 11px;
  margin-bottom: 8px;
}

.form-error {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  font-weight: 500;
}
.form-input.is-invalid,
.admin-form-field input.is-invalid,
.admin-form-field select.is-invalid {
  border-color: var(--danger);
}
.form-input.is-invalid:focus,
.admin-form-field input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(var(--danger-rgb, 214, 57, 57), 0.15);
}

/* Admin forms – minimal, tech, modern card layout */
.admin-form {
  max-width: 560px;
  margin-top: 20px;
  padding: 1.5rem 2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
}

.admin-form--centered {
  margin-left: auto;
  margin-right: auto;
}

.admin-filter-select {
  width: auto;
  min-width: 140px;
}

.admin-form-field {
  margin-bottom: 20px;
}

.admin-form-field:last-of-type {
  margin-bottom: 0;
}

.admin-form-row + .admin-form-field,
.admin-form-row + .admin-form-row {
  margin-top: 0;
}

.admin-form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
}

.admin-form-field input[type="text"],
.admin-form-field input[type="email"],
.admin-form-field input[type="number"],
.admin-form-field input[type="url"],
.admin-form-field input[type="password"],
.admin-form-field input[type="date"],
.admin-form-field input[type="datetime-local"],
.admin-form-field select,
.admin-form-field textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.5;
}

.admin-form-field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  padding-right: 2.25rem;
}

.admin-form-field textarea {
  min-height: 80px;
  resize: vertical;
}

.admin-form-field input:focus,
.admin-form-field select:focus,
.admin-form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 32, 107, 196), 0.15);
}

.admin-form-field input:disabled,
.admin-form-field select:disabled,
.admin-form-field textarea:disabled {
  background: var(--bg);
  opacity: 0.65;
  cursor: not-allowed;
}

.admin-form-field input::placeholder,
.admin-form-field textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.admin-form-help {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
  margin-bottom: 0;
  line-height: 1.4;
}

/* Tabler-style form stack (vertical form layout with consistent spacing) */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}
.form-label-description {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}
.form-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-top: 1rem;
}
/* Horizontal form row (label + input side by side) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.admin-form-actions .form-btn,
.admin-form-actions a.form-btn,
.admin-form-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  height: 36px;
  max-height: 36px;
  line-height: 1.2;
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  flex-shrink: 0;
  vertical-align: middle;
  margin: 0;
}

.admin-form-actions--modal {
  margin-top: 20px;
  padding-top: 16px;
}

.form-btn--narrow {
  min-width: 0;
  width: auto;
  padding-left: 20px;
  padding-right: 20px;
}

.admin-form-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  margin-bottom: 20px;
}

.admin-form-field--checkbox {
  margin-bottom: 0;
}

.admin-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  margin: 0;
}

.admin-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.admin-form-field--checkbox .admin-form-help,
.admin-form-field--checkbox .form-error {
  margin-left: 28px;
  margin-top: 4px;
}

/* Wide admin form (e.g. user add/edit) – full width, two-column rows */
.admin-form--wide {
  max-width: none;
  width: 100%;
}

.admin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.admin-form-row .admin-form-field {
  margin-bottom: 0;
}

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

@media (max-width: 640px) {
  .admin-form-row {
    grid-template-columns: 1fr;
  }
}

/* Rack detail page: same max-width as dashboard (1280px) */
.rack-detail-container {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.rack-card-header .rack-card-icon-wrap {
  width: 120px;
  height: 120px;
}

/* Customer Card Styles */
.customer-card-container {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
}

.customer-card-header {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 24px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.customer-card-flag {
  position: absolute;
  bottom: 20px;
  right: 24px;
  font-size: 28px;
  line-height: 1;
  opacity: 0.9;
}

.customer-card-logo-section {
  flex-shrink: 0;
}

.customer-logo-upload-area {
  width: 200px;
  height: 200px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.customer-logo-upload-area:hover {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.05);
}

.customer-logo-preview-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.customer-logo-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.logo-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: rgba(var(--danger-rgb), 0.9);
  color: var(--on-danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 0;
}

.customer-logo-preview-wrapper:hover .logo-delete-btn {
  opacity: 1;
}

.logo-delete-btn:hover {
  background: var(--danger);
  transform: scale(1.1);
}

.customer-logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.customer-logo-placeholder svg {
  opacity: 0.5;
}

.customer-logo-placeholder span {
  font-size: 13px;
  font-weight: 500;
}

.customer-logo-upload-info {
  margin-top: 12px;
  text-align: center;
}

.customer-logo-upload-info p {
  margin: 4px 0;
}

.customer-card-info {
  flex: 1;
}

/* Facility detail: no image, header uses full width for info */
.facility-detail-header {
  display: block;
}

.facility-detail-header .customer-card-info {
  max-width: 100%;
}

.facility-detail-header-extras {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.facility-detail-header-extras .facility-serviceavtale-badge {
  flex-shrink: 0;
}

.facility-technical-support--inline {
  padding: 10px 12px;
  min-width: 0;
}

.facility-technical-support--inline .facility-technical-support-title {
  margin-bottom: 6px;
}

.facility-technical-support--inline .facility-technical-support-name {
  margin-bottom: 4px;
}

.customer-card-name-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.customer-card-title-block {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.customer-card-name {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  color: var(--text);
  flex: 0 1 auto;
}

.customer-card-slug {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
}

.customer-card-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 10px;
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  box-sizing: border-box;
}

.customer-card-badge--active {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.customer-card-badge--inactive {
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted);
}

.customer-card-meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px 0;
}

.customer-card-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  align-self: center;
}

.customer-card-icon-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  margin: 0;
  text-decoration: none;
  flex-shrink: 0;
  box-sizing: border-box;
  font: inherit;
  line-height: 1;
}

.customer-card-icon-btn svg {
  display: block;
  vertical-align: middle;
}

.customer-card-icon-btn:hover {
  background: var(--btnHover);
  border-color: var(--btnHover);
  transform: translateY(-1px);
}

.customer-card-icon-btn--edit {
  color: var(--text);
}

.customer-card-icon-btn--edit:hover {
  background: rgba(var(--accent-rgb), 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

.customer-card-icon-btn--delete {
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.3);
}

.customer-card-icon-btn--delete:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
}

.customer-card-org,
.customer-card-contact {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0;
}

.customer-card-actions {
  margin-top: 20px;
}

.customer-card-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  padding: 0 4px;
}

.customer-card-tabs--single {
  border-bottom: none;
  margin-bottom: 24px;
  padding: 0;
}

.customer-card-tabs--single .customer-tab {
  cursor: default;
  padding: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  margin: 0;
  border-radius: 0;
}

.customer-card-tabs--single .customer-tab:hover {
  background: transparent;
}

.customer-tab {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
  border-radius: 8px 8px 0 0;
  position: relative;
}

.customer-tab:hover {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.05);
}

.customer-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  font-weight: 600;
}

.customer-card-content {
  min-height: 400px;
}

.customer-tab-panel {
  display: none;
}

.customer-tab-panel.active {
  display: block;
}

.customer-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  min-height: 36px;
  flex-wrap: wrap;
  gap: 16px;
}

.customer-section-header h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

/* Facility sidemenu: show count only on hover or when active */
.facility-sidemenu-count {
  display: none;
}
.facility-sidemenu-item:hover .facility-sidemenu-count,
.facility-sidemenu-item.active .facility-sidemenu-count {
  display: inline;
}

.customer-card-meta {
  margin: 4px 0 0 0;
  font-size: 0.8125rem;
  color: var(--muted, #6b7280);
  line-height: 1.4;
}

.customer-card-label {
  font-size: 0.875rem;
  color: var(--muted, #6b7280);
  font-weight: 500;
  margin-left: 8px;
}

/* Facility detail: status label same color as on /facilities/ but text only (no background) */
.facility-detail-container .customer-card-label {
  background: none;
  color: var(--facility-status-color, var(--muted, #6b7280));
}

.customer-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.customer-info-item {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.customer-info-item--full {
  grid-column: 1 / -1;
}

.customer-info-item label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.customer-info-item p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.customer-info-item code {
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent);
}

.role-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Customer Selection Page */
.customer-selection-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.customer-selection-header {
  margin-bottom: 24px;
  flex-shrink: 0;
}

.customer-selection-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.customer-selection-search {
  margin-bottom: 16px;
  flex-shrink: 0;
}

.customer-selection-search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s;
}

.customer-selection-search-input:focus {
  outline: none;
  border-color: var(--btnHover);
}

.customer-selection-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
  min-height: 0;
}

.customer-selection-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.customer-selection-item:hover {
  border-color: var(--btnHover);
  background: var(--btn);
}

.customer-selection-item-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.customer-selection-item-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.customer-selection-item-logo--placeholder {
  color: var(--muted);
}

.customer-selection-item-logo--placeholder svg {
  width: 20px;
  height: 20px;
}

.customer-selection-item-content {
  flex: 1;
  min-width: 0;
}

.customer-selection-item-name {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 2px 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-selection-item-org {
  font-size: 12px;
  margin: 0;
}

.customer-selection-item-arrow {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.customer-selection-item:hover .customer-selection-item-arrow {
  transform: translateX(2px);
  color: var(--text);
}

/* Customer Switch Modal */
.customer-switch-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  padding: 20px;
}

.customer-switch-modal.modal-open {
  opacity: 1;
  visibility: visible;
}

.customer-switch-modal-content {
  background: var(--card);
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.customer-switch-modal.modal-open .customer-switch-modal-content {
  transform: scale(1);
}

.customer-switch-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.customer-switch-modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.customer-switch-modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.customer-switch-modal-close svg {
  width: 18px;
  height: 18px;
}

.customer-switch-modal-close:hover {
  background: var(--btn);
  color: var(--text);
}

.customer-switch-modal-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.customer-switch-modal-search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s;
}

.customer-switch-modal-search-input:focus {
  outline: none;
  border-color: var(--btnHover);
}

.customer-switch-modal-list {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

.customer-switch-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 4px;
  text-align: center;
}

.customer-switch-card:last-child {
  margin-bottom: 0;
}

.customer-switch-card:hover:not(.customer-switch-card--active) {
  background: var(--btn);
}

.customer-switch-card--active {
  background: var(--btn);
  border: 1px solid var(--btnHover);
  cursor: default;
}

.customer-switch-card-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.customer-switch-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

.customer-switch-card-logo--placeholder {
  color: var(--muted);
}

.customer-switch-card-logo--placeholder svg {
  width: 18px;
  height: 18px;
}

.customer-switch-card-content {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.customer-switch-card-name {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 1px 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-switch-card-org {
  font-size: 11px;
  margin: 0;
}

.customer-switch-card-check,
.customer-switch-card-arrow {
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.customer-switch-card-check svg,
.customer-switch-card-arrow svg {
  width: 16px;
  height: 16px;
}

.customer-switch-card--active .customer-switch-card-check {
  color: var(--btnHover);
}

.customer-switch-card:hover:not(.customer-switch-card--active) .customer-switch-card-arrow {
  color: var(--text);
  transform: translateX(2px);
}

@media (max-width: 768px) {
  .customer-selection-container {
    padding: 24px 16px;
  }
  
  .customer-switch-modal-content {
    max-width: 100%;
    max-height: 90vh;
  }
}

/* Facility List Styles */
.facility-list-container {
  width: 100%;
  padding: 0;
}

.facility-list-header {
  margin-bottom: 32px;
}

.facility-list-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text);
}

.facility-list-subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.facility-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  .facility-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .facility-grid {
    grid-template-columns: 1fr;
  }
}

.facility-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  cursor: pointer;
}
.facility-card--status-ok {
  border-left-color: #16a34a;
}
.facility-card--status-custom {
  border-left-color: var(--facility-status-color, #16a34a);
}
.facility-card-status-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-weight: 500;
}

.facility-card:hover {
  border-color: var(--btnHover);
  background: var(--btn);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.facility-card-icon-wrap {
  display: inline-flex;
  flex-shrink: 0;
}
.facility-card-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent-rgb), 0.1);
  border-radius: 10px;
  color: var(--accent);
}
.facility-card-icon--ok {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}
.facility-card-icon--message {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--on-accent);
}
/* Light mode: message icon uses accent blue (white works in dark only) */
html.theme-light .facility-card-icon--message {
  color: var(--accent);
}
.facility-card-icon--warning {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}
.facility-card-icon--danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}
.facility-card-icon-svg {
  display: block;
}
/* Synced fade for non-house icons (message envelope): 1s per loop, 100% ↔ 35% opacity */
@keyframes facility-icon-fade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.facility-card-icon-svg.facility-card-icon--animate {
  animation: facility-icon-fade 1s ease-in-out infinite;
}
.facility-card-status-badge--custom {
  background: var(--facility-badge-bg, rgba(0,0,0,0.08)) !important;
  color: var(--facility-badge-fg, var(--text)) !important;
}

.facility-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.facility-card-name {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--text);
}

.facility-card-description {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px 0;
  line-height: 1.5;
}

.facility-card-location {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 8px 0;
  line-height: 1.4;
}

.facility-card-arrow {
  flex-shrink: 0;
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: transform 0.2s;
}

.facility-card:hover .facility-card-arrow {
  transform: translateX(4px);
  color: var(--text);
}

.facility-empty-state {
  text-align: center;
  padding: 60px 20px;
}

.facility-empty-icon {
  color: var(--muted);
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

/* Facility Detail Styles */
.facility-detail-container {
  width: 100%;
  padding: 0;
}

.facility-detail-header {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 24px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.facility-detail-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent-rgb), 0.1);
  border-radius: 12px;
  color: var(--accent);
}

.facility-detail-info {
  flex: 1;
}

.facility-detail-name {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text);
}

.facility-detail-location {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 4px 0;
}

.facility-detail-address {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.facility-detail-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}

.facility-tab {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
  white-space: nowrap;
}

.facility-tab:hover {
  color: var(--text);
}

.facility-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.facility-detail-content {
  min-height: 400px;
}

.facility-tab-panel {
  display: none;
}

.facility-tab-panel.active {
  display: block;
}

.facility-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.facility-section-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.facility-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.facility-stat-number {
  font-size: 32px;
  font-weight: 600;
  margin: 12px 0 4px 0;
  color: var(--text);
}

.role-badge--member {
  background: rgba(var(--accent-rgb), 0.2);
  color: var(--accent-light);
}

.role-badge--admin {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success-light);
}

/* Loading indicator (HTMX) – animates in over the topbar only during HTMX requests */
.loading-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 8px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 9999;
  font-size: 0.9rem;
  color: var(--muted);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.25s ease-out, opacity 0.2s ease-out;
}
.loading-indicator.loading-indicator--visible {
  transform: translateY(0);
  opacity: 1;
}

.loading-indicator-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: loading-spin 0.7s linear infinite;
}

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

/* Error recovery panel */
.error-recovery-panel h1 {
  margin-bottom: 12px;
}

.error-recovery-suggestion {
  margin: 12px 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.error-recovery-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.error-recovery-actions .form-btn {
  width: auto;
  margin: 0;
}

/* Welcome staff (tenant with no customers yet) */
.welcome-staff-panel {
  max-width: 560px;
  margin: 2rem auto;
}
.welcome-staff-panel h1 { margin-bottom: 12px; }
.welcome-staff-steps { margin: 16px 0; }
.welcome-staff-list { margin: 8px 0 0 1.25rem; }
.welcome-staff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}
.welcome-staff-actions .form-btn {
  width: auto;
  margin: 0;
}

.modal-content-sm {
  max-width: 420px;
}

/* Help modal */
.help-section {
  margin-bottom: 20px;
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section h3 {
  margin: 0 0 8px 0;
  font-size: 1rem;
}

.help-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-list li {
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-list kbd {
  display: inline-block;
  min-width: 28px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
}

/* Mobile: portal topbar + burger menu, no horizontal scroll (body.page-wrapper = portal only) */
@media (max-width: 992px) {
  body.page-wrapper .topbar .topbar-inner {
    flex-wrap: nowrap;
    padding: 12px 16px;
    gap: 12px;
    min-height: 52px;
  }

  body.page-wrapper .topbar .topbar-mobile-right {
    display: flex !important;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  body.page-wrapper .topbar .topbar-burger {
    display: flex !important;
  }

  body.page-wrapper .topbar .topbar-right {
    display: none !important;
  }

  body.page-wrapper .topbar .topbar-desktop-avatar {
    display: none !important;
  }

  body.page-wrapper .topbar .topbar-nav {
    display: none !important;
  }

  body.page-wrapper .topbar .topbar-left {
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
  }

  body.page-wrapper .topbar .topbar-left .brand {
    font-size: 15px;
  }

  body.page-wrapper .topbar .topbar-search-wrap {
    display: none;
  }

  body.page-wrapper .topbar .topbar-right .topbar-customer-name {
    display: none;
  }

  body.page-wrapper .topbar .topbar-right .topbar-btn--disabled.topbar-btn--with-tooltip {
    display: none;
  }

  body.page-wrapper .topbar .topbar-search-wrap.is-open {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 16px;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
    overflow-y: auto;
  }

  body.page-wrapper .topbar .topbar-search-wrap.is-open .topbar-search-inner {
    width: 100%;
    max-width: min(480px, 92vw);
    max-height: 85vh;
    min-width: 0;
    flex: 0 1 auto;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: stretch;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 8px 32px var(--shadow-strong);
    padding: 12px;
    overflow: hidden;
  }

  body.page-wrapper .topbar .topbar-search-wrap.is-open .topbar-search-inner .topbar-search-input {
    grid-column: 1;
    min-width: 0;
    font-size: 16px; /* Prevent iOS/Android zoom on focus (requires ≥16px) */
    box-sizing: border-box;
  }

  body.page-wrapper .topbar .topbar-search-wrap.is-open .topbar-search-inner .topbar-search-close {
    grid-column: 2;
  }

  body.page-wrapper .topbar .topbar-search-wrap.is-open .topbar-search-results {
    grid-row: 2;
    grid-column: 1 / -1;
    position: static;
    margin: 0;
    max-height: min(360px, 50vh);
    min-height: 0;
    overflow-y: auto;
  }

  body.page-wrapper .user-menu-topbar {
    left: 16px;
    right: auto;
    top: 56px;
  }

  .container {
    padding: 16px;
  }

  .dashboard-widgets {
    grid-template-columns: 1fr;
  }

  .quick-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Small phones: tighter padding (portal) */
@media (max-width: 480px) {
  body.page-wrapper .topbar .topbar-inner {
    padding: 10px 12px;
  }

  .container {
    padding: 12px;
  }

  .page {
    padding: 16px;
  }
}

/* ========== Main site (myportello.com – marketing/landing) ========== */
.main-site-dev-banner {
  background: rgba(var(--warning-rgb, 245, 158, 11), 0.12);
  color: var(--warning, rgb(var(--warning-rgb, 245, 158, 11)));
  padding: 8px 24px;
  font-size: 0.875rem;
  text-align: center;
  border-bottom: 1px solid rgba(var(--warning-rgb, 245, 158, 11), 0.25);
}
.main-site-dev-banner-text {
  font-weight: 500;
}

.main-site-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.main-site-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.main-site-logo {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.main-site-logo:hover {
  color: var(--accent);
}

.main-site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  z-index: 10;
}

.main-site-nav-link {
  padding: 0.5rem 0.75rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  border-radius: 8px;
}

.main-site-nav-link:hover {
  color: var(--text);
  background: var(--btn);
}

.main-site-nav-link--cta {
  color: var(--on-accent);
  background: var(--accent);
}

.main-site-nav-link--cta:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.main-site-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
}

.main-site-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.main-site-mobile-nav {
  display: none;
  flex-direction: column;
  padding: 0 1.5rem 1rem;
  gap: 0.25rem;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.main-site-mobile-nav[aria-hidden="false"] {
  display: flex;
}

.main-site-mobile-link {
  padding: 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
}

.main-site-mobile-link:hover {
  background: var(--btn);
}

.main-site-mobile-link--cta {
  background: var(--accent);
  color: var(--on-accent);
  text-align: center;
  font-weight: 500;
}

.main-site-mobile-link--cta:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

@media (min-width: 768px) {
  .main-site-burger[hidden] {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .main-site-nav {
    display: none;
  }
}

.main-site-main {
  flex: 1;
  width: 100%;
  max-width: 100%;
}

.main-site-toast-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.main-site-toast-wrap .toast {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 0.9375rem;
}

.main-site-footer {
  margin-top: auto;
  background: var(--footer-bg);
  border-top: 1px solid var(--line);
}

.main-site-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.main-site-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.main-site-footer-logo {
  font-weight: 600;
  color: var(--text);
}

.main-site-footer-version {
  font-size: 0.8125rem;
  color: var(--muted);
}

.main-site-footer-links {
  display: flex;
  gap: 1rem;
}

.main-site-footer-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.main-site-footer-link:hover {
  color: var(--accent);
}

.main-site-footer-copy {
  font-size: 0.8125rem;
  color: var(--muted);
  width: 100%;
  text-align: center;
}

@media (min-width: 640px) {
  .main-site-footer-copy {
    width: auto;
    text-align: right;
  }
}

/* Main-site footer language dropdown */
.main-site-lang-dropdown {
  position: relative;
  display: inline-flex;
}
.main-site-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.main-site-lang-trigger:hover {
  color: var(--accent);
}
.main-site-lang-flag {
  display: inline-flex;
  align-items: center;
}
.main-site-lang-flag svg { width: 16px; height: 12px; }
.main-site-lang-label { margin-right: 2px; }
.main-site-lang-chevron { flex-shrink: 0; opacity: 0.7; transition: transform 0.2s; }
.main-site-lang-dropdown.open .main-site-lang-chevron { transform: rotate(180deg); }
.main-site-lang-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 6px;
  min-width: 160px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 100;
}
.main-site-lang-dropdown.open .main-site-lang-menu { display: block; }
.main-site-lang-option-form { display: block; margin: 0; }
.main-site-lang-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.8125rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.main-site-lang-option:hover { background: var(--btn); }
.main-site-lang-option .main-site-lang-flag svg { width: 16px; height: 12px; }

/* Landing hero and sections */
.main-site-hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  max-width: 720px;
  margin: 0 auto;
}

.main-site-hero-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  line-height: 1.2;
  color: var(--text);
}

.main-site-hero-tagline {
  font-size: 1.125rem;
  color: var(--muted);
  margin: 0 0 2rem;
  line-height: 1.5;
}

.main-site-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.main-site-hero-actions .form-btn {
  min-width: 140px;
}

.main-site-hero-actions--stacked {
  flex-direction: column;
  align-items: center;
}

.main-site-hero-actions--stacked .form-btn {
  width: 100%;
  max-width: 320px;
}

.form-btn--large {
  padding: 0.75rem 1.5rem;
  font-size: 1.0625rem;
}

.main-site-hero-note {
  font-size: 0.875rem;
  color: var(--muted);
}

/* Main site choice modal (logged in: go to workspace or stay) */
.main-site-choice-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.main-site-choice-modal .main-site-choice-modal-content {
  max-width: 420px;
}

.main-site-choice-modal-desc {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.5;
}

.main-site-choice-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.main-site-choice-modal-actions .form-btn {
  width: 100%;
  justify-content: center;
}

.main-site-section {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Align with header/footer width (1280px) e.g. pricing page */
.main-site-section--full-width {
  max-width: 1280px;
}

.main-site-section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.main-site-section-lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.main-site-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.main-site-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.main-site-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.main-site-card-desc {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
  flex: 1;
}

.main-site-card-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--text);
}

.main-site-card-list li {
  padding: 0.25rem 0;
  padding-left: 1.25rem;
  position: relative;
}

.main-site-card-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.main-site-divider {
  height: 1px;
  background: var(--line);
  margin: 2rem 0;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

body.main-site-mobile-open {
  overflow: hidden;
}

/* Tabler Icons – size helpers (webfont scales with font-size). Use: <i class="ti ti-<name> ti--16" aria-hidden="true"></i> */
.ti {
  display: inline-block;
  line-height: 1;
  vertical-align: middle;
}
.ti--14 { font-size: 14px; }
.ti--16 { font-size: 16px; }
.ti--20 { font-size: 20px; }
.ti--24 { font-size: 24px; }
.ti--32 { font-size: 32px; }
.ti--48 { font-size: 48px; }

/* ── Admin dashboard stats cards ── */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-stat-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  border-left: 3px solid var(--accent, #206bc4);
  position: relative;
}
.admin-stat-card:nth-child(2) { border-left-color: var(--success, #2fb344); }
.admin-stat-card:nth-child(3) { border-left-color: var(--info, #4299e1); }
.admin-stat-card:hover {
  border-color: var(--accent, #206bc4);
  border-left-color: var(--accent, #206bc4);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.admin-stat-card:nth-child(2):hover { border-left-color: var(--success, #2fb344); }
.admin-stat-card:nth-child(3):hover { border-left-color: var(--info, #4299e1); }
.admin-stat-card .admin-stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(var(--accent-rgb, 32, 107, 196), 0.1);
  color: var(--accent);
  font-size: 1.5rem;
  flex-shrink: 0;
}
.admin-stat-card:nth-child(2) .admin-stat-icon {
  background: rgba(var(--success-rgb, 47, 179, 68), 0.1);
  color: var(--success, #2fb344);
}
.admin-stat-card:nth-child(3) .admin-stat-icon {
  background: rgba(var(--info-rgb, 66, 153, 225), 0.1);
  color: var(--info, #4299e1);
}
.admin-stat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.admin-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}
.admin-stat-label {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.admin-stat-footer {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.admin-stat-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 500;
}
.admin-stat-badge--success {
  background: rgba(var(--success-rgb, 34, 197, 94), 0.15);
  color: var(--success, rgb(var(--success-rgb, 34, 197, 94)));
}
.admin-stat-badge--warning {
  background: var(--warning-bg, #fef3c7);
  color: var(--warning-text, #92400e);
}
.admin-stat-badge--danger {
  background: var(--danger-bg, #fee2e2);
  color: var(--danger-text, #991b1b);
}

/* ── Admin activity list ── */
.admin-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
}
.admin-activity-item {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}
.admin-activity-item:last-child {
  border-bottom: none;
}
.admin-activity-type {
  font-weight: 500;
  min-width: 140px;
}
.admin-activity-actor {
  min-width: 120px;
}
.admin-activity-time {
  margin-left: auto;
  white-space: nowrap;
}
