:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --line: #e5e7eb;
  --text: #203143;
  --muted: #5a6a7e;
  --primary: #145bb4;
  --primary-dark: #0f4d98;
  --danger: #b83645;
  --shadow: 0 20px 50px rgba(24, 48, 84, 0.12);
  --radius: 22px;
  --font-family: "Inter", "Segoe UI", "Trebuchet MS", sans-serif;
  --content-shell-width: 1180px;
  --content-shell-gutter: 36px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-family);
  color: var(--text);
  background: #fff;
}
body.login-page,
body.signup-page {
  background: #fff;
}

html:has(body.designs-page),
html:has(body.shared-page),
html:has(body.cli-page),
html:has(body.skill-page),
html:has(body.cli-ref-page),
html:has(body.profile-page),
html:has(body.admin-page),
body.designs-page,
body.shared-page,
body.cli-page,
body.skill-page,
body.cli-ref-page,
body.profile-page,
body.admin-page {
  background: #fff !important;
}

body.designs-page,
body.shared-page,
body.cli-page,
body.skill-page,
body.cli-ref-page,
body.profile-page,
body.admin-page {
  --bg: #fff;
  --line: #e5e7eb;
  --panel: #fff;
  --panel-2: #fff;
  --surface-light: #fff;
  --hover-bg: #f6f6f6;
  --hover-bg-mid: #eeeeee;
  --shadow: none;
  --shadow-soft: none;
}

[data-theme="dark"] html:has(body.designs-page),
[data-theme="dark"] html:has(body.shared-page),
[data-theme="dark"] html:has(body.cli-page),
[data-theme="dark"] html:has(body.skill-page),
[data-theme="dark"] html:has(body.cli-ref-page),
[data-theme="dark"] html:has(body.profile-page),
[data-theme="dark"] html:has(body.admin-page),
[data-theme="dark"] body.designs-page,
[data-theme="dark"] body.shared-page,
[data-theme="dark"] body.cli-page,
[data-theme="dark"] body.skill-page,
[data-theme="dark"] body.cli-ref-page,
[data-theme="dark"] body.profile-page,
[data-theme="dark"] body.admin-page {
  background: #181816 !important;
}

[data-theme="dark"] body.designs-page,
[data-theme="dark"] body.shared-page,
[data-theme="dark"] body.cli-page,
[data-theme="dark"] body.skill-page,
[data-theme="dark"] body.cli-ref-page,
[data-theme="dark"] body.profile-page,
[data-theme="dark"] body.admin-page {
  --line: rgba(129, 124, 112, 0.42);
  --panel: #24231f;
  --panel-2: #24231f;
  --surface-light: #2a2823;
  --hover-bg: #302e28;
  --hover-bg-mid: #38352e;
}

.saved-shell,
.shared-shell,
.cli-shell,
.skill-shell,
.cli-ref-shell {
  width: min(var(--content-shell-width, 1180px), calc(100vw - var(--content-shell-gutter, 36px)));
  margin: 40px auto 0;
}

.cli-shell,
.skill-shell,
.cli-ref-shell {
  padding: 0 0 56px;
}

.saved-title,
.shared-title,
.cli-title,
.skill-title,
.cli-ref-title {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.2;
  letter-spacing: 0;
}

body.profile-page .account-card,
body.admin-page .account-card {
  box-shadow: none;
}

body.profile-page .account-card,
body.profile-page .panel,
body.profile-page .profile-stat,
body.profile-page .profile-empty,
body.profile-page .profile-publication,
body.admin-page .account-card,
body.admin-page .panel {
  background: #fff;
}

body.profile-page #profile-cli-active-title {
  margin-top: 24px;
}

body.admin-page .account-form.panel {
  margin-bottom: 24px;
}

body.admin-page .inline-grid > div {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-nav-page {
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-breadcrumb {
  width: min(var(--content-shell-width), calc(100vw - var(--content-shell-gutter)));
  margin: 30px auto 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
body.login-page .site-breadcrumb,
body.signup-page .site-breadcrumb,
body.setup-page .site-breadcrumb {
  width: min(480px, calc(100vw - 36px));
}
.site-breadcrumb ol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}
.site-breadcrumb-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}
.site-breadcrumb a:hover,
.site-breadcrumb a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-breadcrumb [aria-current="page"] {
  color: var(--text);
}
.site-breadcrumb-separator {
  color: #8b9aad;
}
.site-nav-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.site-nav-brand-link:hover .site-nav-brand-mark,
.site-nav-brand-link:focus-visible .site-nav-brand-mark {
  transform: none;
}
.nav-account-btn-active {
  background: rgba(255, 255, 255, 0.18);
  color: #f8fbff;
  border-color: rgba(255, 255, 255, 0.3);
}
.account-menu-link.nav-account-btn-active {
  background: #eef4ff;
  color: var(--primary);
}
.account-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}
.account-shell.with-nav {
  min-height: auto;
  padding-top: 24px;
}
.site-nav-page + .saved-shell,
.site-nav-page + .shared-shell,
.site-nav-page + .cli-shell,
.site-nav-page + .skill-shell,
.site-nav-page + .cli-ref-shell {
  margin-top: 40px;
}
.site-breadcrumb + .saved-shell,
.site-breadcrumb + .shared-shell,
.site-breadcrumb + .cli-shell,
.site-breadcrumb + .skill-shell,
.site-breadcrumb + .cli-ref-shell {
  margin-top: 40px;
}
.profile-shell {
  display: block;
  width: min(var(--content-shell-width), calc(100vw - var(--content-shell-gutter)));
  max-width: none;
  margin: 0 auto;
  padding-right: 0;
  padding-left: 0;
}
.account-card {
  width: min(100%, 480px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.account-card.wide {
  width: 100%;
}
.account-kicker {
  margin: 0 0 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 700;
}
h1, h2 {
  margin: 0 0 10px;
}
.title-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}
.title-with-icon i {
  color: inherit;
  font-size: 0.9em;
  line-height: 1;
}
.account-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}
.account-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-form label,
.field label {
  font-weight: 700;
  font-size: 14px;
}
.account-form input,
.account-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}
.account-form button,
.subtle-link {
  font: inherit;
}
.account-form button {
  margin-top: 16px;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #2b7be0 0%, var(--primary) 100%);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.account-message {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 12px;
}
.account-message.success {
  background: #e8f6ed;
  color: #1d6b3f;
}
.account-message.error {
  background: #fdecee;
  color: #942938;
}
.account-footer {
  margin: 16px 0 0;
  color: var(--muted);
}
.account-footer a,
.subtle-link {
  color: var(--primary);
  text-decoration: none;
}
.account-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.panel {
  background: #f9fbfe;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.profile-productions {
  margin-bottom: 18px;
}
.profile-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.profile-section-head .account-copy {
  margin-bottom: 0;
}
.profile-section-actions {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.profile-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 50px;
  border-radius: 12px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #2b7be0 0%, var(--primary) 100%);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-btn-primary);
}
.profile-primary-link:hover,
.profile-primary-link:focus-visible {
  color: #fff;
  text-decoration: none;
}
.profile-saves-link {
  flex: 0 0 auto;
  font-weight: 700;
}
.profile-progress-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.profile-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.profile-stat-value {
  color: var(--primary);
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
}
.profile-stat-label {
  color: var(--muted);
  font-weight: 700;
}
.profile-subtitle {
  margin: 0 0 10px;
  font-size: 16px;
}
.profile-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #fff;
}
.profile-publication-list {
  display: grid;
  gap: 12px;
}
.profile-publication {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.profile-publication-main {
  min-width: 0;
}
.profile-publication-main h4 {
  margin: 0 0 6px;
  font-size: 16px;
}
.profile-publication-main a {
  display: inline-block;
  max-width: 100%;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.profile-publication-main p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.profile-publication-actions {
  flex: 0 0 auto;
  margin: 0;
}
.btn-icon-danger {
  width: 36px;
  height: 36px;
  border: 1px solid #f2c3cb;
  border-radius: 50%;
  background: #fff6f7;
  color: var(--danger);
  font-size: 15px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.btn-icon-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.danger-panel {
  border-color: #f2c3cb;
}
.danger-button {
  background: linear-gradient(180deg, #d85867 0%, var(--danger) 100%) !important;
}
.inline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}
th {
  color: var(--muted);
  font-weight: 700;
}

[data-theme="dark"] body {
  color: #f1efe9;
  background: #181816;
}

[data-theme="dark"] .account-menu-link.nav-account-btn-active {
  background: rgba(106, 176, 255, 0.14);
  color: #8cc6ff;
}

[data-theme="dark"] .site-nav-actions .nav-account-btn-active {
  background: rgba(88, 166, 255, 0.1);
  color: #ffffff;
  border-color: rgba(88, 166, 255, 0.3);
}

[data-theme="dark"] .site-breadcrumb {
  color: #aeb8ca;
}

[data-theme="dark"] .site-breadcrumb a {
  color: #8cc6ff;
}

[data-theme="dark"] .site-breadcrumb [aria-current="page"] {
  color: #f1f5f9;
}

[data-theme="dark"] .site-breadcrumb-separator {
  color: #7d8798;
}

[data-theme="dark"] .account-card {
  background: linear-gradient(180deg, rgba(42, 40, 35, 0.96), rgba(32, 31, 28, 0.96));
  border-color: rgba(129, 124, 112, 0.42);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .account-kicker {
  color: #8cc6ff;
}

[data-theme="dark"] .profile-primary-link {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] .account-form label {
  color: #f3f6ff;
}

[data-theme="dark"] .title-with-icon i {
  color: inherit;
}

[data-theme="dark"] .account-copy,
[data-theme="dark"] .account-footer,
[data-theme="dark"] th {
  color: #c7d2e5;
}

[data-theme="dark"] .account-form input,
[data-theme="dark"] .account-form select {
  background: #201f1c;
  color: #f1efe9;
  border-color: rgba(129, 124, 112, 0.48);
}

[data-theme="dark"] .account-form input::placeholder {
  color: #8892aa;
}

[data-theme="dark"] .profile-stat,
[data-theme="dark"] .profile-empty,
[data-theme="dark"] .profile-publication {
  background: rgba(36, 35, 31, 0.82);
  border-color: rgba(129, 124, 112, 0.42);
}

[data-theme="dark"] .profile-stat-label,
[data-theme="dark"] .profile-empty,
[data-theme="dark"] .profile-publication-main p {
  color: #c7d2e5;
}

[data-theme="dark"] .profile-stat-value,
[data-theme="dark"] .profile-publication-main a {
  color: #8cc6ff;
}

[data-theme="dark"] .account-form select,
[data-theme="dark"] input[type="number"] {
  color-scheme: dark;
}

[data-theme="dark"] .account-message {
  border: 1px solid rgba(129, 124, 112, 0.42);
}

[data-theme="dark"] .account-message.success {
  background: rgba(36, 35, 31, 0.94);
  color: #f1efe9;
  border-color: rgba(106, 176, 255, 0.28);
}

[data-theme="dark"] .account-message.error {
  background: rgba(36, 35, 31, 0.94);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.24);
}

[data-theme="dark"] .btn-icon-danger {
  background: rgba(184, 54, 69, 0.12);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fca5a5;
}
[data-theme="dark"] .btn-icon-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

@media (max-width: 760px) {
  .profile-section-head,
  .profile-publication {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-section-actions {
    justify-content: flex-start;
  }

  .profile-progress-row {
    align-items: stretch;
  }

  .profile-stat {
    display: flex;
  }
}

[data-theme="dark"] .panel {
  background: rgba(36, 35, 31, 0.82);
  border-color: rgba(129, 124, 112, 0.42);
}

[data-theme="dark"] .danger-panel {
  border-color: rgba(248, 113, 113, 0.28);
}

[data-theme="dark"] td {
  color: #f1efe9;
  border-bottom-color: rgba(129, 124, 112, 0.34);
}
@media (max-width: 720px) {
  .account-card {
    padding: 22px;
  }
  .account-topbar {
    flex-direction: column;
  }
  .account-shell.with-nav {
    padding-top: 18px;
  }
}
