:root {
  /* Be On Wave (beonwave.ai) brand tokens */
  --paper: #F4F3F8;          /* hsl(250 20% 96%) */
  --lilac: #E9E5FA;          /* hsl(250 60% 94%) section wash */
  --sheet: #FFFFFF;
  --ink: #282636;            /* hsl(250 18% 18%) */
  --ink-2: #4C4778;          /* hsl(250 25% 38%) */
  --ink-3: #7D7A96;
  --rule: #DEDBEA;           /* hsl(250 20% 88%) */
  --seal: #603BCE;           /* hsl(255 60% 52%) primary */
  --seal-ink: #FAFAFA;
  --bow: linear-gradient(90deg, hsl(255,60%,52%) 0%, hsl(250,58%,55%) 20%, hsl(245,60%,58%) 40%, hsl(240,58%,60%) 65%, hsl(235,56%,62%) 85%, hsl(230,54%,64%) 100%);
  --mark: linear-gradient(90deg, #6A67AE 0%, #9B5FA8 55%, #D3509F 100%);
  --chip: #E6E0FA;
  --chip-ink: #3B2394;
  --shadow-soft: 0 2px 8px hsl(255 60% 52% / .12);
  --shadow-medium: 0 4px 16px hsl(245 58% 55% / .16);
  --shadow-strong: 0 8px 32px hsl(240 60% 58% / .22);
  --bad: #C2261C;
  --ok: #1D6B3A;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  /* one tint + one line colour per kind of personal data */
  --PERSON: #FBE3A1;       --PERSON-l: #A86A0E;
  --ORGANIZATION: #D5E6FA; --ORGANIZATION-l: #2160A6;
  --ADDRESS: #D9EFDB;      --ADDRESS-l: #2C7A37;
  --ID: #E8DAF8;           --ID-l: #6A3CAD;
  --CONTACT: #F8D7E4;      --CONTACT-l: #AE2E68;
  --FINANCIAL: #D2EFEB;    --FINANCIAL-l: #1C766A;
  --DATE: #F9DEC9;         --DATE-l: #B04F14;
  --LOCATION: #E4E8CF;     --LOCATION-l: #66701B;
  --OTHER: #E1E4EA;        --OTHER-l: #525C70;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--seal); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* top bar */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--rule); background: rgba(250,250,253,.92); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.mark { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.mark-logo { height: 34px; width: auto; display: block; }
.mark-name { font-weight: 700; font-size: 18px; letter-spacing: -0.015em; padding-left: 12px; border-left: 1px solid var(--rule); line-height: 26px; }
.tabs { display: flex; gap: 4px; }
.tab {
  border: 0; background: none; padding: 8px 14px; border-radius: 10px; cursor: pointer; color: var(--ink-2); font-weight: 500;
}
.tab:hover { color: var(--ink); background: var(--lilac); }
.tab[aria-current="page"] { color: var(--seal); background: var(--lilac); }

main { padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 40px) 64px; max-width: 1360px; margin: 0 auto; }

/* buttons */
.btn {
  border: 1px solid var(--rule); background: var(--sheet); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: #B9B2DC; background: #FBFAFE; }
.btn.primary { background: var(--bow); color: var(--seal-ink); border: 0; font-weight: 600; box-shadow: var(--shadow-medium); }
.btn.primary:hover { background: var(--bow); filter: brightness(1.06); box-shadow: var(--shadow-strong); }
.btn.big { width: 100%; padding: 13px 16px; font-size: 16px; }
.btn:disabled { opacity: .55; cursor: progress; }
.link, .link-btn { color: var(--seal); text-decoration: underline; text-underline-offset: 3px; }
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }
.err { color: var(--bad); font-weight: 500; margin-top: 10px; min-height: 0; }
.err:empty { display: none; }
code.tok, .tok { font-family: var(--mono); font-size: .86em; font-weight: 500; background: var(--chip); color: var(--chip-ink); padding: 1px 5px; border-radius: 4px; white-space: nowrap; }

/* access code */
.lock { display: grid; place-items: center; min-height: 60vh; }
.lock-card { width: min(380px, 100%); display: grid; gap: 12px; background: var(--sheet); padding: 32px 28px; border-radius: 16px; box-shadow: var(--shadow-strong); border: 1px solid var(--rule); }
.lock-logo { height: 64px; width: auto; justify-self: start; margin-bottom: 6px; }
.lock-card h1 { font-size: 22px; }
.lock-card p { color: var(--ink-2); }
.lock-card input { padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; font-size: 17px; }

/* upload */
.upload { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.intro h1 { font-size: clamp(30px, 4.2vw, 52px); line-height: 1.06; letter-spacing: -0.032em; font-weight: 700; max-width: 15ch; }
.intro.narrow h1 { max-width: 22ch; font-size: clamp(28px, 3.4vw, 40px); }
.lead { color: var(--ink-2); margin-top: 12px; max-width: 60ch; }
.specimen {
  margin-top: 28px; font: 400 clamp(17px, 1.6vw, 20px)/1.75 var(--serif); background: var(--sheet); padding: 20px 22px;
  border-radius: 12px; border: 1px solid var(--rule); box-shadow: var(--shadow-medium); max-width: 62ch;
}
.sp { position: relative; white-space: nowrap; }
.sp::after {
  content: attr(data-l); position: absolute; inset: -1px -3px; display: grid; place-items: center start; padding: 0 5px;
  font: 500 .74em/1 var(--mono); color: var(--chip-ink); background: var(--chip); border-radius: 3px;
  clip-path: inset(0 100% 0 0); animation: wipe .5s cubic-bezier(.6,0,.2,1) forwards;
}
.sp:nth-child(1)::after { animation-delay: .9s; }
.sp:nth-child(2)::after { animation-delay: 1.25s; }
.sp:nth-child(3)::after { animation-delay: 1.6s; }
.sp:nth-child(4)::after { animation-delay: 1.95s; }
@keyframes wipe { to { clip-path: inset(0 0 0 0); } }
.facts { margin: 26px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; max-width: 58ch; color: var(--ink-2); }
.facts li { padding-left: 22px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 0; top: .62em; width: 11px; height: 5px; background: var(--bow); border-radius: 2px; }

.drop {
  border: 2px dashed #BDB3E6; border-radius: 16px; background: var(--sheet); cursor: pointer;
  min-height: 300px; display: grid; place-items: center; text-align: center; padding: 28px; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--seal); background: #F8F6FE; box-shadow: var(--shadow-medium); }
.drop-icon { width: 54px; height: 54px; color: var(--seal); }
.drop-title { font-size: 19px; font-weight: 600; margin-top: 12px; }
.drop-hint { color: var(--ink-3); margin-top: 6px; font-size: 14px; }
.side { display: grid; gap: 14px; }
.sample { color: var(--ink-2); font-size: 15px; }
.privacy { font-size: 14px; color: var(--ink-2); border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 6px; }
.privacy summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.privacy ul { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; }

/* busy */
.busy { display: grid; justify-items: center; gap: 10px; padding-top: 12vh; text-align: center; }
.busy-doc { width: 150px; background: var(--sheet); padding: 18px 16px; border-radius: 10px; box-shadow: var(--shadow-strong); display: grid; gap: 9px; margin-bottom: 14px; }
.busy-doc span { height: 7px; border-radius: 2px; background: #E4E0F2; position: relative; overflow: hidden; }
.busy-doc span:nth-child(2n) { width: 78%; }
.busy-doc span::after { content: ""; position: absolute; inset: 0; background: var(--bow); transform: scaleX(0); transform-origin: left; animation: scan 2.4s ease-in-out infinite; }
.busy-doc span:nth-child(2)::after { animation-delay: .25s; } .busy-doc span:nth-child(3)::after { animation-delay: .5s; }
.busy-doc span:nth-child(4)::after { animation-delay: .75s; } .busy-doc span:nth-child(5)::after { animation-delay: 1s; } .busy-doc span:nth-child(6)::after { animation-delay: 1.25s; }
@keyframes scan { 0%, 15% { transform: scaleX(0); } 45%, 70% { transform: scaleX(1); } 100% { transform: scaleX(1); opacity: 0; } }
.busy-title { font-size: 20px; font-weight: 600; }
.busy-sub { color: var(--ink-2); max-width: 46ch; }

/* review */
.review { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; align-items: start; }
.doc-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.doc-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.doc-tab { border: 1px solid transparent; background: none; padding: 6px 10px; border-radius: 6px 6px 0 0; cursor: pointer; color: var(--ink-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.doc-tab[aria-selected="true"] { background: var(--sheet); color: var(--ink); border-color: var(--rule); border-bottom-color: var(--sheet); font-weight: 600; }
.seg { display: inline-flex; background: #E6E3F1; border-radius: 10px; padding: 3px; }
.seg-btn { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.seg-btn[aria-pressed="true"], .seg-btn[aria-checked="true"] { background: var(--sheet); color: var(--seal); box-shadow: var(--shadow-soft); }
.warn { background: #FFF6E0; border: 1px solid #EBCB80; color: #6B4A06; padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 10px; }
.warn p + p { margin-top: 4px; }
.sheet {
  background: var(--sheet); border-radius: 4px; padding: clamp(20px, 4vw, 52px) clamp(18px, 5vw, 64px);
  border: 1px solid var(--rule); box-shadow: var(--shadow-medium);
  font: 400 17px/1.72 var(--serif); max-height: calc(100vh - 210px); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
.sec + .sec { margin-top: 28px; }
.sec-label { font: 600 12.5px/1 var(--sans); color: var(--ink-3); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #EEECF5; white-space: normal; }
.sheet-tip { color: var(--ink-3); font-size: 13.5px; margin-top: 10px; }
mark.h {
  color: inherit; border-radius: 2px; padding: 0 1px; cursor: pointer;
  background: var(--t); box-shadow: inset 0 -2px 0 var(--tl);
}
mark.h.off { background: none; box-shadow: inset 0 -1px 0 var(--ink-3); text-decoration: none; }
mark.h.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { outline: 3px solid var(--tl); } 100% { outline: 3px solid transparent; } }
.sheet .tok { cursor: default; font-size: .8em; }

.panel { background: var(--sheet); border-radius: 16px; border: 1px solid var(--rule); box-shadow: var(--shadow-medium); padding: 18px; position: sticky; top: 76px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; overflow-y: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel h2 { font-size: 18px; }
.meta { color: var(--ink-3); font-size: 13px; text-align: right; }
.types { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.type-btn {
  border: 1px solid var(--rule); background: var(--sheet); border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 13px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.type-btn .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--t); box-shadow: inset 0 -2px 0 var(--tl); }
.type-btn[aria-pressed="false"] { color: var(--ink-3); text-decoration: line-through; }
.type-btn[aria-pressed="false"] .dot { background: none; box-shadow: inset 0 0 0 1px var(--ink-3); }
.ents { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1 0 280px; border-top: 1px solid #EEECF5; }
.ent { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 8px; padding: 9px 2px; border-bottom: 1px solid #EEECF5; align-items: start; }
.ent input[type="checkbox"] { margin: 4px 0 0; width: 16px; height: 16px; accent-color: var(--seal); }
.ent-main { min-width: 0; }
.ent-name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; cursor: pointer; }
.ent-name::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; background: var(--t); box-shadow: inset 0 -2px 0 var(--tl); }
.ent.off .ent-name { color: var(--ink-3); text-decoration: line-through; }
.ent-vars { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; overflow-wrap: anywhere; }
.ent-vars button { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 0 2px; font-size: 13px; }
.ent-vars button:hover { color: var(--bad); }
.ent-side { display: grid; justify-items: end; gap: 3px; }
.ent-label { font-family: var(--mono); font-size: 12.5px; font-weight: 500; color: var(--chip-ink); background: var(--chip); border: 1px solid transparent; border-radius: 4px; padding: 2px 5px; width: 128px; text-align: right; }
.ent-label:hover { border-color: #B9ABEB; }
.ent.off .ent-label { opacity: .4; }
.ent-count { font-size: 12px; color: var(--ink-3); }
.empty { color: var(--ink-2); padding: 18px 2px; }

.add { margin-top: 10px; }
.add label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.add-row input, .add-row select, .add-row .btn { font-size: 14px; }
.add-row { display: flex; gap: 6px; margin-top: 5px; }
.add-row input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 10px; }
.add-row select { padding: 7px 6px; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); max-width: 120px; }

.out { border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 12px; display: grid; gap: 10px; }
.mode-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mode-row select { padding: 6px 8px; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); font-size: 14px; }
.mode-row select:disabled { opacity: .45; }
.mode-hint { font-size: 13px; color: var(--ink-2); }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-size: 14px; }
.check input { accent-color: var(--seal); }
.done { background: #EEF6F0; border: 1px solid #BFDCC8; border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; font-size: 14px; }
.done .btn { font-size: 14px; padding: 6px 11px; }
.done p:first-child { font-weight: 600; color: var(--ok); }
.done-row { display: flex; gap: 8px; flex-wrap: wrap; }
.fine { font-size: 13px; color: var(--ink-2); }
.restart { justify-self: start; font-size: 14px; }

/* selection popover */
.pop { position: fixed; z-index: 20; background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); max-width: 340px; }
.pop-q { font-size: 13px; margin-bottom: 8px; overflow-wrap: anywhere; }
.pop-btns { display: flex; flex-wrap: wrap; gap: 5px; }
.pop-btns button { border: 0; border-radius: 5px; padding: 4px 9px; font-size: 13px; cursor: pointer; background: var(--t); color: var(--ink); font-weight: 500; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--bow); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-strong); font-size: 14px; z-index: 30; }

/* footer */
.foot { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; padding: 22px clamp(16px, 4vw, 40px) 30px; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: 13.5px; max-width: 1360px; margin: 0 auto; }
.foot a { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-2); font-weight: 600; text-decoration: none; }
.foot a:hover { color: var(--seal); }
.foot img { height: 22px; width: auto; }

/* restore */
.restore .intro { margin-bottom: 18px; }
.key-line { font-size: 14px; color: var(--ink-2); margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.restore-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 6px; }
.lbl-row { display: flex; justify-content: space-between; align-items: end; margin-bottom: 6px; }
.lbl-row .lbl { margin: 0; }
.lbl-row .btn { padding: 4px 10px; font-size: 13px; }
textarea { width: 100%; border: 1px solid var(--rule); border-radius: 12px; padding: 14px; font: 400 15px/1.6 var(--serif); background: var(--sheet); resize: vertical; }
.restored { min-height: 274px; max-height: 520px; font-size: 15.5px; padding: 16px 18px; }
.restored mark { background: #DDF0E2; color: inherit; border-radius: 2px; box-shadow: inset 0 -2px 0 #3D8B57; }
.drop.small { min-height: 0; padding: 14px; margin-top: 10px; border-width: 1.5px; font-size: 14px; color: var(--ink-2); }

@media (max-width: 1080px) {
  .review { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  .ents { max-height: 50vh; }
  .sheet { max-height: 70vh; }
}
@media (max-width: 860px) {
  .upload { grid-template-columns: 1fr; }
  .drop { min-height: 200px; }
  .restore-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .bar { flex-wrap: wrap; }
  .tab { padding: 6px 8px; font-size: 14px; }
  .ent-label { width: 104px; }
  .add-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .sp::after { animation: none; clip-path: none; }
  .busy-doc span::after { animation: none; transform: scaleX(.5); }
  mark.h.flash { animation: none; }
}
