:root {
  --bg: #ffffff;
  --panel: #f4f4f4;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --panel-strong: #0d0d0d;
  --text: #1a1a2e;
  --muted: #6b7280;
  --line: #d1d5db;
  --line-soft: #e5e7eb;
  --primary: #3b1fa8;
  --primary-dark: #2d1580;
  --accent: #3b1fa8;
  --warning: #b45309;
  --danger: #dc2626;
  --success: #10b981;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --popover-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --field-bg: transparent;
  --radius: 12px;
  color-scheme: light;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --panel: #171a23;
  --surface: #111827;
  --surface-soft: #151a24;
  --panel-strong: #05070b;
  --text: #f5f7fb;
  --muted: #a8b0c2;
  --line: #303746;
  --line-soft: #252b38;
  --primary: #8b6cff;
  --primary-dark: #6d4dff;
  --accent: #8b6cff;
  --warning: #f6c453;
  --danger: #fb7185;
  --success: #34d399;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  --popover-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  --field-bg: #111827;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  caret-color: transparent;
  color: var(--text);
  cursor: default;
  user-select: none;
}

button,
input,
select {
  font: inherit;
}

input,
select,
textarea {
  caret-color: auto;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  user-select: text;
}

button {
  cursor: pointer;
}

input,
textarea,
[contenteditable="true"] {
  cursor: text;
}

select,
label,
a,
summary {
  cursor: pointer;
}

.code-output,
.history-output,
.landing-code-preview pre {
  caret-color: transparent;
  user-select: text;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.landing-page {
  --landing-primary: #21005d;
  --landing-primary-dark: #180044;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
}

.landing-page a {
  color: inherit;
  text-decoration: none;
}

.landing-shell {
  display: flex;
  width: min(1180px, 100%);
  min-height: 100svh;
  flex-direction: column;
  gap: clamp(26px, 5vh, 58px);
  margin: 0 auto;
  padding: clamp(10px, 2vw, 28px) clamp(18px, 4vw, 56px) clamp(42px, 6vw, 78px);
}

.landing-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: flex-start;
  gap: clamp(18px, 4vw, 48px);
  min-height: 46px;
}

.landing-logo {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: flex-start;
  color: var(--primary);
  font-weight: 800;
  font-size: clamp(24px, 2.2vw, 30px);
  line-height: 1;
  letter-spacing: 4px;
}

.landing-logo span {
  display: block;
}

.landing-nav,
.landing-actions,
.landing-language,
.language-switch,
.landing-helper {
  display: flex;
  align-items: center;
}

.landing-nav {
  grid-column: 2;
  justify-content: center;
  gap: clamp(28px, 4vw, 48px);
  min-height: 44px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.landing-nav a,
.landing-login {
  transition: color 160ms ease;
}

.landing-nav a:hover,
.landing-login:hover {
  color: var(--primary);
}

.landing-actions {
  grid-column: 3;
  justify-content: flex-end;
  min-height: 44px;
  gap: clamp(16px, 3vw, 32px);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.landing-language {
  gap: 10px;
}

.landing-theme {
  display: inline-flex;
  align-items: center;
}

.landing-theme .theme-toggle {
  width: 34px;
  height: 34px;
}

.landing-theme .theme-toggle svg {
  width: 17px;
  height: 17px;
}

.landing-language button,
.language-switch button {
  display: inline-flex;
  width: 32px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.landing-language button.is-active,
.language-switch button.is-active {
  border-color: rgba(33, 0, 93, 0.24);
  box-shadow: 0 0 0 2px rgba(33, 0, 93, 0.08);
}

.landing-language img,
.language-switch img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.landing-signup,
.landing-hero-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--landing-primary);
  color: #fff;
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
  transition: background 160ms ease, transform 160ms ease;
}

.landing-signup {
  padding: 0 18px;
}

.landing-signup:hover,
.landing-hero-button:hover {
  background: var(--landing-primary-dark);
  transform: translateY(-1px);
}

.landing-page .landing-signup,
.landing-page .landing-hero-button,
.landing-page .landing-signup:hover,
.landing-page .landing-hero-button:hover {
  color: #fff;
}

.landing-mobile-menu {
  display: none;
}

.landing-main {
  display: grid;
  flex: 1;
  place-items: start center;
}

.landing-hero {
  display: grid;
  width: 100%;
  justify-items: center;
  gap: clamp(32px, 5vw, 52px);
  text-align: center;
}

.landing-hero-copy {
  display: grid;
  width: min(720px, 100%);
  justify-items: center;
  gap: clamp(18px, 2.4vw, 28px);
}

.landing-kicker,
.landing-helper {
  margin: 0;
  color: var(--muted);
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.6;
}

.landing-hero h1 {
  max-width: 780px;
  margin: 0;
  color: var(--text);
  font-size: clamp(42px, 6.2vw, 68px);
  font-weight: 800;
  line-height: 1.08;
}

.landing-hero-button {
  min-width: 150px;
  padding: 0 24px;
}

.landing-helper {
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 13px;
}

.landing-helper span + span {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

.landing-code-preview {
  width: min(760px, 100%);
  margin: 0;
  border: 1px solid #27272a;
  border-radius: 8px;
  padding: clamp(12px, 2vw, 18px);
  background: #101010;
  color: #f8fafc;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.14);
  text-align: left;
}

.landing-code-preview figcaption {
  margin: 0 0 12px;
  color: #a1a1aa;
  font-size: 12px;
  font-weight: 800;
}

.landing-code-preview pre {
  margin: 0;
  overflow-x: auto;
  border-radius: 6px;
  padding: clamp(14px, 2vw, 20px);
  background: #050505;
  color: #e5e7eb;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: clamp(11px, 1.5vw, 14px);
  line-height: 1.7;
}

.tools-page .landing-main {
  padding-top: clamp(70px, 11vh, 118px);
}

.tools-page .landing-hero {
  width: min(850px, 100%);
  gap: clamp(44px, 5.2vw, 64px);
}

.landing-feature {
  display: grid;
  justify-items: center;
  gap: 22px;
}

.tools-page .landing-hero h1,
.tools-page .landing-feature h2 {
  max-width: 820px;
  margin: 0;
  color: #18181b;
  font-size: 40px;
  font-weight: 800;
}

.tools-page .landing-hero h1 {
  line-height: 1.16;
}

.tools-page .landing-feature h2 {
  line-height: 1.08;
}

.tools-page .landing-feature p {
  max-width: 780px;
  margin: 0;
  color: #5f6270;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.7;
}

.tools-page .landing-feature .learning-keyword {
  color: #171721;
}

.tools-page .landing-feature .learning-tooltip {
  text-align: left;
}

.about-page .landing-main {
  padding-top: clamp(78px, 12vh, 128px);
}

.about-overview {
  display: grid;
  width: min(760px, 100%);
  justify-items: center;
  gap: clamp(34px, 4.6vw, 46px);
  text-align: center;
}

.about-page .landing-feature {
  gap: 22px;
}

.about-page .landing-feature h1,
.about-pillars h2 {
  margin: 0;
  color: #18181b;
  font-size: 40px;
  font-weight: 800;
  line-height: 1.12;
}

.about-page .landing-feature p {
  max-width: 760px;
  margin: 0;
  color: #5f6270;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.65;
}

.about-pillars {
  display: grid;
  width: min(660px, 100%);
  justify-items: center;
  gap: 24px;
}

.about-pillars ul {
  margin: 0;
  padding-left: 20px;
  color: #5f6270;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.62;
  text-align: left;
}

.about-pillars li + li {
  margin-top: 4px;
}

.about-pillars strong {
  color: #4c4f5c;
  font-weight: 800;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-shell {
  display: grid;
  width: min(980px, 100%);
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 20px;
}

.brand-panel,
.panel,
.auth-card {
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-panel {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px;
  background:
    linear-gradient(135deg, rgba(18, 20, 23, 0.94), rgba(26, 32, 38, 0.88)),
    linear-gradient(45deg, rgba(94, 234, 212, 0.2), rgba(251, 191, 36, 0.22));
  color: #fff;
}

.brand-panel h1,
.auth-card h2,
.panel h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand-panel h1 {
  max-width: 12ch;
  font-size: clamp(40px, 8vw, 76px);
  line-height: 0.95;
}

.brand-copy {
  max-width: 38rem;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1rem;
  line-height: 1.7;
}

.auth-card {
  align-self: stretch;
  padding: 28px;
}

.auth-card__header,
.panel-heading,
.output-heading,
.topbar,
.topbar-actions,
.brand-link,
.button-row {
  display: flex;
  align-items: center;
}

.auth-card__header,
.panel-heading,
.output-heading {
  justify-content: space-between;
  gap: 16px;
}

.auth-card__header {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.brand-panel .eyebrow {
  color: #5eead4;
}

.auth-brand-logo {
  display: block;
  width: min(260px, 100%);
  height: auto;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  color: #047857;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  background: #eef2f7;
}

.generator-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 22px 0;
}

.segmented button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
  padding: 8px 10px;
}

.segmented button.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

.segmented button:hover:not(.is-active) {
  border-color: var(--primary);
  color: var(--primary);
}

.stack-form {
  display: grid;
  gap: 16px;
}

.field {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: 8px; /* Evita que a label colida com o card de cima */
}

.field > span {
  position: absolute;
  top: -9px; /* Centraliza perfeitamente na linha */
  left: 12px;
  z-index: 10; /* Garante que fique acima da borda do input */
  padding: 0 6px;
  background-color: var(--surface); /* Fundo para mascarar a borda */
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
}

.field input,
.field select,
.firewall-section .field input,
.firewall-section .field select,
.config-modal .field input,
.config-modal .field select {
  position: relative;
  z-index: 1; /* Fica abaixo da label */
  width: 100%;
  min-height: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  /* Zera o padding vertical para não amassar o texto no select */
  padding: 0 14px;
  background: var(--field-bg);
  color: var(--text);
  outline: none;
  line-height: normal;
  font-family: inherit;
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: none;
}

.field.is-hidden {
  display: none;
}

.field-counter {
  align-self: flex-end;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.generator-select-field {
  margin: 22px 0;
}

.field input[type="date"] {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.field input[type="date"]::-webkit-datetime-edit {
  overflow: hidden;
}

.field input[type="date"]::-webkit-datetime-edit-year-field {
  min-width: 4ch;
  max-width: 4ch;
}

.firewall-sections {
  display: grid;
  gap: 16px;
}

.firewall-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.firewall-section__header {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  padding: 12px 14px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.firewall-section__header:hover {
  color: var(--primary);
}

.collapse-icon {
  transition: transform 180ms ease;
}

.firewall-section.is-open .collapse-icon {
  transform: rotate(0deg);
}

.firewall-section:not(.is-open) .collapse-icon {
  transform: rotate(-90deg);
}

.firewall-section__content {
  overflow: hidden;
  padding: 8px 16px 20px;
  background: var(--panel);
  transition: max-height 220ms ease;
}

.firewall-section__content > *:last-child {
  margin-bottom: 0;
}

.firewall-section .field,
.config-modal .field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
}

.firewall-section .field > span {
  top: 0;
  transform: translateY(-50%);
  background: var(--panel);
  padding: 0 6px;
  border-radius: 4px;
  line-height: 1;
}

.config-modal .field > span {
  top: 0;
  transform: translateY(-50%);
  background: #fff;
  padding: 0 6px;
  border-radius: 4px;
  line-height: 1;
}

/* bloco de input/select unificado acima */

.essential-toggles {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.section-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.essential-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 32px;
  flex-wrap: nowrap;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.essential-toggle input {
  position: absolute !important;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  appearance: none;
  pointer-events: none;
}

.essential-toggle__pill {
  position: relative;
  width: 52px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid #c7cdd9;
  border-radius: 999px;
  background: #f4f4f4;
  transition: background 150ms ease, border-color 150ms ease;
}

.essential-toggle__thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #94a3b8;
  /* Usar margin-top previne conflitos com o transform: translate(X) do estado checked */
  margin-top: -11px; 
  transition: transform 150ms ease, background 150ms ease;
}

.essential-toggle input:checked + .essential-toggle__pill {
  border-color: var(--primary);
  background: #f0ecff;
}

.essential-toggle input:checked + .essential-toggle__pill .essential-toggle__thumb {
  transform: translateX(22px);
  background: var(--primary);
}

.essential-toggle > span:last-child {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 4px;
}

.service-picker-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: 4px;
}

.service-picker-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: border-color 150ms ease, background 150ms ease;
  text-align: left;
}

.service-picker-item:hover {
  border-color: #3b1fa8;
}

.service-picker-item.selected {
  background: #f0ecff;
  border: 2px solid #3b1fa8;
}

.service-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: border-color 150ms ease, background 150ms ease;
  user-select: none;
}

.service-card:hover {
  border-color: #3b1fa8;
}

.service-card.selected {
  background: #f0ecff;
  border: 2px solid #3b1fa8;
}

.service-card-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}

.service-card .check-badge {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  background: #3b1fa8;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
}

.service-card.selected .check-badge {
  display: flex;
}

.service-picker-item.selected .check-badge {
  display: flex;
}

.service-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.service-icon-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.service-icon-fallback {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  background: #3b1fa8;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.service-icon-fallback.is-visible {
  display: inline-flex;
}

.service-icon.is-hidden {
  display: none;
}

.service-info {
  display: grid;
}

.service-info .service-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
}

.service-info .service-category {
  font-size: 11px;
  color: #6b7280;
  margin-top: 1px;
}

.selected-service-empty {
  color: #6b7280;
  font-size: 12px;
}

.custom-block {
  margin-top: 14px;
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action input {
  flex: 1;
}

.input-with-action .button {
  width: 46px;
  min-width: 46px;
  padding: 0;
}

.pill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #3b1fa8;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f0ecff;
  color: #3b1fa8;
  font-size: 12px;
  font-weight: 700;
}

.selected-service-icon {
  position: relative;
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #d8dce7;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(17, 24, 39, 0.05);
}

.selected-service-icon .service-icon,
.selected-service-icon .service-icon-fallback {
  width: 23px;
  height: 23px;
}

.selected-service-icon .service-icon-text {
  font-size: 17px;
}

.selected-service-icon .service-icon-fallback {
  font-size: 9px;
}

.day-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.day-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 6px 12px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.day-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}

.day-pill.is-active {
  border-color: #3b1fa8;
  background: #f0ecff;
  color: #3b1fa8;
}

.schedule-controls.is-disabled {
  opacity: 0.55;
}

.config-modal {
  width: min(640px, calc(100vw - 24px));
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: transparent;
}

.config-modal::backdrop {
  background: rgba(13, 13, 13, 0.55);
}

.config-modal__panel {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.config-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
}

.config-modal__header h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.config-modal-close {
  min-height: 34px;
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.config-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 0;
}

.service-modal {
  width: min(540px, calc(100vw - 24px));
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: transparent;
}

.service-modal::backdrop {
  background: rgba(13, 13, 13, 0.55);
}

.service-modal__panel {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.service-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.service-modal__title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-modal__title-wrap h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.service-modal__title-wrap p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.service-modal-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
}

.service-modal-close {
  min-height: 34px;
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.service-modal-toggle {
  margin-top: 16px;
}

.service-modal__domains {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}

.service-modal__domains p {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.service-modal__domains ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.service-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

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

.service-block-method {
  display: grid;
  gap: 8px;
  margin: 18px 0 8px;
}

.service-block-method .field {
  margin: 0;
}

.service-method-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.firewall-section .field-grid {
  grid-template-columns: 1fr;
}

.field-wide {
  grid-column: 1 / -1;
}

.compact-field {
  margin: 18px 0 14px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
  text-decoration: none;
}

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

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary,
.icon-button {
  border-color: var(--line);
  background: #fff;
  color: #374151;
}

.button-secondary:hover,
.icon-button:hover {
  border-color: var(--primary);
  background: #fff;
  color: var(--primary);
}

.button-danger {
  width: 100%;
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}

.button-danger:hover {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
}

.form-message {
  margin: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.auth-divider span {
  height: 1px;
  background: var(--line);
}

.auth-divider p {
  margin: 0;
  font-size: 13px;
}

.google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border-color: var(--line);
  background: #fff;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
}

.google-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #4285f4;
  font-weight: 800;
}

.google-button.is-loading .google-icon {
  animation: none;
  opacity: 0.72;
  transform: none;
}

.google-button.is-loading .google-icon svg {
  animation: none;
  transform: none;
}

.auth-login-page {
  min-height: 100vh;
  place-items: center;
  padding: clamp(18px, 5vw, 48px);
  background: #fff;
}

.login-card {
  position: relative;
  display: grid;
  width: min(730px, 100%);
  min-height: min(730px, calc(100vh - 64px));
  align-content: center;
  justify-items: stretch;
  padding: clamp(32px, 7vw, 86px) clamp(22px, 7vw, 112px);
  background: #f7f7f8;
}

.login-header {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

.login-header .status-pill {
  display: none;
}

.login-header h1 {
  margin: 0;
  color: #1f2028;
  font-size: clamp(28px, 3vw, 34px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

.login-header h1 span {
  color: #21005d;
  font-size: 0.82em;
  font-weight: 800;
  letter-spacing: 4px;
}

.login-header p {
  margin: 0;
  color: #8b8b92;
  font-size: 14px;
  line-height: 1.5;
}

.auth-login-page .login-form {
  gap: 18px;
}

.auth-login-page .field {
  margin-top: 4px;
}

.auth-login-page .field span {
  top: -10px;
  left: 13px;
  background: #f7f7f8;
  color: #171721;
  font-size: 12px;
  font-weight: 800;
}

.auth-login-page .field input,
.auth-login-page .field select {
  height: 46px;
  min-height: 46px;
  border-color: #b8bbc1;
  border-radius: 12px;
  background: transparent;
  color: #1f2028;
}

.auth-login-page .field input:focus,
.auth-login-page .field select:focus {
  border-color: #21005d;
}

.password-field input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 14px;
  z-index: 3;
  display: inline-grid;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #7a7a80;
  cursor: pointer;
  line-height: 1;
}

.password-icon {
  display: block;
  width: 20px;
  height: 20px;
}

.password-icon-eye-off,
.password-toggle.is-password-visible .password-icon-eye {
  display: none;
}

.password-toggle.is-password-visible .password-icon-eye-off {
  display: block;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: #21005d;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: -4px;
}

.login-options.is-hidden,
.auth-switch.is-hidden {
  display: none;
}

.remember-session {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #171721;
  font-size: 12px;
  font-weight: 700;
}

.remember-session input {
  width: 18px;
  height: 18px;
  accent-color: #21005d;
}

.auth-login-page .text-link {
  min-height: auto;
  padding: 0;
  color: #3b1fa8;
  font-size: 12px;
  font-weight: 800;
}

.auth-login-page .button-primary {
  min-height: 46px;
  border-radius: 12px;
  background: #21005d;
  color: #fff;
  font-weight: 800;
}

.auth-login-page .button-primary:hover {
  background: #180044;
}

.auth-switch {
  margin: -4px 0 10px;
  color: #171721;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.auth-switch button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #3b1fa8;
  font-weight: 800;
}

.auth-login-page .auth-divider {
  gap: 16px;
  color: #9b9ba1;
}

.auth-login-page .auth-divider p {
  font-size: 13px;
}

.auth-login-page .google-button {
  width: min(260px, 100%);
  min-height: 46px;
  justify-self: center;
  border-color: #b8bbc1;
  border-radius: 12px;
  background: transparent;
  color: #1f2028;
}

.auth-login-page .google-button [data-google-label] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.auth-login-page .google-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
}

.auth-login-page .google-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.auth-login-page #localModeButton {
  margin-top: -4px;
}

.auth-language {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
}

.auth-language button {
  display: inline-flex;
  width: 31px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.auth-language button.is-active {
  border-color: rgba(33, 0, 93, 0.22);
}

.auth-language img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 760px) {
  .auth-login-page {
    padding: 14px;
  }

  .login-card {
    min-height: calc(100vh - 28px);
    padding: 30px 18px;
  }

  .login-header {
    margin-bottom: 24px;
  }

  .login-header h1 {
    font-size: 28px;
  }

  .login-options {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .auth-login-page .text-link {
    align-self: flex-end;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.text-link {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.text-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.text-link-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.single-auth-card {
  width: min(420px, 100%);
}

.auth-heading {
  font-size: 1.5rem;
}

.loading-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #fff;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.96);
}

.loading-screen {
  display: grid;
  width: min(520px, 100%);
  justify-items: center;
  gap: 22px;
}

.loading-logo {
  display: block;
  width: min(300px, 62vw);
  height: auto;
}

.loading-progress {
  position: relative;
  width: min(320px, 72vw);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(59, 31, 168, 0.14);
}

.loading-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  border-radius: inherit;
  background: var(--primary);
  animation: loading-progress 1900ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.loading-text {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

@keyframes loading-progress {
  0% {
    transform: scaleX(0);
  }

  72% {
    transform: scaleX(0.84);
  }

  100% {
    transform: scaleX(1);
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 clamp(18px, 4vw, 56px);
  background: var(--surface);
}

.brand-link {
  gap: 12px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.brand-link img {
  display: block;
  width: min(140px, 34vw);
  height: auto;
}

.brand-wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.brand-wordmark__m {
  color: var(--primary);
}

html[lang="pt-BR"] .brand-wordmark__m {
  background: linear-gradient(135deg, #009b3a 0%, #ffdf00 50%, #002776 100%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
}

html[lang="en"] .brand-wordmark__m {
  background:
    repeating-linear-gradient(
      135deg,
      transparent 0 8px,
      rgba(255, 255, 255, 0.9) 8px 10px,
      #b22234 10px 14px,
      rgba(255, 255, 255, 0.72) 14px 16px,
      transparent 16px 24px
    ),
    linear-gradient(135deg, #3c3b6e 0%, #25215f 48%, #b22234 100%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  filter: drop-shadow(0 0 0.3px rgba(60, 59, 110, 0.46));
}

html[lang="es-ES"] .brand-wordmark__m {
  background:
    linear-gradient(
      145deg,
      #aa151b 0%,
      #c83a40 24%,
      #f1bf00 25%,
      #ffd84d 58%,
      #aa151b 59%,
      #7f1014 100%
    );
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  filter: drop-shadow(0 0 0.25px rgba(170, 21, 27, 0.42));
}

.topbar-actions {
  position: relative;
  gap: 10px;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  transition:
    color 160ms ease,
    transform 160ms ease;
}

.theme-toggle:hover {
  color: var(--primary);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle__icon {
  display: inline-flex;
}

.theme-toggle__icon--moon,
[data-theme="dark"] .theme-toggle__icon--sun {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--moon {
  display: inline-flex;
}

.language-switch {
  gap: 8px;
}

.user-email {
  max-width: 28ch;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu {
  position: relative;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 4px;
  cursor: pointer;
}

.profile-trigger:hover {
  color: var(--primary);
}

.profile-trigger__label {
  max-width: min(28ch, 34vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-trigger__chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-left: -4px;
  color: currentColor;
  transition: transform 160ms ease;
}

.profile-trigger[aria-expanded="true"] .profile-trigger__chevron {
  transform: rotate(180deg);
}

.profile-avatar {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.profile-avatar img,
.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar.has-image {
  border-color: transparent;
  background: var(--surface);
}

.profile-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(280px, calc(100vw - 32px));
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 8px 0;
  background: var(--surface);
  box-shadow: var(--popover-shadow);
}

.profile-popover__header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 20px;
}

.profile-popover__avatar {
  width: 42px;
  height: 42px;
  font-size: 14px;
}

.profile-popover__header div {
  min-width: 0;
}

.profile-popover__header strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-popover__header div > span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-popover__item {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 20px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}

.profile-popover__item:last-child {
  border-bottom: 0;
}

.profile-popover__item:hover {
  background: var(--panel);
}

.app-shell {
  display: block;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 32px 24px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.58fr) minmax(420px, 1fr);
  gap: 24px;
}

.panel {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-heading {
  align-items: flex-start;
}

.generator-panel,
.history-panel {
  align-self: start;
}

.learn-mode-active .generator-panel,
.learn-mode-active .output-panel {
  animation: learning-gold-border 5.8s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.58),
    0 18px 42px rgba(212, 175, 55, 0.12);
}

@keyframes learning-gold-border {
  0% {
    box-shadow:
      0 0 0 1px rgba(184, 134, 11, 0.48),
      0 18px 42px rgba(184, 134, 11, 0.1);
  }

  50% {
    box-shadow:
      0 0 0 1px rgba(245, 215, 110, 0.72),
      0 18px 42px rgba(245, 215, 110, 0.13);
  }

  100% {
    box-shadow:
      0 0 0 1px rgba(212, 175, 55, 0.56),
      0 18px 42px rgba(212, 175, 55, 0.12);
  }
}

[data-theme="dark"] .learn-mode-active .generator-panel,
[data-theme="dark"] .learn-mode-active .output-panel {
  animation-name: learning-gold-border-dark;
}

@keyframes learning-gold-border-dark {
  0% {
    box-shadow:
      0 0 0 1px rgba(184, 134, 11, 0.42),
      inset 0 0 0 999px rgba(184, 134, 11, 0.012),
      inset 0 0 28px rgba(184, 134, 11, 0.055),
      0 16px 34px rgba(184, 134, 11, 0.08);
  }

  50% {
    box-shadow:
      0 0 0 1px rgba(245, 215, 110, 0.56),
      inset 0 0 0 999px rgba(245, 215, 110, 0.016),
      inset 0 0 30px rgba(245, 215, 110, 0.065),
      0 16px 34px rgba(245, 215, 110, 0.1);
  }

  100% {
    box-shadow:
      0 0 0 1px rgba(212, 175, 55, 0.5),
      inset 0 0 0 999px rgba(212, 175, 55, 0.014),
      inset 0 0 28px rgba(212, 175, 55, 0.06),
      0 16px 34px rgba(212, 175, 55, 0.09);
  }
}

[data-theme="dark"] .learn-mode-active .generator-panel .field input,
[data-theme="dark"] .learn-mode-active .generator-panel .field select,
[data-theme="dark"] .learn-mode-active .generator-panel .firewall-section .field input,
[data-theme="dark"] .learn-mode-active .generator-panel .firewall-section .field select,
[data-theme="dark"] .learn-mode-active .generator-panel .config-modal .field input,
[data-theme="dark"] .learn-mode-active .generator-panel .config-modal .field select {
  animation: learning-field-glow-dark 5.8s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes learning-field-glow-dark {
  0%,
  100% {
    border-color: rgba(212, 175, 55, 0.18);
    box-shadow:
      inset 0 0 14px rgba(212, 175, 55, 0.025),
      0 0 0 1px rgba(212, 175, 55, 0.04);
  }

  50% {
    border-color: rgba(245, 215, 110, 0.26);
    box-shadow:
      inset 0 0 16px rgba(245, 215, 110, 0.035),
      0 0 0 1px rgba(245, 215, 110, 0.06);
  }
}

.reduced-motion .learn-mode-active .generator-panel,
.reduced-motion .learn-mode-active .output-panel {
  animation: none;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.58),
    0 18px 42px rgba(212, 175, 55, 0.1);
}

[data-theme="dark"].reduced-motion .learn-mode-active .generator-panel,
[data-theme="dark"].reduced-motion .learn-mode-active .output-panel {
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.48),
    inset 0 0 0 999px rgba(212, 175, 55, 0.012),
    inset 0 0 28px rgba(212, 175, 55, 0.055),
    0 16px 34px rgba(212, 175, 55, 0.08);
}

[data-theme="dark"].reduced-motion .learn-mode-active .generator-panel .field input,
[data-theme="dark"].reduced-motion .learn-mode-active .generator-panel .field select,
[data-theme="dark"].reduced-motion .learn-mode-active .generator-panel .firewall-section .field input,
[data-theme="dark"].reduced-motion .learn-mode-active .generator-panel .firewall-section .field select,
[data-theme="dark"].reduced-motion .learn-mode-active .generator-panel .config-modal .field input,
[data-theme="dark"].reduced-motion .learn-mode-active .generator-panel .config-modal .field select {
  animation: none;
  border-color: rgba(212, 175, 55, 0.2);
  box-shadow:
    inset 0 0 14px rgba(212, 175, 55, 0.025),
    0 0 0 1px rgba(212, 175, 55, 0.04);
}

.generator-panel .stack-form {
  gap: 18px;
}

.generator-panel .field,
.generator-panel .firewall-section .field,
.generator-panel .config-modal .field {
  display: grid;
  gap: 7px;
  margin-top: 0;
}

.generator-panel .field > span,
.generator-panel .firewall-section .field > span,
.generator-panel .config-modal .field > span {
  position: static;
  z-index: auto;
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.generator-panel .field input,
.generator-panel .field select,
.generator-panel .firewall-section .field input,
.generator-panel .firewall-section .field select,
.generator-panel .config-modal .field input,
.generator-panel .config-modal .field select {
  height: 52px;
  min-height: 52px;
  border-color: var(--line);
  border-radius: 10px;
  padding: 0 15px;
  background-color: var(--field-bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.generator-panel .field input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.generator-panel .field input:focus,
.generator-panel .field select:focus,
.generator-panel .firewall-section .field input:focus,
.generator-panel .firewall-section .field select:focus,
.generator-panel .config-modal .field input:focus,
.generator-panel .config-modal .field select:focus {
  border-color: var(--primary);
  background-color: var(--field-bg);
  box-shadow: 0 0 0 3px rgba(59, 31, 168, 0.1);
}

.generator-panel .field select,
.generator-panel .firewall-section .field select,
.generator-panel .config-modal .field select {
  appearance: none;
  padding-right: 46px;
  background-image:
    linear-gradient(45deg, transparent 50%, #171721 50%),
    linear-gradient(135deg, #171721 50%, transparent 50%);
  background-position:
    calc(100% - 23px) 50%,
    calc(100% - 16px) 50%;
  background-repeat: no-repeat;
  background-size: 7px 7px, 7px 7px;
}

.generator-panel .generator-select-field {
  margin: 24px 0 22px;
}

.learn-mode-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 22px;
  border-top: 1px solid #e1e5ec;
  padding-top: 18px;
}

.learn-mode-control strong {
  display: block;
  color: #171721;
  font-size: 14px;
  font-weight: 800;
}

.learn-mode-control > div > span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.learn-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.learn-mode-toggle input {
  position: absolute;
  width: 0;
  height: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.learn-mode-toggle__track {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 30px;
  border: 1px solid #c7cdd9;
  border-radius: 999px;
  background: #f4f4f4;
  transition: background 160ms ease, border-color 160ms ease;
}

.learn-mode-toggle__thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  margin-top: -11px;
  background: #94a3b8;
  transition: transform 160ms ease, background 160ms ease;
}

.learn-mode-toggle input:checked + .learn-mode-toggle__track {
  border-color: var(--primary);
  background: #f0ecff;
}

.learn-mode-toggle input:checked + .learn-mode-toggle__track .learn-mode-toggle__thumb {
  transform: translateX(22px);
  background: var(--primary);
}

.learn-mode-toggle__status {
  display: inline-flex;
  align-items: center;
  min-width: 28px;
  margin-top: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.generator-panel .field-grid {
  gap: 18px;
}

.output-panel {
  display: flex;
  min-height: 540px;
  flex-direction: column;
}

.button-row {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.output-icon-button {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  color: var(--primary);
}

.output-icon-button svg {
  display: block;
  width: 20px;
  height: 20px;
}

.output-icon-button:disabled {
  color: #9ca3af;
}

.page-icon-button {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  color: var(--primary);
}

.page-icon-button svg {
  display: block;
  width: 20px;
  height: 20px;
}

.code-output {
  flex: 1;
  min-height: 300px;
  margin: 18px 0 0;
  overflow: auto;
  border: 0;
  border-radius: 8px;
  padding: 20px;
  background: #0d0d0d;
  color: #e2e8f0;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.code-output code {
  display: block;
}

.code-output.is-typing code::after {
  display: inline-block;
  width: 7px;
  height: 1.1em;
  margin-left: 2px;
  transform: translateY(2px);
  background: #e2e8f0;
  content: "";
  animation: terminal-cursor-blink 680ms steps(2, start) infinite;
}

.output-chunk-fade {
  animation: output-chunk-fade 320ms ease-out both;
}

@keyframes output-chunk-fade {
  from {
    filter: blur(2px);
    opacity: 0;
  }

  to {
    filter: blur(0);
    opacity: 1;
  }
}

@keyframes terminal-cursor-blink {
  0%,
  45% {
    opacity: 1;
  }

  46%,
  100% {
    opacity: 0;
  }
}

.learning-section {
  width: min(920px, 100%);
  margin: 34px 0 0;
  padding: 0 4px 56px;
}

.learning-section[hidden] {
  display: none;
}

.learning-eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.learning-section h2 {
  max-width: 760px;
  margin: 0;
  color: #171721;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 800;
  line-height: 1.1;
}

.learning-section h3 {
  margin: 28px 0 10px;
  color: #171721;
  font-size: 17px;
  font-weight: 800;
}

.learning-section p {
  max-width: 820px;
  margin: 0;
  color: #4b5563;
  font-size: 15px;
  line-height: 1.75;
}

.learning-lead {
  padding-top: 14px;
}

.learning-text-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 5vw, 52px);
  margin-top: 8px;
}

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

.learning-list li {
  display: grid;
  gap: 4px;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.55;
}

.learning-list strong {
  color: #171721;
  font-weight: 800;
}

.learning-list em {
  color: #171721;
  font-style: normal;
  font-weight: 700;
}

.learning-list code {
  border-radius: 5px;
  padding: 2px 5px;
  background: #f1f3f7;
  color: #21005d;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 12px;
}

.learning-keyword {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #171721;
  font-weight: 800;
  line-height: 1.35;
  cursor: help;
}

.field-learning-keyword {
  position: relative;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  cursor: default;
}

.field-learning-keyword .learning-tooltip {
  position: absolute;
  z-index: 120;
  width: min(280px, calc(100vw - 48px));
  white-space: normal;
}

body:not(.learn-mode-active) .field-learning-keyword .learning-tooltip {
  display: none;
}

.learn-mode-active .field-learning-keyword {
  cursor: help;
}

.learn-mode-active .field:has(.field-learning-keyword:hover),
.learn-mode-active .field:has(.field-learning-keyword:focus),
.learn-mode-active .field:has(.field-learning-keyword:focus-within) {
  z-index: 60;
}

.learn-mode-active .firewall-section__content {
  overflow: visible;
}

.learning-keyword:focus {
  outline: none;
}

.learning-keyword:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--primary);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.learning-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  z-index: 40;
  display: grid;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  gap: 5px;
  transform: translate(-50%, 6px);
  visibility: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(17, 24, 39, 0.16);
  color: #4b5563;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.learning-tooltip::after {
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid rgba(148, 163, 184, 0.24);
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  background: #fff;
  content: "";
}

.learning-tooltip strong {
  color: #171721;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.learning-tooltip span {
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.learning-keyword:hover .learning-tooltip,
.learning-keyword:focus .learning-tooltip,
.learning-keyword:focus-within .learning-tooltip {
  visibility: visible;
  transform: translate(-50%, 0);
  opacity: 1;
}

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

.history-item {
  display: grid;
  min-width: 0;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
}

.history-page-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 32px 24px;
}

.history-page-header,
.history-toolbar,
.history-item__main,
.history-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.history-page-header,
.history-toolbar,
.history-item__main {
  justify-content: space-between;
}

.history-page-header h1,
.history-item h2 {
  margin: 0;
  color: var(--text);
}

.history-page-header h1 {
  font-size: 24px;
  font-weight: 800;
}

.history-toolbar {
  margin: 24px 0;
}

.history-toolbar .field {
  width: min(360px, 100%);
}

.history-toolbar .field,
.profile-panel .field {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 7px;
  margin-top: 0;
}

.profile-photo-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface);
}

.profile-photo-preview {
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.profile-photo-preview.has-image {
  border-color: transparent;
  background: var(--surface);
}

.profile-photo-field__content {
  display: grid;
  gap: 7px;
}

.profile-photo-field__content strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.profile-photo-field__content > span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.profile-photo-button {
  width: fit-content;
  margin-top: 4px;
  cursor: pointer;
}

.profile-photo-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.profile-preference-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface);
}

.profile-preference-card__content {
  display: grid;
  flex: 1 1 auto;
  gap: 5px;
  min-width: 0;
}

.profile-preference-card strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.profile-preference-card__content > span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.profile-motion-toggle {
  flex: 0 0 auto;
  width: auto;
  min-width: 52px;
}

.history-toolbar .field span,
.profile-panel .field span {
  position: static;
  z-index: auto;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.history-toolbar .field input,
.profile-panel .field input,
.profile-panel .field select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 52px;
  min-height: 52px;
  border-color: var(--line);
  border-radius: 10px;
  padding: 0 15px;
  background-color: var(--field-bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.profile-panel .field input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
}

.history-toolbar .field input:focus,
.profile-panel .field input:focus,
.profile-panel .field select:focus {
  border-color: var(--primary);
  background-color: var(--field-bg);
  box-shadow: 0 0 0 3px rgba(59, 31, 168, 0.1);
}

.history-item h2 {
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.history-item p {
  min-width: 0;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.history-meta {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.history-output {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  overflow: auto;
  border-radius: 8px;
  padding: 14px;
  background: #0d0d0d;
  color: #e2e8f0;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

.history-danger-button {
  margin-top: 28px;
}

.profile-page-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 32px 24px;
}

.profile-panel h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.profile-form {
  gap: 18px;
  margin-top: 28px;
}

.profile-delete-button {
  margin-top: 18px;
}

.profile-banner {
  margin-top: 24px;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fffbeb;
  color: #92400e;
  font-size: 14px;
  font-weight: 700;
}

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

.history-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-type {
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(59, 31, 168, 0.1);
  color: var(--primary);
  font-size: 0.75rem;
    font-weight: 800;
}

.history-date,
.history-preview,
.empty-state {
  color: var(--muted);
  font-size: 0.84rem;
}

.history-preview {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-actions {
  display: flex;
  gap: 8px;
}

.history-actions .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(380px, calc(100vw - 36px));
  transform: translateY(16px);
  border-radius: var(--radius);
  padding: 13px 15px;
  background: var(--success);
  color: #fff;
  box-shadow: var(--shadow);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast[data-tone="error"] {
  background: var(--danger);
}

.toast[data-tone="warning"] {
  background: var(--warning);
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .landing-shell {
    gap: clamp(26px, 4.5vh, 48px);
  }

  .landing-header {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 20px;
  }

  .landing-nav {
    gap: 28px;
  }

  .landing-actions {
    gap: 16px;
  }

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

  .history-list {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .landing-shell {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    gap: 32px;
    padding: 14px 16px 42px;
    overflow: hidden;
  }

  .landing-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .landing-logo {
    position: static;
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: flex-start;
    font-size: 28px;
  }

  .landing-nav {
    display: none;
  }

  .landing-actions {
    display: flex;
    grid-column: 2;
    min-width: 0;
    min-height: 44px;
    justify-content: flex-end;
    gap: 8px;
    font-size: 13px;
  }

  .landing-actions > .landing-login,
  .landing-actions > .landing-signup {
    display: none;
  }

  .landing-actions .landing-language {
    gap: 6px;
  }

  .landing-mobile-menu {
    position: relative;
    display: block;
    grid-column: 3;
    justify-self: end;
  }

  .landing-mobile-menu summary {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    list-style: none;
    box-shadow: var(--shadow);
  }

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

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

  .landing-mobile-menu__panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 30;
    display: flex;
    width: min(250px, calc(100vw - 32px));
    flex-direction: column;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--popover-shadow);
  }

  .landing-mobile-menu__panel > a {
    display: flex;
    min-height: 38px;
    align-items: center;
    border-radius: 8px;
    padding: 4px 8px;
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
  }

  .landing-mobile-menu__panel > a:not(.landing-signup):hover {
    background: var(--panel);
    color: var(--primary);
  }

  .landing-mobile-menu__panel .landing-language {
    display: none;
  }

  .landing-mobile-menu__panel .landing-theme {
    display: none;
  }

  .landing-mobile-menu__panel .landing-login {
    margin-top: 0;
  }

  .landing-mobile-menu__panel .landing-signup {
    width: 100%;
    min-height: 42px;
    margin-top: 4px;
    padding: 0 14px;
    color: #fff;
  }

  .landing-main {
    width: 100%;
    max-width: 100%;
    place-items: center;
    overflow: hidden;
  }

  .landing-hero {
    width: 100%;
    max-width: 100%;
    gap: 28px;
  }

  .landing-hero-copy {
    width: 100%;
    max-width: 100%;
    gap: 18px;
    justify-items: center;
    text-align: center;
  }

  .landing-kicker {
    max-width: min(330px, 100%);
  }

  .landing-hero h1 {
    max-width: min(360px, 100%);
    font-size: clamp(30px, 8.4vw, 40px);
    line-height: 1.12;
  }

  .tools-page .landing-shell {
    gap: 0;
  }

  .tools-page .landing-main {
    padding-top: 44px;
  }

  .tools-page .landing-hero {
    width: 100%;
    gap: 42px;
  }

  .tools-page .landing-hero h1,
  .tools-page .landing-feature h2 {
    max-width: 360px;
    font-size: 32px;
    line-height: 1.12;
  }

  .tools-page .landing-feature p {
    max-width: 360px;
    font-size: 14px;
    line-height: 1.68;
  }

  .about-page .landing-main {
    padding-top: 54px;
  }

  .about-overview {
    width: 100%;
    gap: 38px;
  }

  .about-page .landing-feature h1,
  .about-pillars h2 {
    max-width: 360px;
    font-size: 32px;
    line-height: 1.12;
  }

  .about-page .landing-feature p,
  .about-pillars ul {
    max-width: 360px;
    font-size: 14px;
    line-height: 1.68;
  }

  .landing-hero-button {
    width: min(100%, 320px);
  }

  .landing-helper {
    width: min(100%, 320px);
    flex-direction: column;
    gap: 4px;
  }

  .landing-helper span + span {
    border-left: 0;
    padding-left: 0;
  }

  .landing-code-preview {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding: 10px;
  }

  .landing-code-preview pre {
    max-width: 100%;
    max-height: 260px;
    overflow-x: auto;
    padding: 14px;
    font-size: 11px;
  }

  .auth-page {
    padding: 16px;
  }

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

  .brand-panel {
    min-height: 280px;
    padding: 28px;
  }

  .brand-panel h1 {
    font-size: 44px;
  }

  .topbar {
    min-height: 64px;
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding: 10px 14px;
  }

  .topbar-actions {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .brand-link {
    min-width: 0;
    flex: 0 1 auto;
    gap: 8px;
  }

  .brand-wordmark {
    font-size: 24px;
    letter-spacing: 0;
  }

  .language-switch {
    flex: 0 0 auto;
    gap: 4px;
  }

  .language-switch button,
  .landing-language button {
    width: 30px;
    height: 24px;
  }

  .theme-toggle {
    width: 30px;
    height: 30px;
  }

  .profile-trigger {
    min-width: 0;
    gap: 4px;
    padding: 3px 0;
  }

  .topbar-actions > .profile-trigger:not(button) {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .profile-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .profile-trigger__label {
    display: none;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    overflow: hidden;
  }

  .workspace {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .panel {
    width: 100%;
    max-width: 100%;
    padding: 22px 18px;
  }

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

  .learn-mode-control {
    align-items: center;
    flex-direction: row;
    gap: 12px;
  }

  .learn-mode-control > div {
    min-width: 0;
    flex: 1 1 auto;
  }

  .learn-mode-toggle {
    margin-left: auto;
  }

  .learning-text-grid {
    grid-template-columns: 1fr;
  }

  .learning-tooltip {
    left: 0;
    max-width: min(280px, calc(100vw - 44px));
    transform: translateY(6px);
  }

  .learning-tooltip::after {
    left: 18px;
    transform: rotate(45deg);
  }

  .learning-keyword:hover .learning-tooltip,
  .learning-keyword:focus .learning-tooltip,
  .learning-keyword:focus-within .learning-tooltip {
    transform: translateY(0);
  }

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

  .output-heading {
    align-items: flex-end;
    flex-direction: row;
    gap: 10px;
  }

  .output-heading > div {
    min-width: 0;
    flex: 1 1 auto;
  }

  .output-heading h2 {
    font-size: clamp(24px, 7vw, 30px);
    line-height: 1.08;
  }

  .button-row {
    width: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .button-row .output-icon-button {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    flex: 0 0 30px;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    color: var(--primary);
  }

  .button-row .output-icon-button:hover {
    background: transparent;
    color: var(--primary-dark);
    transform: translateY(-1px);
  }

  .button-row .output-icon-button:disabled {
    background: transparent;
    color: var(--muted);
    opacity: 0.55;
    transform: none;
  }

  .button-row .output-icon-button svg {
    width: 19px;
    height: 19px;
  }

  .profile-photo-field {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .profile-page-shell,
  .history-page-shell {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    overflow: hidden;
  }

  .profile-panel,
  .history-page-panel {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .profile-panel .field,
  .profile-panel .field input,
  .history-toolbar,
  .history-toolbar .field,
  .history-toolbar .field input,
  .history-list-page,
  .history-item-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .profile-panel .field input[type="date"] {
    font-size: 16px;
  }

  .history-item__main {
    align-items: stretch;
    flex-direction: column;
  }

  .history-page-header {
    align-items: flex-start;
    flex-direction: row;
    gap: 14px;
  }

  .history-page-header .page-icon-button {
    align-self: flex-end;
  }

  .history-toolbar {
    display: block;
    margin: 22px 0;
  }

  .history-list-page {
    overflow: hidden;
  }

  .history-item-page {
    overflow: hidden;
    padding: 14px;
  }

  .history-meta,
  .history-actions {
    justify-content: flex-start;
  }

  .history-actions {
    flex-wrap: wrap;
  }

  .history-actions .button {
    flex: 1 1 120px;
  }

  .history-output {
    max-height: 60vh;
    overflow: auto;
    font-size: 12px;
  }

}

@media (max-width: 420px) {
  .landing-shell {
    padding-inline: 14px;
  }

  .landing-hero h1 {
    font-size: clamp(28px, 8.8vw, 34px);
  }

  .landing-code-preview figcaption {
    font-size: 11px;
  }

  .landing-logo {
    font-size: 26px;
  }

  .topbar {
    padding-inline: 10px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .brand-wordmark {
    font-size: 22px;
  }

  .language-switch button,
  .landing-language button {
    width: 28px;
    height: 22px;
  }
}

@media (max-width: 360px) {
  .landing-header {
    gap: 6px;
  }

  .landing-logo {
    font-size: 23px;
    letter-spacing: 3px;
  }

  .landing-actions {
    gap: 5px;
  }

  .landing-actions .landing-language {
    gap: 4px;
  }

  .language-switch button,
  .landing-language button {
    width: 25px;
    height: 20px;
  }

  .landing-theme .theme-toggle,
  .theme-toggle {
    width: 28px;
    height: 28px;
  }

  .landing-mobile-menu summary {
    width: 40px;
    height: 40px;
  }
}

/* --- CÓDIGO NOVO LIVRE DO @MEDIA --- */

/* 1. Força os blocos do firewall a ocuparem 100% da largura horizontal */
#generatorFields,
.firewall-sections {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
}

.firewall-section {
  width: 100% !important;
  box-sizing: border-box;
}

/* 2. Restaura a altura mais "gordinha" dos inputs para não ficarem achatados na vertical */
.firewall-section .field input,
.firewall-section .field select,
.config-modal .field input,
.config-modal .field select {
  min-height: 54px !important;
  height: 54px !important;
}

[data-theme="dark"] .status-pill {
  border-color: rgba(52, 211, 153, 0.34);
  background: rgba(52, 211, 153, 0.1);
  color: #86efac;
}

[data-theme="dark"] .segmented {
  background: #101522;
}

[data-theme="dark"] .segmented button,
[data-theme="dark"] .button-secondary,
[data-theme="dark"] .icon-button,
[data-theme="dark"] .google-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

[data-theme="dark"] .segmented button:hover:not(.is-active),
[data-theme="dark"] .button-secondary:hover,
[data-theme="dark"] .icon-button:hover,
[data-theme="dark"] .google-button:hover {
  border-color: var(--primary);
  background: #151a24;
  color: var(--primary);
}

[data-theme="dark"] .field > span,
[data-theme="dark"] .firewall-section .field > span,
[data-theme="dark"] .config-modal .field > span {
  background: var(--panel);
  color: var(--text);
}

[data-theme="dark"] .firewall-section,
[data-theme="dark"] .firewall-section__header,
[data-theme="dark"] .service-picker-item,
[data-theme="dark"] .service-card,
[data-theme="dark"] .day-pill,
[data-theme="dark"] .selected-service-icon {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

[data-theme="dark"] .firewall-section__content {
  background: var(--panel);
}

[data-theme="dark"] .essential-toggle__pill,
[data-theme="dark"] .learn-mode-toggle__track {
  border-color: var(--line);
  background: #111827;
}

[data-theme="dark"] .essential-toggle input:checked + .essential-toggle__pill,
[data-theme="dark"] .learn-mode-toggle input:checked + .learn-mode-toggle__track,
[data-theme="dark"] .service-picker-item.selected,
[data-theme="dark"] .service-card.selected,
[data-theme="dark"] .day-pill.is-active,
[data-theme="dark"] .tag-pill {
  border-color: var(--primary);
  background: rgba(139, 108, 255, 0.16);
  color: #c4b5fd;
}

[data-theme="dark"] .service-info .service-name,
[data-theme="dark"] .learn-mode-control strong,
[data-theme="dark"] .learning-section h2,
[data-theme="dark"] .learning-section h3,
[data-theme="dark"] .learning-list strong,
[data-theme="dark"] .learning-list em,
[data-theme="dark"] .learning-keyword {
  color: var(--text);
}

[data-theme="dark"] .service-info .service-category,
[data-theme="dark"] .selected-service-empty,
[data-theme="dark"] .learning-section p,
[data-theme="dark"] .learning-list li {
  color: var(--muted);
}

[data-theme="dark"] .selected-service-icon,
[data-theme="dark"] .history-item,
[data-theme="dark"] .empty-state {
  background: var(--surface);
  box-shadow: none;
}

[data-theme="dark"] .config-modal__panel,
[data-theme="dark"] .service-modal__panel,
[data-theme="dark"] .learning-tooltip {
  border-color: var(--line-soft);
  background: var(--surface);
  box-shadow: var(--popover-shadow);
}

[data-theme="dark"] .learning-tooltip::after {
  border-color: var(--line-soft);
  background: var(--surface);
}

[data-theme="dark"] .learning-tooltip strong,
[data-theme="dark"] .learning-tooltip span {
  color: var(--text);
}

[data-theme="dark"] .learning-tooltip span {
  color: var(--muted);
}

[data-theme="dark"] .tools-page .landing-feature .learning-keyword {
  color: var(--text);
}

[data-theme="dark"] .service-modal__domains,
[data-theme="dark"] .learning-list code,
[data-theme="dark"] .history-type {
  background: rgba(139, 108, 255, 0.13);
  color: #c4b5fd;
}

[data-theme="dark"] .learn-mode-control {
  border-top-color: var(--line-soft);
}

[data-theme="dark"] .generator-panel .field select,
[data-theme="dark"] .generator-panel .firewall-section .field select,
[data-theme="dark"] .generator-panel .config-modal .field select {
  background-image:
    linear-gradient(45deg, transparent 50%, #f5f7fb 50%),
    linear-gradient(135deg, #f5f7fb 50%, transparent 50%);
}

[data-theme="dark"] .auth-login-page,
[data-theme="dark"] .loading-page {
  background: var(--bg);
}

[data-theme="dark"] .login-card {
  background: var(--panel);
}

[data-theme="dark"] .login-header h1,
[data-theme="dark"] .remember-session,
[data-theme="dark"] .auth-switch {
  color: var(--text);
}

[data-theme="dark"] .login-header h1 span,
[data-theme="dark"] .auth-login-page .text-link,
[data-theme="dark"] .auth-switch button,
[data-theme="dark"] .password-toggle:hover,
[data-theme="dark"] .password-toggle:focus-visible {
  color: var(--primary);
}

[data-theme="dark"] .login-header p,
[data-theme="dark"] .auth-login-page .auth-divider,
[data-theme="dark"] .password-toggle {
  color: var(--muted);
}

[data-theme="dark"] .auth-login-page .field span {
  background: var(--panel);
  color: var(--text);
}

[data-theme="dark"] .auth-login-page .field input,
[data-theme="dark"] .auth-login-page .field select,
[data-theme="dark"] .auth-login-page .google-button {
  border-color: var(--line);
  background: var(--field-bg);
  color: var(--text);
}

[data-theme="dark"] .auth-login-page .button-primary {
  background: var(--primary);
}

[data-theme="dark"] .auth-login-page .button-primary:hover {
  background: var(--primary-dark);
}

[data-theme="dark"] .loading-overlay {
  background: rgba(15, 17, 23, 0.94);
}

[data-theme="dark"] .loading-logo {
  filter: brightness(1.65) saturate(1.15) drop-shadow(0 10px 24px rgba(139, 108, 255, 0.28));
}

[data-theme="dark"] .loading-progress {
  background: rgba(139, 108, 255, 0.16);
}

[data-theme="dark"] .profile-banner {
  border-color: rgba(246, 196, 83, 0.45);
  background: rgba(246, 196, 83, 0.12);
  color: #fde68a;
}

[data-theme="dark"] .form-message {
  background: rgba(251, 113, 133, 0.12);
}

[data-theme="dark"] .profile-popover__item:hover {
  background: #151a24;
}

[data-theme="dark"] .landing-page {
  --landing-primary: #8b6cff;
  --landing-primary-dark: #7657f5;
}

[data-theme="dark"] .landing-logo {
  color: var(--primary);
}

[data-theme="dark"] .landing-nav a,
[data-theme="dark"] .landing-login,
[data-theme="dark"] .landing-feature h1,
[data-theme="dark"] .landing-feature h2,
[data-theme="dark"] .about-page .landing-feature h1,
[data-theme="dark"] .about-pillars h2,
[data-theme="dark"] .about-pillars strong {
  color: var(--text);
}

[data-theme="dark"] .landing-kicker,
[data-theme="dark"] .landing-helper,
[data-theme="dark"] .landing-feature p,
[data-theme="dark"] .about-page .landing-feature p,
[data-theme="dark"] .about-pillars li {
  color: var(--muted);
}

[data-theme="dark"] .landing-code-preview {
  border-color: #252b38;
  background: #0b0f17;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
}

[data-theme="dark"] .landing-code-preview pre {
  background: #05070b;
}

[data-theme="dark"] .landing-mobile-menu summary,
[data-theme="dark"] .landing-mobile-menu__panel {
  border-color: var(--line);
  background: var(--surface);
}

[data-theme="dark"] .landing-mobile-menu__panel > a:hover {
  background: #151a24;
}

[data-theme="dark"] .landing-language button.is-active,
[data-theme="dark"] .language-switch button.is-active,
[data-theme="dark"] .auth-language button.is-active {
  border-color: rgba(139, 108, 255, 0.38);
  box-shadow: 0 0 0 2px rgba(139, 108, 255, 0.14);
}
