:root {
  --bs-body-font-family: "Source Sans 3", "Segoe UI", sans-serif;
  --bs-body-bg: #f2f6fb;
  --bs-body-color: #0f172a;
  --bs-border-radius: 0.72rem;
  --bs-border-radius-sm: 0.56rem;
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;

  --app-surface: #ffffff;
  --app-border: #d8e2ee;
  --app-muted: #62748f;
}

* {
  box-sizing: border-box;
}

.app-body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 0% -18%, #e0edf8 0%, rgba(224, 237, 248, 0) 70%),
    radial-gradient(1300px 620px at 100% -24%, #d7efe8 0%, rgba(215, 239, 232, 0) 70%),
    linear-gradient(180deg, #f8fbff 0%, #eef3f9 100%);
}

.app-topbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(112deg, #0f172a 0%, #123157 56%, #0f766e 100%);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2);
}

.app-brand {
  color: #f8fafc;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app-subtitle {
  color: #d7e5f5;
  font-size: 0.88rem;
}

.app-userbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #f8fafc;
}

.app-user-email {
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
}

.app-user-role {
  color: #d7e5f5;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

.login-shell {
  display: flex;
  min-height: calc(100vh - 190px);
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

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

.app-tabs {
  display: inline-flex;
  gap: 0.34rem;
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid #cad6e6;
  background: #f7fbff;
  box-shadow: 0 6px 14px rgba(39, 67, 103, 0.08);
}

.app-tabs .nav-link {
  border: 0;
  border-radius: 999px;
  color: #3e516f;
  font-weight: 700;
  line-height: 1;
  padding: 0.52rem 1.02rem;
}

.app-tabs .nav-link:hover {
  color: #0f172a;
  background: #ecf4ff;
}

.app-tabs .nav-link.active {
  color: #ffffff;
  background: linear-gradient(112deg, #0f172a 0%, #113152 55%, #0f766e 100%);
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.2);
}

.nightly-status-strip {
  border: 1px solid #d8e2ee;
  border-radius: 0.5rem;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(14, 30, 58, 0.06);
  padding: 0.72rem 0.84rem;
}

.nightly-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  border-radius: 999px;
  padding: 0.24rem 0.68rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nightly-status-dot {
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 999px;
  background: currentColor;
}

.nightly-status-badge-completed {
  color: #0f5132;
  background: #d9f8eb;
  border: 1px solid #7cd9b2;
}

.nightly-status-badge-running {
  color: #92400e;
  background: #fff4d7;
  border: 1px solid #f4c35f;
}

.nightly-status-badge-failed {
  color: #991b1b;
  background: #feeceb;
  border: 1px solid #f4b6b2;
}

.nightly-status-badge-unknown {
  color: #475569;
  background: #eef2f6;
  border: 1px solid #ccd6e2;
}

.nightly-status-time {
  color: #52657f;
  font-size: 0.88rem;
  font-weight: 600;
}

.card {
  border: 1px solid var(--app-border);
  border-radius: 1rem;
  background: var(--app-surface);
  box-shadow: 0 10px 20px rgba(14, 30, 58, 0.06);
  overflow: hidden;
}

.card-header {
  border-bottom: 1px solid #e3ebf5;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding-top: 0.84rem;
  padding-bottom: 0.84rem;
}

.card-header .h6,
.card-header h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: #111b31;
}

.metric-card .card-body {
  background: linear-gradient(160deg, #ffffff 0%, #f3faf8 74%);
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.metric-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.76rem;
  color: var(--app-muted);
}

.metric-value {
  margin-top: 0.22rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.08rem;
  line-height: 1;
  font-weight: 700;
  color: #0f172a;
}

.table {
  margin-bottom: 0;
}

.table-scroll-mobile {
  overflow-x: visible;
}

.app-table {
  table-layout: fixed;
  width: 100%;
}

.app-table th {
  white-space: normal;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  color: #4d617f;
  letter-spacing: 0.012em;
  text-transform: none;
  border-color: #dfe8f3;
  padding-top: 0.62rem;
  padding-bottom: 0.62rem;
}

.app-table td {
  font-size: 0.9rem;
  line-height: 1.34;
  vertical-align: middle;
  border-color: #e5edf6;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  word-break: break-word;
}

.app-table tbody tr:nth-child(even) td {
  background: #fcfdff;
}

.app-table tbody tr:nth-child(odd) td {
  background: #ffffff;
}

.app-table tbody tr:hover td {
  background: #eef7ff;
}

.table-light,
.table > :not(caption) > * > * {
  border-color: #dfe8f3;
}

.compact-table th,
.compact-table td {
  padding-top: 0.52rem;
  padding-bottom: 0.52rem;
}

.users-table th:nth-child(1) { width: 21%; }
.users-table th:nth-child(2) { width: 27%; }
.users-table th:nth-child(3) { width: 24%; }
.users-table th:nth-child(4) { width: 28%; }

.dce-table th:nth-child(1) { width: 12%; }
.dce-table th:nth-child(2) { width: 27%; }
.dce-table th:nth-child(3) { width: 23%; }
.dce-table th:nth-child(4) { width: 18%; }
.dce-table th:nth-child(5) { width: 20%; }

.analysis-queue-table th:nth-child(1) { width: 25%; }
.analysis-queue-table th:nth-child(2) { width: 41%; }
.analysis-queue-table th:nth-child(3) { width: 14%; }
.analysis-queue-table th:nth-child(4) { width: 20%; }

.account-cell,
.contact-cell,
.export-cell,
.actions-cell {
  vertical-align: top;
}

.account-usage-line {
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 800;
  margin-top: 0.34rem;
}

.email-line {
  color: #334155;
  margin-top: 0.12rem;
  overflow-wrap: anywhere;
}

.profile-url {
  display: block;
  color: #334155;
  font-size: 0.84rem;
  margin-top: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mono {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.78rem;
}

.limit-select {
  min-width: 84px;
}

.global-run-actions {
  align-items: flex-start;
}

.global-run-form {
  flex: 0 0 auto;
}

.global-run-actions .limit-select {
  width: 17rem;
  flex: 0 0 17rem;
}

.date-input {
  min-width: 152px;
}

.cpv-code-line {
  color: #24364f;
  overflow-wrap: anywhere;
  white-space: normal;
}

.manual-upload-form {
  max-width: 760px;
}

.manual-upload-dropzone {
  display: flex;
  min-height: 124px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  border: 2px dashed #9fb4ce;
  border-radius: 0.72rem;
  background: #f8fbff;
  color: #24364f;
  text-align: center;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.manual-upload-dropzone:hover,
.manual-upload-dropzone.is-dragover {
  border-color: #0f766e;
  background: #eefaf7;
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.12);
}

.manual-upload-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.manual-upload-subtitle {
  color: #62748f;
  font-size: 0.88rem;
  font-weight: 600;
}

.manual-upload-selected {
  overflow-wrap: anywhere;
}

.manual-upload-table th:nth-child(1) { width: 28%; }
.manual-upload-table th:nth-child(2) { width: 24%; }
.manual-upload-table th:nth-child(3) { width: 30%; }
.manual-upload-table th:nth-child(4) { width: 18%; }

.manual-cpv-input {
  min-height: 68px;
  resize: vertical;
}

.scraping-log-tail {
  max-height: 260px;
  overflow: auto;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #dbeafe;
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 0.95rem;
  white-space: pre-wrap;
}

.form-control,
.form-select {
  border-color: #c8d6e7;
}

.form-control:focus,
.form-select:focus {
  border-color: #61b8ab;
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.15);
}

.btn {
  font-weight: 700;
  border-radius: 0.64rem;
  letter-spacing: 0.01em;
}

.btn-sm {
  --bs-btn-padding-y: 0.34rem;
  --bs-btn-padding-x: 0.64rem;
  --bs-btn-font-size: 0.91rem;
}

.btn-primary {
  --bs-btn-bg: #0f766e;
  --bs-btn-border-color: #0f766e;
  --bs-btn-hover-bg: #0d6a62;
  --bs-btn-hover-border-color: #0d6a62;
}

.btn-dark {
  --bs-btn-bg: #0f172a;
  --bs-btn-border-color: #0f172a;
  --bs-btn-hover-bg: #111f38;
  --bs-btn-hover-border-color: #111f38;
}

.btn-outline-secondary {
  --bs-btn-color: #334155;
  --bs-btn-border-color: #b9c8db;
  --bs-btn-hover-bg: #eaf2fb;
  --bs-btn-hover-border-color: #9fb4ce;
  --bs-btn-hover-color: #0f172a;
}

.btn-outline-warning {
  --bs-btn-color: #9a3412;
  --bs-btn-border-color: #f3b875;
  --bs-btn-hover-bg: #fff0db;
  --bs-btn-hover-border-color: #e8a658;
  --bs-btn-hover-color: #7c2d12;
}

.status-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.16rem 0.54rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.status-badge-active {
  color: #0f5132;
  background: #d9f8eb;
  border: 1px solid #7cd9b2;
}

.status-badge-inactive {
  color: #475569;
  background: #eef2f6;
  border: 1px solid #ccd6e2;
}

.status-badge-confidential {
  display: inline-block;
  border-radius: 999px;
  padding: 0.16rem 0.54rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #9a3412;
  background: #fff2de;
  border: 1px solid #f3b975;
}

.status-badge-not-found {
  display: inline-block;
  border-radius: 999px;
  padding: 0.16rem 0.54rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #991b1b;
  background: #feeceb;
  border: 1px solid #f4b6b2;
}

.row-confidential td {
  background: #fff6ea !important;
}

.row-confidential:hover td {
  background: #ffebd4 !important;
}

.row-not-found td {
  background: #fff1f1 !important;
}

.row-not-found:hover td {
  background: #ffdede !important;
}

.muted-inline {
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 600;
}

@media (max-width: 992px) {
  .app-brand {
    font-size: 1.24rem;
  }

  .app-subtitle {
    font-size: 0.8rem;
  }

  .app-userbar {
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
  }

  .app-user-email,
  .app-user-role {
    text-align: left;
  }

  .table-scroll-mobile {
    overflow-x: auto;
  }

  .app-table {
    min-width: 760px;
  }

  .app-table td {
    font-size: 0.85rem;
  }
}
