/* ─── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px var(--s-4);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: var(--c-primary);
  color: var(--c-white);
  box-shadow: 0 1px 4px rgba(232,51,93,0.25);
}
.btn-primary:hover {
  background: var(--c-primary-hover);
  box-shadow: 0 2px 8px rgba(232,51,93,0.32);
}

.btn-navy {
  background: var(--c-navy);
  color: var(--c-white);
}
.btn-navy:hover { background: var(--c-navy-hover); }

.btn-secondary {
  background: var(--c-grey);
  color: var(--c-black);
}
.btn-secondary:hover { background: #e8e6e2; }

.btn-ghost {
  background: none;
  color: rgba(0,0,0,0.65);
  border: 1px solid var(--c-divider);
}
.btn-ghost:hover { background: var(--c-grey); }

.btn-danger {
  background: #c0392b;
  color: var(--c-white);
}
.btn-danger:hover { background: #a93226; }

.btn-sm {
  padding: 5px 10px;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 10px var(--s-6);
  font-size: var(--text-md);
}

/* Pill CTA variant */
.btn-pill {
  border-radius: var(--radius-pill);
}

.btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ─── Badges / Status chips ──────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  border-radius: var(--radius-pill);
}

.badge-active    { background: var(--c-status-active);    color: var(--c-status-active-text); }
.badge-pending   { background: var(--c-status-pending);   color: var(--c-status-pending-text); }
.badge-approved  { background: var(--c-status-approved);  color: var(--c-status-approved-text); }
.badge-rejected  { background: var(--c-status-rejected);  color: var(--c-status-rejected-text); }
.badge-conflict  { background: var(--c-status-conflict);  color: var(--c-status-conflict-text); }
.badge-modelling { background: var(--c-status-modelling); color: var(--c-status-modelling-text); }
.badge-draft     { background: var(--c-grey);             color: rgba(0,0,0,0.5); }

.badge-dot::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}

/* ─── Tables ─────────────────────────────────────────────── */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead th {
  padding: 9px var(--s-3);
  text-align: left;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(0,0,0,0.4);
  background: var(--c-white);
  border-bottom: 1px solid var(--c-divider);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--c-divider);
  transition: background 0.1s;
}

tbody tr:hover { background: #faf9f7; }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 10px var(--s-3);
  color: var(--c-black);
  vertical-align: middle;
}

.td-muted { color: rgba(0,0,0,0.45); }
.td-mono  { font-family: 'SF Mono', 'Fira Code', monospace; font-size: var(--text-xs); }

td:first-child,
th:first-child {
  padding-left: var(--s-4);
}

.table-container {
  background: var(--c-white);
  border: 1px solid var(--c-divider);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

/* ─── KPI Cards ──────────────────────────────────────────── */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}

.kpi-card {
  background: var(--c-white);
  border: 1px solid var(--c-divider);
  border-radius: var(--radius);
  padding: var(--s-5) var(--s-6);
  box-shadow: var(--shadow-xs);
}

.kpi-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(0,0,0,0.38);
  margin-bottom: var(--s-2);
}

.kpi-value {
  font-family: var(--font-ui);
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-black);
  line-height: 1;
  letter-spacing: -0.5px;
}

.kpi-delta {
  font-size: var(--text-xs);
  color: rgba(0,0,0,0.4);
  margin-top: var(--s-1);
}

.kpi-delta.up   { color: var(--c-status-approved-text); }
.kpi-delta.warn { color: var(--c-status-pending-text); }
.kpi-delta.down { color: var(--c-status-rejected-text); }

/* ─── Section blocks ─────────────────────────────────────── */

.section-block {
  background: var(--c-white);
  border: 1px solid var(--c-divider);
  border-radius: var(--radius);
  margin-bottom: var(--s-6);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-6);
  border-bottom: 1px solid var(--c-divider);
  gap: var(--s-4);
}

.section-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--c-black);
}

.section-body {
  padding: var(--s-6);
}

/* ─── Filter bar ─────────────────────────────────────────── */

.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--c-grey);
  border-bottom: 1px solid var(--c-divider);
  flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input[type="text"],
.filter-bar input[type="search"] {
  padding: 6px 10px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  border: 1px solid var(--c-divider);
  background: var(--c-white);
  color: var(--c-black);
  outline: none;
  border-radius: var(--radius-sm);
  min-width: 140px;
}

.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--c-primary);
}

.filter-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(0,0,0,0.38);
  white-space: nowrap;
}

.filter-sep {
  width: 1px;
  height: 18px;
  background: var(--c-divider);
}

/* ─── Pagination ─────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--c-divider);
  font-size: var(--text-xs);
  color: rgba(0,0,0,0.45);
}

.pagination-info { flex: 1; }

.page-btn {
  padding: 4px 9px;
  border: 1px solid var(--c-divider);
  background: var(--c-white);
  font-size: var(--text-xs);
  cursor: pointer;
  font-family: var(--font-ui);
  color: var(--c-black);
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}

.page-btn:hover  { background: var(--c-grey); }
.page-btn.active { background: var(--c-primary); color: var(--c-white); border-color: var(--c-primary); }
.page-btn:disabled { opacity: 0.35; cursor: default; }

/* ─── Chip ───────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--c-primary-tint);
  color: var(--c-primary);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-pill);
}

.chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  opacity: 0.6;
  display: flex;
  align-items: center;
}

.chip-remove:hover { opacity: 1; }

/* ─── Alert / Banner ─────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  font-size: var(--text-sm);
  border-left: 3px solid;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.alert-warn {
  background: var(--c-status-pending);
  border-color: var(--c-status-pending-text);
  color: var(--c-status-pending-text);
}

.alert-error {
  background: var(--c-status-conflict);
  border-color: var(--c-status-conflict-text);
  color: var(--c-status-conflict-text);
}

.alert-info {
  background: var(--c-status-active);
  border-color: var(--c-status-active-text);
  color: var(--c-status-active-text);
}

/* ─── Form elements ──────────────────────────────────────── */

.form-field { margin-bottom: var(--s-4); }

.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(0,0,0,0.45);
  margin-bottom: var(--s-1);
}

.form-input,
.form-select {
  width: 100%;
  padding: 8px 10px;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  border: 1px solid var(--c-divider);
  background: var(--c-white);
  color: var(--c-black);
  outline: none;
  border-radius: var(--radius-sm);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(232,51,93,0.1);
}

/* ─── Divider ────────────────────────────────────────────── */

.divider {
  height: 1px;
  background: var(--c-divider);
  margin: var(--s-6) 0;
}

/* ─── Empty state ────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--s-12) var(--s-8);
  color: rgba(0,0,0,0.35);
}

.empty-state-title {
  font-size: var(--text-md);
  font-weight: 500;
  margin-bottom: var(--s-2);
  color: rgba(0,0,0,0.45);
}
