/* ============================================================
   COMPONENTS — Cards, buttons, forms, badges, modals
   ============================================================ */

/* === Cards ================================================= */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--shadow-sm);
}

.card--flat {
  box-shadow: none;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
}

.card__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--c-primary);
}

/* === Buttons =============================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-lg);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
  white-space: nowrap;
  min-height: 40px;
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.kb-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.kb-icon--sm { width: 14px; height: 14px; }
.kb-icon--md { width: 18px; height: 18px; }
.kb-icon--lg { width: 28px; height: 28px; }

.icon-stack {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--c-accent) 12%, var(--c-surface));
  color: var(--c-accent);
}

.event-link-card .icon,
.event-create-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--c-accent) 12%, var(--c-surface));
  color: var(--c-accent);
}

.event-link-card .icon .kb-icon,
.event-create-card .icon .kb-icon {
  width: 24px;
  height: 24px;
}

.event-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.event-tab .kb-icon {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--c-accent-hover);
  box-shadow: 0 4px 12px rgba(42, 125, 225, .25);
}

.btn-secondary {
  background: var(--c-surface);
  color: var(--c-primary);
  border-color: var(--c-border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--c-surface-alt);
  border-color: var(--c-accent);
}

.btn-danger {
  background: var(--c-error);
  color: #fff;
  border-color: var(--c-error);
}
.btn-danger:hover:not(:disabled) {
  background: #991b1b;
}

.btn-ghost {
  background: transparent;
  color: var(--c-text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--c-surface-alt);
  color: var(--c-text);
}

.btn-sm {
  min-height: 32px;
  padding: var(--sp-xs) var(--sp-md);
  font-size: 13px;
  border-radius: var(--r-sm);
}

.btn-secondary.active {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
}

.btn-group {
  display: inline-flex;
  gap: 1px;
  background: var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.btn-group .btn {
  border-radius: 0;
  border: none;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-sm);
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.page-actions-menu {
  position: relative;
}

.page-actions-menu > summary {
  list-style: none;
}

.page-actions-menu > summary::-webkit-details-marker {
  display: none;
}

.page-actions-menu__body {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  z-index: var(--z-overlay);
  display: grid;
  gap: var(--sp-xs);
  padding: var(--sp-sm);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--shadow-lg);
}

.page-actions-menu__body .btn {
  justify-content: flex-start;
  width: 100%;
}

.admin-filterbar,
.admin-tabbar {
  flex-wrap: wrap;
}

.advanced-actions {
  position: relative;
  display: inline-block;
}

.advanced-actions > summary {
  list-style: none;
}

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

.advanced-actions__body {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: var(--z-overlay);
  display: grid;
  gap: var(--sp-xs);
  min-width: 180px;
  padding: var(--sp-sm);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--shadow-lg);
}

.compliance-doc__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  cursor: pointer;
  list-style: none;
}

.compliance-doc__summary::-webkit-details-marker {
  display: none;
}

.compliance-doc[open] .compliance-doc__summary {
  margin-bottom: var(--sp-md);
}

.fleet-update-menu__body {
  min-width: 280px;
}

.fleet-update-menu__body .field__select {
  width: 100%;
}

.fleet-usage-panel {
  margin-bottom: 12px;
  padding: 0;
  border-radius: var(--r-md);
  box-shadow: none;
}

.fleet-usage-panel .card__header {
  min-height: 46px;
  margin-bottom: 0;
  padding: 0 var(--sp-lg);
}

.fleet-usage-panel #dataUsageBody {
  padding: 0 var(--sp-lg) var(--sp-md);
  border-top: 1px solid var(--c-border-light);
}

.fleet-kiosk-panel {
  padding: 0;
  border-radius: var(--r-md);
  overflow: visible;
}

.fleet-kiosk-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--c-border-light);
}

.fleet-kiosk-list {
  display: grid;
}

.fleet-kiosk-list__head,
.fleet-kiosk-list__row {
  display: grid;
  grid-template-columns:
    minmax(120px, 1.2fr)
    minmax(90px, .7fr)
    minmax(110px, .9fr)
    minmax(150px, 1.05fr)
    minmax(130px, .9fr)
    minmax(160px, 1fr);
  gap: 10px;
  align-items: center;
}

.fleet-kiosk-list__head {
  padding: 10px var(--sp-lg);
  border-bottom: 1px solid var(--c-border-light);
  background: var(--c-surface-alt);
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.fleet-kiosk-list__row {
  padding: 12px var(--sp-lg);
  border-bottom: 1px solid var(--c-border-light);
}

.fleet-kiosk-list__row:last-child {
  border-bottom: none;
}

.fleet-kiosk-list__row:hover {
  background: var(--c-surface-alt);
}

.fleet-kiosk-cell {
  min-width: 0;
  display: grid;
  gap: 6px;
  align-content: center;
}

.fleet-kiosk-cell::before {
  display: none;
}

.fleet-kiosk-name-row,
.fleet-kiosk-version-line,
.fleet-kiosk-health-line,
.fleet-kiosk-mini-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.fleet-kiosk-rename {
  min-height: 26px;
  padding: 2px 6px;
  font-size: 11px;
}

.fleet-kiosk-link {
  color: var(--c-accent);
  font-weight: 800;
  text-decoration: none;
}

.fleet-kiosk-link:hover {
  text-decoration: underline;
}

.fleet-kiosk-inline-field {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.fleet-kiosk-inline-field span {
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.fleet-kiosk-inline-field .field__select {
  width: 100%;
  height: 32px;
  min-height: 32px;
  padding: 0 28px 0 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
}

.fleet-kiosk-health-line {
  justify-content: space-between;
  gap: 10px;
}

.fleet-kiosk-health-line > span:first-child {
  color: var(--c-text-muted);
  font-size: 12px;
  font-weight: 700;
}

.fleet-kiosk-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.fleet-kiosk-actions .btn {
  min-height: 32px;
}

.fleet-kiosk-deploy {
  display: grid;
  gap: 5px;
}

.fleet-kiosk-deploy__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fleet-kiosk-deploy__bar {
  height: 5px;
  overflow: hidden;
  border-radius: var(--r-full);
  background: var(--c-border-light);
}

.fleet-kiosk-deploy__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--c-accent);
}

.fleet-player-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: 12px;
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-md);
  box-shadow: none;
}

.fleet-player-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
}

.fleet-player-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-sm);
}

.fleet-player-stat {
  min-width: 0;
  padding: var(--sp-md);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
}

.fleet-player-stat__label,
.fleet-player-mini-label {
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.fleet-player-stat__value {
  margin-top: 2px;
  color: var(--c-primary);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.1;
}

.fleet-player-stat__detail {
  margin-top: 3px;
  color: var(--c-text-muted);
  font-size: 12px;
}

.fleet-player-release-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-md);
  box-shadow: none;
}

.fleet-player-release-field {
  min-width: 0;
}

.fleet-player-release-note {
  align-self: end;
}

.fleet-player-panel {
  padding: 0;
  border-radius: var(--r-md);
  overflow: visible;
}

.fleet-player-panel__header {
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--c-border-light);
}

.fleet-player-list {
  display: grid;
}

.fleet-player-list__head,
.fleet-player-row {
  display: grid;
  grid-template-columns:
    minmax(118px, .9fr)
    minmax(112px, .8fr)
    minmax(170px, 1.1fr)
    minmax(136px, .9fr)
    minmax(184px, 1fr);
  gap: 10px;
  align-items: center;
}

.fleet-player-list__head {
  padding: 10px var(--sp-lg);
  border-bottom: 1px solid var(--c-border-light);
  background: var(--c-surface-alt);
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.fleet-player-row {
  padding: 12px var(--sp-lg);
  border-bottom: 1px solid var(--c-border-light);
}

.fleet-player-row:last-child {
  border-bottom: none;
}

.fleet-player-row:hover {
  background: var(--c-surface-alt);
}

.fleet-player-cell {
  min-width: 0;
  display: grid;
  gap: 6px;
  align-content: center;
}

.fleet-player-cell::before {
  display: none;
}

.fleet-player-name-line,
.fleet-player-health__line,
.fleet-player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.fleet-player-name-line strong,
.fleet-player-kit strong,
.fleet-player-planning strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fleet-player-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.fleet-player-ip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, .24);
  background: rgba(14, 165, 233, .1);
  color: var(--c-primary);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.fleet-player-ip--missing {
  border-color: var(--c-border-light);
  background: var(--c-surface-alt);
  color: var(--c-text-muted);
  font-weight: 600;
}

.fleet-player-kit,
.fleet-player-health,
.fleet-player-planning,
.fleet-player-planning__current,
.fleet-player-planning__next,
.fleet-player-planning__slot {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.fleet-player-planning__more {
  margin-top: 2px;
}

.fleet-player-planning__more > summary {
  color: var(--c-accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}

.fleet-player-planning__more > summary::-webkit-details-marker {
  display: none;
}

.fleet-player-cell--actions {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.fleet-player-actions {
  justify-content: flex-end;
  gap: 6px;
}

.fleet-player-actions .btn {
  min-height: 32px;
  padding-inline: 10px;
}

@media (min-width: 1120px) {
  .fleet-player-top {
    grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr);
    align-items: stretch;
  }

  .fleet-player-release-panel {
    grid-template-columns: minmax(0, 1fr) minmax(240px, .9fr) auto;
    align-items: end;
  }
}

@media (max-width: 980px) {
  .fleet-kiosk-list__head {
    display: none;
  }

  .fleet-kiosk-list__row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: var(--sp-md);
  }

  .fleet-kiosk-cell::before {
    content: attr(data-label);
    display: block;
    color: var(--c-text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .fleet-kiosk-inline-field {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .fleet-kiosk-actions {
    justify-content: flex-start;
  }

  .fleet-player-list__head {
    display: none;
  }

  .fleet-player-row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: var(--sp-md);
  }

  .fleet-player-cell::before {
    content: attr(data-label);
    display: block;
    color: var(--c-text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .fleet-player-cell--actions {
    grid-template-columns: 1fr;
  }

  .fleet-player-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .fleet-player-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fleet-player-actions .btn {
    flex: 1 1 calc(50% - 8px);
  }

  .fleet-player-cell--actions .dropdown-wrap {
    justify-self: start;
  }
}

.responsive-table {
  width: 100%;
}

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

.setup-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr);
  gap: 20px;
  align-items: center;
}

.setup-hero__action {
  padding: 18px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(0,128,121,.12), rgba(31,41,55,.08));
}

.setup-steps__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-md);
}

.setup-steps__grid > div {
  display: grid;
  gap: 6px;
  padding: var(--sp-md);
  border: 1px solid var(--c-border-light);
  border-radius: var(--r-md);
  background: var(--c-surface-alt);
}

.setup-steps__grid span {
  color: var(--c-text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .page-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .page-actions .btn,
  .page-actions-menu {
    flex: 1 1 auto;
  }

  .page-actions-menu__body,
  .advanced-actions__body {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 88px;
    width: auto;
  }

  .admin-filterbar,
  .admin-tabbar {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .admin-filterbar .btn,
  .admin-tabbar .btn {
    flex: 0 0 auto;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--c-border-light);
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0 !important;
    text-align: left !important;
    white-space: normal !important;
  }

  .responsive-table td::before {
    content: attr(data-label);
    text-align: left;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--c-text-muted);
  }

  .responsive-table td > * {
    min-width: 0;
  }

  .software-release-table td[data-label="Actions"] {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 12px;
    justify-items: stretch;
  }

  .software-release-table td[data-label="Actions"]::before {
    margin-bottom: 0;
  }

  .software-release-table td[data-label="Actions"] .btn,
  .software-release-table td[data-label="Actions"] .advanced-actions {
    grid-column: 2;
    width: 100%;
  }

  .setup-hero__grid,
  .setup-steps__grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .setup-hero__action {
    padding: 14px;
  }
}

/* === Form fields =========================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.field__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text-secondary);
}

.field__input,
.field__select {
  height: 40px;
  padding: 0 var(--sp-md);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  font-size: 14px;
  color: var(--c-text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.field__input::placeholder {
  color: var(--c-text-muted);
}

.field__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b7086' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field__textarea {
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  font-size: 14px;
  color: var(--c-text);
  resize: vertical;
  min-height: 80px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field__textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

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

.field__error {
  font-size: 12px;
  color: var(--c-error);
  font-weight: 600;
}

/* Form row — horizontal fields on desktop */
.form-row {
  display: grid;
  gap: var(--sp-md);
}
@media (min-width: 480px) {
  .form-row--2 { grid-template-columns: 1fr 1fr; }
  .form-row--auto { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (min-width: 640px) {
  .form-row--3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* === Badges ================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--online  { background: #16a34a; color: #fff; }
.badge--offline { background: #dc2626; color: #fff; }
.badge--warning { background: #d97706; color: #fff; }
.badge--info    { background: var(--c-accent-soft); color: var(--c-accent); }
.badge--neutral { background: var(--c-border-light); color: var(--c-text-secondary); }

.badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* === Device strip (kiosk + player + LED on one line) ======= */
.device-strip {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.device-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-xs) var(--sp-md);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
}

.device-chip__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--c-text-muted);
}

.device-chip__status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.device-chip__status--ok     { background: var(--c-success); }
.device-chip__status--warn   { background: var(--c-warn); }
.device-chip__status--off    { background: var(--c-text-muted); }
.device-chip__status--error  { background: var(--c-error); }

/* === KPI cards ============================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-md);
}

.kpi {
  padding: var(--sp-md);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
}

.kpi__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  margin-bottom: var(--sp-xs);
}

.kpi__value {
  font-size: 22px;
  font-weight: 900;
  color: var(--c-primary);
  line-height: 1;
}

/* === Event list ============================================ */
.event-list {
  display: grid;
  gap: var(--sp-md);
}

.event-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-md);
  padding: var(--sp-lg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  cursor: pointer;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.event-row:hover {
  border-color: var(--c-accent);
  box-shadow: var(--shadow-md);
}

@media (min-width: 640px) {
  .event-row {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

.event-row__name {
  font-size: 15px;
  font-weight: 800;
  color: var(--c-primary);
}

.event-row__date {
  font-size: 13px;
  color: var(--c-text-secondary);
}

.event-row__client {
  font-size: 13px;
  color: var(--c-text-muted);
}

/* === Section blocks (for event detail) ===================== */
.section-block {
  display: grid;
  gap: var(--sp-md);
}

.section-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
}

.section-block__title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-secondary);
}

/* === Collapsible section blocks ============================= */
.section-block--collapsible .section-block__header {
  cursor: pointer;
  user-select: none;
}

.section-block--collapsible .section-block__header::after {
  content: '\25BC';
  font-size: 10px;
  color: var(--c-text-muted);
  transition: transform .2s var(--ease);
}

.section-block--collapsible.collapsed .section-block__header::after {
  transform: rotate(-90deg);
}

.section-block--collapsible.collapsed > :not(.section-block__header) {
  display: none;
}

/* === LED scene cards ======================================= */
.led-scenes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--sp-md);
}

.led-scene {
  padding: var(--sp-md);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  text-align: center;
}

.led-scene__preview {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto var(--sp-sm);
  border: 3px solid var(--c-border-light);
}

.led-scene__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-primary);
}

.led-scene__meta {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 2px;
}

/* === Modal ================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: grid;
  place-items: center;
  z-index: var(--z-modal);
  padding: var(--sp-lg);
}

.modal-overlay--dialog,
.modal-overlay:has(.confirm-actions) {
  z-index: 1500;
}

.modal {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  padding: var(--sp-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
}

.modal__title {
  font-size: 18px;
  font-weight: 800;
  color: var(--c-primary);
}

/* === Kiosk diagnostic modal ================================ */
.diag-header-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.diag-compact {
  display: grid;
  gap: var(--sp-md);
}

.diag-recommendation {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-md);
  padding: var(--sp-md);
  border: 1px solid var(--c-border);
  border-left-width: 4px;
  border-radius: var(--r-md);
  background: var(--c-surface-alt);
}

.diag-recommendation--online { border-left-color: var(--c-success); }
.diag-recommendation--warning { border-left-color: var(--c-warn); }
.diag-recommendation--offline { border-left-color: var(--c-error); }

.diag-recommendation__body {
  display: grid;
  gap: var(--sp-sm);
}

.diag-recommendation__body .badge {
  justify-self: start;
  white-space: normal;
}

.diag-recommendation__text {
  color: var(--c-text-secondary);
  font-size: 13px;
}

.diag-recommendation__actions,
.diag-action-row,
.diag-accordion-actions,
.diag-danger-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.diag-section {
  display: grid;
  gap: var(--sp-sm);
}

.diag-section--actions {
  padding: var(--sp-md);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
}

.diag-section__title,
.diag-subtitle {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-secondary);
}

.diag-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-sm);
}

.diag-summary-card {
  min-width: 0;
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--c-border);
  border-left-width: 4px;
  border-radius: var(--r-sm);
  background: var(--c-surface);
}

.diag-summary-card--online { border-left-color: var(--c-success); }
.diag-summary-card--warning { border-left-color: var(--c-warn); }
.diag-summary-card--offline { border-left-color: var(--c-error); }
.diag-summary-card--neutral { border-left-color: var(--c-border); }

.diag-summary-card__label {
  margin-bottom: 3px;
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.diag-summary-card__value {
  min-width: 0;
  color: var(--c-primary);
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.diag-summary-card__detail {
  margin-top: 2px;
  color: var(--c-text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.diag-healthcheck {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-sm);
  align-items: start;
  padding: var(--sp-md);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
}

.diag-healthcheck__summary {
  grid-column: 1 / -1;
  color: var(--c-text-secondary);
  font-size: 13px;
}

.diag-accordion {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  overflow: hidden;
}

.diag-accordion > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  list-style: none;
  padding: var(--sp-sm) var(--sp-md);
  color: var(--c-primary);
  font-weight: 900;
  cursor: pointer;
}

.diag-accordion > summary::-webkit-details-marker {
  display: none;
}

.diag-accordion > summary::after {
  content: '\25BC';
  color: var(--c-text-muted);
  font-size: 10px;
  transition: transform .2s var(--ease);
}

.diag-accordion:not([open]) > summary::after {
  transform: rotate(-90deg);
}

.diag-accordion__body {
  display: grid;
  gap: var(--sp-md);
  padding: 0 var(--sp-md) var(--sp-md);
}

.diag-accordion-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-md);
}

.diag-danger-actions {
  padding-top: var(--sp-xs);
}

@media (min-width: 760px) {
  .diag-recommendation,
  .diag-section--actions {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

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

@media (max-width: 640px) {
  .diag-summary-grid {
    grid-template-columns: 1fr;
  }

  .diag-recommendation__actions .btn,
  .diag-action-row .btn,
  .diag-accordion-actions .btn,
  .diag-danger-actions .btn {
    width: 100%;
  }
}

/* === Toast / Message ======================================= */
.toast {
  position: fixed;
  bottom: var(--sp-xl);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--sp-sm) var(--sp-xl);
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  z-index: var(--z-toast);
  animation: toast-in .25s var(--ease);
  box-shadow: var(--shadow-lg);
}

.toast--success { background: var(--c-success); color: #fff; }
.toast--error   { background: var(--c-error);   color: #fff; }
.toast--info    { background: var(--c-primary);  color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === Progress bar ========================================== */
.progress-bar {
  height: 8px;
  background: var(--c-border-light);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width .4s var(--ease);
}

/* === Data table ============================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 2px solid var(--c-border);
}

.data-table td {
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--c-border-light);
  color: var(--c-text);
}

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

.data-table tr:hover td { background: var(--c-surface-alt); }

@media (max-width: 640px) {
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: var(--sp-xs) var(--sp-sm); }
}

/* === Color swatch ========================================== */
.color-swatch {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 2px solid var(--c-border);
  vertical-align: middle;
}

/* === Confirm dialog ======================================== */
.confirm-actions {
  display: flex;
  gap: var(--sp-sm);
  justify-content: flex-end;
  margin-top: var(--sp-lg);
}

/* === Empty state =========================================== */
.empty-state {
  display: grid;
  place-items: center;
  gap: var(--sp-md);
  padding: var(--sp-3xl) var(--sp-lg);
  text-align: center;
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  color: var(--c-text-muted);
  opacity: .5;
}

.empty-state__text {
  font-size: 15px;
  color: var(--c-text-muted);
  max-width: 340px;
}

/* === Spinner =============================================== */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

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

.spinner--sm { width: 18px; height: 18px; border-width: 2px; }

/* === Skeleton loading ====================================== */
.skeleton {
  background: linear-gradient(90deg, var(--c-border-light) 25%, var(--c-border) 50%, var(--c-border-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease infinite;
  border-radius: var(--r-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton-card {
  height: 80px;
  border-radius: var(--r-lg);
  margin-bottom: 12px;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === FAB (floating action button) ========================== */
.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--c-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(42, 125, 225, .35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  font-size: 24px;
  font-weight: 700;
}
.fab:hover { transform: scale(1.08); }
.fab:active { transform: scale(.95); }

.fab-menu {
  position: fixed;
  bottom: 84px;
  right: 20px;
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  align-items: flex-end;
}
.fab-menu.open { display: flex; }

.fab-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  cursor: pointer;
  white-space: nowrap;
}
.fab-menu__item:hover { background: var(--c-surface-alt); }

@media (max-width: 1023px) { .fab { display: flex; } }
@media print { .fab, .fab-menu { display: none !important; } }

/* === Collapsible sections ================================== */
.section-block--collapsible .section-block__header {
  cursor: pointer;
  user-select: none;
}

.section-block--collapsible .section-block__header::after {
  content: '\25BC';
  font-size: 10px;
  color: var(--c-text-muted);
  transition: transform .2s var(--ease);
}

.section-block--collapsible.collapsed .section-block__header::after {
  transform: rotate(-90deg);
}

.section-block--collapsible.collapsed > :not(.section-block__header) {
  display: none;
}

/* === Dropdown menu (3 dots) ================================ */
.dropdown-wrap { position: relative; display: inline-block; }

.dropdown-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--c-border); border-radius: var(--r-sm);
  background: var(--c-surface); cursor: pointer;
  font-size: 18px; color: var(--c-text-secondary);
}
.dropdown-trigger:hover { background: var(--c-surface-alt); }
.dropdown-trigger .kb-icon { width: 18px; height: 18px; }

.dropdown-menu {
  display: none; position: absolute; right: 0; top: 100%; margin-top: 4px;
  min-width: 180px; background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden;
}
.dropdown-menu.open { display: block; }

.dropdown-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px; border: none; background: none;
  text-align: left; font-size: 14px; font-weight: 600; color: var(--c-text); cursor: pointer;
}
.dropdown-item .kb-icon { width: 15px; height: 15px; }
.dropdown-item:hover { background: var(--c-surface-alt); }
.dropdown-item--danger { color: var(--c-error); }
.dropdown-item--danger:hover { background: var(--c-error-bg); }

/* === Section help text ===================================== */
.section-help { font-size: 12px; color: var(--c-text-muted); margin-top: 2px; font-style: italic; }

/* === Login card ============================================ */
.login-card {
  width: 100%;
  max-width: 400px;
  padding: var(--sp-2xl);
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}

.login-card__brand {
  text-align: center;
  margin-bottom: var(--sp-xl);
}

.login-card__brand-name {
  font-size: 24px;
  font-weight: 900;
  color: var(--c-primary);
}

.login-card__brand-sub {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-top: var(--sp-xs);
}

.login-card .field + .field {
  margin-top: var(--sp-md);
}

.login-card .btn {
  width: 100%;
  margin-top: var(--sp-lg);
}

.login-card__error {
  margin-top: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-md);
  background: var(--c-error-bg);
  color: var(--c-error);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
