:root {
  --canvas: #edf2ef;
  --surface: #ffffff;
  --surface-muted: #f6f8f7;
  --ink: #16211e;
  --ink-soft: #58645f;
  --ink-faint: #7f8b86;
  --line: #dbe4df;
  --line-strong: #c8d5cf;
  --teal-900: #0a4a42;
  --teal-800: #0d5f54;
  --teal-700: #117366;
  --mint: #e4f3ee;
  --coral: #c85e39;
  --coral-soft: #fbeae2;
  --gold: #d6a927;
  --gold-soft: #fbf1d6;
  --danger: #b13b35;
  --shadow: 0 18px 54px rgba(23, 49, 42, 0.08);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(13, 95, 84, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 95, 84, 0.035) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(17, 115, 102, 0.24);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

svg {
  width: 1.1em;
  height: 1.1em;
  stroke-width: 1.9;
}

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

.app-shell {
  width: min(1560px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 24px 24px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  margin-bottom: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #fff;
  background: var(--teal-800);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(13, 95, 84, 0.2);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
  stroke-width: 2;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 24px;
  line-height: 1.15;
}

.brand-copy span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.privacy-note,
.system-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(12px);
}

.privacy-note svg {
  color: var(--teal-700);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #3fa275;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(63, 162, 117, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(540px, 1.14fr) minmax(360px, 0.86fr);
  min-height: calc(100vh - 122px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(200, 213, 207, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.source-pane,
.results-pane {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.source-pane {
  grid-column: 2;
  grid-row: 1;
  background:
    linear-gradient(180deg, rgba(228, 243, 238, 0.66), rgba(246, 248, 247, 0) 270px),
    var(--surface-muted);
  border-inline-end: 1px solid var(--line);
}

.results-pane {
  grid-column: 1;
  grid-row: 1;
  background: var(--surface);
}

.pane-heading,
.results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 88px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal-700);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.pane-heading h1,
.results-heading h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiet-button,
.primary-button,
.sample-button,
.icon-text-button,
.icon-button,
.tab-button,
.copy-field-button,
.export-menu button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 0;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.quiet-button {
  gap: 7px;
  min-height: 36px;
  padding: 0 11px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.quiet-button:hover,
.icon-button:hover {
  color: var(--teal-800);
  border-color: #b8ccc4;
  background: #f9fbfa;
}

.source-body {
  display: flex;
  min-height: 430px;
  flex: 1;
  align-items: flex-start;
  padding: 20px 24px;
  overflow-y: auto;
}

.upload-zone {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(244, 249, 247, 0.92)),
    var(--surface);
  border: 1.5px dashed #adc5bc;
  border-radius: 8px;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.upload-zone.is-dragging {
  background: var(--mint);
  border-color: var(--teal-700);
  box-shadow: inset 0 0 0 3px rgba(17, 115, 102, 0.08);
}

.upload-icon {
  display: grid;
  width: 66px;
  height: 66px;
  margin-bottom: 22px;
  place-items: center;
  color: var(--teal-800);
  background: var(--mint);
  border: 1px solid #c9e3da;
  border-radius: 8px;
  transform: rotate(-3deg);
}

.upload-icon svg {
  width: 29px;
  height: 29px;
}

.upload-zone h2 {
  margin: 0 0 7px;
  font-size: 20px;
  line-height: 1.4;
}

.upload-zone p {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 14px;
}

.primary-button {
  gap: 8px;
  min-width: 144px;
  min-height: 44px;
  padding: 0 18px;
  color: #fff;
  background: var(--teal-800);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(13, 95, 84, 0.18);
}

.primary-button:hover {
  background: var(--teal-900);
  transform: translateY(-1px);
}

.sample-button {
  gap: 7px;
  min-height: 34px;
  margin-top: 12px;
  padding: 0 10px;
  color: var(--teal-700);
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.sample-button:hover {
  background: var(--mint);
}

.preview-wrap {
  display: flex;
  width: 100%;
  min-height: 0;
  flex-direction: column;
}

.preview-stage {
  flex: 1 1 auto;
  position: relative;
  display: grid;
  height: auto;
  min-height: 355px;
  overflow: hidden;
  place-items: center;
  background:
    linear-gradient(45deg, #e9efec 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, #e9efec 25%, transparent 25%) 0 9px / 18px 18px,
    linear-gradient(45deg, transparent 75%, #e9efec 75%) 9px -9px / 18px 18px,
    linear-gradient(-45deg, transparent 75%, #e9efec 75%) -9px 0 / 18px 18px,
    #f6f8f7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-stage::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border: 8px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
}

.generated-flag {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: #fff;
  background: rgba(13, 95, 84, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(13, 50, 43, 0.2);
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.generated-flag svg {
  width: 14px;
  height: 14px;
}

#source-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 560px;
  padding: 22px;
  object-fit: contain;
  transition: transform 220ms ease;
}

.processing-layer {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 24px;
  color: #fff;
  background: linear-gradient(180deg, rgba(10, 74, 66, 0.16), rgba(10, 50, 45, 0.88));
  backdrop-filter: blur(2px);
}

.scan-line {
  position: absolute;
  top: 18%;
  right: 7%;
  left: 7%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #74e1c4 20%, #ffffff 50%, #74e1c4 80%, transparent);
  box-shadow: 0 0 18px rgba(116, 225, 196, 0.85);
  animation: scan 2.1s ease-in-out infinite alternate;
}

@keyframes scan {
  from {
    top: 14%;
    opacity: 0.4;
  }
  to {
    top: 82%;
    opacity: 1;
  }
}

.processing-copy {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
  font-size: 13px;
}

.processing-copy strong {
  flex: 1;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

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

.progress-track {
  width: 100%;
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: #8af0d4;
  border-radius: inherit;
  transition: width 240ms ease;
}

.preview-toolbar {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
}

.file-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.file-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--teal-700);
  background: var(--mint);
  border-radius: 8px;
}

.file-summary > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.file-summary strong {
  overflow: hidden;
  max-width: 260px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary small {
  color: var(--ink-faint);
  font-size: 12px;
}

.preview-actions {
  display: flex;
  gap: 7px;
}

.portrait-tools {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.portraits-panel {
  margin-top: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.portraits-heading,
.all-text-heading {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.portraits-heading small,
.all-text-heading small {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  color: var(--teal-800);
  background: var(--mint);
  border-radius: 6px;
  font-size: 11px;
}

#portrait-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.portrait-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #fbfcfb;
  border: 1px solid #e7ece9;
  border-radius: 8px;
}

.portrait-preview {
  width: 56px;
  height: 68px;
  overflow: hidden;
  background: var(--surface-muted);
  border-radius: 6px;
}

.portrait-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.portrait-copy strong {
  font-size: 12px;
}

.portrait-copy small {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portrait-actions {
  display: flex;
  gap: 5px;
}

.portrait-action {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.portrait-action:hover {
  color: var(--teal-800);
  border-color: #b8ccc4;
}

.portrait-action svg {
  width: 15px;
  height: 15px;
}

.portrait-tones {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  padding-top: 9px;
  border-top: 1px solid #e7ece9;
}

.portrait-tone-option {
  display: flex;
  min-width: 0;
  min-height: 42px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
  color: var(--ink-faint);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 600;
}

.portrait-tone-option:hover {
  color: var(--teal-800);
  border-color: #b8ccc4;
}

.portrait-tone-option.is-active {
  color: var(--teal-900);
  background: var(--mint);
  border-color: #a8cec1;
}

.tone-swatch {
  width: 23px;
  height: 13px;
  border: 1px solid rgba(25, 46, 40, 0.18);
  border-radius: 4px;
}

.tone-original {
  background: linear-gradient(90deg, #d6aa83 0 50%, #7ca899 50%);
}

.tone-gray {
  background: linear-gradient(90deg, #d6d6d6, #6e6e6e);
}

.tone-light {
  background: linear-gradient(90deg, #fff7e8, #dfb78f);
}

.tone-warm {
  background: linear-gradient(90deg, #e7ae76, #a35d3d);
}

.tone-contrast {
  background: linear-gradient(90deg, #f3f0e8, #262d2a);
}

.tone-vivid {
  background: linear-gradient(90deg, #d98777, #6e9fb2);
}

.portrait-empty {
  padding: 20px 12px;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.source-footer {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.format-list {
  display: flex;
  gap: 6px;
}

.format-list span {
  padding: 3px 6px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.results-heading {
  padding-inline: 28px;
}

.extraction-state {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.extraction-state.is-busy {
  color: var(--teal-800);
  background: var(--mint);
  border-color: #c7e1d8;
}

.extraction-state.is-done {
  color: #296c50;
  background: #e9f6ee;
  border-color: #cae6d6;
}

.extraction-state.is-error {
  color: var(--danger);
  background: #fdf0ef;
  border-color: #f2d2cf;
}

.result-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.model-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.model-option {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  color: var(--ink-faint);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition:
    color 150ms ease,
    background-color 150ms ease;
}

.model-option svg {
  width: 13px;
  height: 13px;
}

.model-option:hover:not(:disabled) {
  color: var(--teal-800);
}

.model-option.is-active {
  color: var(--teal-900);
  background: #fff;
  box-shadow: 0 1px 4px rgba(23, 49, 42, 0.12);
}

.model-option:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.regenerate-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  color: #fff;
  background: var(--coral);
  border: 1px solid #b9502e;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition:
    background-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.regenerate-button:hover:not(:disabled) {
  background: #b95130;
  transform: translateY(-1px);
}

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

.regenerate-button.is-busy svg {
  animation: spin 900ms linear infinite;
}

.icon-text-button {
  gap: 7px;
  min-height: 36px;
  padding: 0 11px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.icon-text-button:hover:not(:disabled) {
  color: var(--teal-800);
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

.button-chevron {
  width: 13px;
  height: 13px;
  margin-inline-start: 1px;
}

.export-wrap {
  position: relative;
}

.export-menu {
  position: absolute;
  z-index: 8;
  top: calc(100% + 7px);
  left: 0;
  width: 164px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(25, 53, 45, 0.14);
}

.export-menu button {
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 0 9px;
  color: var(--ink-soft);
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

.export-menu button:hover {
  color: var(--teal-800);
  background: var(--surface-muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 28px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.summary-item {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-inline-start: 1px solid var(--line);
}

.summary-item:first-child {
  padding-inline-start: 0;
  border-inline-start: 0;
}

.summary-item:last-child {
  padding-inline-end: 0;
}

.summary-item span {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-item strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.summary-item:nth-child(2) strong {
  color: var(--coral);
}

.summary-item:nth-child(3) strong {
  color: #9b740f;
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 0 28px;
  padding-top: 12px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  position: relative;
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink-faint);
  background: transparent;
  border-radius: 6px 6px 0 0;
  font-size: 13px;
  font-weight: 600;
}

.all-text-heading {
  margin: -4px -4px 10px;
  background: transparent;
  border-bottom: 1px solid var(--line);
}

#text-blocks-list {
  display: grid;
  gap: 7px;
}

.text-block-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: start;
  gap: 8px;
  padding: 8px 9px;
  background: var(--surface-muted);
  border: 1px solid #e7ece9;
  border-radius: 8px;
}

.text-block-input {
  width: 100%;
  min-height: 34px;
  padding: 6px 7px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 13px;
  line-height: 1.7;
  resize: none;
}

.text-block-input:hover {
  background: rgba(255, 255, 255, 0.72);
}

.text-block-input:focus {
  background: #fff;
  box-shadow: inset 0 0 0 1px #b7d2c8;
}

.tab-button::after {
  position: absolute;
  right: 13px;
  bottom: -1px;
  left: 13px;
  height: 2px;
  content: "";
  background: transparent;
}

.tab-button:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.tab-button.is-active {
  color: var(--teal-800);
}

.tab-button.is-active::after {
  background: var(--teal-700);
}

.result-content {
  min-height: 0;
  flex: 1;
  overflow: auto;
  scrollbar-color: #c4d2cc transparent;
  scrollbar-width: thin;
}

.empty-results {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  place-items: center;
  color: var(--teal-700);
  background: var(--mint);
  border: 1px solid #cce3da;
  border-radius: 50%;
}

.empty-icon svg {
  width: 34px;
  height: 34px;
}

.empty-results h3 {
  margin: 0 0 7px;
  font-size: 19px;
}

.empty-results p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.skeleton-lines {
  display: grid;
  width: min(360px, 70%);
  gap: 9px;
  margin-top: 30px;
}

.skeleton-lines span {
  height: 8px;
  background: #edf2f0;
  border-radius: 999px;
}

.skeleton-lines span:nth-child(1) {
  width: 100%;
}

.skeleton-lines span:nth-child(2) {
  width: 83%;
}

.skeleton-lines span:nth-child(3) {
  width: 62%;
}

.tab-panel {
  padding: 20px 28px 28px;
}

.organized-groups {
  display: grid;
  gap: 12px;
}

.result-group {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.group-heading {
  display: flex;
  min-height: 45px;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
}

.group-heading span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--group-color, var(--teal-700));
  background: var(--group-bg, var(--mint));
  border-radius: 6px;
}

.group-heading svg {
  width: 15px;
  height: 15px;
}

.group-heading h3 {
  flex: 1;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.group-heading small {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 600;
}

.group-rows {
  display: grid;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.28fr) minmax(0, 1fr) 30px;
  align-items: start;
  gap: 12px;
  min-height: 52px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid #edf1ef;
}

.result-row:last-child {
  border-bottom: 0;
}

.field-label {
  padding-top: 7px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 600;
}

.field-input {
  width: 100%;
  min-height: 34px;
  padding: 6px 0;
  overflow: hidden;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
  line-height: 1.7;
  resize: none;
}

.field-input:hover {
  color: var(--teal-900);
}

.field-input:focus {
  padding: 6px 8px;
  background: #f7fbf9;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px #b7d2c8;
}

.copy-field-button {
  width: 28px;
  height: 28px;
  margin-top: 2px;
  color: var(--ink-faint);
  background: transparent;
  border-radius: 6px;
  opacity: 0;
}

.result-row:hover .copy-field-button,
.copy-field-button:focus-visible {
  opacity: 1;
}

.copy-field-button:hover {
  color: var(--teal-700);
  background: var(--mint);
}

.copy-field-button svg {
  width: 14px;
  height: 14px;
}

.text-block {
  margin: 0;
  padding: 9px 0 3px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
}

.raw-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  color: var(--teal-800);
  background: var(--mint);
  border-radius: 6px;
  font-size: 11px;
}

.confidence-badge svg {
  width: 13px;
  height: 13px;
}

.raw-textarea {
  width: 100%;
  min-height: 410px;
  padding: 16px;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.9;
  resize: vertical;
}

.raw-textarea:focus {
  background: #fbfdfc;
  border-color: #a9c7bb;
}

.fields-header {
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) minmax(0, 1fr) 30px;
  gap: 12px;
  padding: 0 12px 9px 14px;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) minmax(0, 1fr) 30px;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 7px 12px 7px 14px;
  border-bottom: 1px solid #edf1ef;
}

.field-row input {
  width: 100%;
  min-height: 34px;
  padding: 5px 7px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 13px;
}

.field-row input.field-key-input {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.field-row input:hover {
  background: var(--surface-muted);
}

.field-row input:focus {
  background: #f7fbf9;
  box-shadow: inset 0 0 0 1px #b7d2c8;
}

.results-footer {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  color: var(--ink-faint);
  background: #fbfcfb;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.local-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.local-note svg {
  width: 13px;
  height: 13px;
  color: var(--teal-700);
}

.toast {
  position: fixed;
  z-index: 30;
  bottom: 24px;
  left: 50%;
  min-width: 180px;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  color: #fff;
  background: #173f37;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 41, 35, 0.2);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(500px, 1.22fr) minmax(320px, 0.78fr);
  }

  .source-body,
  .pane-heading,
  .results-heading {
    padding-inline: 18px;
  }

  .summary-grid,
  .tabs {
    margin-inline: 18px;
  }

  .tab-panel {
    padding-inline: 18px;
  }

  .results-footer,
  .source-footer {
    padding-inline: 18px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
  }

  .workspace {
    display: block;
    min-height: auto;
  }

  .source-pane {
    grid-column: auto;
    grid-row: auto;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

  .results-pane {
    grid-column: auto;
    grid-row: auto;
  }

  .source-body {
    min-height: 430px;
  }

  .results-pane {
    min-height: 680px;
  }

  .result-content {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 10px;
  }

  .app-header {
    min-height: 56px;
    margin-bottom: 10px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand-copy strong {
    font-size: 21px;
  }

  .brand-copy span {
    display: none;
  }

  .privacy-note {
    display: none;
  }

  .system-status {
    min-height: 32px;
    padding-inline: 10px;
  }

  .pane-heading,
  .results-heading {
    min-height: 76px;
    padding: 15px 16px;
  }

  .pane-heading h1,
  .results-heading h2 {
    font-size: 19px;
  }

  .source-body {
    min-height: 360px;
    padding: 14px 16px;
  }

  .upload-zone {
    padding: 30px 16px;
  }

  .upload-icon {
    width: 58px;
    height: 58px;
    margin-bottom: 18px;
  }

  .upload-zone h2 {
    font-size: 18px;
  }

  .source-footer {
    padding-inline: 16px;
  }

  .format-list span:nth-child(n + 4) {
    display: none;
  }

  .preview-stage {
    min-height: 300px;
  }

  #source-image {
    padding: 12px;
  }

  .file-summary strong {
    max-width: 140px;
  }

  .result-heading-actions {
    gap: 5px;
  }

  .model-option {
    width: 30px;
    padding: 0;
  }

  .model-option span {
    display: none;
  }

  .icon-text-button {
    width: 36px;
    padding: 0;
  }

  .regenerate-button {
    width: 36px;
    padding: 0;
  }

  .regenerate-button span {
    display: none;
  }

  .icon-text-button span,
  .icon-text-button .button-chevron {
    display: none;
  }

  .summary-grid {
    margin-inline: 16px;
    padding: 13px 0;
  }

  .summary-item {
    display: grid;
    justify-items: center;
    gap: 5px;
    padding-inline: 8px;
  }

  .summary-item:first-child,
  .summary-item:last-child {
    padding-inline: 8px;
  }

  .summary-item span {
    font-size: 10px;
  }

  .summary-item strong {
    font-size: 18px;
  }

  .tabs {
    margin-inline: 16px;
  }

  .result-content {
    min-height: 470px;
  }

  .tab-panel {
    padding: 14px 16px 20px;
  }

  .result-row {
    grid-template-columns: 76px minmax(0, 1fr) 30px;
    gap: 7px;
    padding-inline: 9px;
  }

  .field-row,
  .fields-header {
    grid-template-columns: 100px minmax(0, 1fr) 30px;
    gap: 7px;
    padding-inline: 9px;
  }

  .results-footer {
    padding-inline: 16px;
  }

  .local-note {
    display: none;
  }

  .results-note {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
