:root {
  color-scheme: light;
  --bg: #071a33;
  --panel: #ffffff;
  --panel-strong: #eef4fb;
  --line: rgba(28, 43, 63, 0.12);
  --text: #142033;
  --muted: #607086;
  --soft: #3d4c61;
  --accent: #1668b8;
  --accent-strong: #0f5aa7;
  --ok: #17875a;
  --warn: #b97912;
  --danger: #c93644;
  --shadow: 0 20px 60px rgba(20, 32, 51, 0.13);
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(65, 132, 210, 0.34), transparent 34%),
    linear-gradient(180deg, #071a33 0%, #0b2442 48%, #102f55 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }

.app-shell {
  width: min(1580px, calc(100% - 36px));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0 auto;
  padding: 28px 0 34px;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 9px 16px;
  border: 1px solid rgba(23,135,90,0.24);
  border-radius: 999px;
  background: #e8f8f1;
  color: #106943;
  font-size: 0.9rem;
  font-weight: 850;
  text-align: center;
  box-shadow: 0 16px 34px rgba(4,14,29,0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-body {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 22px;
  transition: grid-template-columns 0.22s ease;
}

.app-shell.is-sidebar-collapsed .app-body {
  grid-template-columns: 86px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 28px;
  max-height: calc(100vh - 56px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px rgba(4, 14, 29, 0.24);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.28) transparent;
}

.brand-block {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: #fff;
}

.brand-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #dceeff);
  color: var(--accent-strong);
  font-weight: 900;
}

.brand-icon {
  display: block;
  object-fit: cover;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.brand-block strong, .brand-block span { display: block; }
.brand-block span { color: rgba(255,255,255,0.72); font-size: 0.82rem; }

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255,255,255,0.82);
  text-align: left;
  font-weight: 750;
}

.nav-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.78);
}

.nav-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover, .nav-item.is-active {
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.14);
  color: #fff;
}

.nav-item:hover .nav-icon,
.nav-item.is-active .nav-icon {
  color: #fff;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 14px;
  min-height: 0;
}

.sidebar-controls {
  display: grid;
  padding-top: 0;
}

.sidebar-toggle-item {
  justify-content: flex-start;
  color: rgba(255,255,255,0.72);
}

.sidebar-toggle-item .nav-icon svg {
  transition: transform 0.2s ease;
}

.sidebar-access {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(226,232,240,0.78);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,249,252,0.96));
  color: #101827;
  text-align: left;
  box-shadow: 0 10px 24px rgba(4,14,29,0.09), inset 0 1px 0 rgba(255,255,255,0.8);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.sidebar-access:hover {
  transform: translateY(-1px);
  border-color: rgba(79,180,255,0.4);
}

.sidebar-access span {
  color: #52647a;
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.sidebar-access strong {
  color: #101827;
  font-size: 0.86rem;
  line-height: 1.2;
}

.sidebar-access small {
  color: #52647a;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.25;
}

.sidebar-access.is-ok {
  border-color: rgba(23,135,90,0.24);
  background: linear-gradient(180deg, #f4fff9, #eaf8f1);
}

.sidebar-access.is-warn {
  border-color: rgba(203,213,225,0.78);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.sidebar-backup {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(226,232,240,0.64);
  border-radius: 8px;
  background: rgba(248,250,252,0.88);
  color: #101827;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.58);
}

.sidebar-backup > strong {
  color: #334155;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sidebar-backup button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #f2f6fb);
  color: #334155;
  font-size: 0.74rem;
  font-weight: 780;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}

.sidebar-backup button:hover {
  border-color: rgba(15,90,167,0.22);
  background: rgba(243,248,255,0.82);
  color: #0b4f94;
}

.sidebar-backup svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.sidebar-backup p {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.35;
}

.sidebar-health {
  display: grid;
  gap: 0;
  padding: 8px 10px;
  border: 1px solid rgba(226,232,240,0.78);
  border-radius: 8px;
  background: rgba(248,250,252,0.98);
  box-shadow: 0 10px 24px rgba(4,14,29,0.08), inset 0 1px 0 rgba(255,255,255,0.75);
}

.sidebar-health div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  color: #0f172a;
  font-size: 0.84rem;
  border-bottom: 1px solid rgba(203,213,225,0.88);
}

.sidebar-health div:last-child {
  border-bottom: 0;
}

.sidebar-health strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 820;
  text-align: right;
}

.sidebar-status-badge {
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid rgba(148,163,184,0.26);
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  line-height: 1;
}

.sidebar-status-badge.is-ok {
  border-color: rgba(14,165,233,0.22);
  background: #eaf7ff;
  color: #0b6fae;
}

.sidebar-status-badge.is-warn {
  border-color: rgba(185,121,18,0.2);
  background: #fff7e6;
  color: #80530b;
}

.sidebar-status-badge.is-muted {
  border-color: rgba(148,163,184,0.24);
  background: #f1f5f9;
  color: #64748b;
}

.is-sidebar-collapsed .sidebar {
  padding: 14px 12px;
}

.is-sidebar-collapsed .brand-block {
  grid-template-columns: 62px;
  justify-content: center;
  gap: 10px;
}

.is-sidebar-collapsed .brand-copy,
.is-sidebar-collapsed .nav-label,
.is-sidebar-collapsed .sidebar-access,
.is-sidebar-collapsed .sidebar-backup,
.is-sidebar-collapsed .sidebar-health {
  display: none;
}

.is-sidebar-collapsed .sidebar-controls {
  padding-top: 0;
  border-top: 0;
}

.is-sidebar-collapsed .sidebar-toggle-item .nav-icon svg {
  transform: rotate(180deg);
}

.is-sidebar-collapsed .nav-item {
  width: 100%;
  justify-content: center;
  padding: 10px;
}

.main-shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 112px;
  padding: 18px 22px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px rgba(4, 14, 29, 0.24);
}

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

.header-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(4, 14, 29, 0.26);
}

.eyebrow {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
  color: #fff;
}

.lead {
  max-width: 780px;
  margin-bottom: 0;
  color: rgba(255,255,255,0.88);
  font-size: 14px;
  line-height: 1.45;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.header-status-pill {
  flex: 0 0 auto;
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.86);
  padding: 0 13px;
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.header-status-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.42);
  background: rgba(255,255,255,0.16);
}

.header-status-pill.is-ok {
  border-color: rgba(63,211,154,0.34);
  background: rgba(63,211,154,0.14);
  color: #ecfff8;
}

.header-status-pill.is-warn {
  border-color: rgba(241,190,85,0.36);
  background: rgba(241,190,85,0.16);
  color: #fff6df;
}

.header-login-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
}

.header-user-status {
  max-width: 210px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.88);
  font-size: 0.78rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-login-button,
.header-logout-button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #eef7ff);
  color: #0b4f94;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(4, 14, 29, 0.14), inset 0 1px 0 rgba(255,255,255,0.9);
}

.header-login-button:hover,
.header-logout-button:hover {
  background: #ffffff;
}

.help-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.help-button, .modal-close {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.38);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #e8f3ff);
  color: var(--accent-strong);
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(4, 14, 29, 0.2), inset 0 1px 0 rgba(255,255,255,0.9);
  user-select: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.help-button:hover, .modal-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(4, 14, 29, 0.24), inset 0 1px 0 rgba(255,255,255,0.95);
}

.help-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.login-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 14, 29, 0.52);
  backdrop-filter: blur(8px);
}

.login-modal-overlay[hidden] {
  display: none;
}

.login-modal {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(15,90,167,0.18);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 26px 70px rgba(4, 14, 29, 0.3);
  text-align: center;
}

.login-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  position: relative;
}

.login-modal-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.2rem;
}

.modal-eyebrow {
  color: var(--accent-strong);
}

.login-modal-close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border-color: rgba(15,90,167,0.18);
  background: #f3f8ff;
  color: var(--accent-strong);
  box-shadow: none;
}

.login-modal-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.login-submit {
  width: 100%;
}

.login-modal .api-field {
  text-align: center;
}

.login-modal .api-field input {
  text-align: center;
}

.login-modal .field-help {
  max-width: 430px;
  margin-inline: auto;
}

#loginFeedback {
  min-height: auto;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--soft);
  text-align: center;
}

#loginFeedback.success,
#loginFeedback.error,
#loginFeedback.loading,
#loginFeedback.info {
  border: 0;
  background: transparent;
}

.help-button {
  width: auto;
  min-width: 92px;
  grid-template-columns: 22px auto;
  gap: 8px;
  padding: 0 14px;
  flex: 0 0 auto;
}

.help-button span {
  display: inline;
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
}

.app-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, auto);
  gap: 24px;
  align-items: center;
  margin-top: 18px;
  padding: 14px 0 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.76);
}

.footer-brand {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.footer-icon {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: cover;
  border-radius: 9px;
}

.footer-brand strong {
  display: block;
  margin-bottom: 1px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
}

.footer-brand p,
.footer-legal p {
  margin: 0;
  line-height: 1.45;
}

.footer-brand p {
  max-width: 560px;
  font-size: 0.82rem;
}

.footer-legal {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
  font-size: 0.78rem;
}

.footer-legal nav {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.footer-legal a {
  color: rgba(255, 255, 255, 0.76);
  text-decoration: none;
}

.footer-legal a:hover {
  color: #fff;
}

.status-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 6px rgba(63, 211, 154, 0.12);
}
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 7px rgba(241, 190, 85, 0.12); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 0 7px rgba(255, 107, 117, 0.12); }

.step-number {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 1px 0 0;
  border-radius: 999px;
  background: #e9f3ff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.view { display: none; }
.view.is-visible { display: block; }

.composer-view.is-visible {
  display: grid;
  gap: 18px;
}

.composer-top { display: grid; gap: 18px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.94);
  box-shadow: var(--shadow);
  padding: 18px;
}

.input-panel,
.output-panel,
.composer-control-panel { min-width: 0; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.panel-heading h2 { margin-bottom: 6px; font-size: 1.05rem; }
.panel-heading p { margin-bottom: 0; color: var(--muted); line-height: 1.45; }
.compact { margin-bottom: 18px; }

.two-column { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.quick-actions button, .settings-grid button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4f8fd;
  color: var(--text);
  font-weight: 750;
}

.signal-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.signal-grid span {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6faff;
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 750;
  text-align: center;
}

.mail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 12px;
}
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--soft); font-size: 0.88rem; font-weight: 750; }

input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: #fbfdff;
  color: var(--text);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, #31435a 50%),
    linear-gradient(135deg, #31435a 50%, transparent 50%);
  background-position:
    calc(100% - 25px) 50%,
    calc(100% - 18px) 50%;
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
}

textarea {
  min-height: 150px;
  height: 250px;
  max-height: 70vh;
  resize: vertical;
  overflow: auto;
  display: block;
  padding: 16px;
  font-size: 0.96rem;
  line-height: 1.56;
}

.textarea-action-wrap {
  position: relative;
}

.textarea-action-wrap textarea {
  padding-right: 86px;
}

.textarea-delete-button,
.textarea-mic-button {
  position: absolute;
  top: 14px;
  z-index: 2;
  width: 24px;
  height: 24px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.textarea-delete-button {
  right: 14px;
}

.textarea-mic-button {
  right: 46px;
}

.textarea-delete-button:hover,
.textarea-mic-button:hover,
.textarea-mic-button.is-listening {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}

.textarea-mic-button.is-listening {
  animation: mic-pulse 1.3s ease-in-out infinite;
}

.textarea-delete-button svg,
.textarea-mic-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.46; }
}

.small-textarea {
  min-height: 80px;
  height: 128px;
  max-height: 52vh;
}

#responseGoal {
  min-height: 178px;
  height: 178px;
}

.style-notes {
  min-height: calc(2lh + 20px);
  height: calc(2lh + 20px);
  max-height: 220px;
  margin: 14px 0;
  padding: 10px 12px;
  resize: vertical;
}

textarea:focus, input:focus, select:focus {
  border-color: rgba(79,180,255,0.72);
  box-shadow: 0 0 0 3px rgba(79,180,255,0.14);
}

.control-grid { display: grid; grid-template-columns: 1fr; gap: 0; }

.composer-parameters {
  display: grid;
  gap: 14px;
}

.profile-row,
.parameter-grid {
  display: grid;
  gap: 12px;
}

.profile-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.parameter-grid.composer-main-parameters {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.advanced-settings {
  border: 1px solid rgba(126, 159, 205, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.advanced-settings summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  color: var(--text);
  font-weight: 800;
}

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

.advanced-settings summary::after {
  content: "⌄";
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  transform: translateY(-1px);
}

.advanced-settings[open] summary::after {
  transform: rotate(180deg) translateY(1px);
}

.advanced-settings summary strong {
  margin-left: auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(20, 113, 201, 0.09);
  color: var(--primary-strong);
  font-size: 0.76rem;
  white-space: nowrap;
}

.advanced-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 0 14px 14px;
}

.source-answer-settings select {
  min-height: 38px;
  height: 38px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.source-answer-settings .advanced-settings-grid label {
  min-height: 0;
}

.source-answer-settings .composer-field-help {
  min-height: 0;
  margin-top: 5px;
  line-height: 1.35;
}

.composer-parameters .field {
  margin-bottom: 0;
}

.composer-parameters label {
  min-height: 1.05rem;
  line-height: 1.18;
}

.source-answer-settings {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid rgba(126, 159, 205, 0.22);
}

.source-answer-settings[hidden],
.answer-refine-panel[hidden] {
  display: none !important;
}

.answer-refine-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(126, 159, 205, 0.24);
  border-radius: 8px;
  background: rgba(246, 249, 253, 0.82);
}

.answer-refine-action {
  width: auto;
  min-width: 190px;
  padding-inline: 18px;
  white-space: nowrap;
}

.source-settings-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.source-settings-heading h3 {
  margin: 0 0 3px;
  color: var(--text);
  font-size: 1rem;
}

.source-settings-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.answer-refine-panel .composer-main-parameters {
  margin-top: 12px;
}

.refine-history-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.refine-history-actions .icon-button {
  position: static;
  width: 36px;
  height: 36px;
  color: var(--accent-strong);
  background: rgba(255,255,255,0.86);
  border-color: rgba(15,90,167,0.18);
}

.refine-history-actions .icon-button svg {
  width: 18px;
  height: 18px;
}

.refine-history-actions .icon-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.refine-base-field {
  margin-top: 12px;
}

.refine-base-field select {
  max-width: 340px;
}

.answer-refine-panel .advanced-settings {
  margin-top: 10px;
}

.refine-submit-row {
  margin-top: 14px;
}

.refine-submit-row .answer-refine-action {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer-reset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(126, 159, 205, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.composer-reset-row strong {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
}

.composer-reset-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.composer-field-help {
  margin-top: 6px;
  min-height: 2.7em;
  font-size: 0.76rem;
}

.composer-action-row {
  display: grid;
  grid-template-columns: minmax(390px, 0.44fr);
  gap: 12px;
  align-items: center;
}

.composer-reset-action {
  min-width: 190px;
  min-height: 42px;
  height: 42px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.source-submit-row {
  display: flex;
  justify-content: stretch;
  margin-top: 12px;
}

.source-submit-row .primary-action {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  text-align: center;
}

.api-status-pill {
  width: fit-content;
  display: inline-grid;
  grid-template-columns: 10px minmax(0, auto);
  gap: 7px;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  margin: 0;
  border: 1px solid rgba(185,121,18,0.22);
  border-radius: 999px;
  background: linear-gradient(180deg, #fffaf0, #fff3dc);
  color: #7a4a07;
  text-align: left;
  box-shadow: 0 10px 24px rgba(78,52,11,0.08), inset 0 1px 0 rgba(255,255,255,0.86);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.api-status-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(185,121,18,0.34);
  box-shadow: 0 14px 30px rgba(78,52,11,0.12), inset 0 1px 0 rgba(255,255,255,0.92);
}

.api-status-pill [data-api-status-title] {
  display: inline;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
}

.api-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--warn);
  box-shadow: 0 0 0 5px rgba(241,190,85,0.14);
}

.api-status-pill.is-saved {
  border-color: rgba(79,180,255,0.22);
  background: linear-gradient(180deg, #f7fbff, #eaf5ff);
  color: var(--accent-strong);
}

.api-status-pill.is-saved .api-status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(79,180,255,0.13);
}

.api-status-pill.is-connected {
  border-color: rgba(63,211,154,0.24);
  background: linear-gradient(180deg, #f5fffb, #e8fff5);
  color: #0f7650;
}

.api-status-pill.is-connected .api-status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(63,211,154,0.14);
}

.composer-guidance {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
}

.composer-guidance summary {
  width: max-content;
  margin: 0 0 18px;
  color: var(--accent-strong);
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
}

.composer-guidance summary::marker {
  color: var(--accent-strong);
}

.composer-guidance .summary-closed {
  display: none;
}

.composer-guidance:not([open]) .summary-open {
  display: none;
}

.composer-guidance:not([open]) .summary-closed {
  display: inline;
}

.composer-guidance ol {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(18px, 4vw, 54px);
  padding: 0;
  margin: 0;
  list-style: none;
}

.composer-guidance ol::before {
  content: "";
  position: absolute;
  top: 16px;
  left: calc(12.5% - 18px);
  right: calc(12.5% - 18px);
  height: 1px;
  background: #d7dde8;
}

.composer-guidance li {
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 15px;
  color: var(--soft);
  text-align: center;
  font-size: 0.86rem;
  font-weight: 760;
  line-height: 1.35;
}

.composer-guidance li div {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.composer-guidance li strong {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.2;
}

.composer-guidance li small {
  color: var(--soft);
  max-width: 230px;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.42;
}

.composer-guidance li span {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #020719;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.composer-priority-note {
  margin: 14px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(15,90,167,0.14);
  border-radius: 8px;
  background: rgba(238,247,255,0.7);
  color: #40546f;
  font-size: 0.8rem;
  font-weight: 720;
  line-height: 1.35;
}

.composer-tools {
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.workspace-switch {
  justify-self: center;
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.78);
  box-shadow: 0 16px 44px rgba(4, 14, 29, 0.16);
}

.workspace-switch button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--soft);
  font-weight: 850;
}

.workspace-switch button.is-active {
  border-color: rgba(15,90,167,0.18);
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(20,32,51,0.08);
}

.source-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef4fb;
}

.source-mode-toggle button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: #526985;
  font-weight: 900;
}

.source-mode-toggle button.is-active {
  border-color: rgba(22,104,184,0.16);
  background: #fff;
  color: var(--accent-strong);
  box-shadow: var(--shadow-soft);
}

.composer-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.composer-workspace.is-source,
.composer-workspace.is-result {
  grid-template-columns: minmax(0, 1fr);
}

.composer-workspace.is-source .result-panel,
.composer-workspace.is-result .source-panel {
  display: none;
}

.workspace-panel {
  min-height: 100%;
}

.composer-workspace.is-split .source-panel .mail-grid {
  grid-template-columns: 1fr;
}

.composer-workspace.is-split .workspace-panel {
  min-height: 720px;
  display: flex;
  flex-direction: column;
}

.composer-workspace.is-split .source-panel .mail-grid,
.composer-workspace.is-split .result-panel .response-output-wrap {
  flex: 1;
  min-height: 0;
}

.composer-workspace.is-split .source-panel .mail-grid {
  display: flex;
  flex-direction: column;
}

.composer-workspace.is-split .response-goal-field {
  flex: 0.82 1 190px;
  min-height: 190px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 7px;
}

.composer-workspace.is-split .response-goal-field textarea {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  resize: none;
}

.composer-workspace.is-split .inbound-message-field {
  flex: 1.35 1 220px;
  min-height: 220px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
}

.composer-workspace.is-split .answer-notes-field {
  flex: 0.75 1 150px;
  min-height: 150px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
}

.composer-workspace.is-split .context-tabs {
  flex: 0 0 auto;
  min-height: 0;
}

.composer-workspace.is-split .context-panel {
  flex: 0.75 1 0;
  min-height: 150px;
}

.composer-workspace.is-split .response-output {
  flex: 1;
  min-height: 0;
}

.composer-workspace.is-split #inboundMessage,
.composer-workspace.is-split .response-output {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  resize: none;
}

.composer-workspace.is-split .textarea-action-wrap {
  min-height: 0;
  height: 100%;
}

.composer-workspace.is-split .result-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.file-dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 18px 48px 18px 16px;
  margin-bottom: 16px;
  border: 1px dashed rgba(22,104,184,0.34);
  border-radius: var(--radius);
  background: rgba(248,251,255,0.72);
  color: var(--soft);
  text-align: center;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.file-dropzone.is-dragging {
  border-color: rgba(15,90,167,0.62);
  background: #eef7ff;
}

.file-dropzone strong {
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 900;
}

.file-dropzone span {
  color: var(--muted);
  font-weight: 850;
}

.file-dropzone small {
  color: var(--muted);
  font-size: 0.86rem;
}

.source-file-status-row {
  display: block;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

.source-file-status-row small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.icon-button.source-file-clear-button {
  display: none;
  position: absolute;
  top: 18px;
  right: 18px;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.icon-button.source-file-clear-button.is-visible {
  display: inline-grid;
  place-items: center;
}

.icon-button.source-file-clear-button:hover {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent-strong);
}

.icon-button.source-file-clear-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.file-dropzone p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.file-dropzone label {
  color: var(--accent-strong);
  font-weight: 850;
  cursor: pointer;
}

.file-drop-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-drop-actions button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(15,90,167,0.22);
  border-radius: var(--radius);
  background: #fff;
  color: var(--accent-strong);
  font-weight: 850;
}

.source-demo-block {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(22,104,184,0.14);
  color: var(--muted);
  text-align: center;
}

.source-demo-block span {
  color: #586f8f;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.source-demo-block small {
  grid-column: 1 / -1;
  min-width: 0;
  color: #586f8f;
  font-size: 0.77rem;
  line-height: 1.3;
  max-width: 360px;
}

.source-demo-block .success-action {
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid rgba(23,135,90,0.22);
  border-radius: var(--radius);
  border-color: rgba(23,135,90,0.22);
  background: #f1fbf6;
  color: #106943;
  font-weight: 850;
}

@media (max-width: 760px) {
  .source-demo-block {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

.optional-context {
  display: grid;
  grid-template-columns: minmax(150px, 0.38fr) minmax(0, 1fr);
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(22,104,184,0.14);
  border-radius: var(--radius);
  background: rgba(248,251,255,0.72);
}

.optional-context > strong {
  grid-column: 1 / -1;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 900;
}

.optional-context-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(150px, 0.38fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.optional-context-row > label {
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.25;
}

.segmented-control,
.tab-buttons,
.result-tabs {
  display: inline-grid;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #edf3f9;
}

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

.segmented-control button,
.tab-buttons button,
.result-tabs button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 850;
  white-space: nowrap;
}

.segmented-control button.is-active,
.tab-buttons button.is-active,
.result-tabs button.is-active {
  border-color: rgba(15,90,167,0.18);
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 6px 18px rgba(20,32,51,0.08);
}

.template-picker { margin-bottom: 0; }

.context-tabs {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
}

.tab-buttons {
  width: fit-content;
  grid-template-columns: repeat(2, minmax(0, auto));
}

.context-panel { display: none; }
.context-panel.is-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
}
.context-panel label { color: var(--soft); font-size: 0.88rem; font-weight: 750; }
.field-hint {
  margin: -1px 0 3px;
  padding: 7px 10px;
  border: 1px solid rgba(15,90,167,0.14);
  border-radius: 8px;
  background: rgba(15,90,167,0.055);
  color: var(--soft);
  font-size: 0.8rem;
  line-height: 1.35;
}

.primary-action {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(15,90,167,0.48);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #1976d2, #0f5aa7);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 12px 28px rgba(15,90,167,0.16), inset 0 1px 0 rgba(255,255,255,0.16);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.primary-action:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(136,208,255,0.55); }
.primary-action:disabled { cursor: not-allowed; opacity: 0.58; transform: none; }
button.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: wait;
  opacity: 1;
}
.primary-action.is-loading,
.header-login-button.is-loading,
.header-logout-button.is-loading {
  background: linear-gradient(180deg, #2c83d9, #0f5aa7);
  color: #fff;
}
.secondary-action.is-loading,
.trial-action.is-loading,
.purchase-action.is-loading,
.success-action.is-loading,
#refreshCreditsBtn.is-loading,
#billingPortalBtn.is-loading,
#sendLoginLinkBtn.is-loading {
  border-color: rgba(15,90,167,0.36);
  background: #edf6ff;
  color: var(--accent-strong);
}

.button-spinner,
.loading-ring {
  display: inline-block;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.34);
  border-top-color: #fff;
  animation: smart-spin 0.85s linear infinite;
}

.button-spinner {
  width: 16px;
  height: 16px;
  border-color: rgba(15,90,167,0.22);
  border-top-color: currentColor;
}

.narrow { max-width: 260px; }

.source-metrics { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.counter {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  white-space: nowrap;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 750;
}
.quality-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}
.quality-badge.success { border-color: rgba(23,135,90,0.22); background: #e8f8f1; color: #106943; }
.quality-badge.warn { color: #9a650d; }
.quality-badge.danger { color: var(--danger); }

.response-output {
  min-height: 180px;
  height: 420px;
  max-height: 72vh;
  resize: vertical;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.56;
}

.response-output-wrap {
  position: relative;
}

.output-field-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  gap: 12px;
}

.response-output-wrap .response-output {
  padding-right: 92px;
}

.response-output.is-placeholder { color: var(--muted); }
.response-output.is-loading {
  border-color: rgba(15,90,167,0.22);
  background: linear-gradient(180deg, #fff, #f2f8ff);
}
.response-section {
  display: none;
  position: relative;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.response-section.has-actions {
  padding-right: 68px;
}
.response-section-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}
.response-section-action {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-color: transparent;
  background: transparent;
}
.response-section.is-active { display: block; }
.response-section p, .response-section ul, .response-section ol { margin-bottom: 10px; }
.response-section p:last-child, .response-section ul:last-child, .response-section ol:last-child { margin-bottom: 0; }

.shipping-check {
  display: grid;
  gap: 12px;
}

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

.shipping-check-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(22,104,184,0.14);
  border-radius: var(--radius);
  background: #f6faff;
}

.shipping-check-item span {
  color: #586f8f;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.shipping-check-item strong {
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.35;
}

.shipping-check-notes {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.shipping-check-notes h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.92rem;
}

.shipping-check-notes ul {
  padding-left: 18px;
}

.shipping-check-notes li {
  margin-bottom: 6px;
  line-height: 1.45;
}

.empty-output {
  min-height: 360px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  border: 0;
  background: transparent;
}

.empty-output strong {
  color: var(--text);
  font-size: 1.05rem;
}

.empty-output p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.5;
}

.loading-output {
  min-height: 360px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  border: 1px dashed rgba(22,104,184,0.24);
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 42%, rgba(25,118,210,0.1), transparent 32%), #f8fbff;
}

.loading-output strong {
  color: var(--text);
  font-size: 1.05rem;
}

.loading-output p {
  max-width: 520px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.5;
}

.loading-ring {
  width: 34px;
  height: 34px;
  border-color: rgba(15,90,167,0.18);
  border-top-color: var(--accent-strong);
  box-shadow: 0 10px 26px rgba(15,90,167,0.16);
}

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

.quality-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.quality-strip[hidden],
.result-tabs[hidden] {
  display: none;
}

.score-badge {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6faff;
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: center;
}

.score-badge.success {
  border-color: rgba(23,135,90,0.22);
  background: #e8f8f1;
  color: #106943;
}

.score-badge.warn {
  border-color: rgba(185,121,18,0.24);
  background: #fff5e0;
  color: #7a4a07;
}

.result-tabs {
  width: 100%;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 10px;
}

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  width: 100%;
  margin-top: 12px;
}

.result-actions button {
  height: 48px;
  min-height: 48px;
  padding: 6px 10px;
}

.toolbar button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 750;
  line-height: 1.15;
  padding: 8px 12px;
  text-align: center;
}
#copyAllBtn {
  border-color: rgba(15,90,167,0.48);
  background: linear-gradient(180deg, #1976d2, #0f5aa7);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 12px 28px rgba(15,90,167,0.16), inset 0 1px 0 rgba(255,255,255,0.16);
}

#copyAllBtn:hover:not(:disabled) {
  border-color: rgba(136,208,255,0.55);
}
#resetBtn, #clearDataBtn { border-color: rgba(201,54,68,0.2); background: #fff7f8; color: #9e2634; }

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

.settings-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.settings-actions button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 750;
}

.button-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
}

.button-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.info-note {
  padding: 13px 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(22,104,184,0.18);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f8fbff, #eef6ff);
}
.info-note strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 0.95rem;
}
.info-note p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.template-tools,
.history-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 10px;
  margin-bottom: 14px;
}
.diagnostics-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}
.diagnostics-panel h3 { margin-bottom: 10px; font-size: 1rem; }
#diagnosticsOutput { display: grid; gap: 8px; }
.diagnostic-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
}
.diagnostic-row strong { color: var(--text); }
.diagnostic-row.success { border-color: rgba(23,135,90,0.22); background: #e8f8f1; color: #106943; }
.diagnostic-row.warn { border-color: rgba(185,121,18,0.24); background: #fff5e0; color: #7a4a07; }
.diagnostic-row.danger { border-color: rgba(201,54,68,0.22); background: #fff0f2; color: #9e2634; }
.template-form textarea { grid-column: 1 / -1; min-height: 140px; }
.template-form .check-row { align-self: center; }

.template-save-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 0.62fr) minmax(560px, 1.38fr);
  gap: 12px;
  align-items: center;
}

.template-action-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-self: center;
}

.template-action-group:has(#saveTemplateAsNewBtn:not([hidden])) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.template-action-group button {
  width: 100%;
  min-height: 38px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-action-group button:not(.primary-action) {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: #334155;
  font-weight: 800;
}

.template-action-group button[hidden] {
  display: none;
}

.card-list { display: grid; gap: 10px; }
.empty-state {
  padding: 20px;
  border: 1px dashed rgba(22,104,184,0.26);
  border-radius: var(--radius);
  background: #f6faff;
  color: var(--muted);
}
.data-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #f7fafe);
}

.data-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
}

.data-card-title {
  min-width: 0;
}

.data-card h3 {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.25;
}

.data-card small {
  display: block;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.25;
}

.data-card p {
  margin-bottom: 10px;
  color: var(--soft);
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.48;
}

.favorite-star {
  display: inline-block;
  margin-right: 5px;
  color: #0f5aa7;
}

.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.tag-list span {
  padding: 4px 8px;
  border: 1px solid rgba(22,104,184,0.18);
  border-radius: 999px;
  background: #eef6ff;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 850;
}

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

.card-actions-compact {
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
}

.card-actions button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.15;
}

.card-actions .card-primary-action {
  min-width: 0;
  border-color: rgba(15,90,167,0.18);
  background: #fff;
  color: #172033;
  white-space: nowrap;
}

.card-actions .icon-action {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #33445f;
}

.card-actions .icon-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.card-actions .icon-action:hover,
.card-actions .card-primary-action:hover {
  border-color: rgba(22,104,184,0.28);
  background: #f2f8ff;
  color: var(--accent-strong);
}

.card-actions .danger-action {
  border-color: rgba(201,54,68,0.22);
  background: #fff5f6;
  color: #9e2634;
}

.card-actions .danger-action:hover {
  border-color: rgba(201,54,68,0.32);
  background: #fff0f2;
  color: #9e2634;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 8px;
}
.style-grid label, .check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 650;
}
.style-grid label {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
}
.check-row input, .style-grid input { width: 16px; min-height: 16px; }

.style-assist {
  display: grid;
  grid-template-columns: minmax(275px, 39%) minmax(0, 61%);
  gap: 12px;
  margin: 14px 0;
}

.style-assist article {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.style-assist h3 {
  margin-bottom: 5px;
  font-size: 0.98rem;
}

.style-assist p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-grid button {
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid rgba(22,104,184,0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}

.chip-grid button.is-active {
  border-color: rgba(22,104,184,0.42);
  background: #eaf4ff;
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(22,104,184,0.08);
}

.style-profile-actions {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(180px, auto) minmax(110px, auto);
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.style-profile-edit-notice {
  width: fit-content;
  max-width: 100%;
  margin-top: 12px;
  padding: 7px 10px;
  border: 1px solid rgba(15,90,167,0.16);
  border-radius: 999px;
  background: #eef7ff;
  color: #0b4f94;
  font-size: 0.78rem;
  font-weight: 850;
}

.style-profile-edit-notice[hidden] {
  display: none;
}

.style-profile-actions .field {
  margin-bottom: 0;
}

.style-profile-actions button {
  width: auto;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 750;
  white-space: nowrap;
}

.style-profile-actions .muted-action {
  background: #f8fafc;
  color: #52647a;
}

.style-profile-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.style-profile-card {
  padding: 14px;
}

.style-profile-title {
  min-width: 0;
  align-self: center;
}

.style-profile-title h3 {
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-profile-title small {
  margin-bottom: 0;
}

.style-profile-card .card-actions .icon-action {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
}

.api-key-card {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #f6f9fd);
}

.access-panel {
  background: linear-gradient(180deg, #f6fbff 0%, #edf7ff 100%);
}

.access-panel.is-login-required {
  display: grid;
  align-items: start;
  justify-items: center;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin-inline: auto;
  padding: clamp(90px, 18vh, 220px) 0 18px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.access-heading {
  margin-bottom: 12px;
}

.access-heading h2 {
  font-size: 1.08rem;
}

.access-heading p {
  color: #526982;
}

.access-login-notice {
  margin: 0 0 12px;
  padding: 11px 13px;
  border: 1px solid rgba(241,190,85,0.28);
  border-radius: 8px;
  background: #fff8e8;
  color: #76521a;
  font-size: 0.88rem;
  font-weight: 850;
}

.access-login-notice[hidden] {
  display: none;
}

.access-heading[hidden] {
  display: none;
}

.access-onboarding {
  display: grid;
  gap: 16px;
  min-width: 0;
  overflow: hidden;
  margin: 0 auto 14px;
  padding: 18px;
  border: 1px solid rgba(22,104,184,0.22);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(23, 54, 86, 0.09);
}

.access-onboarding[data-mode="carousel"] {
  max-width: 512px;
  width: min(512px, 100%);
  gap: 0;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.access-onboarding[data-mode="carousel"] .access-onboarding-header,
.access-onboarding[data-mode="carousel"] .access-onboarding-hint {
  display: none;
}

.access-onboarding[data-mode="dismissed"] {
  max-width: 560px;
  padding: 16px;
}

.access-onboarding[data-state="ready"] {
  padding: 14px 16px;
  border-color: rgba(23,135,90,0.25);
  background: #f4fbf7;
}

.access-onboarding[data-state="check-failed"] {
  border-color: rgba(201,54,68,0.22);
  background: #fff7f7;
}

.access-onboarding-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(22,104,184,0.12);
  border-radius: 8px;
  background: #f7fbff;
}

.access-onboarding[data-mode="carousel"] .access-onboarding-header {
  text-align: left;
}

.access-onboarding[data-mode="dismissed"] .access-onboarding-header {
  border-color: rgba(22,104,184,0.1);
  background: #ffffff;
}

.access-onboarding-header .connection-badge {
  flex: 0 0 auto;
  max-width: 180px;
  white-space: normal;
  text-align: center;
}

.access-onboarding-kicker {
  margin-bottom: 6px;
  color: #0f6a44;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.access-onboarding-header h3 {
  margin: 0 0 6px;
  color: #17314f;
  font-size: 1.18rem;
  line-height: 1.18;
}

.access-onboarding[data-state="ready"] .access-onboarding-header h3 {
  font-size: 0.95rem;
}

.access-onboarding-header p,
.access-onboarding-hint,
.access-onboarding-card p {
  margin: 0;
  color: #526982;
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.38;
}

.access-onboarding-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.access-onboarding[data-mode="carousel"] .access-onboarding-cards {
  display: block;
}

.access-onboarding-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  min-height: 232px;
  padding: 18px;
  border: 1px solid rgba(22,104,184,0.16);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.access-onboarding-card[hidden] {
  display: none;
}

.access-onboarding[data-mode="carousel"] .access-onboarding-card {
  position: relative;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  align-content: stretch;
  height: 342px;
  min-height: 342px;
  padding: 18px 18px 76px;
  border-color: rgba(22,104,184,0.14);
  box-shadow: 0 18px 38px rgba(23, 54, 86, 0.12);
}

.access-onboarding-card:nth-child(5) {
  border-color: rgba(15,90,167,0.42);
}

.access-card-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding-right: 32px;
}

.access-card-progress span {
  height: 3px;
  border-radius: 999px;
  background: #c7cfda;
}

.access-card-progress span.is-active {
  background: #6f94c8;
}

.access-card-icon {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f1ff;
  color: #0f5aa7;
}

.access-card-icon::before {
  content: attr(data-icon);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.access-card-icon[data-icon="screen"]::before { content: "APP"; }
.access-card-icon[data-icon="mail"]::before { content: "MAIL"; }
.access-card-icon[data-icon="lock"]::before { content: "KEY"; }
.access-card-icon[data-icon="spark"]::before { content: "AI"; }
.access-card-icon[data-icon="check"]::before { content: "OK"; }
.access-card-icon[data-icon="bolt"]::before { content: "GO"; }
.access-card-icon[data-icon="license"]::before { content: "PRO"; }
.access-card-icon[data-icon="refresh"]::before { content: "SYNC"; }
.access-card-icon[data-icon="key"]::before { content: "API"; }
.access-card-icon[data-icon="alert"]::before { content: "!"; }

.access-onboarding-card strong {
  display: block;
  margin-bottom: 12px;
  color: #23364f;
  font-size: 1.28rem;
  line-height: 1.22;
}

.access-onboarding-card p {
  color: #435a72;
  font-size: 0.9rem;
  font-weight: 720;
  line-height: 1.43;
}

.access-onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.access-onboarding[data-mode="carousel"] > .access-onboarding-actions {
  display: none;
}

.access-onboarding[data-mode="dismissed"] > .access-onboarding-actions {
  justify-content: center;
}

.access-onboarding-actions.compact {
  margin-top: 2px;
}

.access-onboarding-card-actions .access-onboarding-actions {
  margin-top: 14px;
}

.access-onboarding[data-mode="carousel"] .access-onboarding-card-actions {
  position: absolute;
  right: 18px;
  bottom: 67px;
  left: 18px;
}

.access-onboarding-actions[hidden] {
  display: none;
}

.access-onboarding-actions button {
  width: auto;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.15;
}

.access-onboarding[data-state="logged-out"] > .access-onboarding-actions .primary-action {
  min-width: 180px;
  min-height: 44px;
  font-size: 0.92rem;
}

.access-onboarding-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.access-onboarding-actions .primary-action {
  border-color: rgba(15,90,167,0.48);
  background: #0f5aa7;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(15,90,167,0.16);
}

.access-onboarding-actions .primary-action:disabled {
  border-color: rgba(100,116,139,0.18);
  background: #eef2f7;
  color: #64748b;
  box-shadow: none;
}

.access-onboarding-actions .secondary-action {
  border-color: rgba(23,135,90,0.2);
  background: #f7fcf9;
  color: #106943;
}

.access-onboarding-actions .success-action {
  border-color: rgba(23,135,90,0.22);
  background: #eefaf4;
  color: #14734c;
}

.access-onboarding-actions .dismiss-action {
  min-width: 44px;
  width: 44px;
  padding: 9px 0;
  border-color: rgba(71,85,105,0.22);
  background: #ffffff;
  color: #334155;
  font-size: 1.25rem;
  line-height: 1;
}

.access-onboarding-actions .nav-dismiss-action,
.access-onboarding-actions .nav-prev-action,
.access-onboarding-actions .nav-next-action {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.16rem;
  line-height: 1;
}

.access-onboarding-actions .nav-dismiss-action {
  border-color: transparent;
  background: transparent;
  color: rgba(51,65,85,0.62);
  box-shadow: none;
}

.access-onboarding-actions .nav-prev-action {
  border-color: rgba(15,90,167,0.16);
  background: rgba(255,255,255,0.82);
  color: #315a86;
}

.access-onboarding-actions .nav-next-action {
  margin-left: auto;
  border-color: rgba(15,90,167,0.28);
  background: #17314f;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(23,49,79,0.16);
}

.access-onboarding-actions .nav-dismiss-action:hover,
.access-onboarding-actions .nav-prev-action:hover,
.access-onboarding-actions .nav-next-action:hover {
  transform: translateY(-1px);
}

.access-card-footer {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin-top: 0;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 850;
}

.access-card-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.access-card-footer em {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f4f8;
  color: #526177;
  font-style: normal;
  line-height: 1.2;
  text-align: right;
  white-space: normal;
}

.access-card-close {
  position: absolute;
  top: 9px;
  right: 10px;
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(51,65,85,0.58);
  cursor: pointer;
  font-size: 1.18rem;
  font-weight: 650;
  line-height: 1;
  box-shadow: none;
}

.access-card-close:hover {
  color: #17314f;
  background: rgba(15,90,167,0.06);
}

.access-card-nav-left,
.access-card-nav-right {
  display: flex;
  align-items: center;
}

.access-card-nav-left {
  justify-content: flex-start;
}

.access-card-nav-right {
  justify-content: flex-end;
}

.access-card-arrow {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(15,90,167,0.14);
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  color: #315a86;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1;
  box-shadow: none;
}

.access-card-arrow.is-next {
  border-color: rgba(23,49,79,0.28);
  background: #17314f;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(23,49,79,0.14);
}

.access-card-arrow:hover {
  transform: translateY(-1px);
}

.access-onboarding-card.is-green .access-card-icon,
.access-onboarding-card.is-green .access-card-footer em {
  background: #e4f6eb;
  color: #106943;
}

.access-onboarding-card.is-amber .access-card-icon,
.access-onboarding-card.is-amber .access-card-footer em {
  background: #fff4df;
  color: #9a5a12;
}

.access-onboarding-card.is-violet .access-card-icon,
.access-onboarding-card.is-violet .access-card-footer em {
  background: #f0ebff;
  color: #6040a8;
}

.access-onboarding-card.is-red .access-card-icon,
.access-onboarding-card.is-red .access-card-footer em {
  background: #fff0f1;
  color: #b32638;
}

.access-panel.is-login-required .access-section-tabs,
.access-panel.is-login-required .access-card {
  display: none;
}

.access-section-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.access-section-tabs button {
  min-height: 40px;
  border: 1px solid rgba(15,90,167,0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.78);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.access-section-tabs button:hover {
  border-color: rgba(15,90,167,0.34);
  background: #fff;
}

.access-card {
  border-color: rgba(22,104,184,0.28);
  background: rgba(226, 242, 255, 0.72);
  box-shadow: none;
}

.access-card:nth-of-type(2) {
  border-color: rgba(23,135,90,0.28);
  background: rgba(232, 250, 243, 0.68);
}

.billing-card {
  border-color: rgba(95,111,134,0.26);
  background: rgba(247, 250, 253, 0.78);
}

.billing-portal-box {
  display: grid;
  gap: 10px;
}

.billing-portal-box p {
  margin: 0;
  color: var(--soft);
  line-height: 1.45;
}

.billing-connection-note {
  padding: 10px 12px;
  border: 1px solid rgba(23,135,90,0.2);
  border-radius: var(--radius);
  background: #f1fbf6;
  color: #106943;
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.4;
}

.access-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 10px 0 18px;
}

.access-step {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 7px;
  min-width: 0;
  padding: 0 18px;
  text-align: center;
  color: #35465d;
}

.access-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 15px;
  left: calc(50% + 20px);
  width: calc(100% - 40px);
  height: 1px;
  background: rgba(97, 117, 139, 0.28);
}

.access-step:first-child::before,
.access-step:last-child::after {
  content: none !important;
  display: none !important;
  width: 0;
}

.access-step span {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #e6edf6;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 900;
  z-index: 1;
}

.access-step strong {
  width: 100%;
  color: #23364f;
  font-size: 0.9rem;
  line-height: 1.25;
}

.access-step small {
  max-width: 230px;
  color: #526982;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.28;
}

.access-step-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 2px;
}

.access-step-links button {
  border: 1px solid rgba(22, 111, 200, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #1167b3;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.2;
  padding: 5px 8px;
  white-space: nowrap;
}

.access-step-links button:hover,
.access-step-links button:focus-visible {
  background: #ffffff;
  border-color: rgba(22, 111, 200, 0.45);
  color: #0c5595;
  outline: none;
}

.access-license-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.license-key-note {
  margin-top: -4px;
  padding: 10px 12px;
  border: 1px solid rgba(23,135,90,0.18);
  border-radius: var(--radius);
  background: #f7fcf9;
  color: #164d36;
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.35;
}

.access-license-actions button,
.built-smart-actions button,
.billing-portal-box button {
  min-width: 0;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-weight: 800;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
}

.access-license-actions button,
.billing-portal-box button {
  width: 100%;
  justify-content: center;
  font-size: clamp(0.78rem, 0.9vw, 0.95rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
}

.access-license-actions .key-feedback {
  grid-column: 1 / -1;
}

.access-license-actions .primary-action {
  border-color: rgba(15,90,167,0.28);
  background: #f3f8ff;
  color: var(--accent-strong);
}

.access-license-actions .secondary-action {
  border-color: rgba(23,135,90,0.2);
  background: #f7fcf9;
  color: #106943;
}

.access-license-actions .muted-action {
  border-color: rgba(201,54,68,0.12);
  background: #f3f0f4;
  color: #b36b7a;
}

.access-license-actions .trial-action,
.built-smart-actions .success-action {
  border-color: rgba(23,135,90,0.22);
  background: #eefaf4;
  color: #14734c;
}

.access-license-actions .trial-action.is-finished {
  border-color: rgba(100,116,139,0.16);
  background: #f4f7fb;
  color: #526177;
}

.access-license-actions .purchase-action,
.billing-portal-box .purchase-action {
  border-color: rgba(23,135,90,0.32);
  background: #dff6eb;
  color: #0f6a44;
  box-shadow: inset 0 0 0 1px rgba(23,135,90,0.04);
}

.access-license-actions button:disabled,
.billing-portal-box button:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

.built-smart-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

.credit-package-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.credit-package-picker label {
  display: block;
  cursor: pointer;
}

.credit-package-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.credit-package-picker span {
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 7px;
  border: 1px solid rgba(23,135,90,0.18);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.72);
  color: #526177;
  font-size: 0.76rem;
  line-height: 1.15;
  text-align: center;
}

.credit-package-picker strong {
  color: #106943;
  font-size: 0.82rem;
}

.credit-package-picker input:checked + span {
  border-color: rgba(23,135,90,0.42);
  background: #f1fbf6;
  color: #106943;
  box-shadow: inset 0 0 0 1px rgba(23,135,90,0.16);
}

.ki-options-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.built-smart-credit-summary {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(23,135,90,0.2);
  border-radius: var(--radius);
  background: #f1fbf6;
  color: #106943;
  font-size: 0.9rem;
  font-weight: 850;
}

.built-smart-credit-summary.is-empty {
  border-color: rgba(100,116,139,0.16);
  background: #f4f7fb;
  color: #526177;
}

.ki-option {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 100%;
  padding: 12px;
  border: 1px solid rgba(23,135,90,0.18);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.52);
}

.ki-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.built-smart-option {
  background: rgba(245, 251, 255, 0.66);
  border-color: rgba(22,104,184,0.18);
}

.ki-option h4 {
  margin: -4px 0 0;
  font-size: 0.98rem;
}

.ki-option p {
  margin: 0;
  color: #304257;
  font-size: 0.84rem;
  line-height: 1.35;
}

.option-kicker {
  color: #65758d;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.neutral-badge {
  width: fit-content;
  border-color: rgba(100,116,139,0.18);
  background: #f4f7fb;
  color: #415069;
}

.provider-help-link {
  width: fit-content;
  color: #177057;
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.provider-help-link:hover {
  color: #0f5f49;
  text-decoration: underline;
}

.own-key-option .secret-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.delete-key-button {
  border-color: rgba(201,54,68,0.16);
  background: #fff8f8;
  color: #b62f3c;
}

.delete-key-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.own-key-info {
  padding: 10px 12px;
  border: 1px solid rgba(100,116,139,0.16);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.72);
  color: #3f4d61;
  font-size: 0.82rem;
  line-height: 1.45;
}

.built-smart-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.own-key-option .api-action-row {
  grid-template-columns: 1fr;
}

.own-key-option .api-actions {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.own-key-option .api-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.own-key-option .key-feedback {
  min-height: 38px;
}

.access-note {
  border-color: rgba(185,121,18,0.2);
  background: #fff8e8;
}

.access-note p:last-child {
  margin-bottom: 0;
}

@media (max-width: 1280px) {
  .access-license-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .access-onboarding-cards {
    grid-template-columns: 1fr;
  }

  .access-onboarding-card {
    min-height: auto;
  }
}

@media (max-width: 980px) {
  .access-steps,
  .access-onboarding-cards,
  .ki-options-grid,
  .access-license-actions,
  .legal-consent-box {
    grid-template-columns: 1fr;
  }

  .access-steps {
    gap: 12px;
    padding-inline: 0;
  }

  .access-step {
    justify-items: start;
    grid-template-columns: auto minmax(0, 1fr);
    text-align: left;
  }

  .access-step::after {
    display: none;
  }

  .access-step small {
    grid-column: 2;
    max-width: none;
  }

  .access-step-links {
    grid-column: 2;
    justify-content: flex-start;
  }

  .access-onboarding-header {
    display: grid;
  }
}

@media (max-width: 640px) {
  .built-smart-actions {
    grid-template-columns: 1fr;
  }
}
.api-key-toggle {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  list-style: none;
}
.api-key-toggle::-webkit-details-marker { display: none; }
.api-key-toggle h3 { margin: 0 0 2px; font-size: 0.98rem; }
.api-key-toggle p, .field-help { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.35; }
.api-key-summary { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.chevron {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--soft);
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.api-key-toggle:hover .chevron {
  background: rgba(15,90,167,0.07);
  color: var(--accent-strong);
}
.api-key-card[open] .chevron { transform: rotate(180deg); }
.api-key-details { display: grid; gap: 10px; }
.api-key-card:not([open]) { gap: 0; }
.api-key-card:not([open]) .api-key-details { display: none; }
.api-field { margin-bottom: 0; }

.connection-badge {
  padding: 4px 8px;
  border: 1px solid rgba(185,121,18,0.22);
  border-radius: 999px;
  background: #fff5e0;
  color: #7a4a07;
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}
.connection-badge.is-connected { border-color: rgba(23,135,90,0.24); background: #e8f8f1; color: #106943; }
.secret-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.icon-button {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--text);
}
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}
.output-copy-button,
.output-delete-button {
  width: 24px;
  height: 24px;
  min-height: 24px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.output-copy-button {
  color: var(--muted);
}
.output-copy-button:not(:disabled):hover {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}
.output-delete-button {
  color: var(--muted);
}
.output-delete-button:hover {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}
.output-copy-button svg,
.output-delete-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}
#clearInboundBtn.textarea-delete-button,
#sourceDictateBtn.textarea-mic-button,
#copyOutputIconBtn.output-copy-button,
#resetBtn.output-delete-button {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

#clearInboundBtn.textarea-delete-button:hover,
#sourceDictateBtn.textarea-mic-button:hover,
#sourceDictateBtn.textarea-mic-button.is-listening,
#copyOutputIconBtn.output-copy-button:not(:disabled):hover,
#resetBtn.output-delete-button:hover {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}

#copyOutputIconBtn.output-copy-button.is-copied {
  color: #138a55;
}

#copyOutputIconBtn.output-copy-button.is-copied svg {
  stroke-width: 2.4;
}

#copyAllBtn.is-copied {
  border-color: rgba(19,138,85,0.28);
  background: #e8f8f1;
  color: #106943;
}

#sourceDictateBtn.textarea-mic-button:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  opacity: 0.46;
}
.eye-button { width: 44px; display: inline-grid; place-items: center; padding: 0; }
.eye-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.eye-button.is-active { background: #dceeff; color: var(--accent-strong); }

.api-action-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 8px;
  align-items: stretch;
}
.api-actions { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; }
.license-action-row { grid-template-columns: minmax(0,1fr) minmax(260px,1fr); }
.license-actions { grid-template-columns: repeat(2, minmax(0,1fr)); }
.license-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.api-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-weight: 750;
}
#saveKeyBtn { border-color: rgba(15,90,167,0.28); background: #f3f8ff; color: #0b4f94; }
#connectBtn, #testConnectionBtn, #verifyLicenseBtn { border-color: rgba(23,135,90,0.25); background: #f1fbf6; color: #106943; }
#disconnectBtn { border-color: rgba(201,54,68,0.22); background: #fff5f6; color: #9e2634; }
.api-actions button.is-connected { border-color: rgba(23,135,90,0.38); background: #17875a; color: #fff; }
.api-actions button:disabled { cursor: not-allowed; opacity: 0.58; }

.key-feedback {
  min-height: 36px;
  display: flex;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
#licenseFeedback {
  justify-content: center;
  text-align: center;
}
#keyFeedback {
  justify-content: center;
  text-align: center;
}
.key-feedback.success { border-color: rgba(23,135,90,0.22); background: #e8f8f1; color: #106943; }
.key-feedback.error { border-color: rgba(201,54,68,0.22); background: #fff0f2; color: #9e2634; }
.key-feedback.loading { border-color: rgba(15,90,167,0.24); background: #edf6ff; color: var(--accent-strong); }
.key-feedback.info { border-color: rgba(28,43,63,0.12); background: #f4f7fb; color: var(--soft); }
.key-feedback.loading {
  display: flex;
  align-items: center;
  gap: 8px;
}
.key-feedback.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid rgba(15,90,167,0.18);
  border-top-color: var(--accent-strong);
  border-radius: 999px;
  animation: smart-spin 0.85s linear infinite;
}

.legal-consent-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 9px 16px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(15,90,167,0.14);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.54);
  overflow: hidden;
}
.legal-consent-box.has-error {
  border-color: rgba(201,54,68,0.42);
  background: #fff7f8;
}
.credit-legal-consent-box {
  grid-template-columns: 1fr;
  margin-top: 2px;
  background: rgba(255,255,255,0.72);
}
.legal-consent-box strong {
  grid-column: 1 / -1;
  color: var(--text);
  font-size: 0.9rem;
}
.legal-consent-row {
  position: relative;
  width: 100%;
  max-width: 100%;
  display: block;
  min-height: 22px;
  padding-left: 25px;
  color: var(--soft);
  font-size: 0.84rem;
  line-height: 1.35;
}
.legal-consent-row input {
  appearance: auto;
  box-sizing: border-box;
  position: absolute;
  left: 0;
  top: 1px;
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  border-radius: 3px;
  background: #fff;
}
.legal-consent-row span {
  display: block;
  min-width: 0;
}
.legal-consent-row a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}
.legal-consent-row a:hover {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .legal-consent-box {
    grid-template-columns: 1fr;
  }
}

.privacy-note {
  padding: 10px 11px;
  border: 1px solid rgba(185,121,18,0.26);
  border-radius: var(--radius);
  background: rgba(255,245,224,0.92);
}
.privacy-note strong { display: block; margin-bottom: 5px; }
.privacy-note p { margin-bottom: 0; color: var(--soft); font-size: 0.85rem; line-height: 1.42; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 28px;
  background: rgba(5, 18, 34, 0.64);
  backdrop-filter: blur(10px);
}
.help-toggle:checked ~ .modal-backdrop { display: grid; }
.help-modal {
  width: min(1120px, 100%);
  max-height: min(820px, calc(100vh - 56px));
  overflow: auto;
  padding: 22px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,0.28);
}
.help-header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.help-header .eyebrow { color: var(--accent-strong); }
.help-header h2 { margin-bottom: 6px; }
.help-intro {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.help-layout {
  display: grid;
  grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.help-nav {
  position: sticky;
  top: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.help-nav a {
  display: block;
  padding: 8px 9px;
  border-radius: 6px;
  color: var(--soft);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.2;
}

.help-nav a:hover {
  background: #eaf5ff;
  color: var(--accent-strong);
}

.help-content {
  display: grid;
  gap: 14px;
}

.help-chapter {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 18px;
}

.help-chapter:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.help-chapter h3 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 1.08rem;
}

.help-chapter h4 {
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.help-chapter p,
.help-chapter li {
  color: var(--muted);
  line-height: 1.52;
}

.help-chapter p {
  margin-bottom: 9px;
}

.help-chapter ul,
.help-chapter ol {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding-left: 21px;
}

.help-chapter a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.help-callout {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(22,104,184,0.16);
  border-radius: var(--radius);
  background: #f8fbff;
}

.help-callout strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.help-quickstart {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.help-quickstart article {
  display: grid;
  grid-template-columns: 32px minmax(0,1fr);
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(22,104,184,0.18);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f8fbff, #eef6ff);
}
.help-quickstart span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #0f5aa7;
  color: #fff;
  font-weight: 900;
  font-size: 0.82rem;
}
.help-quickstart strong { display: block; margin-bottom: 4px; font-size: 0.92rem; }
.help-quickstart p { margin-bottom: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.38; }
.help-section {
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.help-section h3,
.help-reference h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}
.help-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--soft);
  line-height: 1.48;
}
.help-steps li::marker { color: var(--accent-strong); font-weight: 900; }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.help-grid article { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #f8fbff; }
.help-grid h3 { margin-bottom: 6px; font-size: 1rem; }
.help-grid p { margin-bottom: 0; color: var(--muted); line-height: 1.45; }
.help-reference {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  margin-top: 12px;
}
.help-reference article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.help-reference ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}
.help-reference li { margin-bottom: 7px; }
.help-reference li:last-child { margin-bottom: 0; }
.help-reference code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f4f8fd;
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
}

@media (max-width: 1180px) {
  .composer-top { grid-template-columns: 1fr; }
  .settings-panel { position: static; }
  .composer-workspace,
  .parameter-grid,
  .composer-main-parameters,
  .advanced-settings-grid,
  .composer-action-row,
  .composer-tools, .composer-guidance ol, .optional-context, .optional-context-row, .style-profile-actions, .style-profile-card { grid-template-columns: 1fr; }
  .quality-strip, .result-tabs { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .help-layout { grid-template-columns: 1fr; }
  .help-nav { position: static; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .help-quickstart { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 900px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav-list { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .app-shell { width: min(100% - 20px, 1580px); padding: 16px 0; }
  .app-header { align-items: stretch; flex-direction: column; }
  .header-brand { align-items: center; flex-direction: row; gap: 14px; }
  .header-icon { width: 48px; height: 48px; border-radius: 12px; }
  .header-actions { justify-content: space-between; }
  .help-modal { padding: 16px; max-height: calc(100vh - 32px); }
  .help-header { align-items: flex-start; }
  .help-nav { grid-template-columns: 1fr; }
  .nav-list, .two-column, .mail-grid, .template-form, .settings-grid, .settings-actions, .profile-row, .parameter-grid, .composer-main-parameters, .advanced-settings-grid, .composer-action-row, .composer-workspace, .workspace-switch, .optional-context, .optional-context-row, .style-profile-actions, .style-profile-card, .license-grid, .api-action-row, .api-actions, .license-actions, .result-actions, .style-grid, .style-assist, .help-grid, .quick-actions, .signal-grid, .quality-strip, .result-tabs, .history-tools, .template-tools, .access-section-tabs, .composer-guidance ol, .help-quickstart, .help-reference { grid-template-columns: 1fr; }
  .composer-reset-row { align-items: stretch; flex-direction: column; }
  .composer-reset-action { width: 100%; }
  .template-save-row,
  .template-action-group { grid-template-columns: 1fr; }
  .composer-guidance ol { gap: 22px; }
  .composer-guidance ol::before { display: none; }
  .app-footer { margin-top: 38px; padding-top: 24px; }
  .app-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .footer-brand {
    grid-template-columns: 34px minmax(0, auto);
    justify-content: center;
  }
  .footer-legal {
    justify-items: center;
    text-align: center;
  }
  .footer-legal nav {
    justify-content: center;
  }
  .style-profile-card .card-actions { justify-content: flex-start; flex-wrap: wrap; }

  .data-card-header {
    grid-template-columns: 1fr;
  }

  .card-actions-compact {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  h1 { font-size: 24px; }
}
