/* Garage voice agent dashboard — shared styles (index.html + admin.html). */

:root {
  --accent: #1e40af;
  --accent-hover: #1d4ed8;
  --accent-soft: #e3eafb;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #dde3ec;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #b91c1c;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

h2 {
  font-size: 17px;
  margin: 0;
}

h3 {
  font-size: 15px;
  margin: 24px 0 4px;
}

/* --- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 16px;
  font-size: 14.5px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  background: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

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

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:not(:disabled):hover {
  border-color: #b9c3d4;
  background: #f8fafc;
}

.btn-small {
  padding: 5px 12px;
  font-size: 13.5px;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-block + .btn-block {
  margin-top: 10px;
}

/* --- Badges -------------------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-grey {
  background: #e9edf3;
  color: #4b5563;
}

.badge-red {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-amber {
  background: #fef3c7;
  color: #b45309;
}

/* --- Auth screens -------------------------------------------------------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.auth-card .lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

/* --- Forms ---------------------------------------------------------------- */

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

input:disabled {
  background: #f1f5f9;
  color: var(--muted);
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  margin: 0 0 12px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.form-actions {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* --- App shell ------------------------------------------------------------ */

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-title {
  font-size: 17px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tabs-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
}

.tab-btn {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--muted);
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 72px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.empty-state {
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
}

/* --- Tables --------------------------------------------------------------- */

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.data-table th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tr.clickable {
  cursor: pointer;
}

.data-table tr.clickable:hover {
  background: #f0f4fa;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Booking cards ---------------------------------------------------------- */

.booking-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.booking-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.booking-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.booking-head strong {
  font-size: 15.5px;
  overflow-wrap: anywhere;
}

.booking-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 14px;
  margin: 0;
}

.booking-grid dt {
  color: var(--muted);
  font-size: 13.5px;
}

.booking-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.booking-card .created {
  margin: 0;
}

.booking-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

/* --- Slide-over panel (transcript / garage detail) -------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}

.slide-panel {
  background: var(--surface);
  width: min(540px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.15);
}

.slide-panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.slide-panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.slide-panel-head p {
  margin: 2px 0 0;
}

.slide-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 32px;
}

.slide-panel-content h4 {
  font-size: 13.5px;
  color: var(--muted);
  text-transform: none;
  margin: 20px 0 8px;
}

.slide-panel-content h4:first-child {
  margin-top: 0;
}

/* --- Transcript bubbles --------------------------------------------------- */

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

.bubble-row {
  display: flex;
}

.bubble-row.from-caller {
  justify-content: flex-start;
}

.bubble-row.from-agent {
  justify-content: flex-end;
}

.bubble {
  max-width: 85%;
  border-radius: 12px;
  padding: 8px 12px;
  background: #eef1f6;
}

.from-agent .bubble {
  background: var(--accent-soft);
}

.bubble-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 2px;
}

.bubble-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* --- Settings editors ------------------------------------------------------- */

.editor-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.editor-row input {
  min-width: 0;
}

/* --- Admin extras ----------------------------------------------------------- */

.mini-item {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.mini-item:last-child {
  border-bottom: none;
}

.mini-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mini-item-head strong {
  overflow-wrap: anywhere;
}

.mini-item p {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

pre.sql-snippet {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  margin: 12px 0;
}

/* --- Toast -------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  background: #1f2937;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14.5px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  max-width: calc(100vw - 32px);
}

.toast-error {
  background: var(--danger);
}

/* --- Responsive ------------------------------------------------------------------ */

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

  .booking-list {
    grid-template-columns: 1fr;
  }

  .tab-btn {
    flex: 1;
    padding: 12px 8px;
  }

  .bubble {
    max-width: 92%;
  }
}
