/* ==========================================================================
   Thema Logistics UI — built on ThemaSolutions tokens
   ========================================================================== */

:root {
  --ts-safe-top: env(safe-area-inset-top, 0px);
  --ts-safe-bottom: env(safe-area-inset-bottom, 0px);
}

body.theme-dark {
  background: inherit;
  color: inherit;
}

/* ----------------------------- Layout ----------------------------------- */

.ts-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.ts-app__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: calc(48px + var(--ts-safe-bottom));
}

.ts-app__body--stretch {
  flex: 1;
  padding-bottom: calc(16px + var(--ts-safe-bottom));
  min-height: 0;
}

.ts-app__body--stretch > .ts-section,
.ts-app__body--stretch > .ts-map-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ts-app__body--no-nav {
  padding-bottom: 24px;
}

/* ----------------------------- Top bar ---------------------------------- */

.ts-topbar {
  position: sticky;
  top: 0;
  inset-inline: 0;
  z-index: 90;
  padding: calc(10px + var(--ts-safe-top)) 0 12px;
  background: transparent;
  border-bottom: none;
  backdrop-filter: none;
}

.ts-topbar__inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ts-topbar__title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  font-family: var(--ts-font-heading, "Manrope", "Segoe UI", sans-serif);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ts-topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ts-topbar__badge {
  background: rgba(34, 211, 238, 0.16);
  color: var(--ts-accent, #22d3ee);
}

.ts-nav--app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.ts-nav--app .ts-nav__brand {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.ts-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius:0;
  background: rgba(79, 140, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(79, 140, 255, 0.25);
  color: #dbe7ff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ts-header-badge__dot {
  width: 8px;
  height: 8px;
  border-radius:0;
  background: linear-gradient(135deg, #38bdf8, #4f8cff);
  box-shadow: 0 0 8px rgba(79, 140, 255, 0.45);
}

.ts-header-badge__label {
  display: inline-block;
}

.ts-nav__brand-text {
  font-family: var(--ts-font-heading, "Manrope", "Segoe UI", sans-serif);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: #f8fafc;
}

.ts-nav--app .ts-nav__links {
  gap: 24px;
}

.ts-home-hero__surface {
  display: grid;
  gap: clamp(16px, 4vw, 24px);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: stretch;
}

.ts-home-hero__content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ts-home-hero__title {
  font-family: var(--ts-font-heading, "Manrope", "Segoe UI", sans-serif);
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  margin: 0;
}

.ts-home-hero__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.action-chip:hover,
.action-chip:focus-visible {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.45);
}

.action-chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 1.1rem;
  font-weight: 700;
}

.action-chip__icon--minus {
  font-size: 1.3rem;
  line-height: 1;
}

.ts-home-hero__search {
  display: grid;
  gap: 12px;
  align-content: start;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.ts-home-actions {
  display: grid;
  gap: clamp(16px, 4vw, 24px);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.ts-home-card {
  display: flex;
  gap: 16px;
  justify-content: stretch;
  text-decoration: none;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.8);
  padding: clamp(16px, 3vw, 20px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.ts-home-card:hover,
.ts-home-card:focus-visible {
  border-color: rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
}

.ts-home-card--primary {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(34, 211, 238, 0.12));
  border-color: rgba(59, 130, 246, 0.35);
}

.ts-home-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(48px, 6vw, 64px);
  min-width: 48px;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
}

.ts-home-card__glyph {
  filter: drop-shadow(0 6px 18px rgba(15, 23, 42, 0.45));
}

.ts-home-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: inherit;
}

.ts-home-card__title {
  margin: 0;
  font-family: var(--ts-font-heading, "Manrope", "Segoe UI", sans-serif);
  font-size: 1.1rem;
}

.ts-home-card__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ts-home-card__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.12);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cbd5f5;
}

.ts-home-card--primary .ts-home-card__pill {
  border-color: rgba(59, 130, 246, 0.42);
  background: rgba(59, 130, 246, 0.18);
}

.ts-nav--app .ts-button {
  margin-left: auto;
  flex-shrink: 0;
}

.ts-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  line-height: 1;
  padding: 10px 18px;
  border-radius:0;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
  color: #0f172a;
  background: linear-gradient(135deg, var(--ts-primary, #3b82f6), var(--ts-accent, #22d3ee));
  box-shadow: 0 20px 36px -24px rgba(59, 130, 246, 0.65);
}

.ts-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 26px 40px -22px rgba(59, 130, 246, 0.7);
}

.ts-button:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.9);
  outline-offset: 2px;
}

.ts-button:active {
  transform: translateY(0);
  box-shadow: 0 10px 24px -18px rgba(59, 130, 246, 0.7);
}

.ts-button--xs {
  padding: 6px 14px;
  font-size: 0.78rem;
}

.ts-shell__body {
  gap: 12px;
}

.ts-shell__footer {
  display: none;
  width: 100%;
}

@media (max-width: 960px) {
  .ts-nav--app {
    gap: 16px;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  .ts-nav--app .ts-nav__links {
    display: none;
  }

  .ts-nav--app .ts-nav__brand {
    flex: 1 1 auto;
  }

  .ts-nav--app .ts-button {
    margin-left: 16px;
  }

  .ts-shell__footer {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .ts-bottom-nav {
    display: flex !important;
  }

  .ts-shell {
    padding-bottom: calc(96px + var(--ts-safe-bottom, 0px));
  }
}

/* ----------------------------- Surfaces --------------------------------- */

.ts-section-title {
  font-family: var(--ts-font-heading, "Manrope", "Segoe UI", sans-serif);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin: 0 0 12px 0;
}

.ts-card-title {
  font-family: var(--ts-font-heading, "Manrope", "Segoe UI", sans-serif);
  font-size: 1.05rem;
  margin: 0;
}

.ts-emphasis {
  font-weight: 700;
}

.ts-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius:0;
  background: rgba(59, 130, 246, 0.14);
  color: var(--ts-primary-accent, #60a5fa);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ts-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius:0;
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  background: rgba(255, 255, 255, 0.04);
  color: var(--ts-text-muted, #94a3b8);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}

.ts-pill.is-active {
  background: linear-gradient(135deg, var(--ts-primary, #3b82f6), var(--ts-accent, #22d3ee));
  color: #ffffff;
  border-color: transparent;
  box-shadow: var(--ts-shadow, 0 30px 60px -40px rgba(15, 118, 110, 0.6));
}

.ts-pill.is-active .ts-badge {
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
}

/* ----------------------------- Forms ------------------------------------ */

.ts-form-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ts-text-muted, #94a3b8);
}

.ts-form-note {
  font-size: 0.85rem;
  color: var(--ts-text-muted, #94a3b8);
}

.ts-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.ts-field-row > * {
  flex: 1 1 auto;
}

.ts-field-row > .ts-button {
  flex: 0 0 auto;
}

.ts-field-row--compact {
  gap: 10px;
}

.ts-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}

.ts-checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--ts-primary, #3b82f6);
}

.ts-choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Buttons */

.ts-button--neutral {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  color: var(--ts-text-muted, #94a3b8);
  box-shadow: none;
}

.ts-button--success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.ts-button--warning {
  background: linear-gradient(135deg, #f59e0b, #f97316);
}

.ts-button--danger {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.ts-button--block {
  width: 100%;
  justify-content: center;
}

.ts-button--pill {
  border-radius:0;
}

.ts-button--sm {
  padding: 10px 18px;
  font-size: 0.85rem;
}

.ts-button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ----------------------------- Project bar ------------------------------ */

.ts-project-switcher {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  max-width: min(420px, 100%);
  margin: 0 0 12px 0;
}

.ts-project-switcher__label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ts-text-muted, #94a3b8);
}

.ts-project-switcher__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ts-project-switcher__select {
  flex: 0 1 260px;
  min-width: 200px;
  max-width: 280px;
  width: 100%;
  padding: 8px 12px;
  line-height: 1.2;
}

.ts-project-switcher__status {
  display: none;
  font-size: 0.85rem;
  color: var(--ts-text-muted, #94a3b8);
}

.ts-project-switcher__status.is-visible {
  display: block;
}

.ts-project-switcher--compact {
  gap: 6px;
  max-width: min(360px, 100%);
}

.ts-project-switcher--compact .ts-project-switcher__select {
  min-width: 170px;
}
/* ----------------------------- Tables ----------------------------------- */

.ts-table-scroll {
  overflow: hidden;
  border-radius:0;
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  background: rgba(16, 23, 34, 0.72);
}

.ts-table-scroll + .ts-table-scroll {
  margin-top: 18px;
}

.ts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.ts-table thead th {
  text-align: left;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ts-text-muted, #94a3b8);
  padding: 16px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(10, 13, 18, 0.5);
}

.ts-table tbody td {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.ts-table tbody tr:last-child td {
  border-bottom: none;
}

.ts-table__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.ts-table__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ts-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius:0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ts-text-muted, #94a3b8);
}

.ts-tag--success {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}

.ts-tag--warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

.ts-tag--danger {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
}

.ts-tag--info {
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
}

.ts-table__meta {
  color: var(--ts-text-muted, #94a3b8);
  font-size: 0.85rem;
}

/* ----------------------------- Inventory -------------------------------- */

.ts-filter-card {
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) {
  .ts-filter-card {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.ts-inventory-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ts-inventory-list {
  display: grid;
  gap: 16px;
}

@media (min-width: 680px) {
  .ts-inventory-list {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

.ts-inventory-item {
  border-radius:0;
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  background: rgba(16, 23, 34, 0.85);
  box-shadow: var(--ts-shadow, 0 30px 60px -40px rgba(15, 118, 110, 0.6));
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ts-inventory-item__title {
  font-family: var(--ts-font-heading, "Manrope", "Segoe UI", sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
}

.ts-inventory-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--ts-text-muted, #94a3b8);
  font-size: 0.9rem;
}

.ts-inventory-item__serial,
.ts-inventory-item__notes {
  color: var(--ts-text-muted, #94a3b8);
  font-size: 0.9rem;
}

.ts-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius:0;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ts-text-muted, #94a3b8);
}

.ts-chip--accent {
  background: rgba(59, 130, 246, 0.16);
  color: var(--ts-primary-accent, #60a5fa);
}

.ts-color-swatch {
  width: 38px;
  height: 38px;
  border-radius:0;
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  background: rgba(255, 255, 255, 0.04);
}

.ts-inventory-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.ts-inventory-item__actions .ts-button {
  flex: 0 0 auto;
}

.ts-inventory-children {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  margin-top: 4px;
  border-left: 2px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.35);
  border-radius:0;
}

.ts-inventory-children.is-collapsed {
  display: none !important;
}

.ts-inventory-child {
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  background: rgba(15, 23, 42, 0.45);
  border-radius:0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ts-inventory-child__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ts-inventory-child__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.ts-inventory-child__serial,
.ts-inventory-child__notes {
  color: var(--ts-text-muted, #94a3b8);
  font-size: 0.85rem;
}

.ts-inventory-child__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--ts-text-muted, #94a3b8);
}

.ts-inventory-child__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ts-empty {
  padding: 28px;
  text-align: center;
  border-radius:0;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ts-text-muted, #94a3b8);
  font-size: 0.95rem;
}

/* ----------------------------- Admin ------------------------------------ */

.ts-admin-shell {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: min(1080px, 96vw);
  margin: 0 auto;
  padding-inline: clamp(12px, 4vw, 24px);
}

.ts-admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  row-gap: 6px;
  padding: 0;
  margin: 10px 0 0;
  width: 100%;
  align-items: center;
}

.ts-admin-tab {
  flex: 0 0 auto;
  padding: 10px 18px;
  border-radius:0;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ts-text-muted, #94a3b8);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}

.ts-admin-tab.is-active {
  background: linear-gradient(135deg, var(--ts-primary, #3b82f6), var(--ts-accent, #22d3ee));
  color: #ffffff;
  box-shadow: var(--ts-shadow, 0 30px 60px -40px rgba(15, 118, 110, 0.6));
}

.ts-admin-config {
  position: relative;
  display: none;
}

.ts-admin-config__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ts-admin-config__label {
  white-space: nowrap;
}

.ts-admin-config__current {
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.ts-admin-config__chevron {
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.ts-admin-config__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 8px;
  border-radius:0;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(6, 12, 22, 0.96);
  box-shadow: 0 20px 40px -32px rgba(6, 12, 22, 0.8);
  z-index: 40;
}

.ts-admin-config__menu[hidden] {
  display: none !important;
}

.ts-admin-config__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius:0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ts-text, #e2e8f0);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border 0.2s ease;
}

.ts-admin-config__item:hover,
.ts-admin-config__item:focus-visible {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.32);
}

.ts-admin-config__trigger.is-open .ts-admin-config__chevron {
  transform: rotate(-135deg);
}

.ts-admin-panels {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  width: 100%;
}

.ts-admin-panel {
  display: none;
  margin: 0;
}

.ts-admin-panel.is-active {
  display: block;
}

.ts-admin-inventory-grid {
  display: grid;
  gap: 18px;
}

.ts-admin-two-up {
  display: grid;
  gap: 16px;
}

@media (min-width: 720px) {
  .ts-admin-two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ts-color-input {
  width: 56px;
  height: 40px;
  border-radius:0;
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  background: transparent;
  padding: 4px;
  cursor: pointer;
}

.ts-log-surface {
  border-radius:0;
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  background: rgba(15, 18, 26, 0.8);
  padding: 0;
  overflow: hidden;
}

.ts-log-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
}

.ts-progress {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius:0;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.ts-progress__bar {
  position: absolute;
  inset: 0;
  width: 0;
  border-radius:0;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  transition: width 0.3s ease;
}

.ts-log-output {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 20px;
  font-family: "JetBrains Mono", Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  color: #e5edff;
  background: rgba(0, 0, 0, 0.25);
}

/* ----------------------------- Map -------------------------------------- */

.ts-map-shell {
  width: min(1100px, 94vw);
  margin: 0 auto;
  flex: 1;
  display: flex;
  min-height: 0;
  align-items: stretch;
}

.ts-map-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius:0;
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  background: rgba(15, 18, 26, 0.9);
  overflow: hidden;
  box-shadow: var(--ts-shadow, 0 30px 60px -40px rgba(15, 118, 110, 0.6));
}

.ts-map {
  position: absolute;
  inset: 0;
}

.ts-map .ts-map-tile-smooth {
  opacity: 0;
  transition: opacity 320ms ease;
}

.ts-map .ts-map-tile-smooth.leaflet-tile-loaded {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .ts-map .ts-map-tile-smooth {
    transition: none;
  }
}

.ts-map-ui {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius:0;
  background: rgba(7, 12, 20, 0.72);
  border: 1px solid rgba(59, 130, 246, 0.2);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 22px 60px -32px rgba(6, 20, 37, 0.9);
  z-index: 1200;
  pointer-events: auto;
}

.ts-map-button {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius:0;
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  background: rgba(15, 23, 42, 0.92);
  color: var(--ts-text, #e3edf8);
  cursor: pointer;
  box-shadow: 0 12px 30px -22px rgba(15, 23, 42, 0.9);
  transition: transform 0.2s ease, background 0.2s ease;
}

.ts-map-button:hover,
.ts-map-button:focus-visible {
  transform: translateY(-1px);
  background: rgba(59, 130, 246, 0.32);
}

.ts-map-button svg {
  pointer-events: none;
}

.ts-map-button--ready {
  background: linear-gradient(135deg, var(--ts-primary, #3b82f6), var(--ts-accent, #22d3ee));
  color: #ffffff;
  border-color: transparent;
  box-shadow: var(--ts-shadow, 0 30px 60px -40px rgba(15, 118, 110, 0.6));
}

/* ----------------------------- Bottom nav ------------------------------- */

.ts-bottom-nav {
  position: sticky;
  bottom: 0;
  inset-inline: 0;
  z-index: 80;
  width: min(680px, 92vw);
  margin: 0 auto calc(12px + var(--ts-safe-bottom));
  padding: 12px;
  display: none;
  gap: 10px;
  background: rgba(10, 13, 18, 0.82);
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.2));
  border-radius:0;
  backdrop-filter: blur(18px) saturate(140%);
}

.ts-bottom-nav__link {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius:0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ts-text-muted, #94a3b8);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ts-bottom-nav__link:hover,
.ts-bottom-nav__link:focus-visible {
  color: var(--ts-text, #e3edf8);
}

.ts-bottom-nav__link.is-active {
  background: linear-gradient(135deg, var(--ts-primary, #3b82f6), var(--ts-accent, #22d3ee));
  color: #ffffff;
  box-shadow: var(--ts-shadow, 0 30px 60px -40px rgba(15, 118, 110, 0.6));
}

@supports (gap: 12px) {
  .ts-bottom-nav {
    padding: 12px 14px;
  }
}

/* ----------------------------- Auth ------------------------------------- */

.ts-auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 6vw, 64px);
}

.ts-auth-card {
  width: min(420px, 94vw);
}

.ts-alert {
  border-radius:0;
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  padding: 16px;
}

/* ----------------------------- Utilities -------------------------------- */

.ts-hidden {
  display: none !important;
}

.ts-text-right {
  text-align: right;
}

.ts-nowrap {
  white-space: nowrap;
}

.ts-divider {
  width: 100%;
  height: 1px;
  background: rgba(148, 163, 184, 0.12);
}

.ts-scroll-y {
  overflow-y: auto;
}

.ts-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;
}

@media (max-width: 720px) {
  .ts-bottom-nav {
    width: min(520px, 94vw);
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(12px + var(--ts-safe-bottom, 0px));
    margin: 0;
  }

  .ts-topbar__inner {
    flex-wrap: wrap;
    gap: 10px;
  }

  .ts-topbar__title {
    order: -1;
    width: 100%;
  }

  .ts-topbar__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .ts-project-switcher {
    max-width: 100%;
  }

  .ts-project-switcher__controls {
    flex-wrap: wrap;
    gap: 10px;
  }

  .ts-project-switcher__select {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: 1 1 100%;
  }

  .ts-admin-config {
    display: block;
  }

  .ts-admin-tab[data-tab-target="categories"],
  .ts-admin-tab[data-tab-target="types"],
  .ts-admin-tab[data-tab-target="inventory"] {
    display: none;
  }

  .ts-admin-tab[data-tab-target="tiffs"],
  .ts-admin-tab[data-tab-target="users"] {
    display: none;
  }

  .ts-admin-config__menu {
    right: auto;
    left: 0;
  }
}

@media (max-width: 540px) {
  .ts-topbar {
    gap: 8px;
  }

  .ts-topbar__title {
    font-size: 1rem;
  }

  .ts-topbar__actions {
    gap: 6px;
  }

  .ts-button--sm {
    padding: 8px 14px;
  }
}






@media (max-width: 640px) {
  .ts-home-card--primary {
    grid-column: span 1;
  }

  .ts-home-hero__surface {
    grid-template-columns: 1fr;
  }

  .ts-home-hero__search {
    grid-template-columns: 1fr;
  }
}

/* ------------------------- Search select ------------------------------- */

.ts-search-select {
  position: relative;
  width: 100%;
}

.ts-search-select__anchor {
  position: relative;
  display: block;
  width: 100%;
}

.ts-search-select__anchor > .ts-input {
  width: 100%;
}

.ts-search-select__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 999;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.4);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.ts-search-select__header {
  padding: 10px 16px 6px;
  font-weight: 600;
  font-size: 0.88rem;
  opacity: 0.8;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.ts-search-select__list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}

.ts-search-select__option {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 16px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1.4;
}

.ts-search-select__option:focus {
  outline: none;
}

.ts-search-select__option.is-highlighted,
.ts-search-select__option:hover {
  background: rgba(79, 140, 255, 0.18);
}

.ts-search-select__option-label {
  display: block;
  font-weight: 600;
}

.ts-search-select__option-caption {
  display: block;
  font-size: 0.85rem;
  opacity: 0.78;
  margin-top: 2px;
}
.is-hidden {
  display: none !important;
}
