/* Shared site-wide styles */

body {
  margin: 0;
  padding: 0;
  background-color: var(--admin-background);
  color: var(--admin-foreground);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
}

/* Container & headings */
.container {
  padding: 24px;
  max-width: 720px;
  margin: 0 auto;
}

h1 {
  margin-bottom: 12px;
  font-size: 22px;
  color: var(--admin-foreground);
}

/* Forms & text areas — scoped to .container */
.container form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
}

.field label {
  margin-bottom: 4px;
  font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  background-color: var(--admin-input-background);
  color: var(--admin-foreground);
  border: 1px solid var(--admin-border);
  border-radius: 4px;
  padding: 12px;
  font-family: inherit;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--admin-muted-foreground);
}

/* Buttons — scoped to .container */
.container button,
.container input[type="submit"] {
  background-color: var(--admin-accent);
  color: var(--admin-on-accent);
  border: none;
  padding: 10px 16px;
  border-radius: calc(var(--admin-radius) - 2px);
  font-weight: var(--admin-font-weight-semibold);
  cursor: pointer;
  width: fit-content;
}

.container button:hover,
.container input[type="submit"]:hover {
  background-color: var(--admin-accent-hover);
}

/* Transcript box */
#transcript {
  background-color: var(--admin-input-background);
  border: 1px solid var(--admin-border);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  min-height: 150px;
  line-height: 1.5;
  font-size: 15px;
}

#response {
  background-color: var(--admin-input-background);
  margin-top: 20px;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid var(--admin-border);
  font-size: 14px;
}

/* ── Dashboard page ── */

/* Font scope */
.admin-page.dash-root {
  font-family: var(--dash-font-body);
}

/* Load animation */
@keyframes dash-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Masthead */
.dash-masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--admin-border);
  animation: dash-fade-up 0.25s ease-out both;
}

.dash-masthead-label {
  margin: 0;
  font-family: var(--dash-font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--admin-foreground);
}

.dash-masthead-date {
  font-family: var(--dash-font-display);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--admin-muted-foreground);
}

/* Metrics strip */
.dash-metrics {
  animation: dash-fade-up 0.25s 0.08s ease-out both;
}

.dash-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 28px 0 24px;
}

.dash-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 40px;
  min-width: 0;
  overflow: hidden;
}

.dash-metric + .dash-metric {
  padding-left: 40px;
  padding-right: 40px;
  border-left: 1px solid var(--admin-border);
}

.dash-metric:last-child {
  padding-right: 0;
}

.dash-metric-label {
  font-family: var(--dash-font-display);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--admin-muted-foreground);
}

.dash-metric-value {
  font-family: var(--dash-font-display);
  font-size: 3.25rem;
  font-weight: 700;
  line-height: 1;
  color: var(--admin-foreground);
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-metric-em {
  font-style: normal;
  color: var(--admin-muted-foreground);
}

.dash-metric-sub {
  font-size: 0.8125rem;
  color: var(--admin-muted-foreground);
  line-height: 1.4;
}

/* Action prompt */
.dash-prompt {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
  background: var(--admin-accent-subtle);
  border: 1px solid var(--admin-accent-border);
  border-radius: calc(var(--admin-radius) + 4px);
  margin-bottom: 24px;
  animation: dash-fade-up 0.25s 0.14s ease-out both;
}

.dash-prompt-tag {
  font-family: var(--dash-font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--admin-accent-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.dash-prompt-text {
  flex: 1;
  font-size: 1rem;
  font-weight: 500;
  color: var(--admin-foreground);
  margin: 0;
  line-height: 1.4;
}

.dash-prompt-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.dash-btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  background: var(--admin-accent);
  border: 1px solid var(--admin-accent);
  border-radius: calc(var(--admin-radius) - 2px);
  color: var(--admin-on-accent);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--dash-font-body);
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.dash-btn-accent:hover {
  background: var(--admin-accent-hover);
  border-color: var(--admin-accent-hover);
}

.dash-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--admin-muted-foreground);
  border-radius: calc(var(--admin-radius) - 2px);
  color: var(--admin-foreground);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--dash-font-body);
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.dash-btn-ghost:hover {
  background: var(--admin-hover);
  border-color: var(--admin-foreground);
}

.dash-btn-accent:focus-visible,
.dash-btn-ghost:focus-visible,
a.dash-nav-item:focus-visible,
.dash-activity-cta:focus-visible {
  outline: 2px solid var(--admin-ring);
  outline-offset: 2px;
}

/* Stats row — used on script template show pages */
.dash-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.dash-stat-card {
  padding: 20px 24px;
  position: relative;
}

.dash-stat-card .admin-section-header {
  display: none;
}

.dash-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 16px;
}

.dash-dot-teal { background: var(--admin-accent); }
.dash-dot-muted { background: var(--admin-muted-foreground); }
.dash-dot-purple { background: var(--admin-muted-foreground); }

.dash-stat-label {
  font-family: var(--dash-font-display);
  font-size: 0.8125rem;
  font-weight: var(--admin-font-weight-semibold);
  color: var(--admin-muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.dash-stat-value {
  font-family: var(--dash-font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--admin-foreground);
  line-height: 1.1;
  margin-bottom: 4px;
}

.dash-stat-em { font-style: normal; }

.dash-stat-sub {
  font-size: 0.875rem;
  color: var(--admin-muted-foreground);
}

/* Bottom grid */
.dash-bottom-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  animation: dash-fade-up 0.25s 0.2s ease-out both;
}

.dash-bottom-grid .admin-section-card {
  margin-top: 0;
}

/* Panel header (replaces admin-section-header in dashboard cards) */
.dash-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
}

.dash-panel-title {
  margin: 0;
  font-family: var(--dash-font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--admin-muted-foreground);
}

/* Activity empty state */
.dash-activity-empty {
  padding: 28px 20px 32px;
}

.dash-activity-msg {
  margin: 0 0 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--admin-foreground);
}

.dash-activity-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--admin-muted-foreground);
  line-height: 1.5;
  max-width: 52ch;
}

.dash-activity-cta {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--admin-accent-text);
  text-decoration: none;
  transition: opacity 0.12s ease;
}

.dash-activity-cta:hover {
  opacity: 0.75;
}

/* Settings nav list */
.dash-nav-list {
  display: flex;
  flex-direction: column;
}

.dash-nav-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--admin-border);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.1s ease;
}

.dash-nav-item--last {
  border-bottom: none;
}

a.dash-nav-item:hover {
  background: var(--admin-hover);
}

.dash-nav-item--soon {
  opacity: 0.7;
  cursor: default;
}

a.dash-nav-item[aria-disabled="true"] {
  pointer-events: none;
}

.dash-nav-index {
  font-family: var(--dash-font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--admin-muted-foreground);
  line-height: 1;
  padding-top: 2px;
}

.dash-nav-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dash-nav-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--admin-foreground);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-nav-desc {
  font-size: 0.8125rem;
  color: var(--admin-muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-nav-arrow {
  font-size: 0.9375rem;
  color: var(--admin-muted-foreground);
  opacity: 0.5;
  line-height: 1;
}

.dash-soon-tag {
  font-family: var(--dash-font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--admin-muted-foreground);
  white-space: nowrap;
}

/* Shared empty state — used on conversations, analytics pages */
.dash-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.dash-empty-icon {
  margin-bottom: 16px;
  opacity: 0.5;
  font-size: 24px;
  color: var(--admin-muted-foreground);
}

.dash-empty-headline {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  font-weight: var(--admin-font-weight-semibold);
  color: var(--admin-foreground);
}

.dash-empty-sub {
  margin: 0 0 20px;
  font-size: 0.9375rem;
  color: var(--admin-muted-foreground);
  max-width: 320px;
  line-height: 1.5;
}

.dash-ghost-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--admin-accent-subtle);
  border: 1px solid var(--admin-accent-border);
  border-radius: calc(var(--admin-radius) - 2px);
  color: var(--admin-accent-text);
  font-size: 0.875rem;
  font-weight: var(--admin-font-weight-medium);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dash-ghost-btn:hover {
  background: var(--admin-accent-subtle);
  border-color: var(--admin-accent);
}

.dash-badge {
  font-size: 0.75rem;
  font-weight: var(--admin-font-weight-semibold);
  color: var(--admin-accent-text);
  background: var(--admin-accent-subtle);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dash-empty-state--padded { padding: 32px 24px; }
.dash-empty-icon-svg { font-size: 1.5rem; color: var(--admin-muted-foreground); }
.dash-badge--lg { font-size: 0.8125rem; padding: 6px 14px; }

.reports-body-text {
  margin: 1.5rem 0;
  font-size: 1.1rem;
  line-height: 1.4;
}

/* Dashboard responsive */
@media (max-width: 900px) {
  .dash-prompt {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .dash-prompt-actions {
    width: 100%;
  }

  .dash-btn-accent,
  .dash-btn-ghost {
    flex: 1;
    justify-content: center;
  }

  .dash-metrics-row {
    grid-template-columns: 1fr;
  }

  .dash-metric + .dash-metric {
    padding-left: 0;
    padding-right: 0;
    border-left: none;
    padding-top: 20px;
    border-top: 1px solid var(--admin-border);
  }

  .dash-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-masthead,
  .dash-metrics,
  .dash-prompt,
  .dash-bottom-grid {
    animation: none;
  }
}
