/* Audit Firm ERP Phase 7Q.1 — Standard Theme Tokens
   Purpose: one consistent colour, card, button, badge and form language across dashboards.
   This file is plain CSS and works with the current Tailwind CDN setup. */

:root {
  /* Brand / CA professional blue */
  --af-color-brand-50: #eff6ff;
  --af-color-brand-100: #dbeafe;
  --af-color-brand-200: #bfdbfe;
  --af-color-brand-300: #93c5fd;
  --af-color-brand-400: #60a5fa;
  --af-color-brand-500: #2563eb;
  --af-color-brand-600: #1d4ed8;
  --af-color-brand-700: #1e40af;
  --af-color-brand-800: #1e3a8a;
  --af-color-brand-900: #172554;

  /* Neutral system */
  --af-color-bg: #f8fafc;
  --af-color-surface: #ffffff;
  --af-color-surface-muted: #f1f5f9;
  --af-color-border: #e2e8f0;
  --af-color-text: #0f172a;
  --af-color-muted: #64748b;

  /* Status system */
  --af-color-success-50: #ecfdf5;
  --af-color-success-600: #059669;
  --af-color-success-700: #047857;
  --af-color-warning-50: #fffbeb;
  --af-color-warning-600: #d97706;
  --af-color-warning-700: #b45309;
  --af-color-danger-50: #fef2f2;
  --af-color-danger-600: #dc2626;
  --af-color-danger-700: #b91c1c;
  --af-color-info-50: #eff6ff;
  --af-color-info-600: #2563eb;
  --af-color-info-700: #1d4ed8;

  /* Shape and elevation */
  --af-radius-card: 1rem;
  --af-radius-control: 0.75rem;
  --af-shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --af-shadow-card: 0 18px 45px rgba(15, 23, 42, 0.10);
}

body {
  background: var(--af-color-bg);
  color: var(--af-color-text);
}

/* Reusable UI classes for upcoming dashboard refinements */
.af-page-shell {
  max-width: 90rem;
  margin-left: auto;
  margin-right: auto;
}

.af-page-title {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--af-color-text);
}

.af-page-subtitle {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--af-color-muted);
}

.af-card {
  border: 1px solid var(--af-color-border);
  background: var(--af-color-surface);
  border-radius: var(--af-radius-card);
  box-shadow: var(--af-shadow-soft);
}

.af-card-muted {
  border: 1px solid var(--af-color-border);
  background: linear-gradient(180deg, #ffffff 0%, var(--af-color-surface-muted) 100%);
  border-radius: var(--af-radius-card);
}

.af-metric-card {
  border: 1px solid var(--af-color-border);
  background: var(--af-color-surface);
  border-radius: var(--af-radius-card);
  box-shadow: var(--af-shadow-soft);
  padding: 1rem;
}

.af-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--af-radius-control);
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.af-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

.af-btn-primary {
  background: var(--af-color-brand-600);
  color: #ffffff;
}

.af-btn-primary:hover {
  background: var(--af-color-brand-700);
}

.af-btn-secondary {
  border: 1px solid var(--af-color-border);
  background: #ffffff;
  color: #334155;
}

.af-btn-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
}

.af-btn-danger {
  background: var(--af-color-danger-600);
  color: #ffffff;
}

.af-btn-danger:hover {
  background: var(--af-color-danger-700);
}

.af-input,
.af-select,
.af-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--af-color-text);
  border-radius: var(--af-radius-control);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.af-input:focus,
.af-select:focus,
.af-textarea:focus {
  outline: none;
  border-color: var(--af-color-brand-500);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.af-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1rem;
}

.af-badge-neutral { background: #f1f5f9; color: #334155; }
.af-badge-brand { background: var(--af-color-brand-50); color: var(--af-color-brand-700); }
.af-badge-success { background: var(--af-color-success-50); color: var(--af-color-success-700); }
.af-badge-warning { background: var(--af-color-warning-50); color: var(--af-color-warning-700); }
.af-badge-danger { background: var(--af-color-danger-50); color: var(--af-color-danger-700); }
.af-badge-info { background: var(--af-color-info-50); color: var(--af-color-info-700); }

.af-section-heading {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.af-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.af-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--af-color-border);
}

.af-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--af-color-border);
  font-size: 0.875rem;
}

.af-kanban-column {
  border: 1px solid var(--af-color-border);
  background: #f8fafc;
  border-radius: var(--af-radius-card);
  padding: 0.75rem;
}

.af-kanban-card {
  border: 1px solid var(--af-color-border);
  background: #ffffff;
  border-radius: 0.875rem;
  padding: 0.75rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

/* Phase 7Q common dashboard alignment refinement
   Low-specificity padding/layout helpers for all dashboards.
   Tailwind padding classes such as p-4/p-6 will still override these defaults. */
:where(.af-card) {
  padding: 1.25rem;
  overflow: hidden;
}

:where(.af-card > .flex:first-child),
:where(.af-card > .grid:first-child) {
  min-width: 0;
}

:where(.af-card h1, .af-card h2, .af-card h3) {
  line-height: 1.35;
}

:where(.af-card .af-btn) {
  white-space: nowrap;
}

:where(.af-metric-card) {
  min-height: 7rem;
  overflow: hidden;
}

:where(.af-dashboard-grid) {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 1280px) {
  :where(.af-dashboard-grid-2) {
    grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem);
    align-items: start;
  }
}

:where(.af-panel-header) {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f1f5f9;
}

@media (max-width: 640px) {
  :where(.af-panel-header) {
    flex-direction: column;
  }
  :where(.af-card .af-btn) {
    width: 100%;
  }
}

/* Phase 7Q dashboard alignment strong fix
   Purpose: ensure all dashboard cards have safe internal spacing even when templates
   use only class="af-card" without Tailwind p-* classes. */
.af-card {
  padding: 1.25rem !important;
  overflow: hidden;
  box-sizing: border-box;
}

.af-card > .flex:first-child,
.af-card > .grid:first-child {
  min-width: 0;
}

.af-card > .flex:first-child {
  gap: 0.875rem;
  flex-wrap: wrap;
}

.af-card > .flex:first-child > div,
.af-card > .flex:first-child > section,
.af-card > .flex:first-child > article {
  min-width: 0;
}

.af-card > .flex:first-child .af-btn,
.af-card > .flex:first-child a[class*="rounded"],
.af-card > .flex:first-child button[class*="rounded"] {
  flex-shrink: 0;
}

.af-card h1,
.af-card h2,
.af-card h3,
.af-card h4 {
  margin-top: 0;
  overflow-wrap: anywhere;
}

.af-card dl,
.af-card p,
.af-card table,
.af-card form {
  min-width: 0;
}

.af-card .af-btn,
.af-card a.af-btn,
.af-card button.af-btn {
  max-width: 100%;
  white-space: nowrap;
}

.af-dashboard-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

@media (min-width: 1280px) {
  .af-dashboard-two-col {
    grid-template-columns: minmax(0, 1fr) minmax(22rem, 24rem);
    align-items: start;
  }
}

@media (max-width: 640px) {
  .af-card {
    padding: 1rem !important;
  }
  .af-card > .flex:first-child {
    align-items: stretch;
  }
  .af-card > .flex:first-child .af-btn,
  .af-card > .flex:first-child a[class*="rounded"],
  .af-card > .flex:first-child button[class*="rounded"] {
    width: 100%;
  }
}
