@font-face {
  font-family: "SF Pro Display Local";
  src:
    local("SF Pro Display Regular"),
    local("SFProDisplay-Regular"),
    url("fonts/SFPRODISPLAYREGULAR.OTF") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "SF Pro Display Local";
  src:
    local("SF Pro Display Medium"),
    local("SFProDisplay-Medium"),
    url("fonts/SFPRODISPLAYMEDIUM.OTF") format("opentype");
  font-style: normal;
  font-weight: 500;
  font-display: block;
}

@font-face {
  font-family: "SF Pro Display Local";
  src:
    local("SF Pro Display Bold"),
    local("SFProDisplay-Bold"),
    url("fonts/SFPRODISPLAYBOLD.OTF") format("opentype");
  font-style: normal;
  font-weight: 700;
  font-display: block;
}

:root {
  color-scheme: dark;
  --page: #07130f;
  --panel: rgba(13, 31, 25, 0.9);
  --panel-strong: #0d1f19;
  --panel-soft: #112820;
  --field: #07130f;
  --border: rgba(160, 255, 213, 0.14);
  --border-focus: #20d69a;
  --line: rgba(160, 255, 213, 0.14);
  --accent: #20d69a;
  --accent-strong: #0e9f73;
  --text: #f5fff9;
  --muted: #a7bdb3;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }

body {
  min-width: 320px;
  background: var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

button, textarea, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.saas-editor-page {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 2%, rgba(32, 214, 154, 0.14), transparent 28%),
    radial-gradient(circle at 94% 22%, rgba(32, 214, 154, 0.08), transparent 25%),
    var(--page);
  background-attachment: fixed;
}

.app-shell {
  width: min(1500px, calc(100% - clamp(24px, 4vw, 64px)));
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 40px;
}

.editor-header {
  min-height: 92px;
  margin-bottom: clamp(24px, 2.6vw, 38px);
  padding: 16px clamp(20px, 2vw, 30px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 26px 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.editor-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.sms-wordmark {
  color: var(--text);
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1;
}
.sms-wordmark span { color: var(--accent); }

.editor-brand-copy {
  min-width: 0;
  padding-left: 18px;
  display: grid;
  gap: 3px;
  border-left: 1px solid var(--line);
}
.editor-brand-copy strong {
  color: #eaf7f1;
  font-size: 15px;
  font-weight: 750;
}
.editor-brand-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-badges span,
.form-chip,
#counter {
  padding: 9px 13px;
  border: 1px solid rgba(32, 214, 154, 0.18);
  border-radius: 999px;
  background: rgba(32, 214, 154, 0.055);
  color: #8fe9c8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(500px, 590px) minmax(360px, 450px);
  justify-content: center;
  align-items: start;
  gap: clamp(34px, 4vw, 68px);
}
.builder-panel { min-width: 0; }
.builder-panel-preview { display: flex; justify-content: center; }

.panel,
.mockup-preview-shell {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel.mockup-form {
  width: 100%;
  min-height: 0;
  height: auto;
  padding: 30px 32px 32px;
  overflow: visible;
}

.form-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 9px;
  color: var(--text);
  font-size: 34px;
  line-height: 1.02;
  letter-spacing: -0.045em;
}
h2 {
  margin-bottom: 0;
  color: #eef5f2;
  font-size: 22px;
  letter-spacing: -0.025em;
}
.subtitle {
  max-width: 430px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.font-status {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5, 18, 14, 0.5);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.font-status.ok {
  border-color: rgba(32, 214, 154, 0.24);
  background: rgba(32, 214, 154, 0.055);
  color: #79efc8;
}
.font-status.warn {
  border-color: rgba(255, 196, 92, 0.2);
  color: #ffd59a;
}

.form-divider {
  margin: 24px 2px 17px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
}
.form-divider span { height: 1px; background: var(--line); }
.form-divider strong {
  color: #cfe2da;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
}

.field { display: block; margin-top: 17px; }
.field > span,
.timing-control > span {
  display: block;
  margin-bottom: 9px;
  color: #dfece6;
  font-size: 14px;
  font-weight: 650;
}
.field small,
.timing-control small { color: var(--muted); font-weight: 500; }

textarea,
.text-input,
.time-generator-row input[type="time"],
.window-control input,
.fine-grid input,
.fine-grid select {
  width: 100%;
  border: 1px solid rgba(169, 218, 197, 0.19);
  border-radius: 13px;
  background: var(--field);
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

textarea {
  min-height: 174px;
  padding: 14px 16px;
  resize: vertical;
  line-height: 1.5;
  font-size: 14px;
}
.text-input {
  min-height: 52px;
  padding: 0 16px;
  font-size: 15px;
}
textarea::placeholder,
input::placeholder { color: #71877f; }
textarea:focus,
input:focus,
select:focus {
  border-color: var(--border-focus) !important;
  box-shadow: 0 0 0 3px rgba(32, 214, 154, 0.1);
}

.time-generator-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) 92px minmax(145px, .9fr);
  gap: 12px;
  align-items: end;
}
.time-generator-row input[type="time"] {
  min-height: 52px;
  padding: 0 15px;
  color-scheme: dark;
  font-size: 16px;
  font-weight: 700;
}
.time-generator-row input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
}
.window-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
}
.window-control input {
  min-height: 52px;
  padding: 0 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}
.timing-help {
  display: block;
  margin-top: 10px;
  color: #789087 !important;
  font-size: 11px;
  line-height: 1.45;
}

button {
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease, filter .15s ease;
}
button:hover:not(:disabled) {
  border-color: rgba(32, 214, 154, 0.28);
  background: #17352b;
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: wait; }
button.accent-outline {
  border-color: rgba(32, 214, 154, 0.3);
  color: #79efc8;
}
button.primary {
  border-color: rgba(32, 214, 154, 0.64);
  background: linear-gradient(145deg, var(--accent), #15b982);
  color: #032219;
  font-weight: 850;
  box-shadow: 0 14px 30px rgba(32, 214, 154, 0.13);
}
button.primary:hover:not(:disabled) {
  border-color: var(--accent);
  background: linear-gradient(145deg, #29e2a5, #19c38a);
  filter: brightness(1.02);
}

.actions {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}
.actions .primary { grid-column: 1 / -1; }

.fine-tune {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.fine-tune summary {
  color: #eef5f2;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}
.fine-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}
.fine-grid label { color: var(--muted); font-size: 11px; }
.fine-grid input,
.fine-grid select {
  min-height: 42px;
  margin-top: 6px;
  padding: 0 11px;
  font-size: 12px;
}

.mockup-stage {
  position: sticky;
  top: 22px;
  width: min(100%, 430px);
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 14px;
}
.preview-head {
  width: 100%;
  padding: 0 4px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
.mockup-preview-shell,
.canvas-shell {
  width: 100%;
  height: auto;
  padding: 14px;
  display: grid;
  justify-items: center;
  align-items: start;
  overflow: hidden;
}
canvas {
  display: block;
  width: 100%;
  max-width: 390px;
  height: auto;
  aspect-ratio: 1136 / 1600;
  background: #000;
  filter: drop-shadow(0 22px 38px rgba(0, 0, 0, .28));
}

@media (max-width: 1180px) {
  .app-shell { width: min(1040px, calc(100% - 26px)); }
  .builder-layout {
    grid-template-columns: minmax(450px, 560px) minmax(330px, 390px);
    gap: 28px;
  }
  .mockup-stage { width: min(100%, 390px); }
  canvas { max-width: 350px; }
  .time-generator-row {
    grid-template-columns: minmax(150px, 1fr) 86px;
  }
  .time-generator-row button { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .app-shell { width: min(760px, calc(100% - 22px)); }
  .editor-header {
    min-height: 80px;
    border-radius: 0 0 20px 20px;
  }
  .header-badges { display: none; }
  .builder-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .builder-panel-preview { justify-content: center; }
  .mockup-stage {
    position: static;
    width: min(100%, 470px);
  }
  .mockup-preview-shell,
  .canvas-shell { padding: 13px; }
  canvas { max-width: 420px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .app-shell { width: calc(100% - 14px); padding-bottom: 24px; }
  .editor-header {
    min-height: 72px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 0 0 18px 18px;
  }
  .sms-wordmark { font-size: 31px; }
  .editor-brand { gap: 10px; }
  .editor-brand-copy { display: none; }
  .panel.mockup-form {
    padding: 22px 16px 24px;
    border-radius: 18px;
  }
  .form-chip { display: none; }
  h1 { font-size: 30px; }
  h2 { font-size: 20px; }
  .subtitle { font-size: 14px; }
  .field > span,
  .timing-control > span { font-size: 14px; }
  textarea { min-height: 160px; font-size: 15px; }
  .text-input { font-size: 16px; }
  .time-generator-row {
    grid-template-columns: 1fr 92px;
    gap: 10px;
  }
  .time-generator-row button { grid-column: 1 / -1; }
  button { min-height: 52px; font-size: 15px; }
  .actions { grid-template-columns: 1fr; }
  .actions .primary { grid-column: auto; }
  .fine-grid { grid-template-columns: 1fr; }
  .preview-head { padding-inline: 2px; }
  .mockup-stage { width: 100%; }
  .mockup-preview-shell { border-radius: 18px; padding: 9px; }
  canvas { width: 100%; max-width: none; }
}

@media (max-width: 380px) {
  .time-generator-row { grid-template-columns: 1fr; }
  .window-control { width: 100%; }
  .time-generator-row button { grid-column: auto; }
}
