:root {
  color-scheme: light dark;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #0f172a;
  color: #e2e8f0;
}

body {
  margin: 0;
  background: linear-gradient(120deg, #0f172a, #1e293b 60%, #111827 100%);
  min-height: 100vh;
}

#app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  backdrop-filter: blur(12px);
  background: rgba(15, 23, 42, 0.85);
  border-right: 1px solid rgba(148, 163, 184, 0.2);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar h1 {
  font-size: 1.2rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #38bdf8;
}

.profile-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  background: rgba(30, 41, 59, 0.65);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.profile-card.active {
  border-color: #38bdf8;
  transform: translateX(4px);
}

.profile-card:hover {
  border-color: rgba(56, 189, 248, 0.6);
}

.profile-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.profile-card span {
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.7);
}

.primary-button,
.secondary-button,
.danger-button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-button {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #0f172a;
}

.primary-button:hover {
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.35);
  transform: translateY(-1px);
}

.secondary-button {
  background: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

.secondary-button:hover {
  background: rgba(148, 163, 184, 0.35);
}

.danger-button {
  background: linear-gradient(135deg, #f87171, #ef4444);
  color: #0f172a;
}

.content {
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tab-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.tab {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(30, 41, 59, 0.6);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.tab.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.panel {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.45);
}

.panel h3 {
  margin-top: 0;
  font-size: 1.05rem;
  color: #38bdf8;
  letter-spacing: 0.04em;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.85);
}

.form-group input,
.form-group textarea,
.form-group select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  color: #e2e8f0;
  font-size: 0.95rem;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two-columns {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.asset-canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(148, 163, 184, 0.35);
}

.asset-canvas-wrapper canvas {
  max-width: 100%;
  border-radius: 0.75rem;
  background: transparent;
}

.asset-library {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  max-height: 340px;
  overflow-y: auto;
}

.asset-tile {
  position: relative;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.5rem;
  background: rgba(30, 41, 59, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.asset-tile img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.85);
}

.asset-tile span {
  font-size: 0.75rem;
  text-align: center;
  color: rgba(226, 232, 240, 0.75);
}

.log-area {
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.75rem;
  max-height: 160px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: rgba(203, 213, 225, 0.9);
}

.template-layout-preview {
  border-radius: 1rem;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  padding: 1rem;
  background: rgba(15, 23, 42, 0.75);
  min-height: 200px;
}

.template-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.7));
  overflow: hidden;
}

.template-canvas .frame {
  position: absolute;
  inset: 8%;
  border-radius: 1.25rem;
  border: 4px solid rgba(148, 163, 184, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-canvas .frame span {
  color: rgba(226, 232, 240, 0.7);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.iframe-shell {
  position: relative;
  border-radius: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(148, 163, 184, 0.25), rgba(15, 23, 42, 0.9));
  box-shadow: inset 0 0 0 10px rgba(15, 23, 42, 0.9);
}

.device-frame {
  width: 375px;
  height: 812px;
  border-radius: 1.75rem;
  overflow: hidden;
  border: 12px solid rgba(15, 23, 42, 0.95);
  box-shadow: 0 40px 80px rgba(15, 23, 42, 0.4);
  background: #000;
}

.device-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  border-radius: 0.75rem;
  overflow: hidden;
}

.table thead {
  background: rgba(30, 41, 59, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
}

.table th,
.table td {
  padding: 0.65rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.alert {
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bae6fd;
  font-size: 0.85rem;
}

.alert.alert-error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

@media (max-width: 1024px) {
  #app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    overflow-x: auto;
  }
  .profile-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
