:root {
  --bg: #f2ede2;
  --panel: rgba(252, 248, 240, 0.76);
  --panel-strong: rgba(255, 252, 246, 0.9);
  --card: rgba(255, 255, 255, 0.58);
  --card-strong: rgba(255, 255, 255, 0.76);
  --ink: #16363d;
  --ink-soft: #607077;
  --line: rgba(20, 59, 66, 0.12);
  --line-strong: rgba(20, 59, 66, 0.2);
  --accent: #ff8b5c;
  --accent-deep: #e06438;
  --secondary: #1f6662;
  --secondary-soft: rgba(31, 102, 98, 0.1);
  --success: #2b8c68;
  --danger: #b84b4b;
  --shadow: 0 26px 90px rgba(21, 52, 60, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --sans: "Trebuchet MS", "Avenir Next", "Segoe UI Variable Text", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(191, 227, 209, 0.9), transparent 32%),
    radial-gradient(circle at right 10% top 18%, rgba(255, 182, 143, 0.55), transparent 30%),
    linear-gradient(160deg, #f4ecdd 0%, #efe9dc 30%, #ddebe5 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  filter: blur(8px);
}

body::before {
  width: 300px;
  height: 300px;
  left: -70px;
  bottom: 4%;
  background: radial-gradient(circle, rgba(255, 139, 92, 0.22), transparent 65%);
  animation: drift 16s ease-in-out infinite;
}

body::after {
  width: 340px;
  height: 340px;
  right: -70px;
  top: 10%;
  background: radial-gradient(circle, rgba(74, 154, 135, 0.18), transparent 68%);
  animation: drift 20s ease-in-out infinite reverse;
}

.page-shell {
  position: relative;
  max-width: 1520px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-actions,
.panel,
.stat-card,
.entity-card,
.provider-card,
.delivery-editor,
.dialog-summary,
.section-stack {
  animation: riseIn 0.55s ease both;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  color: var(--ink-soft);
}

.hero-copy h1,
.panel-head h2,
.modal-head h3,
.section-head h4 {
  margin: 0;
  letter-spacing: -0.03em;
}

.hero-copy h1 {
  font-size: clamp(2.9rem, 5vw, 4.8rem);
  line-height: 0.95;
  max-width: 9ch;
}

.hero-text {
  max-width: 58ch;
  margin: 18px 0 0;
  font-size: 1.04rem;
  line-height: 1.72;
  color: var(--ink-soft);
}

.glass-card {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: var(--radius-xl);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: space-between;
  padding: 22px;
}

.hero-buttons,
.panel-head,
.modal-actions,
.section-head,
.delivery-toolbar,
.entity-head,
.entity-actions,
.delivery-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 244, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 36px rgba(31, 68, 71, 0.08);
}

.stat-label,
.micro-copy,
.hint-copy,
.field-help,
.entity-description,
.result-meta,
.empty-state,
.confirm-copy,
.dialog-summary p,
.delivery-summary-main p {
  color: var(--ink-soft);
}

.stat-label,
.field-help {
  font-size: 0.88rem;
}

.stat-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.stat-note {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.dashboard,
.panel,
.entity-card,
.provider-card,
.modal-layout,
.tab-shell,
.section-stack,
.delivery-editor,
.delivery-content {
  display: flex;
  flex-direction: column;
}

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

.lower-grid {
  margin-top: 24px;
}

.panel {
  padding: 22px;
  min-height: 320px;
}

.home-workspace {
  gap: 18px;
  min-height: 620px;
}

.home-workspace-head {
  align-items: flex-end;
}

.home-workspace-head .micro-copy {
  max-width: 54ch;
  text-align: right;
}

.home-tab-shell {
  flex: 1;
  gap: 18px;
}

.home-tab-strip {
  align-self: stretch;
  overflow-x: auto;
  padding: 10px;
}

.home-tab-panel {
  flex: 1;
  min-height: 460px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(250, 246, 239, 0.82));
}

.home-tab-panel .panel-head {
  align-items: flex-start;
}

.home-tab-panel .entity-grid,
.home-tab-panel .provider-grid {
  margin-top: 18px;
}

.entity-grid,
.provider-grid,
.delivery-list {
  display: grid;
  gap: 16px;
}

.entity-grid {
  margin-top: 16px;
}

.provider-grid {
  margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.entity-card,
.provider-card,
.dialog-summary,
.section-stack,
.delivery-shell {
  background: rgba(255, 252, 247, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.entity-card,
.provider-card {
  padding: 18px;
  gap: 12px;
}

.entity-meta,
.chip-row,
.delivery-summary-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.entity-title h3,
.provider-card h3,
.dialog-summary h4,
.section-head h4 {
  margin: 0;
}

.entity-description {
  margin: 0;
  line-height: 1.6;
}

.chip,
.status-pill,
.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1px solid transparent;
}

.chip {
  background: rgba(19, 59, 66, 0.06);
  color: var(--ink-soft);
}

.status-pill[data-status="enabled"] {
  background: rgba(43, 140, 104, 0.12);
  color: var(--success);
}

.status-pill[data-status="disabled"] {
  background: rgba(184, 75, 75, 0.12);
  color: var(--danger);
}

.type-pill {
  background: rgba(31, 102, 98, 0.12);
  color: var(--secondary);
}

.button,
.icon-button,
.tab-button {
  border: none;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--secondary);
  color: white;
  font: inherit;
  box-shadow: 0 10px 24px rgba(31, 102, 98, 0.16);
  text-decoration: none;
}

.button:hover,
.icon-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.button-secondary {
  background: rgba(19, 59, 66, 0.08);
  color: var(--ink);
  box-shadow: none;
}

.button-accent {
  background: linear-gradient(135deg, var(--accent), #ffb36c);
  color: #402411;
}

.button-danger {
  background: linear-gradient(135deg, #e86a57, #b84b4b);
}

.button-ghost {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(19, 59, 66, 0.06);
  color: var(--ink);
  font-size: 1.45rem;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 700;
}

.text-input,
.text-area,
select.text-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 14px;
  font: inherit;
  resize: vertical;
}

.text-input:focus,
.text-area:focus {
  outline: 2px solid rgba(31, 102, 98, 0.18);
  border-color: rgba(31, 102, 98, 0.34);
}

.text-area-sm {
  min-height: 96px;
}

.code-area,
.code-block {
  font-family: var(--mono);
  font-size: 0.9rem;
}

.form-grid,
.structured-grid,
.stack-grid,
.level-grid {
  display: grid;
  gap: 14px;
}

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

.stack-grid {
  grid-template-columns: 1.25fr 0.75fr;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.toggle-row,
.structured-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(19, 59, 66, 0.04);
  border: 1px solid var(--line);
  color: var(--ink);
}

.toggle-row {
  font-size: 0.95rem;
}

.toggle-row > span,
.toggle-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.toggle-row > span {
  color: var(--ink);
}

.toggle-row > .toggle-input {
  order: 2;
}

.toggle-row > span {
  order: 1;
}

.toggle-title {
  color: var(--ink);
  font-weight: 700;
}

.toggle-copy .field-help {
  margin: 0;
}

.toggle-card {
  min-height: 60px;
  border-style: solid;
}

.toggle-input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 30px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(31, 102, 98, 0.18);
  background: rgba(19, 59, 66, 0.12);
  box-shadow: inset 0 1px 2px rgba(20, 59, 66, 0.16);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.toggle-input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 3px 10px rgba(20, 59, 66, 0.18);
  transition: transform 0.18s ease;
}

.toggle-input:hover {
  box-shadow: inset 0 1px 2px rgba(20, 59, 66, 0.16), 0 0 0 4px rgba(31, 102, 98, 0.08);
}

.toggle-input:checked {
  background: linear-gradient(135deg, var(--secondary), #4f9f8c);
  border-color: rgba(31, 102, 98, 0.3);
}

.toggle-input:checked::after {
  transform: translateX(18px);
}

.toggle-input:focus-visible {
  outline: 3px solid rgba(31, 102, 98, 0.2);
  outline-offset: 2px;
}

.compact-toggle {
  min-width: 118px;
  padding: 10px 12px;
}

.compact-toggle .toggle-copy {
  gap: 0;
}

.compact-toggle .toggle-title {
  font-size: 0.88rem;
  font-weight: 600;
}

.empty-structured {
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink-soft);
}

.result-panel {
  min-height: 420px;
}

.code-block {
  margin: 0;
  padding: 18px;
  flex: 1;
  overflow: auto;
  border-radius: var(--radius-lg);
  background: #17343d;
  color: #f7efe3;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block.empty {
  color: rgba(247, 239, 227, 0.72);
}

.provider-card ul,
.assist-list ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
}

.modal {
  width: min(1020px, calc(100vw - 24px));
  padding: 0;
  border: none;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(250, 245, 236, 0.98), rgba(246, 241, 233, 0.98));
  box-shadow: 0 40px 120px rgba(17, 37, 45, 0.24);
}

.modal::backdrop {
  background: rgba(16, 31, 38, 0.36);
  backdrop-filter: blur(8px);
}

.modal-head,
.modal-actions {
  padding: 20px 24px;
}

.modal-head {
  border-bottom: 1px solid var(--line);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 24px;
}

.dialog-summary {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 18px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(247, 243, 235, 0.76));
}

.compact-summary {
  grid-template-columns: 1fr;
}

.summary-main,
.summary-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tab-shell {
  gap: 14px;
}

.tab-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px;
  border-radius: 999px;
  background: rgba(19, 59, 66, 0.06);
  align-self: flex-start;
}

.tab-button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
}

.tab-button.is-active {
  background: white;
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(21, 52, 60, 0.08);
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tab-panel[hidden] {
  display: none;
}

.section-stack {
  gap: 14px;
  padding: 18px;
}

.section-soft {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(249, 246, 240, 0.8));
}

.section-head {
  align-items: flex-start;
}

.delivery-list {
  gap: 12px;
}

.delivery-editor {
  gap: 12px;
}

.delivery-shell {
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(250, 246, 239, 0.84));
}

.delivery-summary {
  cursor: pointer;
  padding: 16px 18px;
  list-style: none;
}

.delivery-summary::-webkit-details-marker {
  display: none;
}

.delivery-summary-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.delivery-summary-main strong {
  font-size: 1rem;
}

.delivery-content {
  gap: 14px;
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
}

.delivery-toolbar {
  padding-top: 14px;
  justify-content: flex-end;
}

.compact-tab-shell {
  gap: 12px;
}

.compact-tab-strip {
  padding: 6px;
}

.compact-tab-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.92rem;
}

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

.level-card {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.level-card.is-disabled {
  opacity: 0.66;
}

.level-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.level-card-head strong {
  font-size: 0.94rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.level-card-body {
  display: grid;
  gap: 12px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 20;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  color: white;
  background: rgba(21, 52, 60, 0.92);
  box-shadow: 0 24px 50px rgba(17, 37, 45, 0.2);
  animation: riseIn 0.24s ease both;
}

.toast[data-tone="success"] {
  background: rgba(43, 140, 104, 0.95);
}

.toast[data-tone="error"] {
  background: rgba(184, 75, 75, 0.95);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

.docs-shell {
  max-width: 1440px;
}

.docs-hero {
  grid-template-columns: 1.2fr 0.8fr;
}

.docs-hero-card {
  gap: 16px;
}

.docs-fact-list,
.docs-nav-list,
.docs-content,
.provider-doc-grid {
  display: flex;
  flex-direction: column;
}

.docs-fact-list {
  gap: 12px;
}

.docs-fact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
}

.docs-fact code,
.docs-callout code,
.docs-table code,
.docs-list code,
.docs-steps code {
  font-family: var(--mono);
  font-size: 0.92em;
}

.docs-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.docs-nav {
  position: sticky;
  top: 24px;
  padding: 18px;
}

.docs-nav-list {
  gap: 8px;
}

.docs-nav-list a {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.docs-nav-list a:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
}

.docs-content {
  gap: 24px;
}

.docs-card {
  padding: 22px;
  gap: 18px;
}

.docs-grid {
  display: grid;
  gap: 16px;
}

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

.docs-steps,
.docs-list {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
  line-height: 1.72;
}

.docs-steps li + li,
.docs-list li + li {
  margin-top: 8px;
}

.docs-code {
  flex: none;
  min-height: 0;
}

.docs-callout {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 139, 92, 0.12), rgba(31, 102, 98, 0.1));
  border: 1px solid rgba(31, 102, 98, 0.12);
}

.docs-callout strong {
  display: block;
  margin-bottom: 8px;
}

.docs-callout p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.68;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
}

.docs-table th,
.docs-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.docs-table th {
  font-size: 0.92rem;
  color: var(--ink);
  background: rgba(19, 59, 66, 0.06);
}

.docs-table td {
  color: var(--ink-soft);
  line-height: 1.66;
}

.docs-table tbody tr:last-child th,
.docs-table tbody tr:last-child td {
  border-bottom: none;
}

.compact-table th {
  width: 220px;
}

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

.provider-doc-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.72);
  border: 1px solid var(--line);
}

.provider-doc-card h3 {
  margin: 0;
}

.provider-doc-card strong {
  margin-top: 4px;
  font-size: 0.92rem;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(18px, -14px, 0);
  }
}

@media (max-width: 1120px) {
  .hero,
  .workspace-grid,
  .stats-grid,
  .dialog-summary,
  .form-grid,
  .structured-grid,
  .stack-grid,
  .level-grid,
  .docs-layout,
  .docs-grid-2,
  .provider-doc-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    width: min(920px, calc(100vw - 18px));
  }

  .docs-nav {
    position: static;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 18px 14px 34px;
  }

  .hero-copy h1 {
    font-size: 2.6rem;
  }

  .hero-buttons,
  .panel-head,
  .modal-actions,
  .delivery-summary,
  .entity-head,
  .entity-actions,
  .docs-fact {
    flex-direction: column;
    align-items: stretch;
  }

  .tab-strip {
    width: 100%;
    border-radius: 20px;
  }

  .tab-button,
  .button {
    width: 100%;
  }

  .home-workspace,
  .home-tab-panel {
    min-height: auto;
  }

  .home-workspace-head .micro-copy {
    max-width: none;
    text-align: left;
  }

  .modal-head,
  .modal-actions,
  .modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}
