@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap");

:root {
  --ink: #17201d;
  --muted: #66706b;
  --paper: #f4f1e8;
  --panel: #fffdf8;
  --line: #dcd8cc;
  --brand: #133f37;
  --brand-soft: #d9e7df;
  --accent: #e4643b;
  --danger: #a83d30;
  --success: #176c51;
  --shadow: 0 24px 70px rgba(25, 40, 34, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 22%, rgba(217, 231, 223, 0.8), transparent 32%),
    radial-gradient(circle at 92% 74%, rgba(228, 100, 59, 0.08), transparent 30%),
    var(--paper);
  font-family: "DM Sans", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.admin-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(220, 216, 204, 0.85);
  background: rgba(244, 241, 232, 0.88);
  backdrop-filter: blur(18px);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.admin-brand > span,
.card-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--brand);
  font: 800 13px/1 "Manrope", sans-serif;
  letter-spacing: -0.05em;
}

.admin-brand strong {
  font: 800 20px/1 "Manrope", sans-serif;
  letter-spacing: -0.04em;
}

.admin-header-actions,
.secure-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.secure-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.secure-label i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2da36f;
  box-shadow: 0 0 0 5px rgba(45, 163, 111, 0.12);
}

.quiet-button,
.text-button {
  border: 0;
  color: var(--brand);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.quiet-button {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
}

.admin-main {
  min-height: calc(100vh - 132px);
}

.login-shell {
  display: grid;
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 132px);
  margin: 0 auto;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 450px);
  gap: clamp(52px, 8vw, 120px);
  padding: 70px 0;
}

.login-intro {
  max-width: 610px;
}

.eyebrow,
.step-label {
  margin: 0 0 13px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-intro h1,
.portal-heading h1 {
  margin: 0;
  font: 700 clamp(43px, 5.7vw, 72px)/0.99 "Manrope", sans-serif;
  letter-spacing: -0.065em;
}

.login-intro > p:not(.eyebrow) {
  max-width: 570px;
  margin: 28px 0 34px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.trust-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 14px;
  list-style: none;
}

.trust-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  font-weight: 600;
}

.trust-list span {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(19, 63, 55, 0.18);
  border-radius: 50%;
  color: var(--brand);
  font-size: 10px;
}

.login-card,
.panel,
.site-card,
.stats-card {
  border: 1px solid rgba(220, 216, 204, 0.92);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.login-card {
  position: relative;
  overflow: hidden;
  padding: 38px;
  border-radius: 24px;
}

.login-card::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 140px;
  height: 140px;
  border-radius: 0 0 0 140px;
  background: var(--brand-soft);
  content: "";
  opacity: 0.65;
}

.card-mark {
  position: relative;
  margin-bottom: 32px;
}

.login-card h2,
.section-title h2,
.panel h2 {
  margin: 0;
  font: 700 26px/1.16 "Manrope", sans-serif;
  letter-spacing: -0.04em;
}

.card-copy,
.empty-copy {
  margin: 12px 0 25px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

form label {
  display: grid;
  gap: 8px;
  color: #46504b;
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  color: var(--ink);
  background: white;
  padding: 0 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(19, 63, 55, 0.1);
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: 11px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  color: white;
  background: var(--brand);
}

.primary-button:hover {
  background: #0c312b;
}

.secondary-button {
  color: var(--brand);
  border: 1px solid rgba(19, 63, 55, 0.26);
  background: white;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.code-input {
  height: 66px;
  text-align: center;
  font: 700 30px/1 "Manrope", sans-serif;
  letter-spacing: 0.25em;
}

.code-actions {
  display: flex;
  justify-content: space-between;
  padding-top: 16px;
}

.form-message {
  min-height: 20px;
  margin: 16px 0 0;
  color: var(--success);
  font-size: 13px;
  line-height: 1.45;
}

.form-message.error {
  color: var(--danger);
}

.privacy-note {
  margin: 19px 0 0;
  padding-top: 17px;
  border-top: 1px solid var(--line);
  color: #7e8682;
  font-size: 10px;
  line-height: 1.55;
}

.portal-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 62px 0 90px;
}

.portal-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 50px;
}

.portal-heading h1 {
  font-size: clamp(38px, 5vw, 64px);
}

.portal-heading > div:first-child > p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
}

.identity-chip {
  display: flex;
  min-width: 270px;
  align-items: center;
  gap: 12px;
  padding: 11px 14px 11px 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 253, 248, 0.75);
}

.identity-chip > span {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.identity-chip div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.identity-chip strong,
.identity-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-chip strong {
  font-size: 13px;
}

.identity-chip small {
  color: var(--muted);
  font-size: 11px;
}

.section-title,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.section-title {
  margin-bottom: 22px;
}

.section-note {
  color: var(--muted);
  font-size: 12px;
}

.site-grid,
.stats-grid {
  display: grid;
  gap: 18px;
}

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

.site-card {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  padding: 25px;
  border-radius: 19px;
}

.site-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.product-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: var(--brand);
  background: var(--brand-soft);
  font: 800 11px/1 "Manrope", sans-serif;
}

.status-pill,
.count-badge {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--success);
  background: #e2f1e9;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill.paused {
  color: #8a4d20;
  background: #faeadc;
}

.site-card h3 {
  margin: 26px 0 7px;
  font: 700 20px/1.2 "Manrope", sans-serif;
  letter-spacing: -0.035em;
}

.site-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.site-meta {
  display: grid;
  margin: 20px 0;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.site-card .primary-button {
  margin-top: auto;
}

.site-card .primary-button:disabled {
  cursor: not-allowed;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 42px;
  border: 1px dashed #c9c3b7;
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
}

.stats-card {
  padding: 22px;
  border-radius: 17px;
}

.stats-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.stats-card strong {
  display: block;
  margin-top: 8px;
  font: 700 32px/1 "Manrope", sans-serif;
}

.platform-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(420px, 1.28fr);
  gap: 20px;
}

.panel {
  padding: 25px;
  border-radius: 20px;
}

.panel-heading {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.count-badge {
  min-width: 29px;
  justify-content: center;
  color: var(--brand);
  background: var(--brand-soft);
}

.application-list {
  display: grid;
  max-height: 640px;
  overflow: auto;
}

.application-item {
  display: grid;
  gap: 8px;
  padding: 17px 2px;
  border-bottom: 1px solid var(--line);
}

.application-item:last-child {
  border-bottom: 0;
}

.application-item strong {
  font-size: 14px;
}

.application-item span {
  color: var(--muted);
  font-size: 11px;
}

.application-item button {
  justify-self: start;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--brand);
  background: transparent;
  padding: 3px 0;
  font-size: 11px;
  font-weight: 800;
}

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

.form-grid .wide-field {
  grid-column: 1 / -1;
}

.provision-panel .primary-button {
  width: auto;
}

.secret-panel {
  display: grid;
  grid-template-columns: 0.8fr 1.3fr auto;
  align-items: center;
  gap: 28px;
  margin-top: 20px;
  border-color: rgba(228, 100, 59, 0.42);
}

.secret-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.secret-values {
  display: grid;
  min-width: 0;
  margin: 0;
  gap: 10px;
}

.secret-values div {
  display: grid;
  min-width: 0;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
}

.secret-values dt {
  color: var(--muted);
  font-size: 11px;
}

.secret-values dd {
  min-width: 0;
  margin: 0;
}

.secret-values code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.merchant-panel {
  margin-top: 20px;
}

.merchant-admin-list {
  display: grid;
  gap: 0;
}

.merchant-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(300px, 1.2fr);
  align-items: center;
  gap: 22px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.merchant-row:last-child {
  border-bottom: 0;
}

.merchant-row h3 {
  margin: 0 0 5px;
  font: 700 15px/1.2 "Manrope", sans-serif;
}

.merchant-row p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.mini-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 100px auto;
  gap: 8px;
}

.mini-form input,
.mini-form select,
.mini-form button {
  height: 39px;
}

.mini-form button {
  border: 0;
  border-radius: 9px;
  color: white;
  background: var(--brand);
  padding: 0 12px;
  font-size: 11px;
  font-weight: 800;
}

.admin-footer {
  display: flex;
  min-height: 60px;
  align-items: center;
  gap: 22px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.admin-footer a {
  text-decoration: none;
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
    gap: 45px;
  }

  .login-intro {
    max-width: 720px;
  }

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

  .platform-layout,
  .secret-panel {
    grid-template-columns: 1fr;
  }

  .merchant-row {
    grid-template-columns: 1fr;
  }

  .mini-form {
    max-width: 520px;
  }
}

@media (max-width: 620px) {
  .secure-label {
    display: none;
  }

  .admin-header {
    min-height: 64px;
  }

  .login-shell,
  .portal-shell {
    width: min(100% - 28px, 1240px);
  }

  .login-shell {
    padding: 44px 0;
  }

  .login-card,
  .panel {
    padding: 21px;
    border-radius: 17px;
  }

  .portal-shell {
    padding: 42px 0 70px;
  }

  .portal-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 36px;
  }

  .identity-chip {
    width: 100%;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-grid,
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide-field {
    grid-column: auto;
  }

  .mini-form {
    grid-template-columns: 1fr;
  }

  .admin-footer {
    flex-wrap: wrap;
    padding-top: 17px;
    padding-bottom: 17px;
  }
}
