:root {
    color-scheme: light;
    --page: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f7f8fa;
    --ink: #131827;
    --muted: #697386;
    --line: #dfe3ea;
    --line-strong: #cdd3dd;
    --accent: #176b57;
    --accent-soft: #e4f5ef;
    --accent-bright: #6ee7b7;
    --shadow: 0 20px 50px rgba(18, 25, 38, 0.09);
  }
  
  * { box-sizing: border-box; }
  
  html { min-width: 320px; }
  
  body {
    margin: 0;
    min-height: 100vh;
    background:
      radial-gradient(circle at 8% 0%, rgba(110, 231, 183, 0.14), transparent 24rem),
      var(--page);
    color: var(--ink);
    font-family: "DM Sans", sans-serif;
  }
  
  button, input, select { font: inherit; }
  button { color: inherit; }
  
  .app-shell {
    width: min(1500px, calc(100% - 40px));
    margin: 0 auto;
    padding: 34px 0 48px;
  }
  
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
  }
  
  .eyebrow, .section-label {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  
  h1 {
    margin: 0;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
  }
  
  .environment {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
  }
  
  .environment span, .preview-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22a06b;
    box-shadow: 0 0 0 4px rgba(34, 160, 107, 0.12);
  }
  
  .workspace {
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  
  .tabs-wrap {
    overflow-x: auto;
    border-bottom: 1px solid var(--line-strong);
    background: #e7eaf0;
    scrollbar-width: thin;
  }
  
  .tabs {
    display: flex;
    align-items: end;
    gap: 4px;
    min-width: max-content;
    padding: 10px 10px 0;
  }
  
  .tab-button {
    position: relative;
    min-width: 132px;
    padding: 12px 18px 13px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 11px 11px 0 0;
    background: transparent;
    color: #596274;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
  }
  
  .tab-button:hover { background: rgba(255, 255, 255, 0.55); color: var(--ink); }
  
  .tab-button[aria-selected="true"] {
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--ink);
  }
  
  .tab-button[aria-selected="true"]::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--surface);
    content: "";
  }
  
  .workspace-body {
    display: grid;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    min-height: 650px;
  }
  
  .controls-panel {
    padding: 24px;
    border-right: 1px solid var(--line);
    background: var(--surface-soft);
  }
  
  .panel-heading, .preview-toolbar, .form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
  
  h2 { margin: 0; font-size: 1.32rem; letter-spacing: -0.025em; }
  
  .text-button {
    padding: 7px 9px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
  }
  
  .fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 12px;
    margin-top: 23px;
  }
  
  .field { display: grid; gap: 7px; min-width: 0; }
  .field.full { grid-column: 1 / -1; }
  
  .field label {
    color: #3f4859;
    font-size: 0.82rem;
    font-weight: 700;
  }
  
  .field input, .field select {
    width: 100%;
    height: 42px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    outline: none;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.9rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
  }
  
  .field input:focus, .field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(23, 107, 87, 0.12);
  }
  
  .field-hint { color: var(--muted); font-size: 0.73rem; line-height: 1.35; }
  
  .form-actions {
    position: sticky;
    bottom: 0;
    margin: 24px -24px -24px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--line);
    background: rgba(247, 248, 250, 0.94);
    backdrop-filter: blur(8px);
  }
  
  .apply-button, .secondary-button {
    min-height: 42px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
  }
  
  .apply-button {
    width: 100%;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
  }
  
  .apply-button:hover { background: #105845; }
  
  .preview-panel { min-width: 0; padding: 24px; background: var(--surface); }
  
  .preview-toolbar { min-height: 42px; }
  .preview-title { display: flex; align-items: center; gap: 10px; }
  .preview-title strong { font-size: 1rem; }
  .preview-title span:last-child { color: var(--muted); font-size: 0.82rem; }
  
  .secondary-button {
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-size: 0.84rem;
  }
  
  .secondary-button:hover { background: var(--surface-soft); }
  
  .url-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    margin: 14px 0;
    padding: 8px 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--muted);
  }
  
  .url-bar code {
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .preview-stage {
    position: relative;
    overflow: hidden;
    background:
      linear-gradient(#fff 31px, transparent 31px),
      linear-gradient(90deg, rgba(19, 24, 39, 0.025) 1px, transparent 1px),
      linear-gradient(rgba(19, 24, 39, 0.025) 1px, transparent 1px),
      #fff;
    background-size: auto, 24px 24px, 24px 24px, auto;
  }
  
  #placement-frame {
    display: block;
    width: 100%;
    height: 510px;
    border: 0;
    background: transparent;
  }
  
  .empty-state {
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.94);
    text-align: center;
  }
  
  .empty-state:not([hidden]) { display: flex; }
  .empty-state strong { font-size: 1.05rem; }
  .empty-state span { color: var(--muted); font-size: 0.88rem; }
  
  @media (max-width: 980px) {
    .workspace-body { grid-template-columns: 1fr; }
    .controls-panel { border-right: 0; border-bottom: 1px solid var(--line); }
    .fields-grid { grid-template-columns: repeat(3, 1fr); }
    .field.full { grid-column: auto; }
  }
  
  @media (max-width: 720px) {
    .app-shell { width: min(100% - 20px, 1500px); padding-top: 20px; }
    .topbar { align-items: flex-start; }
    .environment { display: none; }
    .workspace { border-radius: 13px; }
    .workspace-body { min-height: 0; }
    .controls-panel, .preview-panel { padding: 18px; }
    .fields-grid { grid-template-columns: 1fr 1fr; }
    .form-actions { margin: 22px -18px -18px; padding: 15px 18px 18px; }
    .preview-stage, #placement-frame { min-height: 460px; height: 460px; }
  }
  
  @media (max-width: 480px) {
    .fields-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .preview-toolbar { align-items: flex-start; }
    .secondary-button { min-height: 38px; padding: 0 10px; }
  }


  .platform-header {
    position: relative;
    z-index: 100;
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 0 32px;
    background: #ffffff;
    border-bottom: 1px solid #dfe4ea;
  }
  
  .platform-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
    color: #182033;
    text-decoration: none;
  }
  
  .platform-logo {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #131827;
    color: #6ee7b7;
    font-size: 20px;
    font-weight: 800;
  }
  
  .platform-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  
  .platform-brand-text strong {
    font-size: 15px;
    line-height: 1.1;
  }
  
  .platform-brand-text small {
    color: #6b7280;
    font-size: 11px;
    line-height: 1.1;
  }
  
  .platform-navigation {
    align-self: stretch;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  .platform-navigation__link {
    position: relative;
    height: 100%;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition:
      color 0.2s ease,
      background-color 0.2s ease;
  }
  
  .platform-navigation__link:hover {
    color: #182033;
    background: #f8fafc;
  }
  
  .platform-navigation__link.active {
    color: #182033;
  }
  
  .platform-navigation__link.active::after {
    content: "";
    position: absolute;
    right: 16px;
    bottom: 0;
    left: 16px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: #28a979;
  }
  
  @media (max-width: 700px) {
    .platform-header {
      align-items: flex-start;
      flex-direction: column;
      gap: 10px;
      padding: 16px 18px 0;
    }
  
    .platform-navigation {
      width: 100%;
      min-height: 48px;
    }
  
    .platform-navigation__link {
      padding: 0 12px;
    }
  
    .platform-navigation__link.active::after {
      right: 12px;
      left: 12px;
    }
  }