:root {
  --bg: #0f0f12;
  --surface: #18181c;
  --border: #2a2a30;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --accent: #0ea5e9;
  --accent-hover: #38bdf8;
  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;
  --radius: 10px;
  --font: "DM Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* Login */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.login-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

#login-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

#login-form input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

#login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

#login-form button {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

#login-form button:hover {
  background: var(--accent-hover);
}

#login-form button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  text-align: center;
}

/* Dashboard */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-left h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.org-name {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-email {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: var(--font);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-primary {
  padding: 0.5rem 1rem;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: var(--font);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.dashboard-main {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.filters label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.filters input[type="date"],
.filters select {
  padding: 0.4rem 0.6rem;
  margin-left: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.calls-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.calls-table {
  width: 100%;
  border-collapse: collapse;
}

.calls-table th,
.calls-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.calls-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.calls-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.calls-table td {
  font-size: 0.875rem;
}

.intent-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.intent-badge.appointment_booking { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.intent-badge.appointment_cancellation { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.intent-badge.appointment_rescheduling { background: rgba(234, 179, 8, 0.2); color: #eab308; }
.intent-badge.packages_discounts { background: rgba(14, 165, 233, 0.2); color: #0ea5e9; }
.intent-badge.general_enquiry { background: rgba(161, 161, 170, 0.2); color: #a1a1aa; }

.recording-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
}

.recording-link:hover {
  text-decoration: underline;
}

.transcript-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: var(--border);
  border: none;
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
}

.transcript-btn:hover {
  background: var(--accent);
  color: #fff;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.pagination button {
  padding: 0.4rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
}

.pagination button:hover:not(:disabled) {
  background: var(--border);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
}

.modal-content h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
}

#transcript-text {
  white-space: pre-wrap;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 1rem 0;
  max-height: 50vh;
  overflow: auto;
}

.modal-content .btn-primary {
  margin-top: 0.5rem;
}
