:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #20332e;
  background: #f5f4ee;
  line-height: 1.5;
  font-synthesis: none;
  --accent: #14634e;
  --border: #cbd3cc;
}
* { box-sizing: border-box; }
body { margin: 0; }
.masthead, main, footer { max-width: 1500px; margin: auto; padding: 24px 32px; }
.masthead { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; border-bottom: 1px solid var(--border); }
.brand { margin: 0 0 12px; font-size: .78rem; font-weight: 700; letter-spacing: .035em; color: var(--accent); }
h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.7rem); letter-spacing: -.04em; line-height: 1.15; }
h2 { margin: 0 0 14px; font-size: 1.1rem; }
h3 { margin: 0 0 12px; font-size: 1rem; }
#tagline { margin: 12px 0 0; }
.language-control { width: 250px; flex-shrink: 0; }
.language-control small { display: block; margin-top: 7px; }
#languageWarning { color: #8c331c; }
.intro { max-width: 950px; margin: 0 0 24px; font-size: 1.05rem; }
.workspace { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.library { padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: #eaf0e9; }
.library-actions { display: grid; gap: 8px; }
.record-list { display: grid; gap: 8px; margin: 20px 0; }
.record { display: grid; width: 100%; text-align: left; gap: 5px; overflow-wrap: anywhere; background: #fff; }
.record span, .record small { font-size: .8rem; color: #4d6259; }
.record.selected { border: 2px solid var(--accent); background: #f3fbf6; }
.empty { padding: 12px 0; color: #465d53; }
.editor-area { min-width: 0; }
.editor-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 18px; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; }
.save-state { color: #506257; font-size: .85rem; }
.save-state.unsaved { font-weight: 700; color: #8a4a0d; }
.comparison-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 22px; min-width: 0; }
.panel-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.panel-heading h2 { margin-bottom: 0; }
.muted, small { color: #53655b; font-size: .85rem; }
.lock-note { font-size: .85rem; font-weight: 650; color: var(--accent); border-left: 3px solid var(--accent); padding-left: 10px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
label { display: block; margin: 16px 0 6px; font-weight: 650; font-size: .9rem; }
.language-control label { margin-top: 0; }
input, textarea, select { display: block; width: 100%; max-width: 100%; font: inherit; font-size: .95rem; padding: 10px 12px; color: #20332e; background: #fff; border: 1px solid #aab9af; border-radius: 7px; }
textarea { resize: vertical; min-height: 85px; }
input[type='file'] { padding: 9px; font-size: .85rem; }
input[type='file']::file-selector-button { font: inherit; padding: 7px; border-radius: 4px; border: 1px solid #aab9af; margin-right: 8px; }
input:disabled, textarea:disabled, select:disabled { opacity: 1; color: #344d42; background: #f0f4ef; border-color: #d1dbd3; -webkit-text-fill-color: #344d42; }
[aria-invalid='true'] { border: 2px solid #ac361d; }
button { font: inherit; font-size: .88rem; font-weight: 600; padding: 10px 13px; min-height: 44px; border: 1px solid #a4b6a8; border-radius: 8px; color: #214536; background: #fff; cursor: pointer; }
button:hover:not(:disabled) { background: #eaf4ee; border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: #104c3c; }
button.danger { color: #8f2d1c; border-color: #d7ada4; }
button:disabled { cursor: wait; opacity: .6; }
:focus-visible { outline: 3px solid #146dbe; outline-offset: 3px; }
figure { margin: 18px 0 12px; }
figure img { display: block; width: 100%; height: 290px; object-fit: contain; border-radius: 9px; background: #eef2ed; border: 1px solid var(--border); }
figcaption { margin-top: 7px; font-size: .8rem; color: #53655b; overflow-wrap: anywhere; }
.photo-empty { display: grid; place-items: center; min-height: 170px; margin: 18px 0; padding: 20px; text-align: center; border: 2px dashed #bbc9bf; border-radius: 10px; color: #526b5d; background: #f6f8f4; }
.difference-card { padding: 18px 0; border-top: 1px solid #dce3dc; }
.previous-value { background: #eef3ed; border-radius: 7px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.previous-value span { display: block; font-size: .75rem; font-weight: 700; color: #50685a; margin-bottom: 3px; }
.summary { display: inline-block; border-radius: 7px; padding: 8px 12px; background: #e7f1e9; color: #20533d; font-weight: 700; }
.export-panel { margin-top: 22px; }
#comparisonPreview { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .84rem; line-height: 1.6; min-height: 290px; background: #fafbf8; white-space: pre-wrap; }
.export-panel .actions { margin-top: 14px; }
.message { padding: 14px 18px; margin: 0 0 20px; border: 1px solid; border-radius: 9px; overflow-wrap: anywhere; }
.message.success { background: #e6f1e7; border-color: #a5c4a8; color: #244d2d; }
.message.error { background: #fff0e8; border-color: #d9a391; color: #7d2919; }
.example-banner { padding: 12px 16px; background: #fff4d9; border: 1px solid #d9ba72; border-radius: 8px; color: #725006; }
footer { color: #506257; font-size: .82rem; padding-top: 12px; padding-bottom: 35px; }
.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; }
[hidden] { display: none !important; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); gap: 16px; }
  .panel { padding: 16px; }
  .comparison-grid { gap: 14px; }
  .masthead, main, footer { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; }
  .record-list { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .library-actions { grid-template-columns: 1fr 1fr; }
  .comparison-grid { grid-template-columns: 1fr; }
  .masthead { flex-direction: column; gap: 18px; }
  .language-control { width: 100%; max-width: 350px; }
}
@media (max-width: 450px) {
  .masthead, main, footer { padding-left: 12px; padding-right: 12px; }
  .panel, .library { padding: 14px; }
  .editor-top .actions { width: 100%; }
  .editor-top .actions button { flex: 1 1 auto; }
  figure img { height: 240px; }
  h1 { font-size: 1.85rem; }
}
