:root {
  --bg-start: #f4f8fb;
  --bg-end: #e7eff6;
  --card: #ffffff;
  --text: #163044;
  --muted: #5f7384;
  --accent: #0f766e;
  --accent-2: #1d4ed8;
  --border: #d7e3ed;
  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --error-bg: #fef2f2;
  --error-text: #991b1b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
}

.container {
  width: min(1180px, 94%);
  margin: 24px auto;
}

.header h1 {
  margin: 8px 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.header-copy {
  min-width: 0;
}

.client-logo {
  display: block;
  width: min(220px, 70vw);
  height: auto;
  margin: 0 0 12px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
  color: #2c6079;
  margin: 0;
}

.sync-workflow {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.action-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 18px rgba(16, 36, 52, 0.05);
}

.workflow-card {
  min-height: 96px;
}

.workflow-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.workflow-buttons form {
  margin: 0;
}

.action-card h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.action-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.action-card .cache-note {
  margin-top: 6px;
  color: var(--text);
}

.cache-note strong {
  color: var(--accent);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 10px 22px rgba(16, 36, 52, 0.05);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.btn {
  border: 0;
  color: #fff;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  min-width: 96px;
}

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

.btn.secondary {
  background: var(--accent-2);
}

.btn.danger {
  background: #dc2626;
}

.btn.ghost {
  background: #e8eef4;
  color: #1f3d53;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn.full {
  width: 100%;
}

.btn.btn-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.alerts {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.alert {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.94rem;
}

.alert.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.alert.error {
  background: var(--error-bg);
  color: var(--error-text);
}

.history {
  margin-top: 20px;
}

.client-summary {
  margin-top: 18px;
  padding: 16px 18px;
}

.client-summary h2 {
  margin: 4px 0 6px;
  font-size: 1.2rem;
}

.summary-logo {
  display: block;
  width: min(180px, 60vw);
  height: auto;
  margin: 4px 0 10px;
}

.summary-line {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
}

.summary-line span {
  min-width: 0;
}

.summary-separator {
  color: #9aabb8;
}

.progress-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.progress-grid.single-panel {
  grid-template-columns: 1fr;
}

.progress-card {
  min-width: 0;
}

.client-list-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.client-table td,
.client-table th {
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e7edf3;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #0f766e, #1d4ed8);
  transition: width 0.4s ease;
}

.progress-percent {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #f9fcff;
  min-width: 0;
}

.metric span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.brand-crediauto {
  --bg-start: #f6f8fb;
  --bg-end: #e9edf3;
  --text: #151c28;
  --muted: #647080;
  --accent: #ff3d00;
  --accent-2: #172236;
  --border: #e1e6ee;
  background:
    linear-gradient(180deg, rgba(21, 28, 40, 0.72), rgba(21, 28, 40, 0.2) 260px),
    linear-gradient(180deg, var(--bg-start), var(--bg-end));
}

.brand-crediauto .header {
  color: #ffffff;
  padding: 8px 0 2px;
}

.brand-crediauto .eyebrow {
  color: #ff3d00;
}

.brand-crediauto .header h1 {
  color: #ffffff;
}

.brand-crediauto .subtitle {
  color: rgba(255, 255, 255, 0.82);
}

.brand-crediauto .client-summary,
.brand-crediauto .action-card,
.brand-crediauto .card {
  border-color: rgba(225, 230, 238, 0.95);
  box-shadow: 0 12px 28px rgba(21, 28, 40, 0.1);
}

.brand-crediauto .client-summary,
.brand-crediauto .workflow-card {
  background: rgba(255, 255, 255, 0.98);
}

.brand-crediauto .client-summary {
  border-top: 4px solid #ff3d00;
}

.brand-crediauto .btn.primary,
.brand-crediauto .btn.secondary {
  background: #ff3d00;
}

.brand-crediauto .btn.ghost {
  background: #eef2f7;
  color: #172236;
}

.brand-crediauto .progress-fill {
  background: linear-gradient(90deg, #ff3d00, #172236);
}

.brand-crediauto input,
.brand-crediauto select {
  background: #ffffff;
  border-color: #e1e6ee;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hidden {
  display: none;
}

input,
select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  width: 100%;
}

.inline-form {
  margin-top: 12px;
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form label {
  color: var(--muted);
  font-size: 0.9rem;
}

.source-form {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.source-form label {
  color: var(--muted);
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 0.93rem;
}

th {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.empty {
  margin: 0;
}

.activity-table th:first-child,
.activity-table td:first-child {
  width: 180px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.login-card {
  width: min(420px, 100%);
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-form label {
  font-size: 0.9rem;
  color: var(--muted);
}

.login-form input {
  margin-bottom: 8px;
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 24px, 1180px);
    margin: 14px auto;
  }

  .header-row {
    flex-direction: column;
  }

  .header h1 {
    font-size: 1.45rem;
  }

  .header-row form,
  .header-row .btn {
    width: 100%;
  }

  .sync-workflow,
  .progress-grid {
    grid-template-columns: 1fr;
  }

  .action-card {
    grid-template-columns: 1fr;
  }

  .action-card form,
  .action-card .btn {
    width: 100%;
  }

  .workflow-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .card,
  .client-summary,
  .action-card {
    padding: 14px;
  }

  .summary-line {
    display: grid;
    gap: 4px;
  }

  .summary-separator {
    display: none;
  }

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

  .source-form {
    gap: 10px;
  }

  .client-table {
    min-width: 720px;
  }

  .activity-table th:first-child,
  .activity-table td:first-child {
    width: 128px;
  }
}

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

  .activity-table th,
  .activity-table td {
    padding: 9px 4px;
    font-size: 0.86rem;
  }
}
