@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&display=swap');

:root {
  --bg: #0b0f1a;
  --ink: #e5e7eb;
  --accent: #22d3ee;
  --panel: rgba(15, 23, 42, 0.9);
  --border: rgba(148, 163, 184, 0.2);
}

body {
  margin: 0;
  display: flex;
  justify-content: center;
  background: radial-gradient(circle at top left, #1f2937 0%, #0b0f1a 45%, #0a0d18 100%);
  color: var(--ink);
  font-family: 'Space Grotesk', sans-serif;
}

.app {
  width: 100%;
  max-width: 800px;
  padding: 40px 20px;
}

body.admin {
  background: radial-gradient(circle at top left, #1f2937 0%, #0b0f1a 45%, #0a0d18 100%);
  color: #e5e7eb;
  display: block;
}

body.admin::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  opacity: 0.4;
  z-index: 0;
}

.login-panel {
  max-width: 520px;
  margin: 80px auto;
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(8px);
}

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
  position: relative;
  z-index: 1;
}

.sidebar {
  background: rgba(10, 14, 24, 0.95);
  border-right: 1px solid rgba(148, 163, 184, 0.15);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand h2 {
  margin: 0;
  font-size: 1.05rem;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #0b0f1a;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.35);
}

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

.nav-btn {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.08);
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn.active,
.nav-btn:hover {
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.35), rgba(34, 211, 238, 0.35));
  border-color: rgba(99, 102, 241, 0.6);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.25);
}

.full {
  width: 100%;
}

.main {
  padding: 28px 34px;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.main h1 {
  margin: 0;
  font-size: 1.8rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 20px;
}

body.admin .panel {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}

.cost-dashboard {
  display: grid;
  gap: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 20px;
  box-shadow: inset 0 0 18px rgba(99, 102, 241, 0.12);
}

.metric-card h2 {
  margin: 6px 0 8px;
}

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

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.5);
}

.metric-row {
  display: flex;
  gap: 18px;
  margin-top: 12px;
}

.metric-row h4 {
  margin: 4px 0 0;
}

details.card {
  overflow: hidden;
}

details.card.nested {
  margin-top: 16px;
  background: rgba(15, 23, 42, 0.7);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

body.admin input, body.admin textarea, body.admin select {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(148, 163, 184, 0.3);
  color: #e5e7eb;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

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

.data-table thead th {
  text-align: left;
  color: #94a3b8;
  font-weight: 600;
}

.data-table .right {
  text-align: right;
}

details.card > summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 12px;
}

.vendor-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.hero {
  background: var(--panel);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 20px;
}

.transcript {
  height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.line {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
}

.line.user {
  align-self: flex-end;
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.9), rgba(34, 211, 238, 0.9));
  color: #0b0f1a;
}

.line.ai {
  align-self: flex-start;
  background: rgba(148, 163, 184, 0.15);
  color: #e5e7eb;
}

.controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

#loginPanel .controls {
  margin-top: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

input, textarea, select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.95rem;
  background: rgba(15, 23, 42, 0.7);
  color: var(--ink);
}

.muted {
  color: #94a3b8;
  font-size: 0.9rem;
}

details {
  margin-top: 12px;
}

#audioBtn {
  border-color: #93c5fd;
}

button {
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

button.primary { background: var(--accent); color: white; }
button.ghost { background: transparent; border: 1px solid var(--border); }

body.admin button.primary {
  background: linear-gradient(120deg, #6366f1, #22d3ee);
  color: #0b0f1a;
  border: none;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.35);
}

body.admin button.ghost {
  border-color: rgba(148, 163, 184, 0.3);
  color: #e5e7eb;
}
