
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #020617;
  --bg-elevated: rgba(15, 23, 42, 0.92);
  --bg-soft: rgba(15, 23, 42, 0.82);
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-gold: #fbbf24;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: rgba(148, 163, 184, 0.35);
  --error: #f97373;
  --radius-xl: 18px;
  --shadow-soft: 0 22px 55px rgba(15, 23, 42, 0.9);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at top left, #0f172a, #020617 55%, #000 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro", sans-serif;
}

#app {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  width: 320px;
  padding: 20px 18px;
  border-right: 1px solid rgba(148, 163, 184, 0.35);
  background: radial-gradient(circle at top left, #020617, #020617 45%, #000 100%);
  backdrop-filter: blur(26px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.16), rgba(251, 191, 36, 0.08));
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 26px rgba(56, 189, 248, 0.6);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #fbbf24, #0ea5e9 55%, #1d4ed8 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  color: #020617;
  font-weight: 800;
  font-size: 22px;
  text-shadow: 0 0 14px rgba(15, 23, 42, 0.7);
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-text span {
  font-size: 11px;
  color: var(--muted);
}

.profile-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 64, 175, 0.9));
  border-radius: var(--radius-xl);
  padding: 14px 14px 12px;
  border: 1px solid rgba(37, 99, 235, 0.7);
  box-shadow: var(--shadow-soft);
}

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #38bdf8, #1d4ed8 55%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.profile-name {
  font-weight: 600;
}

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

.profile-stats {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.stat {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 14px;
  padding: 8px 9px;
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
  margin-top: 4px;
}

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

.nav-item {
  background: transparent;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.12s ease-out;
}

.nav-item span {
  font-size: 16px;
}

.nav-item.active,
.nav-item:hover {
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.18), rgba(251, 191, 36, 0.12));
  border-color: rgba(56, 189, 248, 0.9);
}

.tip {
  margin-top: auto;
  font-size: 12px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.96);
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  color: var(--muted);
}

/* MAIN */

.main {
  flex: 1;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ping-status,
.sync-status {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.7);
  background: rgba(15, 23, 42, 0.9);
}

.sync-status {
  border-color: rgba(251, 191, 36, 0.8);
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.panel {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: 14px 15px 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

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

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

.grid-2-40 {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  margin-top: 4px;
  border-radius: 10px;
  border: 1px solid rgba(51, 65, 85, 0.9);
  background: rgba(15, 23, 42, 0.96);
  padding: 8px 9px;
  color: var(--text);
  font-size: 13px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.7);
}

textarea {
  resize: vertical;
}

.upload-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.file-hint {
  font-size: 11px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.98);
  color: var(--text);
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease-out;
}

.btn.primary {
  border-color: rgba(56, 189, 248, 0.9);
  background: linear-gradient(120deg, #0ea5e9, #38bdf8);
  color: #020617;
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 4px 10px;
  font-size: 12px;
}

.btn.danger {
  border-color: rgba(248, 113, 113, 0.9);
  color: #fecaca;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* COURSE LIST */

.course-list {
  margin-top: 10px;
  max-height: 420px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.course-list.empty {
  font-size: 13px;
  color: var(--muted);
}

.course-item {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 9px 10px;
  background: var(--bg-soft);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.12s ease-out;
}

.course-item:hover {
  border-color: rgba(56, 189, 248, 0.85);
  background: rgba(15, 23, 42, 0.96);
}

.course-item.active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.course-title {
  font-size: 14px;
  font-weight: 600;
}

.course-meta {
  font-size: 11px;
  color: var(--muted);
}

.course-badges {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  text-align: right;
  color: var(--muted);
}

/* COURSE DETAIL */

.course-detail {
  min-height: 180px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.95);
  padding: 10px 11px;
  font-size: 13px;
  white-space: pre-wrap;
}

.course-detail.empty {
  color: var(--muted);
}

/* IA OUTPUT */

.ia-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.ia-output {
  min-height: 220px;
  max-height: 450px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98));
  padding: 12px 13px;
  font-size: 13px;
  white-space: pre-wrap;
}

/* ORAL */

.oral-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 12px;
}

.box {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.96);
  min-height: 80px;
  padding: 10px 11px;
  font-size: 13px;
  white-space: pre-wrap;
}

.box.small {
  min-height: 60px;
  max-height: 220px;
  overflow: auto;
}

/* DASHBOARD */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.dash-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), rgba(15, 23, 42, 0.98));
  padding: 12px 13px;
  font-size: 13px;
}

.dash-card:nth-child(2) {
  background: radial-gradient(circle at top left, rgba(251, 191, 36, 0.18), rgba(15, 23, 42, 0.98));
}

.dash-card h4 {
  margin: 0 0 6px;
}

.dash-value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 2px;
}

.dash-value.small {
  font-size: 18px;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 24px;
  background: rgba(15, 23, 42, 0.96);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid rgba(56, 189, 248, 0.8);
  box-shadow: 0 10px 35px rgba(15, 23, 42, 0.95);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.18s ease-out;
}

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

/* RESPONSIVE */

@media (max-width: 980px) {
  .sidebar {
    display: none;
  }
  .main {
    padding: 14px;
  }
  .grid-2,
  .grid-2-40,
  .dash-grid,
  .oral-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
