:root {
  --ink: #171918;
  --muted: #6b706d;
  --line: #d9ddda;
  --surface: #ffffff;
  --soft: #f3f5f3;
  --green: #006f55;
  --green-dark: #00503e;
  --cyan: #d9f5ef;
  --amber: #d68910;
  --danger: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f7f8f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; }
button { letter-spacing: 0; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(0, 111, 85, .24); outline-offset: 2px; }
[hidden] { display: none !important; }

.auth-page {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background:
    linear-gradient(rgba(23, 25, 24, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 25, 24, .045) 1px, transparent 1px),
    #f7f8f7;
  background-size: 32px 32px;
}

.auth-shell {
  width: min(920px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(23, 25, 24, .1);
  background: var(--surface);
}

.brand-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  color: #fff;
  background: #1a1e1c;
}

.brand-mark { width: 56px; height: 56px; border: 1px solid #6c7772; padding: 11px; margin-bottom: 54px; }
.brand-mark span { display: block; width: 100%; height: 100%; background: var(--cyan); clip-path: polygon(0 0, 100% 0, 100% 35%, 35% 35%, 35% 100%, 0 100%); }
.eyebrow, .section-label { margin: 0 0 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: 0; font-weight: 700; }
.brand-block .eyebrow { color: #9aa59f; }
.brand-block h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 56px; line-height: 1.04; font-weight: 500; letter-spacing: 0; }
.brand-copy { margin: 20px 0 50px; color: #c7ceca; font-size: 17px; }

.format-line { display: flex; flex-wrap: wrap; gap: 8px; }
.format-line span { padding: 6px 8px; border: 1px solid currentColor; border-radius: 2px; font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; }
.brand-block .format-line { color: #829089; }

.auth-panel { display: flex; flex-direction: column; justify-content: center; gap: 48px; padding: 64px 56px; }
.section-label { color: var(--green); }
.auth-panel h2 { margin: 0; font-size: 27px; line-height: 1.25; letter-spacing: 0; }
form label, .result-link-block label { display: block; margin: 0 0 9px; font-size: 13px; font-weight: 700; }
.password-field { display: grid; grid-template-columns: 1fr 48px; border: 1px solid #aeb5b1; border-radius: 4px; overflow: hidden; background: #fff; }
.password-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 111, 85, .12); }
.password-field input { min-width: 0; height: 52px; padding: 0 14px; border: 0; outline: 0; }
.icon-button { width: 48px; height: 52px; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.eye-icon { display: inline-block; width: 19px; height: 12px; border: 1.5px solid currentColor; border-radius: 50%; position: relative; }
.eye-icon::after { content: ""; position: absolute; width: 4px; height: 4px; border: 1.5px solid currentColor; border-radius: 50%; top: 2px; left: 6px; }
.is-visible .eye-icon::before { content: ""; position: absolute; width: 22px; height: 1.5px; background: currentColor; transform: rotate(-35deg); left: -2px; top: 5px; z-index: 2; }

.form-message { min-height: 22px; margin: 9px 0 8px; color: var(--danger); font-size: 13px; }
.form-message.success { color: var(--green); }
.primary-button, .quiet-button { min-height: 44px; border-radius: 4px; cursor: pointer; font-weight: 700; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid var(--green); padding: 0 18px; color: #fff; background: var(--green); }
.primary-button:hover { background: var(--green-dark); border-color: var(--green-dark); }
.primary-button:disabled, .quiet-button:disabled { cursor: wait; opacity: .55; }
form .primary-button { width: 100%; justify-content: space-between; }
.quiet-button { border: 1px solid var(--line); padding: 0 16px; color: var(--ink); background: var(--surface); }
.quiet-button:hover { border-color: #929a95; background: var(--soft); }

.workspace-page { display: flex; flex-direction: column; background: #f7f8f7; }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100% - 1080px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .94); }
.wordmark { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-family: Georgia, "Times New Roman", serif; font-size: 21px; font-weight: 700; }
.wordmark-symbol { width: 22px; height: 22px; background: var(--green); clip-path: polygon(0 0, 100% 0, 100% 38%, 38% 38%, 38% 100%, 0 100%); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.secure-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.secure-state span { width: 7px; height: 7px; border-radius: 50%; background: #18a474; box-shadow: 0 0 0 3px #dcf4eb; }
.topbar .quiet-button { min-height: 36px; }

.workspace { width: min(1080px, calc(100% - 48px)); margin: 0 auto; padding: 54px 0 40px; }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.workspace-heading h1 { margin: 0; font-size: 34px; line-height: 1.1; letter-spacing: 0; }
.workspace-heading > p { margin: 0; color: var(--muted); font-size: 13px; }

.upload-stage { min-height: 460px; position: relative; }
.drop-zone { width: 100%; min-height: 430px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed #96a29c; border-radius: 6px; color: var(--ink); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--green); background: #f4fbf8; }
.upload-symbol { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 27px; border: 1px solid #8aa097; border-radius: 50%; color: var(--green); background: var(--cyan); font-size: 30px; line-height: 1; }
.drop-title { font-size: 22px; font-weight: 750; }
.drop-subtitle { margin: 8px 0 28px; color: var(--muted); font-size: 14px; }
.format-line.compact { color: #78827d; }

.selection, .result { min-height: 430px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.selection { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); }
.preview-frame { min-height: 428px; display: grid; place-items: center; padding: 28px; border-right: 1px solid var(--line); background-color: #edf0ee; background-image: linear-gradient(45deg, #e2e6e3 25%, transparent 25%), linear-gradient(-45deg, #e2e6e3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e2e6e3 75%), linear-gradient(-45deg, transparent 75%, #e2e6e3 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.preview-frame img { display: block; max-width: 100%; max-height: 370px; object-fit: contain; box-shadow: 0 14px 35px rgba(23, 25, 24, .18); }
.file-details { min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 38px; }
.file-name { overflow-wrap: anywhere; margin: 0 0 8px; font-size: 18px; font-weight: 750; }
.file-meta { margin: 0; color: var(--muted); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.selection-actions { display: grid; gap: 10px; margin-top: 34px; }

.upload-progress { width: min(520px, 100%); margin: 150px auto 0; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 14px; font-weight: 700; }
.progress-track { height: 5px; overflow: hidden; background: #dfe4e1; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--green); transition: width .15s; }

.result { padding: 36px; }
.result-status { display: flex; align-items: center; gap: 10px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.result-status span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; background: var(--green); }
.result-body { display: grid; grid-template-columns: 230px 1fr; gap: 34px; align-items: center; padding: 34px 0; }
.result-body > img { width: 230px; height: 150px; object-fit: contain; border: 1px solid var(--line); background: var(--soft); }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.copy-row input { min-width: 0; height: 48px; padding: 0 13px; border: 1px solid #aeb5b1; border-right: 0; border-radius: 4px 0 0 4px; color: #343836; background: #f8f9f8; }
.copy-row .copy-button { border-radius: 0 4px 4px 0; }
.upload-error { text-align: center; }
.workspace-footer { width: min(1080px, calc(100% - 48px)); display: flex; justify-content: space-between; margin: auto auto 0; padding: 18px 0 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0; }

@media (max-width: 760px) {
  .auth-page { padding: 0; place-items: stretch; }
  .auth-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .brand-block { min-height: 260px; padding: 36px 28px; justify-content: flex-end; }
  .brand-mark { width: 42px; height: 42px; margin-bottom: 28px; }
  .brand-block h1 { font-size: 42px; }
  .brand-copy { margin: 12px 0 22px; }
  .auth-panel { padding: 42px 28px; gap: 30px; }
  .topbar { padding: 0 18px; }
  .secure-state { display: none; }
  .workspace { width: calc(100% - 32px); padding-top: 36px; }
  .workspace-heading { align-items: start; }
  .workspace-heading h1 { font-size: 30px; }
  .drop-zone { min-height: 390px; padding: 30px 20px; }
  .selection { grid-template-columns: 1fr; }
  .preview-frame { min-height: 280px; border-right: 0; border-bottom: 1px solid var(--line); }
  .preview-frame img { max-height: 240px; }
  .file-details { padding: 28px; }
  .result { padding: 24px; }
  .result-body { grid-template-columns: 1fr; gap: 24px; }
  .result-body > img { width: 100%; height: 190px; }
  .copy-row { grid-template-columns: 1fr; gap: 9px; }
  .copy-row input { border-right: 1px solid #aeb5b1; border-radius: 4px; }
  .copy-row .copy-button { border-radius: 4px; }
  .workspace-footer { width: calc(100% - 32px); flex-direction: column; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
