/* EDIT shared UI components */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--edit-font-ui);
  color: var(--edit-ink);
  background: var(--edit-canvas);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.display-heading,
.page-heading h1,
.dashboard-intro h1,
.section-card-title,
.auth-required-card h1,
.business-login-panel h1 {
  font-family: var(--edit-font-display);
  font-weight: 400;
  letter-spacing: -0.03em;
}

.eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--edit-accent);
}

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

/* Buttons */
.edit-button {
  background: var(--edit-ink);
  color: #fff;
  border: 1px solid var(--edit-ink);
  padding: 11px 18px;
  border-radius: var(--edit-radius-sm);
  font-weight: 650;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 42px;
}

.edit-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(23, 23, 23, 0.12);
}

.edit-button.secondary {
  background: var(--edit-surface);
  color: var(--edit-ink);
  border-color: var(--edit-line-strong);
}

.edit-button.secondary:hover {
  background: var(--edit-surface-soft);
}

.edit-button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--edit-muted);
  box-shadow: none;
}

.edit-button.ghost:hover {
  background: var(--edit-accent-bg);
  color: var(--edit-ink);
  transform: none;
}

.edit-button.danger {
  background: var(--edit-surface);
  color: var(--edit-error);
  border-color: var(--edit-error-border);
}

.text-button {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  color: var(--edit-muted);
  font-weight: 650;
  font-size: 13px;
  padding: 6px 4px;
}

.text-button:hover { color: var(--edit-ink); }

/* Cards */
.edit-card,
.surface-card,
.section-card {
  background: var(--edit-surface);
  border: 1px solid var(--edit-line);
  border-radius: var(--edit-radius-lg);
  padding: 22px 24px;
  box-shadow: var(--edit-shadow-soft);
}

.section-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-card-header h2 {
  font-family: var(--edit-font-display);
  font-size: 22px;
  font-weight: 400;
  margin: 4px 0 0;
  letter-spacing: -0.02em;
}

.section-card-link {
  font-size: 12px;
  font-weight: 650;
  color: var(--edit-accent);
  white-space: nowrap;
}

.section-card-link:hover { text-decoration: underline; }

/* Page header component */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 24px;
  padding: 2px 0;
}

.page-header-main { min-width: 0; }

.page-header h1 {
  font-family: var(--edit-font-display);
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.08;
  margin: 6px 0 8px;
  letter-spacing: -0.03em;
}

.page-header p {
  margin: 0;
  color: var(--edit-muted);
  font-size: 14px;
  line-height: 1.55;
  max-width: 640px;
}

.page-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Stats */
.stats-grid,
.metric-grid,
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card,
.metric-card {
  background: var(--edit-surface);
  border: 1px solid var(--edit-line);
  border-radius: var(--edit-radius-lg);
  padding: 18px 20px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--edit-shadow-soft);
  transition: box-shadow 0.15s ease;
}

.stat-card:hover,
.metric-card:hover {
  box-shadow: var(--edit-shadow-card);
}

.stat-card span,
.metric-card .metric-header span {
  font-size: 11px;
  font-weight: 650;
  color: var(--edit-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-card strong,
.metric-card > strong {
  font-family: var(--edit-font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.03em;
  margin-top: auto;
}

.stat-card small,
.metric-card > small {
  font-size: 12px;
  color: var(--edit-muted);
}

.stat-card-link {
  text-decoration: none;
  color: inherit;
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--edit-accent-bg);
  color: var(--edit-accent);
  display: grid;
  place-items: center;
  font-size: 14px;
}

/* Tabs */
.tab-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 4px;
  background: var(--edit-surface);
  border: 1px solid var(--edit-line);
  border-radius: var(--edit-radius-md);
  width: fit-content;
  max-width: 100%;
}

.tab-button {
  border: 0;
  background: transparent;
  padding: 9px 16px;
  border-radius: var(--edit-radius-sm);
  font: 650 13px var(--edit-font-ui);
  color: var(--edit-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-button:hover {
  background: var(--edit-canvas);
  color: var(--edit-ink);
}

.tab-button.active {
  background: var(--edit-ink);
  color: #fff;
}

/* Alerts */
.alert,
.form-error,
.form-success {
  border-radius: var(--edit-radius-md);
  padding: 13px 16px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.alert.success,
.form-success {
  background: var(--edit-success-bg);
  border: 1px solid var(--edit-success-border);
  color: var(--edit-success);
}

.alert.error,
.form-error {
  background: var(--edit-error-bg);
  border: 1px solid var(--edit-error-border);
  color: var(--edit-error);
}

.alert.info {
  background: var(--edit-info-bg);
  border: 1px solid var(--edit-info-border);
  color: var(--edit-info);
}

.alert.warning {
  background: var(--edit-warning-bg);
  border: 1px solid var(--edit-warning-border);
  color: var(--edit-warning);
}

/* Empty state */
.empty-state {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 24px;
  border: 1px dashed var(--edit-line-strong);
  border-radius: var(--edit-radius-lg);
  background: linear-gradient(180deg, var(--edit-surface-soft), var(--edit-surface));
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--edit-accent-bg);
  color: var(--edit-accent);
  display: grid;
  place-items: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.empty-state h2,
.empty-state strong {
  font-family: var(--edit-font-display);
  font-size: 20px;
  font-weight: 400;
  margin: 0 0 6px;
}

.empty-state p {
  color: var(--edit-muted);
  font-size: 13px;
  margin: 0 0 16px;
  max-width: 360px;
}

/* Forms */
.form-grid {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.form-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field.full-width,
.full-width { grid-column: 1 / -1; }

.field label {
  font-size: 12px;
  font-weight: 650;
  color: var(--edit-ink-soft);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--edit-line-strong);
  border-radius: var(--edit-radius-sm);
  background: var(--edit-surface-soft);
  color: var(--edit-ink);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 0;
  border-color: var(--edit-ink);
  background: var(--edit-surface);
  box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.06);
}

.field textarea { min-height: 108px; resize: vertical; }

/* Lists */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--edit-line);
  text-decoration: none;
  color: inherit;
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.list-row:last-child { border-bottom: 0; }

.list-row:hover { background: var(--edit-surface-soft); }

.list-row div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.list-row small {
  font-size: 12px;
  color: var(--edit-muted);
}

/* Status badges */
.status-badge,
.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--edit-accent-bg);
  border: 1px solid var(--edit-line);
  font-size: 11px;
  font-weight: 650;
  color: var(--edit-ink-soft);
}

.status-badge.complete,
.status-active {
  background: var(--edit-ink);
  color: #fff;
  border-color: var(--edit-ink);
}

/* Section heading (legacy compat) */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-family: var(--edit-font-display);
  font-size: 20px;
  font-weight: 400;
  margin: 0;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 22px;
  margin-bottom: 22px;
}

.page-heading h1 {
  font-family: var(--edit-font-display);
  font-size: clamp(28px, 4vw, 36px);
  margin: 6px 0 8px;
}

.heading-actions,
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.content-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--edit-line);
  border-top-color: var(--edit-ink);
  border-radius: 50%;
  animation: edit-spin 0.8s linear infinite;
}

@keyframes edit-spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .stats-grid,
  .metric-grid,
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid-two { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .page-header,
  .page-heading { flex-direction: column; align-items: flex-start; }
  .page-header-actions,
  .heading-actions { width: 100%; }
  .page-header-actions .edit-button,
  .heading-actions .edit-button { flex: 1; }
  .stats-grid,
  .metric-grid,
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid.two-columns { grid-template-columns: 1fr; }
}
