:root {
  --peach-dark: #4b2415;
  --peach-mid: #9d5838;
  --peach-light: #f0a987;
  --peach-cream: #fff8f2;
  --peach-border: rgba(104, 49, 24, .16);
  --peach-text: #3b1f14;
  --peach-muted: #6f432d;
  --peach-error: #7a1a1a;
  --peach-warn: #8b4000;
  --ink: #2c170f;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100dvh;
  color: var(--peach-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 18%, #fff5ee 0, rgba(255,245,238,.9) 18%, transparent 38%),
    radial-gradient(circle at 92% 12%, #ffd1bd 0, rgba(255,209,189,.72) 24%, transparent 46%),
    linear-gradient(135deg, #fff8f2 0%, #ffe1d1 42%, #f0a987 100%);
}

a { color: inherit; text-decoration: none; }
button, .button, input::file-selector-button, select, textarea, input {
  border-radius: 0;
  border: 0;
  color: var(--peach-text);
  font: inherit;
  font-weight: 800;
  letter-spacing: .06em;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
button, .button, input::file-selector-button { cursor: pointer; text-transform: uppercase; }
button:hover, .button:hover, input::file-selector-button:hover { transform: translateY(-2px); }
button:active, .button:active { transform: translateY(0); }
button:disabled { opacity: .42; cursor: not-allowed; transform: none; }

.button, button, input::file-selector-button {
  padding: 13px 15px;
  background: linear-gradient(135deg, var(--peach-dark), var(--peach-mid));
  color: #fff5ed;
  border: 1px solid var(--peach-dark);
  box-shadow: 9px 9px 0 rgba(100,45,22,.10);
  font-size: 11px;
  text-align: center;
}
button.secondary, .button.secondary, input.secondary {
  background: rgba(255,255,255,.34);
  color: #5b2b18;
  border: 1px solid rgba(91,43,24,.3);
  box-shadow: none;
}
button.danger { background: linear-gradient(135deg, #43100d, #7a1a1a); }
button.active, .button.active { background: linear-gradient(135deg, var(--peach-mid), var(--peach-light)); color: var(--peach-text); }

label {
  display: grid;
  gap: 7px;
  color: #89563e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
input, select, textarea {
  width: 100%;
  padding: 11px 10px;
  background: rgba(255,255,255,.42);
  border: 1px solid rgba(91,43,24,.25);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
textarea { min-height: 82px; resize: vertical; }
input[type="color"] { height: 38px; padding: 2px; }
input[type="range"] { padding: 0; accent-color: var(--peach-mid); }

.app-shell { height: 100dvh; display: grid; grid-template-columns: 300px minmax(0, 1fr); overflow: hidden; }
.left {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 28px 24px;
  border-right: 1px solid var(--peach-border);
  background: rgba(255,248,242,.62);
  backdrop-filter: blur(18px);
}
.tool-left { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.right { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: linear-gradient(160deg, rgba(255,230,215,.45), rgba(255,172,132,.38)); }

.peach-nav {
  display: grid;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--peach-border);
}
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.logo { color: #6f351e; font-size: 13px; font-weight: 900; letter-spacing: .24em; }
.back-link { color: #6f432d; font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 9px 13px;
  background: linear-gradient(135deg, var(--peach-dark), var(--peach-mid));
  border: 1px solid var(--peach-dark);
  box-shadow: 6px 6px 0 rgba(100,45,22,.10);
  color: #fff5ed;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.privacy-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 7px;
  padding: 8px 10px;
  background: rgba(75,36,21,.10);
  border: 1px solid rgba(104,49,24,.28);
  color: #6f351e;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.badge-icon { width: 10px; height: 10px; border: 2px solid currentColor; transform: rotate(45deg); display: inline-block; }

.kicker { color: var(--peach-mid); font-size: 11px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 12px 0; color: #472313; font-size: 38px; line-height: 1.05; letter-spacing: 0; overflow-wrap: anywhere; }
h2 { color: #472313; font-size: 32px; line-height: 1.1; letter-spacing: 0; overflow-wrap: anywhere; }
h3 { margin: 0 0 12px; color: #70361f; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
p { color: var(--peach-muted); font-size: 14px; line-height: 1.55; }
.muted { color: var(--peach-muted); }
.small { font-size: 12px; line-height: 1.45; }

.tools { overflow: auto; padding-right: 4px; }
.toolgroup { display: grid; gap: 10px; padding: 16px 0; border-top: 1px solid rgba(104,49,24,.18); }
.toolgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.toolgrid.three { grid-template-columns: repeat(3, 1fr); }
.filebox { display: grid; gap: 12px; padding: 16px; border: 1px solid rgba(82,38,20,.22); background: rgba(255,255,255,.25); }
.filebox input[type="file"] { color: var(--peach-muted); font-size: 12px; }

.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid rgba(104,49,24,.18); }
.meta div { padding-top: 14px; }
.meta strong { display: block; color: #512716; font-size: 22px; }
.meta span { color: #89563e; font-size: 11px; }

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--peach-border);
  background: rgba(255,248,242,.18);
}
.pagebar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pagebar input { width: 68px; text-align: center; }
.status { color: #70361f; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.workspace { min-height: 0; min-width: 0; display: grid; grid-template-columns: 130px minmax(0, 1fr) 240px; }
.thumbs { overflow: auto; padding: 18px 14px; border-right: 1px solid var(--peach-border); background: rgba(255,248,242,.24); }
.thumb { position: relative; width: 100%; aspect-ratio: 1 / 1.35; margin-bottom: 12px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(82,38,20,.22); background: #fff8f2; box-shadow: 8px 8px 0 rgba(100,45,22,.09); color: #89563e; cursor: pointer; font-size: 12px; font-weight: 900; }
.thumb canvas { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.thumb.active { outline: 3px solid rgba(157,88,56,.35); background: #ffe1d1; }
.thumb-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 4px; background: rgba(75,36,21,.82); color: #fff5ed; font-size: 10px; letter-spacing: .12em; text-align: center; }

.stagewrap { min-width: 0; overflow: auto; padding: 24px; display: flex; align-items: flex-start; justify-content: flex-start; }
.stage { position: relative; flex: none; margin-inline: auto; background: #fff8f2; border: 1px solid rgba(82,38,20,.22); box-shadow: 12px 12px 0 rgba(100,45,22,.12); }
.pdf-canvas, .edit-layer { position: absolute; left: 0; top: 0; }
.pdf-canvas { z-index: 1; background: #fff; }
.edit-layer { z-index: 2; pointer-events: auto; touch-action: none; }
.empty {
  width: min(680px, 100%);
  padding: 44px;
  border: 1px solid rgba(82,38,20,.22);
  background: linear-gradient(145deg, #fff2e8 0%, #ffcdb8 52%, #d8835d 100%);
  box-shadow: 24px 24px 0 rgba(100,45,22,.12);
}
.empty h2 { margin: 0 0 16px; font-size: 32px; line-height: 1.1; letter-spacing: 0; }
.empty ul { margin: 20px 0 0; padding-left: 18px; color: #5b2b18; line-height: 1.65; }

.inspector { overflow: auto; padding: 18px; border-left: 1px solid var(--peach-border); background: rgba(255,248,242,.32); }
.panel { margin-bottom: 14px; padding: 16px; border: 1px solid rgba(82,38,20,.22); background: rgba(255,255,255,.24); }
.list { display: grid; gap: 8px; }
.item { display: grid; gap: 7px; padding: 10px; border: 1px solid rgba(82,38,20,.16); background: rgba(255,255,255,.35); color: #5b2b18; font-size: 12px; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.item button { padding: 8px; box-shadow: none; }

.note, .shape, .signature-box {
  position: absolute;
  min-width: 34px;
  min-height: 24px;
  z-index: 3;
  border: 2px solid var(--peach-mid);
  background: rgba(255,209,189,.38);
  cursor: move;
  user-select: none;
}
.note { padding: 0; border: 0; min-width: 0; min-height: 0; color: var(--peach-text); font-family: Arial, sans-serif; font-weight: bold; white-space: pre; line-height: 1.2; }
.shape.highlight { border: 0; background: rgba(255,210,70,.38); }
.shape.whiteout { border: 1px dashed rgba(82,38,20,.28); background: #fff; }
.shape.redact { border: 2px solid #7a1a1a; background: rgba(180,0,0,.25); }
.shape.selected, .note.selected, .signature-box.selected { outline: 3px solid rgba(75,36,21,.35); }
.signature-box { display: grid; place-items: center; padding: 0; min-width: 0; min-height: 0; background: transparent; border: 0; outline: 1px dashed #31415c; }
.signature-box img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: none;
  max-width: min(390px, calc(100vw - 44px));
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--peach-dark), var(--peach-mid));
  box-shadow: 12px 12px 0 rgba(100,45,22,.14);
  color: #fff5ed;
  font-size: 13px;
  line-height: 1.45;
}
.toast.show { display: block; }
.toast.error { background: linear-gradient(135deg, #43100d, var(--peach-error)); }
.toast.warn { background: linear-gradient(135deg, #5b2b18, var(--peach-warn)); }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; padding: 24px; background: rgba(45, 23, 15, .42); }
.modal-backdrop.show { display: grid; }
.modal { width: min(520px, 100%); padding: 22px; border: 1px solid rgba(82,38,20,.32); background: #fff8f2; box-shadow: 18px 18px 0 rgba(45,23,15,.18); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.hub-page { overflow: auto; }
.hub {
  min-height: 100dvh;
  height: auto;
  display: grid;
  grid-template-rows: minmax(450px, 60fr) minmax(240px, 25fr) minmax(190px, 15fr);
  gap: 0;
  padding: 0;
}
.hub-hero,
.hub-tool-section,
.site-footer {
  max-width: 1360px;
  width: 100%;
  margin-inline: auto;
  border: 1px solid rgba(82,38,20,.22);
  background: rgba(255,248,242,.58);
}
.hub-hero {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-content: stretch;
  gap: 18px;
  padding: 24px;
  box-shadow: 18px 18px 0 rgba(100,45,22,.10);
}
.hero-copy {
  display: grid;
  align-content: center;
  max-width: 920px;
}
.hero-copy h1 {
  max-width: 880px;
  margin-bottom: 16px;
  font-size: 72px;
}
.hero-copy p { max-width: 620px; font-size: 16px; }
.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-proof span {
  padding: 8px 10px;
  border: 1px solid rgba(104,49,24,.20);
  background: rgba(255,255,255,.28);
  color: #70361f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.hub-tool-section {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 14px;
  padding: 14px;
  box-shadow: 12px 12px 0 rgba(100,45,22,.08);
}
.section-label {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 10px;
  border-right: 1px solid rgba(104,49,24,.18);
}
.hub-tools { min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-content: stretch; }
.tool-card { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; align-content: stretch; gap: 8px; padding: 10px; border: 1px solid rgba(82,38,20,.22); background: rgba(255,255,255,.34); box-shadow: 7px 7px 0 rgba(100,45,22,.08); transition: transform .18s ease, background .18s ease; }
.tool-card:hover { transform: translateY(-3px); background: rgba(255,248,242,.72); }
.tool-icon { width: 100%; height: 100%; min-height: 104px; display: block; object-fit: cover; border: 0; box-shadow: 0 22px 34px rgba(75, 36, 21, .22); background: transparent; }
.tool-name { color: #512716; font-size: 11px; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.tool-desc { display: none; }
.tool-cta { width: fit-content; }
.site-footer {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr minmax(210px, 300px);
  gap: 18px;
  align-items: center;
  padding: 12px 16px;
  box-shadow: 10px 10px 0 rgba(100,45,22,.08);
}
.site-footer-brand {
  display: grid;
  gap: 5px;
}
.site-footer-brand p { max-width: 260px; font-size: 11px; line-height: 1.35; }
.site-footer-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.footer-col { display: grid; align-content: start; gap: 4px; }
.footer-col h4 {
  margin: 0 0 2px;
  color: #70361f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.footer-col a {
  color: var(--peach-muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}
.footer-col a:hover { color: var(--peach-dark); text-decoration: underline; text-underline-offset: 3px; }
.site-footer-bottom {
  display: grid;
  justify-items: end;
  gap: 7px;
  color: #89563e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: right;
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 12px; }
.sig-pad { width: 100%; height: 150px; border: 1px solid rgba(91,43,24,.25); background: rgba(255,255,255,.5); touch-action: none; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 18px; }
.library-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.library-table th, .library-table td { padding: 10px; border-bottom: 1px solid rgba(82,38,20,.16); text-align: left; }

.transcribe-page { overflow: auto; }
.transcribe-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 340px 1fr;
}
.transcribe-left {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 28px 24px;
  border-right: 1px solid var(--peach-border);
  background: rgba(255,248,242,.64);
  backdrop-filter: blur(18px);
}
.transcribe-intro h1 {
  font-size: 36px;
}
.transcribe-left textarea {
  min-height: 170px;
}
.transcribe-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  color: #6f432d;
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: .08em;
}
.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--peach-mid);
}
.transcribe-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: linear-gradient(160deg, rgba(255,230,215,.45), rgba(255,172,132,.34));
}
.transcribe-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
  gap: 18px;
  padding: 18px;
  overflow: auto;
}
.video-panel,
.transcript-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
}
.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(82,38,20,.22);
  background: rgba(255,248,242,.54);
  box-shadow: 18px 18px 0 rgba(100,45,22,.10);
}
.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.empty-video {
  min-height: 100%;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 26px;
}
.empty-video h2 {
  margin: 0;
  max-width: 420px;
}
.empty-video p {
  max-width: 560px;
}
.transcript-note {
  margin: 0;
}
.transcript-toolbar {
  min-height: 74px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}
.transcript-toolbar h2 {
  margin: 4px 0 0;
}
.transcript-toolbar select {
  width: min(190px, 45%);
  background: rgba(255,255,255,.46);
}
.transcript-preview {
  min-height: 0;
  max-height: calc(100dvh - 150px);
  overflow: auto;
  border: 1px solid rgba(82,38,20,.22);
  background: rgba(255,248,242,.64);
  box-shadow: 18px 18px 0 rgba(100,45,22,.10);
}
.empty-state {
  min-height: 440px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 34px;
}
.empty-state h2 {
  margin: 0;
  max-width: 480px;
}
.transcript-document {
  max-width: 820px;
  margin: 0 auto;
  padding: 44px;
}
.transcript-kicker,
.source-line {
  color: #89563e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.transcript-document h1 {
  margin: 8px 0 12px;
  font-size: 36px;
}
.transcript-document p {
  color: #3b1f14;
  font-size: 16px;
  line-height: 1.72;
}
.source-line {
  margin-bottom: 28px;
  word-break: break-word;
  text-transform: none;
  letter-spacing: .02em;
}

@media (max-width: 1100px) {
  body { overflow: auto; }
  .hub-page { overflow: auto; }
  .transcribe-page { overflow: auto; }
  .app-shell { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .transcribe-shell { grid-template-columns: 1fr; height: auto; }
  .hub { height: auto; grid-template-rows: auto; }
  .left, .transcribe-left { min-height: auto; }
  .workspace { grid-template-columns: 1fr; }
  .transcribe-workspace { grid-template-columns: 1fr; overflow: visible; }
  .transcript-preview { max-height: none; }
  .thumbs { display: flex; gap: 12px; max-height: 160px; }
  .thumb { flex: 0 0 90px; margin: 0; }
  .inspector { display: block; }
  .tools { max-height: 50dvh; }
  .stagewrap { max-height: 80dvh; min-height: 320px; }
  .right { min-height: 80dvh; }
  .transcribe-main { min-height: 80dvh; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .hub-hero { min-height: 56dvh; gap: 28px; }
  .hub-tool-section { grid-template-columns: 1fr; }
  .section-label { border-right: 0; border-bottom: 1px solid rgba(104,49,24,.18); }
  .hub-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-footer { grid-template-columns: 1fr; align-items: start; }
  .site-footer-bottom { justify-items: start; text-align: left; }
  .site-footer-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

input, textarea, select, .panel, .tool-card, .left, .transcribe-left { min-width: 0; }
p, .status, .tool-name, .item, .footer-col a, .privacy-badge { overflow-wrap: anywhere; }
.topbar { flex-wrap: wrap; }
.library-grid .tool-desc { display: block; }
.library-grid .tool-card.selected { outline: 3px solid rgba(157,88,56,.6); }
.hub-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); gap: 24px; padding: 24px; align-items: start; }
body:not(.hub-page) > .hub { display: flex; align-items: center; justify-content: center; padding: 24px; }
.print-pages { display: none; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid #31415c; outline-offset: 3px; }
@media print {
  body > :not(.print-pages) { display: none !important; }
  .print-pages { display: block; }
  .print-pages canvas { display: block; width: 100%; height: auto; break-after: page; }
  .print-pages canvas:last-child { break-after: auto; }
}

@media (max-width: 720px) {
  .hub-grid { grid-template-columns: 1fr; padding: 0; }
  .left, .transcribe-left, .stagewrap { padding: 16px; }
  .transcribe-workspace { padding: 16px; }
  .hub-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer { padding: 18px; }
  .site-footer-links { grid-template-columns: 1fr; }
  .toolgrid, .toolgrid.three { grid-template-columns: 1fr; }
  .transcribe-actions { grid-template-columns: 1fr; }
  .transcript-toolbar { align-items: stretch; flex-direction: column; }
  .transcript-toolbar select { width: 100%; }
  .transcript-document { padding: 24px; }
  h1 { font-size: 40px; }
  .hero-copy h1 { font-size: 40px; }
  .empty { padding: 24px; }
  .empty h2 { font-size: 38px; }
}
