:root {
  color-scheme: light;
  --page: #f7f3ea;
  --panel: rgba(255, 252, 245, 0.88);
  --panel-strong: #fffaf1;
  --ink: #201c1a;
  --muted: #716760;
  --line: rgba(67, 55, 44, 0.16);
  --gold: #b9873c;
  --gold-soft: #efe0bd;
  --burgundy: #7f2437;
  --teal: #1f6f73;
  --teal-soft: #dcebec;
  --shadow: 0 24px 70px rgba(58, 43, 31, 0.16);
  --radius: 8px;
  --input-height: 46px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --page: #171513;
  --panel: rgba(37, 32, 28, 0.88);
  --panel-strong: #2d2722;
  --ink: #f8efe3;
  --muted: #c2b5a8;
  --line: rgba(247, 239, 228, 0.15);
  --gold: #d6a75d;
  --gold-soft: rgba(214, 167, 93, 0.16);
  --burgundy: #c35b70;
  --teal: #78c9ca;
  --teal-soft: rgba(120, 201, 202, 0.14);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(31, 111, 115, 0.12), transparent 30%),
    linear-gradient(225deg, rgba(127, 36, 55, 0.10), transparent 34%),
    var(--page);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(460px, 100%);
}

.login-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 16px;
}

.login-card h1 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.35;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.8;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  height: var(--input-height);
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel-strong);
  outline: none;
}

.login-message {
  min-height: 26px;
  color: var(--burgundy);
  font-weight: 800;
}

.privacy-link,
.privacy-top-link {
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.privacy-link {
  display: inline-flex;
  margin-top: 12px;
}

.legal-notice {
  width: min(680px, 100%);
}

.notice-back {
  width: fit-content;
  margin-top: 6px;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-frame {
  width: min(1480px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

[data-theme="dark"] .app-frame {
  background: rgba(26, 23, 20, 0.55);
}

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.58);
}

[data-theme="dark"] .workflow-strip {
  background: rgba(32, 28, 26, 0.58);
}

.workflow-step {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-inline-start: 1px solid var(--line);
  color: var(--muted);
}

.workflow-step:first-child {
  border-inline-start: 0;
}

.workflow-step span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  background: var(--panel-strong);
  font-size: 12px;
  font-weight: 900;
}

.workflow-step b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.workflow-step.active {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(185, 135, 60, 0.14), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(185, 135, 60, 0.42);
  border-radius: 50%;
  color: var(--gold);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), transparent 42%),
    var(--gold-soft);
}

.brand-mark svg {
  width: 34px;
  height: 34px;
}

.brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-copy strong,
.brand-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy strong {
  font-size: 18px;
  line-height: 1.35;
}

.brand-copy small {
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.icon-button,
.tool-tab,
.primary-button,
.ghost-button,
.icon-text-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel-strong);
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 116px minmax(0, 1.05fr) minmax(340px, 0.72fr);
  gap: 0;
}

.tool-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 12px;
  border-inline-start: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.62);
}

[data-theme="dark"] .tool-rail {
  background: rgba(45, 39, 34, 0.5);
}

.tool-tab {
  min-height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  color: var(--muted);
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.tool-tab span {
  font-size: 13px;
  font-weight: 700;
}

.tool-tab.active,
.tool-tab:hover {
  color: var(--burgundy);
  border-color: rgba(127, 36, 55, 0.28);
  background: rgba(127, 36, 55, 0.08);
  transform: translateY(-1px);
}

.draft-panel {
  min-width: 0;
  padding: 24px;
  border-inline-start: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
}

.panel-head,
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  line-height: 1.3;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

.case-badge {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(185, 135, 60, 0.34);
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  white-space: nowrap;
}

.case-badge span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

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

.form-grid,
.translation-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

label,
.label-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: rgba(18, 16, 15, 0.46);
}

input,
select {
  height: var(--input-height);
  padding: 0 12px;
}

textarea {
  min-height: 238px;
  padding: 13px 14px;
  resize: vertical;
  line-height: 1.85;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 111, 115, 0.56);
  box-shadow: 0 0 0 4px rgba(31, 111, 115, 0.12);
  background: var(--panel-strong);
}

.hidden {
  display: none;
}

.template-dock {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(31, 111, 115, 0.08), transparent 48%),
    rgba(255, 255, 255, 0.42);
}

[data-theme="dark"] .template-dock {
  background:
    linear-gradient(135deg, rgba(120, 201, 202, 0.08), transparent 48%),
    rgba(18, 16, 15, 0.34);
}

.dock-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dock-head h2 {
  font-size: 16px;
}

.dock-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

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

.template-card {
  min-height: 94px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: start;
  background: var(--panel-strong);
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease;
}

.template-card:hover {
  color: var(--burgundy);
  border-color: rgba(127, 36, 55, 0.26);
  transform: translateY(-1px);
}

.template-card b {
  font-size: 14px;
}

.template-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.case-dossier {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(127, 36, 55, 0.08), transparent 52%),
    rgba(255, 255, 255, 0.38);
}

[data-theme="dark"] .case-dossier {
  background:
    linear-gradient(135deg, rgba(195, 91, 112, 0.08), transparent 52%),
    rgba(18, 16, 15, 0.30);
}

.dossier-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dossier-head h2 {
  font-size: 16px;
}

.dossier-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

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

.dossier-grid textarea {
  min-height: 86px;
}

.translation-studio,
.proofread-studio {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(31, 111, 115, 0.10), transparent 50%),
    rgba(255, 255, 255, 0.42);
}

[data-theme="dark"] .translation-studio,
[data-theme="dark"] .proofread-studio {
  background:
    linear-gradient(135deg, rgba(120, 201, 202, 0.08), transparent 50%),
    rgba(18, 16, 15, 0.34);
}

.studio-head,
.box-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.studio-head {
  margin-bottom: 12px;
}

.studio-head h2 {
  font-size: 16px;
}

.detected-language {
  min-width: 148px;
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  text-align: center;
}

.detected-language span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.detected-language b {
  color: var(--teal);
  font-size: 13px;
}

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

.translation-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.translation-box {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.translation-box textarea {
  min-height: 220px;
}

.translation-box.output textarea {
  background:
    linear-gradient(180deg, rgba(185, 135, 60, 0.08), transparent 44%),
    rgba(255, 255, 255, 0.56);
}

[data-theme="dark"] .translation-box.output textarea {
  background: rgba(18, 16, 15, 0.48);
}

.mini-button {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 800;
}

.mini-button:hover {
  color: var(--gold);
  border-color: rgba(185, 135, 60, 0.42);
}

body[data-active-tool="translate"] .workspace {
  grid-template-columns: 116px minmax(0, 1fr);
}

body[data-active-tool="translate"] .draft-panel {
  border-inline-start: 1px solid var(--line);
}

body[data-active-tool="translate"] .panel-head,
body[data-active-tool="translate"] #matterField,
body[data-active-tool="translate"] #metadataFields,
body[data-active-tool="translate"] #caseDossier,
body[data-active-tool="translate"] #mainTextField,
body[data-active-tool="translate"] #notesField,
body[data-active-tool="translate"] #templateDock,
body[data-active-tool="translate"] #mainCommandBar,
body[data-active-tool="translate"] #aiChatPanel,
body[data-active-tool="translate"] .result-panel {
  display: none !important;
}

body[data-active-tool="translate"] .translation-studio {
  min-height: calc(100vh - 210px);
}

body[data-active-tool="translate"] .translation-workspace {
  min-height: 430px;
}

body[data-active-tool="translate"] .translation-box textarea {
  min-height: 430px;
}

body[data-active-tool="consult"] .workspace {
  grid-template-columns: 116px minmax(0, 1fr);
}

body[data-active-tool="consult"] .panel-head,
body[data-active-tool="consult"] #legalForm,
body[data-active-tool="consult"] .result-panel {
  display: none !important;
}

body[data-active-tool="consult"] .draft-panel {
  display: flex;
  flex-direction: column;
}

body[data-active-tool="consult"] #aiChatPanel {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 0;
  min-height: calc(100vh - 170px);
}

body[data-active-tool="consult"] .chat-messages {
  flex: 1;
  max-height: none;
  min-height: 360px;
}

body[data-active-tool="proofread"] .workspace {
  grid-template-columns: 116px minmax(0, 1fr);
}

body[data-active-tool="proofread"] .panel-head,
body[data-active-tool="proofread"] #legalForm > :not(#proofreadStudio),
body[data-active-tool="proofread"] .result-panel,
body[data-active-tool="proofread"] #aiChatPanel {
  display: none !important;
}

body[data-active-tool="proofread"] .proofread-studio {
  display: block !important;
  min-height: calc(100vh - 210px);
}

body[data-active-tool="proofread"] .translation-workspace {
  min-height: 430px;
}

body[data-active-tool="proofread"] .translation-box textarea {
  min-height: 430px;
}

body[data-active-tool="archive"] .workspace {
  grid-template-columns: 116px minmax(0, 1fr);
}

body[data-active-tool="archive"] .panel-head,
body[data-active-tool="archive"] #legalForm,
body[data-active-tool="archive"] #aiChatPanel,
body[data-active-tool="archive"] .result-panel {
  display: none !important;
}

body[data-active-tool="archive"] #memoArchivePanel {
  display: block !important;
}

.memo-archive-panel {
  min-height: calc(100vh - 170px);
}

.archive-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.archive-head h1 {
  font-size: 26px;
}

.archive-head > span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid rgba(185, 135, 60, 0.34);
  border-radius: 999px;
  color: var(--gold);
  background: var(--gold-soft);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

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

.memo-archive-list {
  display: grid;
  gap: 12px;
}

.memo-archive-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(185, 135, 60, 0.08), transparent 54%),
    var(--panel-strong);
}

.memo-archive-card h2 {
  margin: 0 0 5px;
  font-size: 17px;
}

.memo-archive-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.memo-archive-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.memo-archive-meta span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.34);
  font-size: 12px;
  font-weight: 800;
}

.archive-card-actions {
  display: grid;
  gap: 8px;
  min-width: 136px;
}

.archive-card-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  font-weight: 800;
}

.archive-card-actions button:hover {
  color: var(--gold);
  border-color: rgba(185, 135, 60, 0.44);
}

.archive-card-actions .danger-action {
  color: var(--burgundy);
}

.ai-chat-panel {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(185, 135, 60, 0.10), transparent 48%),
    rgba(255, 255, 255, 0.44);
}

[data-theme="dark"] .ai-chat-panel {
  background:
    linear-gradient(135deg, rgba(214, 167, 93, 0.08), transparent 48%),
    rgba(18, 16, 15, 0.34);
}

.chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.chat-head h2 {
  font-size: 18px;
}

.chat-head > span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.chat-messages {
  display: grid;
  gap: 10px;
  max-height: 340px;
  overflow: auto;
  padding: 2px;
}

.chat-message {
  width: min(92%, 680px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.chat-message.user {
  justify-self: start;
  color: #fffaf1;
  border-color: transparent;
  background: linear-gradient(135deg, var(--teal), #375f60);
}

.chat-message.assistant {
  justify-self: end;
}

.chat-message span {
  display: block;
  margin-bottom: 6px;
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.76;
}

.chat-message p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.9;
}

.chat-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.chat-form textarea {
  min-height: 96px;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.command-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.icon-text-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 800;
  transition: transform 160ms ease, filter 160ms ease, border-color 160ms ease;
}

.primary-button {
  color: #fffaf1;
  border-color: transparent;
  background: linear-gradient(135deg, var(--burgundy), #9b6532);
}

.ghost-button:hover,
.icon-text-button:hover,
.icon-button:hover {
  border-color: rgba(185, 135, 60, 0.45);
  color: var(--gold);
}

.primary-button:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.result-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-inline-start: 1px solid var(--line);
  background: var(--panel-strong);
  overflow: hidden;
}

.visual-band {
  position: relative;
  min-height: 192px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.visual-band img {
  width: 100%;
  height: 100%;
  min-height: 192px;
  object-fit: cover;
  display: block;
}

.visual-band::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(32, 28, 26, 0.45), transparent 62%),
    linear-gradient(90deg, rgba(32, 28, 26, 0.28), transparent 58%);
}

.seal {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 1;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 250, 241, 0.48);
  border-radius: 50%;
  color: #f7e5bd;
  background: rgba(32, 28, 26, 0.58);
  backdrop-filter: blur(8px);
}

.seal svg {
  width: 38px;
  height: 38px;
}

.result-head {
  margin: 0;
  padding: 20px 20px 12px;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 6px rgba(185, 135, 60, 0.14);
}

.status-dot.ready {
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(31, 111, 115, 0.14);
}

.status-dot.error {
  background: var(--burgundy);
  box-shadow: 0 0 0 6px rgba(127, 36, 55, 0.14);
}

.quality-panel {
  margin: 0 20px 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
}

[data-theme="dark"] .quality-panel {
  background: rgba(18, 16, 15, 0.32);
}

.memory-panel,
.reference-panel {
  margin: 0 20px 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.38);
}

[data-theme="dark"] .memory-panel,
[data-theme="dark"] .reference-panel {
  background: rgba(18, 16, 15, 0.3);
}

.memory-head,
.reference-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.memory-head strong,
.reference-head strong {
  color: var(--ink);
  font-size: 14px;
}

.icon-text-button.compact {
  flex: 0 0 auto;
  min-width: 92px;
}

.memory-signals {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.memory-signals span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid rgba(31, 111, 115, 0.2);
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 800;
}

.reference-head > span {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(185, 135, 60, 0.12);
  font-weight: 900;
}

.reference-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  margin-top: 10px;
}

.reference-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 4px);
  background: var(--panel-strong);
}

.reference-card strong,
.reference-card span,
.reference-card a {
  display: block;
}

.reference-card strong {
  color: var(--ink);
  font-size: 13px;
}

.reference-card span {
  margin-top: 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.reference-card p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.reference-card a {
  width: fit-content;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.quality-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.quality-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quality-head b {
  color: var(--teal);
  direction: ltr;
  font-size: 18px;
  unicode-bidi: isolate;
}

.quality-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(113, 103, 96, 0.16);
}

.quality-meter span {
  width: 0%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 220ms ease;
}

.quality-list {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.quality-list span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-strong);
  font-size: 12px;
  font-weight: 700;
}

.quality-list span.done {
  color: var(--teal);
  border-color: rgba(31, 111, 115, 0.24);
  background: var(--teal-soft);
}

.quality-list span.missing {
  color: var(--burgundy);
  border-color: rgba(127, 36, 55, 0.24);
  background: rgba(127, 36, 55, 0.08);
}

.result-output {
  flex: 1;
  min-height: 260px;
  margin: 0 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: pre-wrap;
  overflow: auto;
  line-height: 1.9;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(185, 135, 60, 0.08), transparent 42%),
    rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .result-output {
  background: rgba(18, 16, 15, 0.44);
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 20px;
  flex-wrap: wrap;
}

.icon-text-button {
  flex: 1 1 92px;
}

.saved-drafts {
  margin: 0 20px 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.saved-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.saved-head h2 {
  font-size: 16px;
}

.saved-head > span {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--teal);
  background: var(--teal-soft);
  font-weight: 900;
}

.draft-list {
  display: grid;
  gap: 8px;
  max-height: 178px;
  overflow: auto;
  padding-inline-end: 2px;
}

.draft-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.46);
}

[data-theme="dark"] .draft-item {
  background: rgba(18, 16, 15, 0.32);
}

.draft-item button {
  border: 0;
  padding: 0;
  color: inherit;
  text-align: start;
  background: transparent;
}

.draft-item b,
.draft-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-item b {
  margin-bottom: 4px;
  font-size: 13px;
}

.draft-item span,
.empty-state {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.delete-draft {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line) !important;
  border-radius: 50%;
  color: var(--burgundy) !important;
  background: transparent !important;
}

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

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .workflow-strip,
  .tool-rail,
  .draft-panel,
  .visual-band,
  .result-actions,
  .saved-drafts {
    display: none !important;
  }

  .app-frame,
  .workspace,
  .result-panel {
    display: block;
    width: 100%;
    min-height: auto;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .result-output {
    margin: 0;
    border: 0;
    color: #111;
    background: #fff;
  }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .result-panel {
    grid-column: 1 / -1;
    min-height: 520px;
    border-top: 1px solid var(--line);
  }

  .visual-band {
    min-height: 154px;
  }

  .visual-band img {
    min-height: 154px;
  }

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

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

  .translation-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-frame {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
    border-inline: 0;
  }

  .topbar {
    align-items: flex-start;
  }

  .workflow-strip {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    overflow-x: auto;
  }

  .workflow-step {
    min-height: 52px;
    padding: 10px 12px;
  }

  .archive-head,
  .archive-toolbar,
  .memo-archive-card {
    grid-template-columns: 1fr;
  }

  .archive-head {
    flex-direction: column;
  }

  .archive-card-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .brand-copy strong {
    max-width: 210px;
    white-space: normal;
  }

  .brand-copy small {
    display: none;
  }

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

  .tool-rail {
    position: sticky;
    top: 0;
    z-index: 3;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
    border-bottom: 1px solid var(--line);
  }

  .tool-tab {
    min-width: 86px;
    min-height: 66px;
  }

  .draft-panel {
    padding: 18px 14px;
    border-inline-start: 0;
  }

  .panel-head {
    flex-direction: column;
  }

  h1 {
    font-size: 23px;
  }

  .form-grid,
  .translation-row {
    grid-template-columns: 1fr;
  }

  .dock-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .dock-head > span {
    white-space: normal;
  }

  .dossier-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .dossier-head > span {
    white-space: normal;
  }

  .studio-head {
    flex-direction: column;
  }

  .detected-language {
    width: 100%;
  }

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

  .result-panel {
    border-inline-start: 0;
  }
}
