body.app-body {
  padding: 28px;
  min-height: 100vh;
  position: relative;
  pointer-events: auto;
  isolation: isolate;
}

.app-body::before,
.app-body::after {
  content: none;
}

.app-body .layout {
  max-width: min(1200px, 100%);
  margin: 0 auto 18px;
}

.layout.wide {
  max-width: min(1400px, 100%);
}

#editor-card {
  grid-column: 1 / -1;
}

#plan-card {
  grid-column: span 1;
}

#events-card,
#accounts-card {
  grid-column: span 1;
}

#plan-editor {
  min-height: 420px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  margin: 0 auto 18px;
  max-width: min(1200px, 100%);
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1000;
  pointer-events: auto;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  pointer-events: auto;
}

.topbar a,
.topbar button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  pointer-events: auto;
}

.topbar a.primary,
.topbar button.primary {
  background: var(--gradient-primary);
  color: #0b0f1e;
  border: none;
}

.card {
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: rgba(7, 15, 33, 0.6);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.status {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(7, 15, 33, 0.6);
  color: var(--muted);
  margin-top: 10px;
}

.status.success {
  border-color: rgba(19, 208, 255, 0.35);
  color: var(--text);
}

.status.error {
  border-color: rgba(255, 122, 217, 0.4);
  color: #ffb3e3;
}

.skeleton {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton.big {
  height: 20px;
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(7, 15, 33, 0.9);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-strong);
  z-index: 50;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.plan-stage {
  position: relative;
  transform-origin: 0 0;
  z-index: 3;
  pointer-events: auto;
}

.plan-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background-image: linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.plan-grid.visible {
  opacity: 1;
}

.plan-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.plan-controls button {
  border-radius: 10px;
}

.calendar .fc .fc-toolbar-title {
  color: var(--heading);
}

.calendar .fc .fc-button {
  background: rgba(7, 15, 33, 0.7);
  border: 1px solid var(--border);
  color: var(--text);
}

.calendar .fc .fc-button-primary:not(:disabled).fc-button-active,
.calendar .fc .fc-button-primary:not(:disabled):active {
  background: var(--accent);
  color: #08101f;
}

.calendar .fc .fc-daygrid-day-frame,
.calendar .fc .fc-timegrid-slot {
  background: rgba(7, 15, 33, 0.5);
}

.calendar .fc .fc-event {
  border: none;
  border-radius: 8px;
  padding: 2px 6px;
}

.btn:focus-visible,
.topbar a:focus-visible,
.topbar button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(19, 208, 255, 0.7);
  outline-offset: 2px;
}

@keyframes shimmer {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.field input,
.field select,
.field textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(7, 15, 33, 0.6);
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 10px 16px;
  border: none;
  cursor: pointer;
  background: var(--gradient-primary);
  color: #0b0f1e;
  font-weight: 700;
}

.btn.primary {
  background: var(--gradient-primary);
  color: #0b0f1e;
}

.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.plan-wrapper {
  position: relative;
  width: 100%;
  min-height: 500px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  overflow: hidden;
  background: rgba(4, 10, 25, 0.6);
}

.plan-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.plan-stage {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  z-index: 3;
}

.plan-point {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--accent);
  color: #08101f;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.plan-point.image {
  background: transparent;
  border: none;
  padding: 0;
}

.plan-point img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

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

.modal .slot-list {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 6px;
}

#point-slot-list {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 6px;
}

.slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(7, 15, 33, 0.6);
  color: var(--text);
}

.slot.reserved {
  opacity: 0.7;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 3000;
}

.modal.open {
  display: flex;
}

.modal-card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  padding: 20px;
  border-radius: 18px;
  width: min(760px, 96vw);
  border: 1px solid var(--border);
  position: relative;
  z-index: 3001;
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.2fr);
  gap: 16px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }
}

.calendar {
  background: rgba(7, 15, 33, 0.6);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 17, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 4000;
}

.loading-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.phone-frame {
  width: min(420px, 90vw);
  height: min(740px, 80vh);
  border-radius: 28px;
  border: 1px solid var(--border);
  background: #0b1220;
  padding: 12px;
  box-shadow: var(--shadow-strong);
  margin: 10px auto 0;
}

.phone-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 20px;
  background: #050913;
}

.preview-mode .topbar {
  display: none;
}

.preview-mode .layout {
  margin-top: 0;
}

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

@media (max-width: 700px) {
  .modal-card {
    width: min(96vw, 520px);
    max-height: 88vh;
    overflow-y: auto;
  }
  .plan-controls {
    flex-direction: column;
  }
  .plan-controls .btn {
    width: 100%;
  }
  .plan-wrapper {
    min-height: 320px;
  }
  .plan-point {
    font-size: 11px;
    padding: 5px 8px;
  }
  .plan-point img {
    width: 30px;
    height: 30px;
  }
  .calendar .fc .fc-toolbar {
    flex-direction: column;
    gap: 8px;
  }
  .calendar .fc .fc-toolbar-chunk {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
  }
  .calendar .fc .fc-button {
    flex: 1 1 auto;
  }
}

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