@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-dark: #111827;
  --ink: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --error: #dc2626;
  --ok: #16a34a;
  --radius: 16px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 18rem);
  font-family: Inter, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1180px, 100% - 2rem);
  margin: 1.5rem auto 2.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0 1.4rem;
}

.eyebrow,
.section-label {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
}

h2 {
  font-size: 1.08rem;
}

h3 {
  font-size: 1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.device-panel {
  position: sticky;
  top: 1rem;
  padding: 1rem;
  color: #e5e7eb;
  background:
    linear-gradient(160deg, rgba(37, 99, 235, 0.24), transparent 55%),
    var(--panel-dark);
  border-color: rgba(255, 255, 255, 0.08);
}

.device-panel .section-label,
.device-panel .status-text {
  color: #9ca3af;
}

.slots-panel {
  padding: 1rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.toolbar {
  align-items: center;
}

.status-text,
.hint,
.slot-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.device-panel .status-text {
  min-height: 5.5rem;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.74);
}

.hint {
  margin-bottom: 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.actions.vertical {
  display: grid;
  margin-top: 1rem;
}

.actions.compact {
  margin-top: 0.75rem;
}

button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.62rem 0.9rem;
  transition: background 130ms ease, border-color 130ms ease, transform 130ms ease;
}

button:hover:enabled {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

button.secondary {
  color: #334155;
  background: #ffffff;
  border-color: var(--line-strong);
}

.device-panel button.secondary {
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

button.secondary:hover:enabled {
  color: #0f172a;
  background: #f8fafc;
}

.device-panel button.secondary:hover:enabled {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.badge,
.count {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.35rem 0.6rem;
}

.badge {
  color: #475569;
  background: #e2e8f0;
}

.badge.connected {
  color: #166534;
  background: #dcfce7;
}

.badge.error {
  color: #991b1b;
  background: #fee2e2;
}

.count {
  color: #475569;
  background: #f1f5f9;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.slot-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  background: #ffffff;
}

.slot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
}

textarea {
  width: 100%;
  min-height: 8rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  padding: 0.8rem;
  resize: vertical;
}

textarea:focus {
  border-color: rgba(37, 99, 235, 0.8);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  outline: none;
}

.slot-status {
  margin-top: 0.65rem;
  font-size: 0.85rem;
}

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

  .device-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 1rem, 1180px);
    margin-top: 0.75rem;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .actions,
  .actions.compact {
    display: grid;
  }

  button {
    width: 100%;
  }
}
