/* ==========================================================================
   Familieportal — Modern responsive family portal styles
   Typography: DM Sans (Danish-friendly)
   Theme: html[data-theme="light|dark"]
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design tokens — light (default)
   -------------------------------------------------------------------------- */
:root,
html[data-theme="light"] {
  color-scheme: light;

  --fp-primary: #5b4fc7;
  --fp-primary-hover: #4a3fb5;
  --fp-primary-soft: rgba(91, 79, 199, 0.12);
  --fp-primary-muted: rgba(91, 79, 199, 0.22);

  --fp-accent: #e8875b;
  --fp-accent-soft: rgba(232, 135, 91, 0.14);
  --fp-accent-warm: #f4a261;
  --fp-accent-rose: #e07a7a;

  --fp-success: #2d9d6f;
  --fp-success-soft: rgba(45, 157, 111, 0.12);
  --fp-warning: #d4920a;
  --fp-warning-soft: rgba(212, 146, 10, 0.14);
  --fp-danger: #d64545;
  --fp-danger-soft: rgba(214, 69, 69, 0.12);
  --fp-info: #3b82c4;
  --fp-info-soft: rgba(59, 130, 196, 0.12);

  --fp-bg: #f6f4fb;
  --fp-bg-elevated: #ffffff;
  --fp-bg-subtle: #eeebf8;
  --fp-bg-sidebar: #ffffff;
  --fp-bg-topbar: rgba(255, 255, 255, 0.88);

  --fp-text: #1a1625;
  --fp-text-secondary: #5c5668;
  --fp-text-muted: #8a8494;
  --fp-text-inverse: #ffffff;

  --fp-border: #e4e0ef;
  --fp-border-strong: #cfc8de;
  --fp-border-focus: var(--fp-primary);

  --fp-shadow-xs: 0 1px 2px rgba(26, 22, 37, 0.04);
  --fp-shadow-sm: 0 2px 8px rgba(26, 22, 37, 0.06);
  --fp-shadow-md: 0 8px 24px rgba(26, 22, 37, 0.08);
  --fp-shadow-lg: 0 16px 48px rgba(26, 22, 37, 0.12);

  --fp-radius-sm: 8px;
  --fp-radius-md: 12px;
  --fp-radius-lg: 16px;
  --fp-radius-xl: 20px;
  --fp-radius-full: 9999px;

  --fp-sidebar-width: 17.5rem;
  --fp-topbar-height: 3.75rem;
  --fp-touch: 44px;
  --fp-content-max: 72rem;

  --fp-font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fp-font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;

  --fp-transition: 180ms ease;
  --fp-transition-slow: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   Design tokens — dark
   -------------------------------------------------------------------------- */
html[data-theme="dark"] {
  color-scheme: dark;

  --fp-primary: #8b82e8;
  --fp-primary-hover: #a29bf0;
  --fp-primary-soft: rgba(139, 130, 232, 0.16);
  --fp-primary-muted: rgba(139, 130, 232, 0.28);

  --fp-accent: #f0a070;
  --fp-accent-soft: rgba(240, 160, 112, 0.14);
  --fp-accent-warm: #f4b87a;
  --fp-accent-rose: #e89292;

  --fp-success: #4ec992;
  --fp-success-soft: rgba(78, 201, 146, 0.14);
  --fp-warning: #e8b44a;
  --fp-warning-soft: rgba(232, 180, 74, 0.14);
  --fp-danger: #ef6b6b;
  --fp-danger-soft: rgba(239, 107, 107, 0.14);
  --fp-info: #6ba8e8;
  --fp-info-soft: rgba(107, 168, 232, 0.14);

  --fp-bg: #12101a;
  --fp-bg-elevated: #1c1926;
  --fp-bg-subtle: #252131;
  --fp-bg-sidebar: #1c1926;
  --fp-bg-topbar: rgba(28, 25, 38, 0.92);

  --fp-text: #f0edf8;
  --fp-text-secondary: #b8b2c8;
  --fp-text-muted: #857f96;
  --fp-text-inverse: #12101a;

  --fp-border: #2f2a3d;
  --fp-border-strong: #3d3750;
  --fp-border-focus: var(--fp-primary);

  --fp-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --fp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --fp-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --fp-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--fp-font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--fp-text);
  background: var(--fp-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

a:hover {
  color: var(--fp-primary-hover);
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--fp-border-focus);
  outline-offset: 2px;
}

::selection {
  background: var(--fp-primary-soft);
  color: var(--fp-text);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.5rem, 2.5vw, 1.875rem); }
h2 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   App shell — sidebar layout
   -------------------------------------------------------------------------- */
.app {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  width: var(--fp-sidebar-width);
  background: var(--fp-bg-sidebar);
  border-right: 1px solid var(--fp-border);
  box-shadow: var(--fp-shadow-sm);
  transform: translateX(0);
  transition: transform var(--fp-transition-slow);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--fp-border);
}

.sidebar__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.35rem;
  background: var(--fp-primary-soft);
  border-radius: var(--fp-radius-md);
  flex-shrink: 0;
}

.sidebar__brand strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--fp-text);
}

.sidebar__sub {
  display: block;
  font-size: 0.8125rem;
  color: var(--fp-text-muted);
  margin-top: 0.125rem;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--fp-touch);
  padding: 0.625rem 0.875rem;
  border-radius: var(--fp-radius-md);
  color: var(--fp-text-secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  transition:
    background var(--fp-transition),
    color var(--fp-transition);
}

.sidebar__link:hover {
  background: var(--fp-bg-subtle);
  color: var(--fp-text);
}

.sidebar__link.is-active {
  background: var(--fp-primary-soft);
  color: var(--fp-primary);
  font-weight: 600;
}

.sidebar__link .nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar__link.is-active .nav-icon {
  opacity: 1;
}

.sidebar__foot {
  padding: 0.875rem;
  border-top: 1px solid var(--fp-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: var(--fp-touch);
  padding: 0.5rem 0.625rem;
  border-radius: var(--fp-radius-md);
  color: var(--fp-text);
  transition: background var(--fp-transition);
}

.sidebar__user:hover {
  background: var(--fp-bg-subtle);
  color: var(--fp-text);
}

.sidebar__user-name {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__logout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--fp-touch);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fp-text-secondary);
  border-radius: var(--fp-radius-md);
  transition:
    background var(--fp-transition),
    color var(--fp-transition);
}

.sidebar__logout:hover {
  background: var(--fp-danger-soft);
  color: var(--fp-danger);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(18, 16, 26, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--fp-transition-slow),
    visibility var(--fp-transition-slow);
}

.sidebar-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

.sidebar-backdrop[hidden] {
  display: none;
}

.sidebar-backdrop.is-visible[hidden] {
  display: block;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--fp-sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--fp-topbar-height);
  padding: 0.625rem 1.25rem;
  background: var(--fp-bg-topbar);
  border-bottom: 1px solid var(--fp-border);
  backdrop-filter: blur(12px);
}

.topbar__menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--fp-touch);
  height: var(--fp-touch);
  padding: 0;
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-md);
  background: var(--fp-bg-elevated);
  color: var(--fp-text);
  font-size: 1.25rem;
  line-height: 1;
  transition:
    background var(--fp-transition),
    border-color var(--fp-transition);
}

.topbar__menu:hover {
  background: var(--fp-bg-subtle);
  border-color: var(--fp-border-strong);
}

.topbar__title {
  flex: 1;
  margin: 0;
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-toggle,
.auth-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--fp-touch);
  height: var(--fp-touch);
  padding: 0;
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-md);
  background: var(--fp-bg-elevated);
  color: var(--fp-text);
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
  transition:
    background var(--fp-transition),
    border-color var(--fp-transition),
    transform var(--fp-transition);
}

.theme-toggle:hover,
.auth-theme:hover {
  background: var(--fp-primary-soft);
  border-color: var(--fp-primary-muted);
}

.theme-toggle:active,
.auth-theme:active {
  transform: scale(0.96);
}

.main {
  flex: 1;
  width: 100%;
  max-width: var(--fp-content-max);
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 3vw, 1.75rem) 2rem;
}

.footer {
  padding: 1rem 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--fp-text-muted);
  border-top: 1px solid var(--fp-border);
}

/* Mobile sidebar */
@media (max-width: 899px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

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

  .topbar__menu {
    display: flex;
  }
}

/* --------------------------------------------------------------------------
   Flash messages
   -------------------------------------------------------------------------- */
.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  margin-bottom: 1.25rem;
  border-radius: var(--fp-radius-md);
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  animation: fp-flash-in 320ms ease;
}

@keyframes fp-flash-in {
  from {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash--success {
  background: var(--fp-success-soft);
  border-color: rgba(45, 157, 111, 0.25);
  color: var(--fp-success);
}

.flash--error,
.flash--danger {
  background: var(--fp-danger-soft);
  border-color: rgba(214, 69, 69, 0.25);
  color: var(--fp-danger);
}

.flash--warning {
  background: var(--fp-warning-soft);
  border-color: rgba(212, 146, 10, 0.25);
  color: var(--fp-warning);
}

.flash--info {
  background: var(--fp-info-soft);
  border-color: rgba(59, 130, 196, 0.25);
  color: var(--fp-info);
}

/* --------------------------------------------------------------------------
   Panels
   -------------------------------------------------------------------------- */
.panel {
  background: var(--fp-bg-elevated);
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-lg);
  box-shadow: var(--fp-shadow-xs);
  overflow: hidden;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--fp-border);
}

.panel__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.panel__body {
  padding: 1.25rem;
}

.panel__footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--fp-border);
  background: var(--fp-bg-subtle);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--fp-bg-elevated);
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-lg);
  box-shadow: var(--fp-shadow-xs);
  overflow: hidden;
  transition:
    box-shadow var(--fp-transition),
    border-color var(--fp-transition);
}

.card:hover {
  box-shadow: var(--fp-shadow-sm);
}

.card__header {
  padding: 1rem 1.25rem 0;
}

.card__body {
  padding: 1rem 1.25rem 1.25rem;
}

.card__footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--fp-border);
}

.card--interactive {
  cursor: pointer;
}

.card--interactive:hover {
  border-color: var(--fp-primary-muted);
}

.card--accent {
  border-color: var(--fp-accent-soft);
  background: linear-gradient(135deg, var(--fp-bg-elevated) 0%, var(--fp-accent-soft) 100%);
}

/* Stat cards */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.25rem;
  background: var(--fp-bg-elevated);
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-lg);
  box-shadow: var(--fp-shadow-xs);
}

.stat-card__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card__value {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--fp-text);
  line-height: 1.1;
}

.stat-card__change {
  font-size: 0.8125rem;
  font-weight: 500;
}

.stat-card__change--up {
  color: var(--fp-success);
}

.stat-card__change--down {
  color: var(--fp-danger);
}

.stat-card--primary {
  border-color: var(--fp-primary-muted);
  background: linear-gradient(135deg, var(--fp-bg-elevated), var(--fp-primary-soft));
}

.stat-card--warm {
  border-color: var(--fp-accent-soft);
  background: linear-gradient(135deg, var(--fp-bg-elevated), var(--fp-accent-soft));
}

/* --------------------------------------------------------------------------
   Dashboard grid
   -------------------------------------------------------------------------- */
.dashboard-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(12, 1fr);
}

.dashboard-grid > * {
  grid-column: span 12;
}

@media (min-width: 640px) {
  .dashboard-grid > .col-6-sm { grid-column: span 6; }
  .dashboard-grid > .col-4-sm { grid-column: span 4; }
}

@media (min-width: 900px) {
  .dashboard-grid > .col-8 { grid-column: span 8; }
  .dashboard-grid > .col-6 { grid-column: span 6; }
  .dashboard-grid > .col-4 { grid-column: span 4; }
  .dashboard-grid > .col-3 { grid-column: span 3; }
}

.grid {
  display: grid;
  gap: 1rem;
}

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

@media (max-width: 639px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 640px) and (max-width: 899px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--fp-touch);
  padding: 0.625rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--fp-radius-md);
  font-family: var(--fp-font);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--fp-transition),
    border-color var(--fp-transition),
    color var(--fp-transition),
    box-shadow var(--fp-transition),
    transform var(--fp-transition);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--primary {
  background: var(--fp-primary);
  color: var(--fp-text-inverse);
  box-shadow: 0 2px 8px rgba(91, 79, 199, 0.25);
}

.btn--primary:hover {
  background: var(--fp-primary-hover);
  color: var(--fp-text-inverse);
}

.btn--secondary {
  background: var(--fp-bg-subtle);
  border-color: var(--fp-border);
  color: var(--fp-text);
}

.btn--secondary:hover {
  background: var(--fp-bg-elevated);
  border-color: var(--fp-border-strong);
  color: var(--fp-text);
}

.btn--accent {
  background: var(--fp-accent);
  color: var(--fp-text-inverse);
}

.btn--accent:hover {
  background: var(--fp-accent-warm);
  color: var(--fp-text-inverse);
}

.btn--ghost {
  background: transparent;
  color: var(--fp-text-secondary);
}

.btn--ghost:hover {
  background: var(--fp-bg-subtle);
  color: var(--fp-text);
}

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

.btn--danger:hover {
  filter: brightness(1.08);
  color: #fff;
}

.btn--sm {
  min-height: 2.25rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}

.btn--lg {
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn--block {
  width: 100%;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--fp-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge--primary {
  background: var(--fp-primary-soft);
  color: var(--fp-primary);
}

.badge--accent {
  background: var(--fp-accent-soft);
  color: var(--fp-accent);
}

.badge--success {
  background: var(--fp-success-soft);
  color: var(--fp-success);
}

.badge--warning {
  background: var(--fp-warning-soft);
  color: var(--fp-warning);
}

.badge--danger {
  background: var(--fp-danger-soft);
  color: var(--fp-danger);
}

.badge--muted {
  background: var(--fp-bg-subtle);
  color: var(--fp-text-muted);
}

/* --------------------------------------------------------------------------
   Avatars
   -------------------------------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--fp-radius-full);
  object-fit: cover;
  background: var(--fp-primary-soft);
  color: var(--fp-primary);
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
  border: 2px solid var(--fp-bg-elevated);
  box-shadow: var(--fp-shadow-xs);
}

.avatar--sm {
  width: 2rem;
  height: 2rem;
  font-size: 0.75rem;
}

.avatar--lg {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.125rem;
}

.avatar--xl {
  width: 5rem;
  height: 5rem;
  font-size: 1.5rem;
}

.avatar--placeholder {
  background: linear-gradient(135deg, var(--fp-primary), var(--fp-accent));
  color: #fff;
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  margin-left: -0.5rem;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.form-row {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-row--2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fp-text);
}

.form-label--required::after {
  content: " *";
  color: var(--fp-danger);
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--fp-text-muted);
}

.form-control {
  width: 100%;
  min-height: var(--fp-touch);
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-md);
  background: var(--fp-bg-elevated);
  color: var(--fp-text);
  transition:
    border-color var(--fp-transition),
    box-shadow var(--fp-transition);
}

.form-control:hover {
  border-color: var(--fp-border-strong);
}

.form-control:focus {
  outline: none;
  border-color: var(--fp-primary);
  box-shadow: 0 0 0 3px var(--fp-primary-soft);
}

.form-control::placeholder {
  color: var(--fp-text-muted);
}

.form-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--fp-bg-subtle);
}

textarea.form-control {
  min-height: 6rem;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8494' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.25rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: var(--fp-touch);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--fp-primary);
}

.form-error {
  font-size: 0.8125rem;
  color: var(--fp-danger);
}

.form-control.is-invalid {
  border-color: var(--fp-danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--fp-danger-soft);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-lg);
  background: var(--fp-bg-elevated);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th,
.table td {
  padding: 0.875rem 1rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--fp-border);
}

.table th {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--fp-bg-subtle);
}

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

.table tbody tr:hover {
  background: var(--fp-bg-subtle);
}

.table--compact th,
.table--compact td {
  padding: 0.625rem 0.875rem;
}

.table td.num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Chat bubbles
   -------------------------------------------------------------------------- */
.chat {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.chat-message {
  display: flex;
  gap: 0.625rem;
  max-width: 85%;
}

.chat-message--own {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.chat-message__bubble {
  padding: 0.75rem 1rem;
  border-radius: var(--fp-radius-lg);
  font-size: 0.9375rem;
  line-height: 1.45;
  word-break: break-word;
}

.chat-message:not(.chat-message--own) .chat-message__bubble {
  background: var(--fp-bg-subtle);
  border: 1px solid var(--fp-border);
  border-bottom-left-radius: var(--fp-radius-sm);
}

.chat-message--own .chat-message__bubble {
  background: var(--fp-primary);
  color: var(--fp-text-inverse);
  border-bottom-right-radius: var(--fp-radius-sm);
}

.chat-message__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--fp-text-muted);
}

.chat-message--own .chat-message__meta {
  justify-content: flex-end;
}

.chat-input {
  display: flex;
  gap: 0.625rem;
  padding: 0.875rem;
  border-top: 1px solid var(--fp-border);
  background: var(--fp-bg-elevated);
}

.chat-input .form-control {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Calendar list
   -------------------------------------------------------------------------- */
.calendar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calendar-item {
  display: flex;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: var(--fp-bg-elevated);
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-md);
  transition:
    border-color var(--fp-transition),
    box-shadow var(--fp-transition);
}

.calendar-item:hover {
  border-color: var(--fp-primary-muted);
  box-shadow: var(--fp-shadow-xs);
}

.calendar-item__date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  padding: 0.375rem 0.5rem;
  background: var(--fp-primary-soft);
  border-radius: var(--fp-radius-sm);
  text-align: center;
  flex-shrink: 0;
}

.calendar-item__day {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fp-primary);
  line-height: 1;
}

.calendar-item__month {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--fp-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-item__body {
  flex: 1;
  min-width: 0;
}

.calendar-item__title {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.calendar-item__time {
  font-size: 0.8125rem;
  color: var(--fp-text-muted);
}

.calendar-item--today {
  border-color: var(--fp-accent);
  background: linear-gradient(90deg, var(--fp-accent-soft), var(--fp-bg-elevated));
}

.calendar-item--today .calendar-item__date {
  background: var(--fp-accent);
}

.calendar-item--today .calendar-item__day,
.calendar-item--today .calendar-item__month {
  color: #fff;
}

/* --------------------------------------------------------------------------
   Photo grid
   -------------------------------------------------------------------------- */
.photo-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

@media (min-width: 640px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
  }
}

.photo-grid__item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--fp-radius-md);
  background: var(--fp-bg-subtle);
  cursor: pointer;
}

.photo-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--fp-transition-slow);
}

.photo-grid__item:hover img {
  transform: scale(1.05);
}

.photo-grid__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 0.625rem;
  background: linear-gradient(transparent 40%, rgba(0, 0, 0, 0.55));
  opacity: 0;
  transition: opacity var(--fp-transition);
}

.photo-grid__item:hover .photo-grid__overlay {
  opacity: 1;
}

.photo-grid__caption {
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
}

/* --------------------------------------------------------------------------
   Auth pages
   -------------------------------------------------------------------------- */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, var(--fp-primary-soft), transparent),
    radial-gradient(ellipse 60% 50% at 90% 90%, var(--fp-accent-soft), transparent),
    var(--fp-bg);
}

.auth-theme {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.auth-wrap {
  width: 100%;
  max-width: 26rem;
}

.auth-card {
  padding: 2rem clamp(1.5rem, 4vw, 2.25rem);
  background: var(--fp-bg-elevated);
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-xl);
  box-shadow: var(--fp-shadow-md);
}

.auth-card__brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-card__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.875rem;
  font-size: 1.75rem;
  background: var(--fp-primary-soft);
  border-radius: var(--fp-radius-lg);
}

.auth-card__title {
  margin: 0 0 0.375rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.auth-card__subtitle {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--fp-text-muted);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  font-size: 0.8125rem;
  color: var(--fp-text-muted);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--fp-border);
}

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--fp-text-muted);
}

.auth-footer a {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.text-muted { color: var(--fp-text-muted); }
.text-secondary { color: var(--fp-text-secondary); }
.text-primary { color: var(--fp-primary); }
.text-success { color: var(--fp-success); }
.text-danger { color: var(--fp-danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

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

.empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--fp-text-muted);
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.empty-state__title {
  margin: 0 0 0.375rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--fp-text);
}

.page-head--row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group input {
  flex: 1;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group__suffix {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--fp-surface-2, #f4f4f8);
  border: 1px solid var(--fp-border);
  border-left: 0;
  border-radius: 0 var(--fp-radius-sm, 8px) var(--fp-radius-sm, 8px) 0;
  color: var(--fp-text-muted);
  font-size: 0.9375rem;
  white-space: nowrap;
}

.stat-num--sm {
  font-size: 0.95rem;
  word-break: break-all;
}

.mail-actions summary {
  cursor: pointer;
  list-style: none;
}

.mail-actions summary::-webkit-details-marker {
  display: none;
}

.mail-actions__body {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--fp-surface-2, #f4f4f8);
  border-radius: var(--fp-radius-sm, 8px);
  display: grid;
  gap: 0.75rem;
}

.form--compact label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.panel--muted {
  background: var(--fp-surface-2, #f4f4f8);
}

.dl {
  display: grid;
  gap: 0.75rem;
}

.dl--compact {
  grid-template-columns: minmax(8rem, 30%) 1fr;
  gap: 0.5rem 1rem;
}

.dl dt {
  margin: 0;
  font-weight: 600;
  color: var(--fp-text-secondary);
}

.dl dd {
  margin: 0;
}

.badge--ok {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.badge--muted {
  background: rgba(100, 116, 139, 0.15);
  color: var(--fp-text-muted);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.panel--warn {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.08);
}

.dns-steps {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.5rem;
}

.dns-status-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.dns-status {
  display: grid;
  gap: 0.2rem;
  padding: 0.875rem 1rem;
  border-radius: var(--fp-radius-sm, 8px);
  border: 1px solid var(--fp-border);
  background: var(--fp-bg-elevated);
}

.dns-status strong {
  font-size: 0.9375rem;
}

.dns-status span {
  color: var(--fp-text-muted);
  font-size: 0.875rem;
  word-break: break-word;
}

.dns-status--ok {
  border-color: rgba(34, 197, 94, 0.35);
}

.dns-status--warn {
  border-color: rgba(245, 158, 11, 0.45);
}

.dns-status--error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.06);
}

.dns-record__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.dns-record__head h2 {
  margin: 0 0.5rem 0 0;
  display: inline;
}

.dns-record__value {
  word-break: break-all;
  white-space: pre-wrap;
}

.dns-record__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.badge--warn {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

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

.mail-inbox__item {
  padding: 1rem;
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-sm, 8px);
  background: var(--fp-bg-elevated);
}

.mail-inbox__item--unread {
  border-color: var(--fp-primary-muted, #5b4fc7);
  background: linear-gradient(135deg, var(--fp-bg-elevated), rgba(91, 79, 199, 0.06));
}

.mail-inbox__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.mail-inbox__from {
  font-size: 0.875rem;
  color: var(--fp-text-secondary);
  margin-top: 0.25rem;
}

.mail-inbox__preview {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--fp-text-muted);
}

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

.mail-item {
  padding: 1rem;
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-sm, 8px);
}

.mail-item--handled {
  opacity: 0.7;
}

.mail-item__head {
  display: grid;
  gap: 0.25rem;
}

.mail-item__preview {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--fp-text-muted);
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
