:root {
  --bg: #f3f0fb;
  --panel: #ffffff;
  --line: #e1daf4;
  --text: #26263c;
  --muted: #66627f;
  --primary: #6c49cb;
  --primary-dark: #4c35a9;
  --accent: #2a8bc4;
  --success: #20815f;
  --warning: #c17900;
  --danger: #bc4161;
  --shadow: 0 20px 60px rgba(65, 37, 125, 0.14);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Century Gothic", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(42, 139, 196, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(108, 73, 203, 0.2), transparent 35%),
    linear-gradient(180deg, #fcfbff 0%, var(--bg) 100%);
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  min-height: 100vh;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-card,
.table-card,
.modal-card,
.hero-banner,
.topbar,
.filters {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 520px);
  padding: 40px;
  border-radius: 32px;
}

.auth-logo,
.brand-logo {
  width: 220px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.auth-copy {
  color: var(--muted);
  line-height: 1.6;
}

.auth-form,
.filters {
  display: grid;
  gap: 16px;
}

.auth-form label,
.filters label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.filter-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.filter-actions .ghost-btn,
.filter-actions .secondary-btn {
  width: 100%;
  min-height: 52px;
  padding-left: 14px;
  padding-right: 14px;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

input[type="date"] {
  min-height: 52px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(108, 73, 203, 0.22);
  border-color: rgba(108, 73, 203, 0.6);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.logout-btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
}

.secondary-btn {
  background: #f3efff;
  color: var(--primary-dark);
}

.ghost-btn,
.logout-btn {
  background: transparent;
  color: var(--primary-dark);
  border: 1px solid rgba(108, 73, 203, 0.26);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.auth-note {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  padding: 16px;
  border-radius: 18px;
  background: #f7f4ff;
  color: var(--muted);
  font-size: 14px;
}

.auth-error {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.dashboard {
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr) auto;
  gap: 20px;
  align-items: center;
  padding: 22px 26px;
  border-radius: var(--radius);
}

.brand-lockup {
  display: flex;
  gap: 18px;
  align-items: center;
}

.manager-card {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.manager-card strong,
.manager-card a {
  color: var(--text);
  text-decoration: none;
}

.hero-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 20px;
  margin-top: 20px;
  padding: 30px;
  border-radius: 32px;
  overflow: hidden;
  position: relative;
}

.hero-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(42, 139, 196, 0.14), transparent 45%),
    linear-gradient(135deg, rgba(108, 73, 203, 0.22), transparent 70%);
  pointer-events: none;
}

.hero-banner > * {
  position: relative;
  z-index: 1;
}

.hero-banner h3 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  max-width: 12ch;
}

.hero-banner p {
  color: var(--muted);
  max-width: 66ch;
  line-height: 1.7;
}

.hero-metrics {
  display: grid;
  gap: 14px;
}

.hero-metrics article {
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(108, 73, 203, 0.12);
}

.hero-metrics span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero-metrics strong {
  font-size: 34px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin: 28px 0 16px;
}

.toolbar-title p {
  color: var(--muted);
  margin-bottom: 0;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 20px;
  border-radius: var(--radius);
}

.table-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 6px 6px;
  color: var(--muted);
  font-size: 14px;
}

.table-tools,
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-summary {
  color: var(--muted);
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  margin: 14px 0 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 16px 14px;
  text-align: left;
  border-bottom: 1px solid #efeaf8;
  vertical-align: top;
}

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

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.sort-button:hover,
.sort-button.active {
  color: var(--text);
}

.sort-indicator {
  display: inline-flex;
  width: 12px;
  flex: 0 0 12px;
  justify-content: center;
  color: var(--accent);
  font-weight: 800;
}

tbody tr {
  cursor: pointer;
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: #faf8ff;
}

tbody tr.selected {
  background: #f3efff;
}

.cell-main {
  font-weight: 700;
}

.cell-sub {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.reference-alert {
  color: var(--danger);
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.ready {
  color: var(--success);
  background: rgba(32, 129, 95, 0.12);
}

.status-pill.partial {
  color: var(--warning);
  background: rgba(193, 121, 0, 0.14);
}

.status-pill.pending {
  color: var(--danger);
  background: rgba(188, 65, 97, 0.12);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 16, 33, 0.56);
  z-index: 30;
}

.modal-card {
  width: min(100%, 1080px);
  max-height: 90vh;
  overflow: auto;
  padding: 28px;
  padding-top: 64px;
  border-radius: 28px;
  position: relative;
}

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

.modal-close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: #f3efff;
  color: var(--primary-dark);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 18px;
  padding-right: 72px;
  flex-wrap: wrap;
}

.modal-actions.vertical {
  display: grid;
  gap: 10px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.details-card {
  padding: 16px;
  border: 1px solid #eee7fa;
  border-radius: 18px;
  background: #faf8ff;
}

.service-list {
  display: grid;
  gap: 18px;
}

.service-group {
  border: 1px solid #eee7fa;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}

.service-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #faf8ff;
  border-bottom: 1px solid #eee7fa;
}

.service-header div {
  display: grid;
  gap: 4px;
}

.service-header span:not(.status-pill) {
  color: var(--muted);
  font-size: 13px;
}

.detail-table td,
.detail-table th {
  padding: 12px;
}

.detail-table .muted-row {
  color: var(--muted);
  background: #fbfafd;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 18px;
  border-radius: 16px;
  background: #1f1837;
  color: #fff;
  z-index: 40;
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  .topbar,
  .hero-banner {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .auth-panel,
  .dashboard {
    padding: 16px;
  }

  .auth-card,
  .topbar,
  .hero-banner,
  .filters,
  .table-card,
  .modal-card {
    padding: 20px;
    border-radius: 24px;
  }

  .brand-lockup {
    flex-direction: column;
    align-items: start;
  }

  .toolbar,
  .table-tools,
  .pagination,
  .footer {
    flex-direction: column;
    align-items: stretch;
  }

  .filters,
  .details-grid {
    grid-template-columns: 1fr;
  }
}
