:root {
  --bg: #f4f0e8;
  --panel: #ffffff;
  --panel-2: #f7f3ec;
  --text: #1f2a36;
  --muted: #5f6f7f;
  --accent: #0b70d1;
  --accent-2: #d5851f;
  --border: #e2d7c6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(11, 112, 209, 0.10), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(213, 133, 31, 0.10), transparent 45%),
    var(--bg);
  color: var(--text);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.login-card {
  width: min(460px, 92vw);
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 18px 40px rgba(31, 42, 54, 0.16);
}

.login-brand h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.login-logo {
  width: 140px;
  height: auto;
  margin-bottom: 10px;
  filter: drop-shadow(0 8px 14px rgba(31, 42, 54, 0.18));
}

.login-brand p {
  margin: 0 0 18px;
  color: var(--muted);
}

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

.login-form label {
  font-size: 13px;
  color: var(--muted);
}

.login-form input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.login-form button {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b70d1;
  color: #fff;
  font-weight: 600;
}

.login-form button:hover {
  filter: brightness(0.98);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 54, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: 0 20px 48px rgba(31, 42, 54, 0.2);
}

.modal h3 {
  margin: 0 0 8px;
}

.modal p {
  margin: 0 0 16px;
  color: var(--muted);
}

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

.modal-actions .secondary {
  background: #f3f5f7;
  color: var(--text);
}
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.hero {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(247, 243, 236, 0.9));
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(31, 42, 54, 0.08);
}

.logo {
  width: 160px;
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(31, 42, 54, 0.18));
}

.brand-text h1 {
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-text p {
  margin: 0;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
}

.ghost-btn:hover {
  background: #eef2f7;
}

.card {
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 12px 30px rgba(31, 42, 54, 0.08);
}

.card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

input[type="file"], select, button {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
}

input[type="text"] {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  min-width: 240px;
}

input[type="number"] {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  width: 90px;
  text-align: center;
  box-shadow: inset 0 1px 3px rgba(31, 42, 54, 0.08);
}

.input-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff9f1;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.file-label {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: #fff9f1;
  border: 1px dashed var(--border);
  padding: 10px;
  border-radius: 10px;
}

.file-label input[type="file"] {
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff9f1;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}

.toggle-chip input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
}

button {
  cursor: pointer;
  background: linear-gradient(120deg, #0b70d1, #1356a6);
  color: #fff;
  border: none;
  transition: transform 0.08s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 16px rgba(11, 112, 209, 0.25);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(11, 112, 209, 0.35);
}

textarea {
  width: 100%;
  min-height: 220px;
  background: #fffdfa;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: inset 0 2px 6px rgba(31, 42, 54, 0.06);
}

.list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}

.robots {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.robot-world {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fffdfa;
}

.robot-world h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.robot-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.robot-input {
  min-width: 200px;
}

#viewer-map {
  height: 420px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.viewer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 900;
}

body.viewer-expanded {
  overflow: hidden;
}

body.viewer-expanded .viewer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.viewer-expanded #viewer-card {
  position: fixed;
  inset: 4vh 4vw;
  z-index: 950;
  margin: 0;
  overflow: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

body.viewer-expanded #viewer-map {
  height: 72vh;
}

body.docker-expanded {
  overflow: hidden;
}

body.docker-expanded .viewer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.docker-expanded #docker-card {
  position: fixed;
  inset: 6vh 8vw;
  z-index: 950;
  margin: 0;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

body.docker-expanded #docker-log {
  flex: 1 1 auto;
  max-height: none;
}

.tutorial-modal {
  position: fixed;
  inset: 5vh 6vw;
  z-index: 960;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

body.tutorial-open {
  overflow: hidden;
}

body.tutorial-open #tutorial-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.tutorial-open .tutorial-modal {
  display: flex;
}

body.multifloor-open {
  overflow: hidden;
}

body.multifloor-open #multifloor-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.multifloor-open #multifloor-modal {
  display: flex;
}

.loading-modal {
  position: fixed;
  inset: 0;
  z-index: 970;
  display: none;
  align-items: center;
  justify-content: center;
}

body.loading-open {
  overflow: hidden;
}

body.loading-open #loading-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.loading-open .loading-modal {
  display: flex;
}

.loading-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.loading-title {
  font-weight: 700;
}

.loading-sub {
  font-size: 12px;
  color: var(--muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e0e5eb;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.tutorial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.tutorial-header h3 {
  margin: 0;
  font-size: 16px;
}

#tutorial-frame {
  border: none;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
}

.multifloor-body {
  padding: 14px 16px;
  overflow: auto;
}

.multifloor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffdfa;
}

.multifloor-row label {
  font-size: 13px;
  color: var(--muted);
  min-width: 80px;
}

.multifloor-row select {
  min-width: 220px;
}

.edit-handle {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #29b6f6;
  border: 2px solid #0b4a6f;
  box-shadow: 0 0 0 2px rgba(41, 182, 246, 0.25);
}

.leaflet-div-icon.edit-handle {
  background: transparent;
  border: none;
}

.leaflet-tooltip.endpoint-label {
  background: #1f2a36;
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.leaflet-tooltip.endpoint-label:before {
  border-top-color: #1f2a36;
}

.line-selected {
  filter: drop-shadow(0 0 6px rgba(255, 193, 7, 0.9));
}

.log {
  background: #0b1017;
  color: #e6edf6;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  min-height: 120px;
  max-height: 240px;
  overflow: auto;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 13px;
  box-shadow: 0 6px 14px rgba(31, 42, 54, 0.08);
}

.chip button {
  background: #f1f4f8;
  color: #1f2a36;
  border: 1px solid var(--border);
  box-shadow: none;
  padding: 2px 8px;
  border-radius: 999px;
}

.chip button:hover {
  transform: none;
  box-shadow: none;
  background: #e3e8ef;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status {
  font-size: 13px;
  color: var(--muted);
}

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #ffffff;
  cursor: help;
}

code {
  background: #fff5e8;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

@media (max-width: 720px) {
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
  }
}

.hidden {
  display: none !important;
}
