.screen-frame {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-surface);
  overflow: hidden;
}

.screen-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-subtle);
}

.screen-leading,
.screen-trailing {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.screen-copy {
  min-width: 0;
}

.screen-eyebrow,
.section-kicker,
.field-label,
.metric-label,
.studio-kicker,
.section-label {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.screen-title {
  margin: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-subtitle {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  padding: 8px;
  overflow: auto;
}

.screen-footer {
  padding: 8px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-subtle);
}

.icon-button,
.action-button,
.tab-button,
.tag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.icon-button {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-color: var(--line-soft);
  background: var(--bg-surface);
  color: var(--text-body);
}

.icon-button-svg,
.icon-button-svg svg {
  display: block;
  width: 18px;
  height: 18px;
}

.icon-button-svg svg {
  stroke: currentColor;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon-button:hover,
.action-button:hover,
.tab-button:hover,
.list-row:hover {
  border-color: var(--line-strong);
  background: var(--bg-muted);
}

.action-button {
  min-height: 36px;
  padding: 0 12px;
}

.action-button-block {
  width: 100%;
}

.action-button-primary {
  border-color: var(--bg-accent);
  background: var(--bg-accent);
  color: var(--text-inverse);
}

.action-button-secondary {
  border-color: #91c7bd;
  background: var(--bg-accent-soft);
  color: #0f4f49;
}

.action-button-quiet {
  border-color: var(--line-soft);
  background: var(--bg-surface);
  color: var(--text-body);
}

.section-card {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-surface);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-subtle);
}

.section-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.section-description {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.section-body {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.stack-gap {
  display: grid;
  gap: 6px;
}

.list-row,
.data-row,
.sync-device-row,
.share-row {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--bg-surface);
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  text-align: left;
}

.list-row-selected {
  border-color: #73b8ad;
  background: #eef8f6;
}

.data-row,
.sync-device-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.split-row,
.sync-device-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.row-copy {
  min-width: 0;
}

.row-title {
  margin: 0;
  overflow: hidden;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta,
.row-detail,
.field-hint,
.empty-copy,
.share-amount {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

.row-detail {
  color: var(--text-body);
}

.row-trailing {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mono-copy,
.invite-url {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Segoe UI Mono", monospace;
}

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

.field-block {
  display: grid;
  gap: 5px;
}

.field-control {
  display: grid;
}

.ui-input,
.ui-select,
.ui-textarea,
.share-input {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-strong);
  outline: none;
}

.ui-input:focus,
.ui-select:focus,
.ui-textarea:focus,
.share-input:focus {
  border-color: var(--bg-accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.ui-textarea {
  min-height: 92px;
  resize: vertical;
}

.combobox {
  position: relative;
}

.combobox-list {
  position: fixed;
  z-index: 200;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-overlay);
}

.combobox-option {
  padding: 8px 10px;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text-body);
}

.combobox-option:hover {
  background: var(--bg-muted);
  color: var(--text-strong);
}

.chip-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  min-height: 30px;
  padding: 0 10px;
  border-color: var(--line-soft);
  background: var(--bg-surface);
  color: var(--text-body);
}

.tag-pill-active {
  border-color: #73b8ad;
  background: var(--bg-accent-soft);
  color: #0f4f49;
}

.status-strip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.status-strip-hidden {
  display: none;
}

.status-strip-info {
  background: #ecfdf5;
  color: #065f46;
}

.status-strip-error,
.form-error {
  background: var(--bg-error);
  color: #991b1b;
}

.status-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.9rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  font-weight: 650;
}

.safe-content-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.settings-overlay,
.sheet-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.settings-backdrop,
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
}

.settings-panel,
.sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(980px, 100%);
  max-height: min(760px, calc(100% - 36px));
  min-height: min(620px, calc(100% - 36px));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-overlay);
  overflow: hidden;
}

.sheet-panel {
  width: min(540px, 100%);
  min-height: 0;
}

.settings-header,
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-subtle);
}

.settings-title-block,
.sheet-copy {
  min-width: 0;
}

.settings-title,
.sheet-title {
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-subtitle,
.sheet-description {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.3;
}

.settings-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-surface);
}

.tab-button {
  padding: 0 12px;
  border-color: var(--line-soft);
  background: var(--bg-surface);
  color: var(--text-body);
}

.tab-button-active {
  border-color: #73b8ad;
  background: var(--bg-accent-soft);
  color: #0f4f49;
}

.settings-body,
.sheet-body {
  flex: 1;
  min-height: 0;
  padding: 10px;
  overflow: auto;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.result-panel,
.invite-panel {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--bg-subtle);
}

.result-actions {
  display: flex;
  justify-content: flex-end;
}

.invite-url {
  margin: 0;
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-body);
  font-size: 0.78rem;
  line-height: 1.4;
}

.share-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.share-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.share-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-side {
  display: flex;
  align-items: center;
  gap: 6px;
}

.share-input {
  width: 70px;
}

.form-error {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 0.9rem;
}

@media (max-width: 1199px) {
  .screen-frame {
    flex: 1;
    min-height: 0;
    height: auto;
  }

  .settings-overlay {
    padding: 0;
  }

  .settings-panel {
    width: 100%;
    min-height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

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

@media (max-width: 720px) {
  .screen-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .screen-leading {
    order: 2;
  }

  .screen-copy {
    order: 1;
  }

  .screen-trailing {
    order: 3;
  }

  .field-grid,
  .share-row,
  .split-row,
  .sync-device-row {
    grid-template-columns: 1fr;
  }

  .button-row,
  .share-side {
    justify-content: stretch;
  }

  .button-row .action-button,
  .share-side .action-button {
    flex: 1 1 auto;
  }
}
