*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    sans-serif;
  color: #0f172a;
  background: radial-gradient(circle at top left, #0f172a, #020617 45%, #020617);
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

#app {
  width: 100%;
  max-width: 1400px;
  margin: 24px;
  border-radius: 24px;
  background: linear-gradient(145deg, #020617 0%, #020617 50%, #020617 100%);
  color: #f9fafb;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 48px);
  box-shadow:
    0 24px 80px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.ts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  background: radial-gradient(circle at top left, #0f172a, #020617);
}

.ts-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ts-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: conic-gradient(
    from 180deg at 50% 50%,
    #22c55e,
    #06b6d4,
    #6366f1,
    #22c55e
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #0b1220;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.8),
    0 0 40px rgba(56, 189, 248, 0.8);
}

.ts-logo-text h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.ts-logo-text p {
  margin: 0;
  font-size: 12px;
  color: #9ca3af;
}

.ts-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ts-user-info {
  font-size: 13px;
  color: #e5e7eb;
  max-width: 190px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.ts-subscription-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.15);
  color: #a5f3fc;
  border: 1px solid rgba(45, 212, 191, 0.35);
}

.ts-subscription-badge.ts-subscription-active {
  background: rgba(22, 163, 74, 0.15);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.5);
}

.ts-subscription-badge.ts-subscription-inactive {
  background: rgba(30, 64, 175, 0.12);
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.4);
}

.ts-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px 18px 12px;
}

.ts-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ts-map-section {
  display: flex;
  flex-direction: column;
}

.ts-panel {
  background: radial-gradient(circle at top left, #020617, #020617 55%, #020617);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 16px 16px 14px;
  box-shadow:
    0 14px 45px rgba(15, 23, 42, 0.8),
    0 0 0 1px rgba(15, 23, 42, 0.8);
}

.ts-panel h2 {
  margin: 0 0 4px;
  font-size: 15px;
}

.ts-panel-subtitle {
  margin: 0 0 10px;
  font-size: 12px;
  color: #9ca3af;
}

.ts-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ts-panel-calendar {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ts-panel-map {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ts-map {
  flex: 1;
  border-radius: 14px;
  border: 1px solid rgba(55, 65, 81, 0.7);
  overflow: hidden;
  min-height: 400px;
}

.ts-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ts-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ts-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label {
  font-size: 12px;
  color: #e5e7eb;
}

input[type='text'],
input[type='date'],
input[type='number'] {
  border-radius: 12px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(circle at top left, #020617, #020617);
  color: #f9fafb;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

input::placeholder {
  color: #6b7280;
}

input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.ts-coords-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ts-help-text {
  margin: 0;
  font-size: 11px;
  color: #a1a1aa;
}

.ts-help-text-muted {
  color: #71717a;
}

.ts-btn {
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13px;
  padding: 7px 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: #e5e7eb;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.05s ease,
    box-shadow 0.15s ease,
    color 0.15s ease;
  outline: none;
}

.ts-btn:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.ts-btn-primary {
  background: linear-gradient(135deg, #22c55e, #22c55e, #06b6d4);
  border-color: rgba(34, 197, 94, 0.4);
  color: #022c22;
  box-shadow:
    0 12px 35px rgba(34, 197, 94, 0.3),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

.ts-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow:
    0 16px 45px rgba(34, 197, 94, 0.35),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
}

.ts-btn-ghost {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.7);
}

.ts-btn-ghost:hover:not(:disabled) {
  background: rgba(31, 41, 55, 0.9);
  border-color: rgba(156, 163, 175, 0.8);
}

.ts-btn-small {
  padding-inline: 10px;
  font-size: 12px;
}

.ts-btn-full {
  width: 100%;
  margin-top: 6px;
}

.ts-segment-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ts-segment-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 12px;
  background: radial-gradient(circle at top left, #020617, #020617);
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.ts-segment-index {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.6);
  color: #bfdbfe;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ts-segment-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ts-segment-location {
  font-size: 13px;
  font-weight: 500;
  color: #e5e7eb;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.ts-segment-dates {
  font-size: 11px;
  color: #9ca3af;
}

.ts-segment-meta {
  font-size: 11px;
  color: #6b7280;
  text-align: right;
}

.ts-footer {
  padding: 10px 18px 14px;
  font-size: 11px;
  color: #6b7280;
  border-top: 1px solid rgba(31, 41, 55, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Leaflet overrides for dark theme */
.leaflet-container {
  background: #020617;
}

.leaflet-control-zoom a {
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  border-radius: 8px;
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.leaflet-control-zoom a:hover {
  background: rgba(31, 41, 55, 0.95);
}

.leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.9);
  color: #9ca3af;
}

@media (max-width: 960px) {
  #app {
    margin: 16px;
  }

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

  .ts-sidebar {
    order: 2;
  }

  .ts-map-section {
    order: 1;
  }
}

@media (max-width: 640px) {
  #app {
    margin: 0;
    border-radius: 0;
  }

  .ts-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .ts-header-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}


