* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #1e1e2a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow: hidden;
}

.container {
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  min-height: 0;
}

header {
  background: #ffffff;
  padding: 14px 20px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

h1 {
  color: #667eea;
  font-size: 1.85em;
}

.app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: transparent;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-subtitle {
  font-size: 0.9em;
  color: #6b7280;
  min-height: 1.2em;
}

.clock-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  justify-self: center;
  align-self: stretch;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin: 8px 0;
}


.app-header .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  align-self: flex-start;
  margin-top: 4px;
}

.sim-clock {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clock-display {
  font-weight: 600;
  font-size: 1rem;
  color: #374151;
}

.clock-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-label {
  font-weight: 600;
  color: #667eea;
}

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #ffffff;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(102, 126, 234, 0.4);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.8);
  color: #4c51bf;
  border: 2px solid rgba(102, 119, 238, 0.2);
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 1);
}

.btn.btn-primary {
  background: #667eea;
}

.btn.btn-danger {
  background: #ff4757;
}

.btn.btn-danger:hover {
  background: #ff3838;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85em;
}

.muted {
  color: #6b7280;
  font-size: 0.9em;
}


.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stats.compact {
  margin-top: 10px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #ffffff;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  font-size: 0.95em;
}

.stat-value {
  font-size: 1.6em;
  font-weight: bold;
  margin-top: 6px;
}

.tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  overflow-x: auto;
  padding-bottom: 4px;
  flex-shrink: 0;
}

.tab-button {
  padding: 12px 20px;
  background: #ffffff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-size: 0.95em;
}

.tab-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.tab-button.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #ffffff;
  transform: translateY(-1px);
}

.tab-content {
  display: none;
  flex: 1;
  min-height: 0;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.main-content {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.panel {
  background: #ffffff;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.12);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: hidden;
}

.panel h2 {
  color: #667eea;
  font-size: 1.35em;
}

.panel h3 {
  color: #667eea;
  margin: 18px 0 12px 0;
  font-size: 1.1em;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2 {
  margin: 0;
}

.panel-heading .btn {
  white-space: nowrap;
}

.panel-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  min-height: 0;
}

.map-search {
  display: flex;
  gap: 8px;
  align-items: center;
}

.map-search input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(102, 119, 234, 0.25);
  font-size: 0.95em;
}

.tool-group {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 8px;
  box-shadow: inset 0 0 0 1px rgba(102, 119, 234, 0.08);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.tool-group + .tool-group {
  margin-top: 6px;
}

.tool-group .mode-button {
  margin: 0;
}

.tool-group.active {
  box-shadow: inset 0 0 0 2px rgba(102, 119, 234, 0.3);
}

.tool-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  margin-top: 0;
  padding-bottom: 8px;
}

.tool-options[hidden] {
  display: none !important;
}

.tool-group.active .tool-options:not([hidden]) {
  margin-top: 12px;
  opacity: 1;
  max-height: clamp(240px, 45vh, 560px);
  padding-bottom: 70px; /* espace pour la barre sticky */
}

.tool-message {
  font-size: 0.9em;
  color: #374151;
}

.tool-subgroup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-label {
  font-size: 0.85em;
  font-weight: 600;
  color: #4c51bf;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(102, 119, 234, 0.12);
  color: #4c51bf;
  font-size: 0.85em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.chip:hover {
  border-color: rgba(102, 119, 234, 0.35);
}

.chip.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #ffffff;
}

.build-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 24%, #ffffff 100%);
  padding-top: 6px;
  padding-bottom: 6px;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.04);
  z-index: 1;
}

/* Rendre la barre de recherche toujours visible dans le panneau d'outils */
.control-panel { position: relative; }
.control-panel > h2 {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #ffffff;
  padding-top: 8px;
  padding-bottom: 8px;
  box-shadow: 0 2px 10px rgba(102,119,234,0.06);
}
.control-panel .map-search {
  position: sticky;
  top: 48px;
  z-index: 2;
  background: #ffffff;
  padding-top: 6px;
  padding-bottom: 8px;
  box-shadow: 0 2px 10px rgba(102,119,234,0.06);
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

.build-cost {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 600;
  color: #1f2937;
}

.build-cost-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
}

.mode-button,
.vehicle-button {
  display: block;
  width: 100%;
  padding: 15px;
  margin-bottom: 10px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mode-button {
  background: #ffffff;
  color: #667eea;
  border-color: rgba(102, 119, 234, 0.3);
}

.mode-button:hover,
.vehicle-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.mode-button.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #ffffff;
}

.vehicle-button {
  color: #ffffff;
  border: none;
}

.metro-btn {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.tram-btn {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.bus-btn {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.vehicle-button.active {
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.small {
  font-size: 0.9em;
  color: #6b7280;
}

.map-panel {
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.map-fullscreen-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 7;
  border: none;
  border-radius: 999px;
  width: 42px;
  height: 42px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.map-fullscreen-toggle:hover {
  transform: translateY(-1px);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.4);
}

.map-panel.fullscreen {
  position: fixed;
  inset: 0;
  padding: 24px;
  background: rgba(15, 23, 42, 0.96);
  z-index: 1200;
  border-radius: 0;
  max-width: none;
  width: 100vw;
  height: 100vh;
  box-shadow: none;
  gap: 20px;
}

.map-panel.fullscreen .map-controls {
  background: rgba(255, 255, 255, 0.92);
}

.map-panel.fullscreen .map-surface {
  min-height: 0;
  flex: 1;
}

.map-panel.fullscreen #mapCanvas,
.map-panel.fullscreen .map-google {
  border-radius: 18px;
}

body.map-fullscreen-active {
  overflow: hidden;
}

.map-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: inset 0 0 0 1px rgba(102, 119, 234, 0.08);
  backdrop-filter: blur(4px);
  position: relative;
  z-index: 5;
}

.map-mode-switch {
  display: inline-flex;
  gap: 8px;
}

.map-mode-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 600;
  background: rgba(102, 126, 234, 0.12);
  color: #4c51bf;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-mode-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #ffffff;
  box-shadow: 0 6px 12px rgba(102, 126, 234, 0.25);
}

.map-mode-btn:hover {
  transform: translateY(-1px);
}

.map-zoom-controls {
  display: inline-flex;
  gap: 6px;
}

.map-zoom-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.map-zoom-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.map-surface {
  position: relative;
  flex: 1;
  min-height: clamp(320px, 55vh, 640px);
  border-radius: 15px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(102, 119, 234, 0.1);
  overflow: hidden;
}

#mapCanvas {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 15px;
  background: transparent;
  cursor: grab;
}

.city-grid {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, #bfc4ff 0px, #bfc4ff 1px, transparent 1px, transparent 25px),
    repeating-linear-gradient(90deg, #bfc4ff 0px, #bfc4ff 1px, transparent 1px, transparent 25px);
  opacity: 0.35;
  pointer-events: none;
  border-radius: 15px;
  z-index: 1;
  transition: opacity 0.2s ease;
}

.map-google {
  position: absolute;
  inset: 0;
  border-radius: 15px;
  overflow: hidden;
  display: none;
  z-index: 0;
}

.map-google.active {
  display: block;
}

.map-google .google-station {
  position: absolute;
  transform-origin: top left;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 20px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
  color: #0f172a;
  font-size: 12px;
  pointer-events: auto;
  transition: transform 0.15s ease;
  z-index: 1;
}

.map-google .google-station.preview {
  opacity: 0.65;
}

.map-google .google-station .station-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #111827;
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
}

.map-google .google-station .station-dot.major {
  width: 10px;
  height: 10px;
}

.map-google .google-station .station-dot.minor {
  width: 6px;
  height: 6px;
  bottom: -3px;
}

.map-google .google-station .station-dot.terminus {
  border: 2px solid #111827;
  background: #ffffff;
  box-sizing: border-box;
}

.map-google .google-station .label strong {
  font-size: 12px;
  display: block;
}

.map-google .google-station .label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  text-align: center;
}

.map-google .google-station .lines {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.map-google .google-station .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  font-weight: 600;
  font-size: 10px;
  min-width: 22px;
  padding: 2px 8px;
  border-radius: 999px;
}

.map-google .google-station .badge.shape-square {
  border-radius: 6px;
}

.map-google .google-station .badge.shape-rectangle {
  border-radius: 6px;
  min-width: 30px;
  padding: 2px 10px;
}

.map-google .google-station .badge.rounded {
  border-radius: 999px !important;
}

.map-message {
  position: absolute;
  inset: 20px;
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.85);
  color: #ffffff;
  z-index: 4;
  padding: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.map-message[hidden] {
  display: none;
}

.map-panel.simple-mode #mapCanvas {
  pointer-events: auto;
}

.map-panel.google-mode #mapCanvas {
  pointer-events: none;
  opacity: 0;
}

.map-panel.google-mode .city-grid {
  opacity: 0;
  pointer-events: none;
}

.map-panel.simple-mode .city-grid {
  opacity: 0.35;
}

.map-panel .map-hint {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(30, 32, 60, 0.85);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9em;
  max-width: 260px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
  z-index: 3;
}

.map-panel .map-hint.show {
  opacity: 1;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: #f8f9fa;
  padding: 18px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
  transition: all 0.25s ease;
  cursor: default;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.card:hover {
  background: #eef1ff;
  transform: translateY(-2px);
}

.card.metro {
  border-left-color: #f5576c;
}

.card.tram {
  border-left-color: #00f2fe;
}

.card.bus {
  border-left-color: #38f9d7;
}

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

.card-title {
  font-weight: bold;
  font-size: 1.1em;
  color: #333333;
}

.card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: #555555;
  font-size: 0.9em;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  background: #ffffff;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid #d7dcff;
  font-size: 0.8rem;
}

.line-token {
  --line-color: #5b6dff;
  --line-contrast: #0f172a;
  --token-size: 2.4rem;
  --token-width: var(--token-size);
  --token-height: var(--token-size);
  --token-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--token-width);
  height: var(--token-height);
  border-radius: var(--token-radius);
  background: var(--line-color);
  color: var(--line-contrast);
  font-weight: 700;
  font-size: 0.85em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease;
}

.line-token--compact {
  --token-size: 2rem;
  font-size: 0.75em;
}

.line-token--large {
  --token-size: 2.8rem;
  font-size: 0.9em;
}

.line-token[data-shape="circle"] {
  --token-radius: 50%;
}

.line-token[data-shape="square"] {
  --token-radius: calc(var(--token-size) * 0.35);
}

.line-token[data-shape="rectangle"] {
  --token-width: calc(var(--token-size) * 1.35);
  --token-height: calc(var(--token-size) * 0.82);
  --token-radius: calc(var(--token-size) * 0.32);
}

.line-token[data-rounded="true"][data-shape="square"],
.line-token[data-rounded="true"][data-shape="rectangle"] {
  --token-radius: calc(var(--token-size) * 0.48);
}

.line-token + .line-token {
  margin-left: 8px;
}

.line-token-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.line-card-header {
  align-items: flex-start;
  flex-wrap: wrap;
}

.line-card-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 240px;
}

.line-identity {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.line-symbol-editor {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.line-token-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
}

.line-symbol-fields,
.line-name-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.line-symbol-fields input,
.line-name-fields input {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(102, 119, 234, 0.25);
  font-weight: 600;
  background: #ffffff;
  color: #1f2937;
}

.line-symbol-fields input {
  width: 86px;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.12em;
}

.line-symbol-fields.readonly {
  min-width: 100px;
}

.line-symbol-fields.readonly .line-symbol-display {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(102, 119, 234, 0.25);
  font-weight: 600;
  background: #f8fafc;
  color: #1f2937;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  min-width: 86px;
}

.line-name-fields input {
  min-width: 200px;
}

.line-symbol-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: rgba(102, 119, 234, 0.08);
}

.line-symbol-options label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4b5563;
}

.line-symbol-options input[type="color"] {
  width: 52px;
  height: 34px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.line-symbol-options select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(102, 119, 234, 0.25);
  background: #ffffff;
  color: #1f2937;
  font-weight: 600;
}

.line-symbol-options .toggle {
  flex-direction: row;
  align-items: center;
  text-transform: none;
  letter-spacing: normal;
  gap: 8px;
  font-size: 0.85rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 0.85em;
  color: #374151;
}

.badge.tag {
  background: #eef1ff;
  border-color: #d7dcff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75em;
}

.color-chip {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  display: inline-block;
}

.assignment {
  background: #ffffff;
  border: 1px solid #d7dcff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.9em;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assignment strong {
  font-size: 0.95em;
  color: #1f2937;
}

.assignment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.assignment .line-token {
  box-shadow: none;
}

.schedule-emoji {
  font-size: 1.2em;
}

.maintenance-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-value {
  font-weight: 600;
  font-size: 0.85em;
  color: #4b5563;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85em;
  letter-spacing: 0.03em;
  color: #ffffff;
}

.status-available {
  background: #22c55e;
}

.status-service {
  background: #facc15;
  color: #2f2a05;
}

.status-maintenance {
  background: #ef4444;
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.mini-label {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.field label {
  font-weight: bold;
  color: #333333;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px;
  border: 2px solid #e0e7ff;
  border-radius: 8px;
  font-size: 1em;
}

.route-visual {
  position: relative;
  padding-top: 26px;
  width: 100%;
}

.route-track {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--route-color, #667eea), var(--route-color, #667eea));
}

.route-stops {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}

.route-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  flex: 1;
  text-align: center;
  min-height: 0;
  min-width: 0;
}

.route-stop-name {
  font-size: 0.78rem;
  color: #374151;
  margin-bottom: 10px;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 100%;
  white-space: nowrap;
}

.route-stop-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid var(--route-color, #667eea);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: bold;
  color: #333333;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 2px solid #e0e7ff;
  border-radius: 8px;
  font-size: 1em;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

input[type="color"] {
  padding: 0;
  border: none;
  background: transparent;
  height: 36px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: bold;
}

.status-operational {
  background: #38f9d7;
  color: #ffffff;
}

.status-maintenance {
  background: #ffa502;
  color: #ffffff;
}

.status-inactive {
  background: #dddddd;
  color: #666666;
}

.route-list {
  margin: 0;
  padding-left: 20px;
  max-height: 200px;
  overflow: auto;
}

.route-list li {
  margin: 4px 0;
}

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #ffffff;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e0e7ff;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  transition: width 0.3s ease;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal {
  background: #ffffff;
  border-radius: 16px;
  width: min(720px, calc(100vw - 48px));
  min-width: min(360px, calc(100vw - 48px));
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.hidden {
  display: none !important;
}

@media (max-width: 1200px) {
  .app-header {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .clock-stack {
    justify-self: flex-start;
    align-items: flex-start;
  }

  .app-header .actions {
    justify-content: flex-start;
  }

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

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  header {
    padding: 16px;
  }

  .app-header .actions {
    width: 100%;
  }

  .app-header .actions .btn {
    flex: 1;
    min-width: min(140px, 100%);
  }

  .stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tabs {
    justify-content: center;
  }
}
