:root {
  --bg: #0b0b0a;
  --panel: #171713;
  --ink: #f7f5ed;
  --muted: #bab7aa;
  --line: rgba(247, 245, 237, 0.14);
  --lime: #b8ff4d;
  --cyan: #57d5ff;
  --coral: #ff6f59;
  --paper: #f7f5ed;
  --paper-ink: #11110f;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(11, 11, 10, 0.93), rgba(11, 11, 10, 0.7)),
    url("/assets/hero-workstation.jpg") center / cover fixed,
    var(--bg);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 32px;
  align-items: center;
  width: min(1120px, calc(100% - 32px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 56px 0;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 56px;
  font-weight: 900;
}

.auth-brand span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--lime);
  color: var(--paper-ink);
}

.eyebrow {
  margin: 0;
  color: var(--lime);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-copy h1 {
  max-width: 720px;
  margin: 12px 0 16px;
  font-size: 4rem;
  line-height: 1;
}

.auth-copy p:not(.eyebrow) {
  max-width: 600px;
  color: var(--muted);
  font-size: 1.08rem;
}

.auth-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.auth-proof span {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(247, 245, 237, 0.05);
  font-size: 0.84rem;
  font-weight: 850;
}

.auth-panel,
.account-card,
.account-hero,
.admin-panel,
.admin-table,
.provider-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(247, 245, 237, 0.08), rgba(247, 245, 237, 0.03)),
    rgba(11, 11, 10, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.panel-head h2,
.account-card h3,
.admin-title h1 {
  margin: 10px 0 8px;
  line-height: 1.08;
}

.panel-head h2 {
  font-size: 2rem;
}

.panel-head p:not(.eyebrow),
.email-login p,
.account-card p,
.admin-title p,
.admin-card p,
.admin-table p {
  color: var(--muted);
}

.provider-list,
.email-login,
.account-card,
.admin-grid {
  display: grid;
  gap: 12px;
}

.provider-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--lime);
  color: var(--paper-ink);
  font-weight: 900;
}

.provider-button {
  justify-content: flex-start;
  gap: 12px;
  background: rgba(247, 245, 237, 0.06);
  color: var(--ink);
}

.provider-button span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--paper-ink);
}

.provider-button.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.email-login label {
  display: grid;
  gap: 8px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(11, 11, 10, 0.72);
  color: var(--ink);
  outline: none;
}

select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--lime) 50%) right 16px center / 7px 7px no-repeat,
    linear-gradient(135deg, var(--lime) 50%, transparent 50%) right 11px center / 7px 7px no-repeat,
    rgba(11, 11, 10, 0.72);
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(184, 255, 77, 0.18);
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.button-secondary {
  background: rgba(247, 245, 237, 0.06);
  color: var(--ink);
}

.account-card {
  padding: 16px;
  box-shadow: none;
}

.account-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.account-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 22px;
}

.account-hero-copy {
  min-width: 0;
}

.account-hero h1 {
  margin: 10px 0 8px;
  font-size: 3rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.account-hero p:not(.eyebrow) {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.account-orbit {
  position: relative;
  display: grid;
  flex: 0 0 158px;
  width: 158px;
  height: 158px;
  place-items: center;
}

.account-orbit::before,
.account-orbit span,
.account-orbit i {
  position: absolute;
  content: "";
  border-radius: 50%;
}

.account-orbit::before {
  inset: 8px;
  border: 1px solid rgba(87, 213, 255, 0.35);
}

.account-orbit span {
  inset: 24px;
  border: 1px dashed rgba(184, 255, 77, 0.42);
}

.account-orbit i {
  right: 13px;
  bottom: 22px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--bg);
  background: var(--lime);
}

.account-hero img,
.account-avatar-fallback,
#account-avatar-fallback {
  position: relative;
  z-index: 1;
  width: 108px;
  height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.account-hero img {
  object-fit: cover;
  background: var(--panel);
}

#account-avatar-fallback {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(184, 255, 77, 0.24), rgba(87, 213, 255, 0.14)),
    var(--panel);
  color: var(--ink);
  font-size: 2rem;
}

.account-stats .admin-card strong {
  font-size: 1.45rem;
}

.panel-split {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.panel-split h2 {
  margin: 8px 0;
}

.panel-split p:not(.eyebrow) {
  color: var(--muted);
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.provider-card {
  display: grid;
  gap: 16px;
  padding: 16px;
  box-shadow: none;
}

.provider-card span {
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.provider-card h3 {
  margin: 8px 0;
}

.provider-card p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.provider-card.is-linked {
  border-color: rgba(184, 255, 77, 0.38);
}

button:disabled,
.button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

.admin-page {
  background: var(--bg);
}

.admin-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 34px;
}

.admin-title h1 {
  font-size: 3rem;
}

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

.admin-card,
.admin-panel {
  padding: 18px;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.admin-card strong {
  display: block;
  margin-top: 10px;
  color: var(--lime);
  font-size: 2.2rem;
  line-height: 1;
}

.admin-panel {
  margin-top: 12px;
}

.admin-panel h2 {
  margin: 0 0 14px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
}

.admin-table th {
  color: var(--ink);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 8px;
  border-radius: var(--radius);
  background: rgba(184, 255, 77, 0.14);
  color: var(--lime);
  font-weight: 850;
}

.account-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
  gap: 12px;
  align-items: start;
}

.account-workspace .admin-panel {
  margin-top: 0;
}

.system-profile {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.system-profile label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-weight: 800;
}

.system-profile label span {
  color: var(--ink);
  font-size: 0.84rem;
}

.system-profile .field-full {
  grid-column: 1 / -1;
}

.system-profile .button {
  align-self: end;
}

#account-note,
#profile-note {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--lime);
  font-weight: 800;
}

.service-option-grid,
.security-grid {
  display: grid;
  gap: 12px;
}

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

.service-option,
.security-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(247, 245, 237, 0.05);
}

.service-option {
  display: grid;
  gap: 10px;
  min-height: 172px;
  padding: 15px;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.service-option:hover,
.service-option:focus-visible {
  border-color: rgba(184, 255, 77, 0.55);
  background: rgba(184, 255, 77, 0.09);
  transform: translateY(-2px);
}

.service-option span,
.security-card span {
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.service-option strong,
.security-card strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.service-option p,
.security-card p {
  margin: 0;
  color: var(--muted);
}

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

.security-card {
  display: grid;
  gap: 8px;
  padding: 15px;
}

.security-card.is-good {
  border-color: rgba(184, 255, 77, 0.38);
}

.security-card.is-warn {
  border-color: rgba(255, 111, 89, 0.48);
}

.security-card.is-warn span {
  color: var(--coral);
}

@media (max-width: 900px) {
  .auth-shell,
  .admin-grid,
  .provider-grid,
  .account-workspace {
    grid-template-columns: 1fr;
  }

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

  .auth-copy h1,
  .admin-title h1 {
    font-size: 2.6rem;
  }
}

@media (max-width: 560px) {
  .auth-shell,
  .admin-shell {
    width: min(100% - 24px, 1160px);
  }

  .auth-copy h1,
  .admin-title h1 {
    font-size: 2.1rem;
  }

  .code-row,
  .admin-topbar,
  .panel-split,
  .account-hero,
  .system-profile,
  .service-option-grid,
  .security-grid {
    grid-template-columns: 1fr;
  }

  .code-row,
  .account-actions,
  .admin-topbar,
  .panel-split,
  .account-hero {
    display: grid;
  }

  .account-orbit {
    width: 132px;
    height: 132px;
  }

  .account-hero img,
  #account-avatar-fallback {
    width: 92px;
    height: 92px;
  }

  .system-profile .field-full {
    grid-column: auto;
  }

  .button {
    width: 100%;
  }
}

/* ── Service Catalog Admin ─────────────────────────────────────────── */
.catalog-panel {
  margin-top: 12px;
}

.catalog-panel .panel-split p:not(.eyebrow) {
  color: var(--muted);
}

.catalog-tabs {
  display: flex;
  gap: 0;
  margin: 20px 0 18px;
  border-bottom: 1px solid var(--line);
}

.catalog-tab {
  padding: 10px 20px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 160ms, border-color 160ms;
}

.catalog-tab:hover {
  color: var(--ink);
}

.catalog-tab.is-active {
  color: var(--lime);
  border-bottom-color: var(--lime);
}

.catalog-pane {
  display: none;
}

.catalog-pane.is-active {
  display: block;
}

.catalog-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.muted-count {
  color: var(--muted);
  font-size: 0.88rem;
}

/* ── Catalog rows ──────────────────────────────────────────────────── */
.catalog-rows-container {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.catalog-row {
  display: grid;
  grid-template-columns: 52px 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  transition: background 160ms;
}

.catalog-row:last-child {
  border-bottom: none;
}

.catalog-row:hover {
  background: rgba(247, 245, 237, 0.03);
}

.catalog-row-order {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.sort-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  line-height: 1;
  transition: background 140ms, color 140ms;
}

.sort-arrow:hover:not(:disabled) {
  background: rgba(247, 245, 237, 0.1);
  color: var(--ink);
}

.sort-arrow:disabled {
  opacity: 0.2;
  cursor: default;
}

.catalog-row-info {
  min-width: 0;
}

.catalog-row-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-row-meta {
  display: flex;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.catalog-row-price {
  color: var(--lime);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.catalog-row-sub {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: capitalize;
}

.cat-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border-radius: 3px;
  background: rgba(87, 213, 255, 0.12);
  color: var(--cyan);
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border-radius: 3px;
  background: rgba(184, 255, 77, 0.14);
  color: var(--lime);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Visibility toggle ─────────────────────────────────────────────── */
.vis-toggle {
  position: relative;
  width: 36px;
  height: 22px;
  border: none;
  border-radius: 11px;
  background: rgba(247, 245, 237, 0.1);
  cursor: pointer;
  transition: background 200ms;
  flex-shrink: 0;
}

.vis-toggle.is-on {
  background: rgba(184, 255, 77, 0.3);
}

.vis-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 200ms, background 200ms;
}

.vis-toggle.is-on::after {
  transform: translateX(14px);
  background: var(--lime);
}

/* ── Row action buttons ────────────────────────────────────────────── */
.catalog-row-actions {
  display: flex;
  gap: 6px;
}

.catalog-row-actions .button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.82rem;
}

/* ── Catalog modal ─────────────────────────────────────────────────── */
.catalog-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 11, 10, 0.86);
  backdrop-filter: blur(10px);
}

.catalog-modal[hidden] {
  display: none;
}

.catalog-modal-box {
  width: min(580px, 100%);
  max-height: min(92svh, 860px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(247, 245, 237, 0.07), rgba(247, 245, 237, 0.02)),
    rgba(11, 11, 10, 0.97);
  box-shadow: 0 48px 120px rgba(0, 0, 0, 0.7);
}

.modal-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-head-row h3 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-x-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 150ms, background 150ms;
}

.modal-x-btn:hover {
  color: var(--ink);
  background: rgba(247, 245, 237, 0.06);
}

/* ── Catalog form ──────────────────────────────────────────────────── */
.catalog-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

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

.field-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
}

.field-inline input[type="checkbox"] {
  width: 16px;
  min-height: auto;
  height: 16px;
  padding: 0;
  accent-color: var(--lime);
  cursor: pointer;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.field-label small,
.field > span small {
  color: var(--muted);
  font-weight: 400;
}

.catalog-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.button-delete {
  margin-left: auto;
  background: rgba(255, 111, 89, 0.12);
  color: var(--coral);
  border-color: rgba(255, 111, 89, 0.3);
}

.button-delete:hover {
  background: rgba(255, 111, 89, 0.2);
}

.modal-error {
  margin: 12px 0 0;
  color: var(--coral);
  font-size: 0.88rem;
}

.catalog-empty-row {
  padding: 20px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ── Homepage loading skeleton ─────────────────────────────────────── */
.catalog-loading {
  display: contents;
}

.catalog-loading span {
  display: block;
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    rgba(247, 245, 237, 0.04) 0%,
    rgba(247, 245, 237, 0.08) 50%,
    rgba(247, 245, 237, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  min-height: 160px;
}

.catalog-loading-3 {
  display: contents;
}

.catalog-loading-3 span {
  display: block;
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    rgba(247, 245, 237, 0.04) 0%,
    rgba(247, 245, 237, 0.08) 50%,
    rgba(247, 245, 237, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  min-height: 220px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.catalog-empty {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (max-width: 700px) {
  .catalog-row {
    grid-template-columns: 40px 1fr auto;
    grid-template-rows: auto auto;
  }

  .catalog-row-price {
    grid-column: 2;
  }

  .catalog-row-actions {
    grid-column: 1 / -1;
  }

  .vis-toggle {
    grid-row: 1;
    grid-column: 3;
  }

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

  .catalog-form-grid .field-full {
    grid-column: auto;
  }

  .field-inline {
    grid-column: auto;
  }

  .button-delete {
    margin-left: 0;
    width: 100%;
  }
}
