:root {
  color-scheme: light;
  --bg: #f7f8f3;
  --panel: #ffffff;
  --panel-strong: #f0f5f1;
  --ink: #1c2522;
  --muted: #66716c;
  --line: #dce2dc;
  --accent: #247a67;
  --accent-dark: #155c4d;
  --warning: #b6533c;
  --shadow: 0 18px 40px rgba(28, 37, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.site-footer {
  min-height: 76px;
  color: var(--muted);
  font-size: 0.92rem;
  border-top: 1px solid var(--line);
}

.brand,
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  color: var(--ink);
  font-weight: 750;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
}

.nav {
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-link {
  font-weight: 750;
}

.menu {
  position: relative;
}

.menu summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  list-style: none;
}

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

.menu summary span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
}

.menu[open] summary,
.menu summary:hover {
  border-color: var(--accent);
  background: var(--panel-strong);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  display: grid;
  min-width: 210px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.menu-panel a,
.menu-email {
  padding: 10px 12px;
  border-radius: 6px;
}

.menu-panel a {
  color: var(--ink);
  font-weight: 700;
}

.menu-panel a:hover {
  background: var(--panel-strong);
  text-decoration: none;
}

.menu-email {
  max-width: 260px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 148px);
  margin: 0 auto;
  padding: 48px 0;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 56px;
  align-items: center;
  min-height: 560px;
}

.auth-copy h1,
.applet-view-header h1,
.editor-header h1,
.examples-header h1,
.profile-layout h1,
.workspace-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  line-height: 1;
}

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

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-form {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.auth-form input:focus,
.editor-form input:focus,
.editor-form textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(36, 122, 103, 0.16);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

.button-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.button-full {
  width: 100%;
}

.button-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.button-ghost:hover {
  border-color: var(--accent);
  background: var(--panel-strong);
}

.message-slot {
  min-height: 0;
}

.form-message {
  padding: 12px 14px;
  border: 1px solid rgba(182, 83, 60, 0.34);
  border-radius: 8px;
  background: rgba(182, 83, 60, 0.1);
  color: #833823;
  font-size: 0.92rem;
  font-weight: 700;
}

.form-message:empty {
  display: none;
}

.form-message-ok {
  border-color: rgba(23, 107, 87, 0.34);
  background: rgba(23, 107, 87, 0.1);
  color: #105443;
}

.form-link {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: center;
}

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.workspace-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.examples-layout {
  display: grid;
  gap: 28px;
}

.examples-header,
.applet-view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.examples-header p:not(.eyebrow) {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
}

.examples-header form {
  margin: 0;
}

.examples-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.example-shell {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
}

.example-sidebar {
  display: grid;
  align-content: start;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.example-link {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.example-link:last-child {
  border-bottom: 0;
}

.example-link:hover {
  background: #f7faf7;
  text-decoration: none;
}

.example-link-active,
.example-link-active:hover {
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
}

.example-link span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
}

.example-link-active span {
  color: rgba(255, 255, 255, 0.74);
}

.example-previews,
.example-preview {
  display: grid;
  gap: 18px;
}

.example-preview-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.example-preview-header p {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--muted);
}

.applet-view-header {
  margin-bottom: 24px;
}

.applet-frame {
  width: 100%;
  min-height: 780px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.editor-layout {
  display: grid;
  gap: 28px;
}

.editor-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.editor-form {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.editor-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.editor-form input,
.editor-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.editor-form input {
  min-height: 46px;
}

.editor-form textarea {
  min-height: 420px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.45;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.profile-layout {
  display: grid;
  gap: 32px;
  max-width: 720px;
}

.profile-json {
  min-height: 160px;
  margin: 0;
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.45;
  box-shadow: var(--shadow);
}

.profile-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.profile-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.profile-card code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--panel-strong, #f3f3ee);
  font-size: 0.88rem;
}

.profile-form {
  display: grid;
  gap: 10px;
}

.subdomain-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.subdomain-row input {
  flex: 1;
  border: 0;
  padding: 10px 12px;
  font: inherit;
  outline: none;
}

.subdomain-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--panel-strong, #f3f3ee);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
}

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

.toggle-form {
  margin: 0;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.applet-list {
  min-height: 220px;
}

.loading,
.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  text-align: center;
}

.empty-state {
  padding: 32px;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  margin-top: 6px;
}

.applet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}

.applet-card {
  display: grid;
  gap: 18px;
  min-height: 240px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(28, 37, 34, 0.06);
}

.applet-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.applet-card h2 {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.25;
}

.slug,
.description {
  margin: 0;
  color: var(--muted);
}

.slug {
  margin-top: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.description {
  min-height: 48px;
}

.status-pill {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f0e1d2;
  color: #74451b;
  font-size: 0.76rem;
  font-weight: 800;
}

.metadata {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0;
}

.metadata div {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.metadata dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metadata dd {
  margin: 2px 0 0;
}

.applet-card-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.applet-card-actions .button-small {
  min-height: 44px;
  min-width: 156px;
  padding: 0 18px;
  font-size: 0.96rem;
}

.applet-edit-link {
  color: #273247;
  font-weight: 800;
}

.button.is-disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.code-preview {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.code-preview summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.code-preview pre {
  max-height: 220px;
  margin: 12px 0 0;
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #202826;
  color: #eef6ef;
  font-size: 0.82rem;
}

.plans-layout {
  display: grid;
  gap: 32px;
}

.plans-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  line-height: 1;
}

.plans-header p:not(.eyebrow) {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 18px;
}

.plan-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.plan-card-highlight {
  border-color: var(--accent);
  box-shadow: 0 22px 50px rgba(36, 122, 103, 0.16);
}

.plan-card-current {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.plan-card-header h2 {
  margin: 6px 0 0;
  font-size: 1.4rem;
}

.plan-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.plan-price {
  margin: 14px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.plan-price strong {
  display: inline-block;
  margin-right: 4px;
  color: var(--ink);
  font-size: 2rem;
  font-weight: 800;
}

.plan-price-alt {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.95rem;
}

.plan-features li {
  padding-left: 22px;
  position: relative;
}

.plan-features li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.plan-card-footer {
  display: grid;
  gap: 8px;
}

.plan-current-tag {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--accent-dark);
  font-weight: 800;
  text-align: center;
}

.plans-reservation-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.plans-reservation-card h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.plans-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

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

.plans-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.plans-table code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--panel-strong);
  font-size: 0.86rem;
}

.checkout-layout {
  display: grid;
  gap: 28px;
  max-width: 640px;
}

.checkout-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.checkout-summary {
  display: grid;
  gap: 14px;
  margin: 0;
}

.checkout-summary div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.checkout-summary div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.checkout-summary dt {
  color: var(--muted);
  font-weight: 700;
}

.checkout-summary dd {
  margin: 0;
  font-weight: 800;
}

.checkout-form {
  margin: 0;
}

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

.reservation-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.reservation-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
}

.app-body {
  overflow: hidden;
  background: #f5f7fb;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.applets-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.applets-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
}

.applets-page-header h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.15;
}

.applets-page-link {
  color: #273247;
  font-weight: 800;
}

.app-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
  border-right: 1px solid #d8dee8;
  background: #ffffff;
}

.app-sidebar:has(.app-file-sidebar) {
  padding: 0;
  gap: 0;
}

.app-sidebar:has(.app-file-sidebar) .app-brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid #d8dee8;
}

.app-sidebar:has(.app-file-sidebar) .app-sidebar-bottom {
  padding: 0 18px 18px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: #172033;
  font-weight: 800;
}

.app-brand:hover {
  text-decoration: none;
}

.app-sidebar-nav {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.app-file-sidebar {
  gap: 0;
  padding: 0;
  overflow-x: hidden;
}

.file-tree {
  min-width: 0;
  width: 100%;
}

.file-tree-list,
.file-tree-entry,
.file-tree-children {
  display: grid;
  min-width: 0;
}

.file-tree-list {
  gap: 0;
}

.file-tree-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 30px;
  padding: 0 18px 0 calc(14px + (var(--depth, 0) * 15px));
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #273247;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
}

.file-tree-root-row {
  font-weight: 800;
  color: #172033;
}

.file-tree-root-row .file-tree-icon {
  color: #687385;
}

button.file-tree-row {
  cursor: pointer;
}

.file-tree-row:hover,
.file-tree-row-active {
  background: #eef4fb;
}

.file-tree-row-dirty .file-dirty-dot {
  opacity: 1;
}

.file-tree-row-binary {
  color: #687385;
}

.file-tree-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-tree-caret,
.file-tree-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.file-tree-caret {
  width: 14px;
  height: 14px;
  color: #687385;
}

.file-tree-caret-placeholder {
  opacity: 0;
}

.file-tree-icon {
  width: 17px;
  height: 17px;
}

.file-tree-caret svg,
.file-tree-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.file-tree-icon-folder {
  color: #b7791f;
}

.file-tree-icon-html {
  color: #c05621;
}

.file-tree-icon-css {
  color: #0f766e;
}

.file-tree-icon-js {
  color: #6d28d9;
}

.file-tree-icon-file {
  color: #687385;
}

.file-tree-add-row {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding-left: calc(35px + (var(--depth, 0) * 15px));
}

.file-tree-add {
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8a94a6;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
}

.file-tree-add:hover {
  color: #273247;
  text-decoration: underline;
}

.file-tree-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.45);
}

.file-tree-modal {
  width: min(420px, 100%);
  padding: 20px;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(23, 32, 51, 0.24);
}

.file-tree-modal-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #172033;
}

.file-tree-modal-form {
  display: grid;
  gap: 12px;
}

.file-tree-modal-form label {
  display: grid;
  gap: 6px;
  color: #687385;
  font-size: 0.82rem;
  font-weight: 800;
}

.file-tree-modal-form select,
.file-tree-modal-form input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #cbd6e6;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  font: inherit;
  font-size: 0.9rem;
}

.file-tree-modal-parent {
  color: #687385;
  font-size: 0.82rem;
}

.file-tree-modal-parent code {
  padding: 1px 6px;
  border-radius: 6px;
  background: #f0f3f8;
  color: #172033;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
}

.file-tree-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.file-tree-modal-form-error {
  min-height: 0;
  color: #b42318;
  font-size: 0.82rem;
}

.file-tree-status {
  padding: 8px 4px;
  color: #687385;
  font-size: 0.86rem;
}

.file-tree-status-error {
  color: #b42318;
}

.sidebar-applet-link {
  display: grid;
  gap: 2px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #273247;
}

.sidebar-applet-link span,
.sidebar-applet-link small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-applet-link span {
  font-size: 0.92rem;
  font-weight: 800;
}

.sidebar-applet-link small {
  color: #687385;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
}

.sidebar-applet-link:hover,
.sidebar-applet-link-active {
  border-color: #cbd6e6;
  background: #eef4fb;
  text-decoration: none;
}

.sidebar-empty {
  padding: 12px;
  border: 1px dashed #d8dee8;
  border-radius: 8px;
  color: #687385;
  font-size: 0.9rem;
}

.app-sidebar-bottom {
  display: grid;
  gap: 10px;
}

.sidebar-bottom-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  color: #273247;
  font-weight: 800;
}

.sidebar-bottom-link:hover {
  background: #eef4fb;
  text-decoration: none;
}

.sidebar-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #d8dee8;
  font-size: 0.86rem;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.app-workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.app-workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  padding: 12px 28px;
}

.app-workspace-title-line {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 8px;
  color: #273247;
  line-height: 1.2;
}

.app-workspace-title-label {
  flex: none;
  color: #687385;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
}

.app-workspace-title-text,
.app-workspace-title-edit {
  margin: 0;
  color: #172033;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 800;
}

.app-workspace-title-edit {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.app-workspace-title-edit:hover {
  color: #176b57;
}

.app-workspace-title-slug,
.app-workspace-title-slug-edit code {
  color: #4f5b6d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  font-weight: 700;
}

.app-workspace-title-slug-edit:hover code {
  color: #176b57;
}

.app-workspace-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  white-space: nowrap;
}

.app-workspace-link {
  color: #176b57;
  font-size: 0.86rem;
  font-weight: 800;
}

.draft-save-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d8dee8;
  border-radius: 999px;
  background: #ffffff;
  color: #4f5b6d;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.draft-save-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #247a67;
}

.draft-save-status[data-state="dirty"] {
  border-color: #e6c26e;
  background: #fff8e6;
  color: #7a4f12;
}

.draft-save-status[data-state="dirty"] .draft-save-dot {
  background: #d3921e;
}

.draft-save-status[data-state="saving"],
.draft-save-status[data-state="publishing"] {
  border-color: #cbd6e6;
  background: #f4f7fb;
  color: #273247;
}

.draft-save-status[data-state="saving"] .draft-save-dot,
.draft-save-status[data-state="publishing"] .draft-save-dot {
  background: #2563eb;
  animation: draft-save-pulse 0.9s ease-in-out infinite;
}

@keyframes draft-save-pulse {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(0.84);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.app-workspace > .form-message {
  margin: 0 28px 14px;
}

.applet-editor-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
}

.editor-meta-panel {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.6fr) minmax(220px, 1.4fr);
  gap: 12px;
  padding: 0 28px 16px;
}

.editor-meta-panel label,
.ai-prompt-panel label {
  display: grid;
  gap: 6px;
  color: #687385;
  font-size: 0.82rem;
  font-weight: 800;
}

.editor-meta-panel input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
}

.source-textarea {
  width: calc(100% - 56px);
  height: calc(100% - 28px);
  margin: 0 28px 28px;
  min-height: 540px;
  padding: 12px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
}

.js-editor-ready .source-textarea {
  display: none;
}

.editor-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 36%);
  height: 100%;
  min-height: 0;
}

.code-editor-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-top: 1px solid #d8dee8;
  border-radius: 0;
  background: #ffffff;
}

.file-tabs {
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 38px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid #d8dee8;
  background: #f7f8fb;
}

.file-tab {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  max-width: 180px;
  min-height: 38px;
  border: 0;
  border-right: 1px solid #d8dee8;
  background: transparent;
  color: #4f5b6d;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
}

.file-tab:hover {
  background: #eef4fb;
  color: #273247;
}

.file-tab-active {
  background: #ffffff;
  color: #172033;
}

.file-tab-select {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 0 8px 0 12px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.file-tab-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-tab-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: #8a94a6;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
}

.file-tab-close:hover {
  background: #e5edf7;
  color: #172033;
}

.file-dirty-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #d3921e;
  opacity: 0;
}

.file-tab-dirty .file-dirty-dot {
  opacity: 1;
}

.file-tab:active {
  color: #172033;
}

.code-editor {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.code-editor .monaco-editor {
  outline: 0;
}

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-top: 1px solid #d8dee8;
  border-left: 1px solid #d8dee8;
  border-radius: 0;
  background: #ffffff;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid #d8dee8;
  color: #273247;
  font-size: 0.88rem;
  font-weight: 800;
}

.applet-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #ffffff;
}

.ai-prompt-panel {
  margin: 0;
  padding: 12px 28px;
  border: 0;
  border-top: 1px solid #cbd6e6;
  border-radius: 0;
  background: #ffffff;
}

.ai-prompt-panel form {
  display: grid;
  gap: 8px;
}

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

.ai-prompt-row textarea {
  width: 100%;
  min-height: 54px;
  max-height: 140px;
  padding: 9px 10px;
  resize: vertical;
  border: 1px solid #d8dee8;
  border-radius: 8px;
}

.history-panel {
  display: grid;
  gap: 14px;
}

.history-list {
  display: grid;
  gap: 10px;
  padding: 0 28px 28px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #ffffff;
}

.history-item-draft {
  border-color: #b9d8cf;
  background: #f6fbf9;
}

.history-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.history-item h2 {
  margin: 0;
  font-size: 1rem;
}

.history-item p {
  margin: 4px 0 0;
}

.history-change-summary {
  max-width: 760px;
  color: #273247;
  font-size: 0.92rem;
}

.history-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.history-badge-published {
  background: #dff7eb;
  color: #0f5a3c;
}

.history-badge-draft {
  background: #e8eef8;
  color: #273247;
}

.history-empty-state {
  min-height: 160px;
  margin-top: 2px;
}

.editor-modal {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(23, 32, 51, 0.24);
}

.editor-modal::backdrop {
  background: rgba(23, 32, 51, 0.45);
}

.editor-modal-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.editor-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.editor-modal-header h2 {
  margin: 0;
  color: #172033;
  font-size: 1.05rem;
}

.editor-modal-close {
  padding: 0;
  border: 0;
  background: transparent;
  color: #687385;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.editor-modal-close:hover {
  color: #172033;
  text-decoration: underline;
}

.editor-modal-form {
  display: grid;
  gap: 12px;
}

.editor-modal-form label,
.editor-modal-field {
  display: grid;
  gap: 6px;
  color: #687385;
  font-size: 0.82rem;
  font-weight: 800;
}

.editor-modal input,
.editor-modal textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #cbd6e6;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  font: inherit;
  font-size: 0.9rem;
}

.editor-modal textarea {
  resize: vertical;
}

.editor-modal input:focus,
.editor-modal textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(36, 122, 103, 0.16);
}

.editor-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 760px) {
  .applet-view-header,
  .editor-header,
  .examples-header,
  .site-header,
  .site-footer,
  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    padding: 16px 0;
  }

  .nav {
    flex-wrap: wrap;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    gap: 28px;
    min-height: auto;
  }

  .auth-copy h1,
  .applet-view-header h1,
  .editor-header h1,
  .examples-header h1,
  .workspace-header h1 {
    font-size: 2.6rem;
  }

  .auth-form {
    padding: 22px;
  }

  .workspace-actions,
  .examples-actions,
  .form-actions {
    justify-content: flex-start;
    width: 100%;
  }

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

  .example-shell {
    grid-template-columns: 1fr;
  }

  .example-preview-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .applet-frame {
    min-height: 720px;
  }
}

@media (max-width: 960px) {
  .app-body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid #d8dee8;
  }

  .app-sidebar-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 220px);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .app-file-sidebar {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    max-height: 260px;
    overflow: auto;
  }

  .app-sidebar-bottom {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .sidebar-account {
    grid-column: 1 / -1;
  }

  .app-main {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-workspace {
    padding: 0;
    overflow: visible;
  }

  .app-workspace-header {
    padding: 12px 20px;
  }

  .app-workspace > .form-message {
    margin: 0 20px 14px;
  }

  .history-list {
    padding: 0 20px 20px;
  }

  .editor-meta-panel {
    grid-template-columns: 1fr;
    padding: 0 20px 16px;
  }

  .editor-stage {
    grid-template-columns: 1fr;
  }

  .source-textarea {
    width: calc(100% - 40px);
    margin: 0 20px 20px;
  }

  .code-editor-panel,
  .editor-stage,
  .code-editor,
  .preview-panel {
    min-height: 520px;
  }

  .preview-panel {
    border-left: 0;
  }

  .ai-prompt-panel {
    padding: 12px 20px;
  }

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

@media (max-width: 620px) {
  .app-workspace-header,
  .history-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-sidebar-bottom {
    grid-template-columns: 1fr;
  }

  .app-workspace-actions,
  .draft-save-status {
    width: auto;
  }

  .app-workspace-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .app-workspace-title-line {
    flex-wrap: wrap;
  }
}
