/* Page CSS for the portfolio: only what sits inside a visual or the kit lacks. Tokens come from :root in the page. */

/* hero picture: the cut-out portrait standing on the surface, the word behind it */
.hero-portrait { background: var(--p-surface); isolation: isolate; }
.hero-portrait__word {
  position: absolute; inset: auto 0 38% 0; z-index: 0; margin: 0; text-align: center;
  font: 700 min(128px, 8.6vw)/1 var(--font-display); letter-spacing: -0.02em;
  color: transparent; -webkit-text-stroke: 1.5px color-mix(in oklab, var(--p-ink) 22%, transparent);
  pointer-events: none; user-select: none; white-space: nowrap;
}
.hero__media.hero-portrait > img {
  position: absolute; inset: auto 0 0 0; z-index: 1; width: 100%; height: 96%;
  object-fit: contain; object-position: 50% 100%; filter: grayscale(1) contrast(1.04);
}

/* the language switch in the bar: a plain word, 44px tall */
.lang-switch { display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--s-3); font-weight: 500; color: var(--ink); text-decoration: none; }
.lang-switch:hover { color: var(--accent); }
.nav__logo svg { width: 28px; height: 28px; flex: none; }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); margin: var(--s-7) 0 0; }
.facts > div { border-top: 1px solid var(--line); padding-top: var(--s-4); }
.facts dt { font-size: var(--t-label); font-weight: 500; color: var(--muted); }
.facts dd { margin: var(--s-2) 0 0; font: 400 var(--t-stat)/1.1 var(--font-display); color: var(--ink); }
.facts dd span { color: var(--accent); }

/* experience rows: the years on the right, tags under the line */
.jobs .rows__name { font-size: var(--t-card); }
.jobs .rows__value { color: var(--accent); font-weight: 500; white-space: nowrap; }
.jobs .tags { grid-column: 1 / -1; margin: 0; font-size: var(--t-small); color: var(--muted); }
#kinh-nghiem > h3 { margin-bottom: var(--s-5); }
@media (max-width: 639px) { .jobs > li { grid-template-columns: minmax(0, 1fr); } .jobs .rows__value { white-space: normal; } }

/* AI steps: a number in the accent over each card */
.step__no { display: block; font: 400 var(--t-stat)/1 var(--font-display); color: var(--accent); margin-bottom: var(--s-4); }

/* the change-request prototype: one app window, list beside the open request */
.cr.ui {
  --u-bg: #fbfaf7; --u-ink: #1b1b1b; --u-muted: #5e5b55; --u-line: #e4e1da; --u-chip: #f0ede6;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); margin-top: var(--s-7);
  background: var(--u-bg); color: var(--u-ink); border: 1px solid var(--u-line); border-radius: 14px;
  overflow: hidden; font-family: var(--font-text); height: min(600px, var(--ly-fit, 600px));
}
.cr__bar { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s-3); padding: 12px 20px; border-bottom: 1px solid var(--u-line); background: #fff; }
.cr__dots { display: flex; gap: 6px; } .cr__dots i { width: 10px; height: 10px; border-radius: 50%; background: #d9d5cc; display: block; }
.cr__title { font-weight: 500; font-size: 15px; }
.cr__count { margin-left: auto; font-size: 13px; color: var(--u-muted); }
.cr__list { border-right: 1px solid var(--u-line); overflow: hidden; min-height: 0; position: relative; }
.cr__list::after { content: ""; position: absolute; inset: auto 0 0 0; height: 56px; background: linear-gradient(transparent, var(--u-bg)); pointer-events: none; }
.cr__filters { display: flex; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--u-line); position: sticky; top: 0; background: var(--u-bg); z-index: 1; }
.cr__filter { font: 500 13px/1 var(--font-text); padding: 9px 12px; min-height: 36px; border-radius: 999px; border: 1px solid var(--u-line); background: #fff; color: var(--u-ink); cursor: pointer; }
.cr__filter[aria-pressed="true"] { background: var(--u-ink); color: #fff; border-color: var(--u-ink); }
.cr__rows { list-style: none; margin: 0; padding: 0; }
.cr__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; width: 100%; text-align: left; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--u-line); background: none; color: inherit; font: inherit; cursor: pointer; }
.cr__row:hover { background: #f3f1ec; }
.cr__row[aria-current="true"] { background: #fff; box-shadow: inset 3px 0 0 #EDAE49; }
.cr__id { font-size: 12px; color: var(--u-muted); }
.cr__name { grid-column: 1; font-size: 14px; font-weight: 500; line-height: 1.35; }
.cr__from { grid-column: 1; font-size: 12px; color: var(--u-muted); }
.chip { grid-column: 2; grid-row: 1 / span 2; align-self: start; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--u-chip); white-space: nowrap; }
.chip[data-s="wait"] { background: #fbecd0; color: #7a4d00; }
.chip[data-s="work"] { background: #e3ecf8; color: #1d4b86; }
.chip[data-s="done"] { background: #e2f1e5; color: #1f6332; }
.chip[data-s="back"] { background: #f7e1df; color: #8f2a1f; }
.cr__open { padding: 24px 28px; overflow: hidden; min-height: 0; }
.cr :focus-visible { outline: 2px solid #181818; outline-offset: 2px; }
.cr.ui.fill { height: auto; }
.cr__open h3 { font-size: 20px; line-height: 1.3; margin: 6px 0 4px; color: var(--u-ink); }
.cr__meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; padding: 0; }
.cr__meta div { background: #fff; border: 1px solid var(--u-line); border-radius: 10px; padding: 10px 12px; }
.cr__meta dt { font-size: 12px; color: var(--u-muted); } .cr__meta dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; }
.cr__why { font-size: 14px; color: #33312d; margin: 0 0 18px; }
.flow { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; counter-reset: f; }
.flow li { font-size: 12px; line-height: 1.3; color: var(--u-muted); padding-top: 10px; border-top: 3px solid var(--u-line); transition: border-color .3s ease, color .3s ease; }
.flow li[data-state="done"] { border-color: #2f8a4a; color: var(--u-ink); }
.flow li[data-state="now"] { border-color: #EDAE49; color: var(--u-ink); font-weight: 500; }
.cr__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.cr__btn { font: 500 16px/1 var(--font-text); min-height: 48px; padding: 0 24px; border-radius: 2px; border: 0; background: #EDAE49; color: #181818; cursor: pointer; transition: transform .15s ease; }
.cr__btn--ghost { background: none; padding: 0 8px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: color-mix(in oklab, currentColor 40%, transparent); }
.cr__btn:active { transform: translateY(1px); }
.cr__btn[disabled] { opacity: .4; cursor: not-allowed; }
.cr__log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--u-line); }
.cr__log li { font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--u-line); color: #33312d; }
.cr__log time { color: var(--u-muted); margin-right: 8px; }
@media (max-width: 1023px) {
  .cr.ui, .cr.ui.fill { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; height: auto; }
  .cr__list { border-right: 0; border-bottom: 1px solid var(--u-line); }
  .cr__list::after { display: none; }
  .cr__rows li:nth-child(n+4) { display: none; }
}
@media (max-width: 639px) {
  #prototype { --hm: 2; }
  .cr__meta { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .flow li { padding: 6px 0 6px 12px; border-top: 0; border-left: 3px solid var(--u-line); }
  .flow li[data-state="done"] { border-left-color: #2f8a4a; } .flow li[data-state="now"] { border-left-color: #EDAE49; }
  .cr__open { padding: 18px; }
  .cr__bar .cr__count { display: none; }
}

/* projects: two linked cards with a picture panel */
.proj .panel { --p-h: 250px; background: #fff; }
.proj .panel img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
@media (max-width: 639px) { .proj .panel { --p-h: 200px; } }

/* skills band on the light ground */
.skillrows .rows__name { font-weight: 500; }
.certs { list-style: none; margin: 0; padding: 0; }
.certs li { padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
.certs li:first-child { padding-top: 0; }
/* tools: one row of chips, a white tile with the real mark and the name */
.icon-row { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); margin-top: var(--s-6); }
@media (min-width: 1100px) { .icon-row { flex-wrap: nowrap; justify-content: space-between; } }
.icon-row > span { display: inline-flex; align-items: center; gap: 8px; flex: none; font-size: var(--t-small); font-weight: 500; white-space: nowrap; border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 14px 4px 4px; }
#ky-nang .icon-row .ic-tile { --tile-bg: #ffffff; --tile-line: var(--line); border-radius: 50%; }
#ky-nang .icon-row .ic-tile > img.ic { width: 20px; height: 20px; max-width: none; max-height: none; object-fit: contain; filter: none; }

/* case study pages */
.case-figure { margin: 0; border-radius: var(--r-lg); overflow: hidden; background: #fff; }
.case-figure img { display: block; width: 100%; height: 100%; object-fit: contain; }
.case-figure { position: relative; }
.case-figure--photo img { object-fit: cover; }
.case-figure--shot { display: grid; place-items: center; padding: clamp(16px, 4vw, 40px); background: radial-gradient(120% 90% at 50% 0%, #34302a 0%, #222 55%, #1c1c1c 100%); }
.hero__media.case-figure--shot > img { position: static; width: 100%; height: auto; max-height: 100%; object-fit: contain; border-radius: 10px; box-shadow: 0 24px 48px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3); }
/* the shoe-shop hero: two browser windows (one transparent image, shadows baked in) with the caption underneath, not on top */
.case-figure--montage { display: flex; flex-direction: column; gap: var(--s-3); padding: clamp(16px, 3vw, 32px) clamp(12px, 2.5vw, 28px) clamp(14px, 2vw, 20px); background: radial-gradient(120% 90% at 50% 0%, #3a342b 0%, #242322 55%, #1c1c1c 100%); }
.hero--split .hero__media.case-figure--montage, .hero__media.case-figure--montage { height: auto !important; align-self: center; }
.hero__media.case-figure--montage > img { position: static; flex: none; width: 100%; height: auto; }
@media (max-width: 1023px) { .hero--split .hero__media.case-figure--montage { flex: none; width: 100%; max-width: 640px; align-self: center; } }
.case-figure--montage .case-credit { position: static; max-width: none; padding: 0 4px; background: none; color: color-mix(in oklab, #f5f3ee 72%, transparent); }
.case-credit { position: absolute; left: 12px; bottom: 12px; right: 12px; width: fit-content; max-width: calc(100% - 24px); padding: 5px 12px; border-radius: 10px; background: rgba(24,24,24,.78); color: #f5f3ee; font-size: 13px; line-height: 1.45; }
.case-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* case study detail: a contents list that stays in view, sections with figures */
.cs-detail { min-height: 0 !important; }
.cs-toc { position: sticky; top: 96px; align-self: start; }
.cs-toc__t { margin: 0 0 var(--s-3); font-size: var(--t-label); font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cs-toc ol { list-style: none; margin: 0 0 var(--s-6); padding: 0; border-left: 1px solid var(--line); counter-reset: toc; }
.cs-toc li { counter-increment: toc; }
.cs-toc ol a { display: flex; gap: 10px; padding: 7px 0 7px 16px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.cs-toc ol a::before { content: counter(toc, decimal-leading-zero); font-variant-numeric: tabular-nums; color: color-mix(in oklab, var(--muted) 70%, transparent); }
.cs-toc ol a:hover, .cs-toc ol a.is-current { color: var(--ink); border-left-color: var(--accent); }
html .cs-file { padding-inline: 0; min-height: 44px; text-align: left; }
.cs-file:hover { color: var(--accent); }
.cs-file__note { margin: var(--s-3) 0 0; font-size: var(--t-small); color: var(--muted); }
.cs-sec { padding-bottom: var(--s-8, 56px); margin-bottom: var(--s-8, 56px); border-bottom: 1px solid var(--line); scroll-margin-top: 96px; }
.cs-sec:last-child { border-bottom: 0; margin-bottom: 0; }
.cs-sec h3 { margin: 0 0 var(--s-4); font-size: var(--t-card); }
.cs-sec p { margin: 0 0 var(--s-4); max-width: 72ch; color: color-mix(in oklab, var(--ink) 86%, transparent); }
.cs-sec code { font: 500 .9em/1 ui-monospace, "Cascadia Mono", Consolas, monospace; padding: 2px 6px; border-radius: 6px; background: var(--p-surface); color: var(--accent); }
.cs-list { list-style: disc; margin: 0 0 var(--s-4); padding-left: 1.3em; max-width: 72ch; display: grid; gap: var(--s-2); }
.cs-list li { padding-left: 4px; }
.cs-list li::marker { color: var(--accent); }
.cs-list--num { list-style: decimal; }
.cs-list--num li::marker { font-weight: 500; }
.cs-fig { margin: var(--s-5) 0 0; }
.cs-fig a { display: block; border-radius: var(--r-lg); overflow: hidden; background: #fff; border: 1px solid var(--line); }
.cs-fig img { display: block; width: 100%; height: auto; max-height: 720px; object-fit: contain; transition: transform .4s ease; }
.cs-fig a:hover img { transform: scale(1.015); }
.cs-fig figcaption { margin-top: var(--s-2); font-size: var(--t-small); color: var(--muted); }
@media (max-width: 1023px) {
  .cs-toc { position: static; grid-column: 1 / -1; }
  .cs-toc ol { columns: 2; column-gap: var(--s-6); }
  .cs-body { grid-column: 1 / -1; margin-top: var(--s-6); }
}
@media (max-width: 639px) { .cs-toc ol { columns: 1; } .cs-sec { padding-bottom: var(--s-6); margin-bottom: var(--s-6); } .case-credit { font-size: 12px; } }

/* AI steps: the real tools sit at the foot of each card */
.ai-card { display: flex; flex-direction: column; align-self: start; }
#ai .grid { align-items: start; }
.ai-tools { display: flex; flex-wrap: wrap; gap: var(--s-3); padding-top: var(--s-5); }
@media (max-width: 639px) { .ai-tools .ic-tile { --tile: 48px; } }
.ai-tools .ic-tile { --tile-bg: #f3f1ec; }

/* phone: the bar keeps the mark, the language and the button inside 320px */
@media (max-width: 400px) { .nav__bar .nav__logo { font-size: 0; gap: 0; } .nav__bar .nav__logo svg { width: 32px; height: 32px; } }
.footer__col a { overflow-wrap: anywhere; }
@media (max-width: 639px) { #du-an { --hm: 2; } #gioi-thieu { --hm: 2; } #ky-nang { --hm: 2; } }
@media (max-width: 1023px) { main > section > .wrap > .cr.fill { flex: none; } }

/* AI steps as open columns: a hairline, the number, the title, the line, the tools */
.steps .step { border-top: 1px solid var(--line); padding-top: var(--s-5); }
.steps .step h3 { font-size: var(--t-card); }
.section h3 { font-size: var(--t-card); }
@media (max-width: 1023px) { .steps .step { grid-column: span 6; } }
@media (max-width: 639px) { .steps .step { grid-column: 1 / -1; } .steps .step__no { font-size: 24px; margin-bottom: 8px; } .ai-tools { padding-top: 12px; } .steps .step p { margin: 4px 0 0; } }
@media (max-width: 639px) { .facts dd { font-size: 24px; } #ai { --hm: 2; } }
.proj .panel { height: 250px; }
@media (max-width: 639px) { .proj .panel { height: 200px; } }
#ky-nang .icon-row { margin-top: var(--s-5); }
#ky-nang .skillrows > li { padding-block: 12px; }
@media (max-width: 639px) { #gioi-thieu .t-lead { font-size: 17px; } }
@media (max-width: 1023px) { .proj .panel { height: 380px; } }
@media (max-width: 639px) {
  .jobs .tags { display: none; }
  #du-an { --hm: 1; }
  .proj .panel { height: 140px; }
}
@media (max-width: 1023px) { .group > .cr.fill { flex: none; } }
.nav__item--lang { display: none; }
@media (max-width: 639px) { .nav__item--lang { display: block; } }
.cr__pick { display: none; }
.chip--inline { display: inline-block; margin-left: 6px; vertical-align: middle; }
@media (min-width: 640px) { .chip--inline { display: none; } }
@media (max-width: 639px) {
  .cr__list { display: none; }
  .cr__pick { display: grid; gap: 6px; margin-bottom: 16px; font-size: 13px; color: var(--u-muted); }
  .cr__pick select { font: 500 15px/1.3 var(--font-text); min-height: 48px; padding: 0 12px; border: 1px solid var(--u-line); border-radius: 8px; background: #fff; color: var(--u-ink); width: 100%; }
}
@media (max-width: 639px) {
  .cr__meta { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
  .cr__meta div { padding: 8px; } .cr__meta dd { font-size: 13px; }
  .flow li { padding: 3px 0 3px 10px; }
  .steps .ai-tools { display: none; }
  .cr__open h3 { font-size: 18px; }
}
@media (min-width: 640px) and (max-width: 1023px) { .cr__rows li:nth-child(n+3) { display: none; } .flow { margin-bottom: 12px; } }

/* ===================== round 2 ===================== */
/* Sections grow with their content: a zoomed-in or short window never overlaps the next section */
main > section, main > .section { height: auto !important; min-height: calc(var(--h, 1) * 100svh); }
main > section.hero { min-height: 100svh; }
.hero--split .hero__media { height: clamp(420px, calc(100svh - 184px), 716px) !important; }
@media (max-width: 1023px) { .hero--split .hero__media { height: clamp(300px, 52svh, 560px) !important; } }
@media (max-width: 639px) { .hero--split .hero__media { height: 300px !important; } }
.hero__media.hero-portrait > img { height: 90%; }
/* the portrait at about three quarters of the column, kept to the right edge */
.hero--split .hero__media.hero-portrait { width: 75%; justify-self: end; align-self: center; height: clamp(315px, calc(75svh - 138px), 537px) !important; }
.hero-portrait__word { font-size: min(96px, 6.4vw); }
/* the one action in the hero: a wider CV button */
.hero-cv { min-width: 260px; justify-content: center; }
@media (max-width: 1023px) { .hero--split .hero__media.hero-portrait { height: clamp(240px, 39svh, 420px) !important; } .hero-portrait__word { font-size: min(96px, 12vw); } }
@media (max-width: 639px) { .hero--split .hero__media.hero-portrait { width: 75%; height: 240px !important; justify-self: center; } .hero-cv { min-width: 0; } }

/* about: a small portrait and two everyday photographs, the yellow frame offset behind the group */
.about-photos { position: relative; align-self: start; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.about-photos::before { content: ""; position: absolute; inset: 16px -16px -16px 16px; border: 1.5px solid var(--accent); border-radius: var(--r-lg); opacity: .6; pointer-events: none; }
.ap { position: relative; margin: 0; border-radius: var(--r-md, 12px); overflow: hidden; background: var(--p-surface); aspect-ratio: 4 / 5; }
.ap img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* four upright photographs (4:5) in a 2 x 2 grid */
.ap { aspect-ratio: 4 / 5; }
@media (max-width: 1023px) { .about .about-photos { grid-column: 1 / -1; max-width: 480px; margin-top: var(--s-7); } }
@media (max-width: 639px) { .about-photos::before { display: none; } }

/* experience as a timeline: a rail that fills in as each role comes into view */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline > li { position: relative; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s-5); padding: 0 0 var(--s-6) 40px; }
.timeline > li::before { content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); transition: background .9s ease .45s, box-shadow .5s ease .2s; }
.timeline > li.is-in::before { background: var(--accent); box-shadow: 0 0 0 6px color-mix(in oklab, var(--accent) 18%, transparent); }
.timeline__date { color: var(--accent); font-weight: 500; padding-top: 2px; }
.timeline .rows__name { display: block; font-size: var(--t-card); font-weight: 500; margin-bottom: var(--s-2); }
.timeline__head { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-3); }
.timeline__head .rows__name { margin-bottom: 0; }
.tl-logo { flex: none; display: flex; align-items: center; justify-content: center; overflow: hidden; width: 176px; height: 84px; padding: 10px 16px; border-radius: 12px; background: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 8px 20px rgba(0,0,0,.25); }
.tl-logo img { display: block; width: 100%; height: 64px; object-fit: contain; }
.about-p2 { margin-top: var(--s-4); color: color-mix(in oklab, var(--ink) 80%, transparent); }
@media (max-width: 639px) { .timeline__head { flex-direction: column; align-items: flex-start; gap: var(--s-2); } .tl-logo { width: 152px; height: 72px; padding: 8px 14px; } .tl-logo img { height: 56px; } }
.timeline p { margin: 0 0 var(--s-2); max-width: 70ch; }
.timeline .tags { font-size: var(--t-small); color: var(--muted); }
@media (max-width: 639px) { .timeline > li { grid-template-columns: minmax(0, 1fr); gap: 4px; padding-left: 32px; } .timeline .tags { display: block; } }

/* projects: a showcase stage with the main window and two papers that fan out on hover */
.show { position: relative; display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--p-surface); border: 1px solid var(--line); overflow: hidden; color: var(--ink); text-decoration: none; transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .35s ease; isolation: isolate; }
.show:hover { transform: translateY(-4px); border-color: color-mix(in oklab, var(--accent) 55%, transparent); }
.show::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 30%), color-mix(in oklab, var(--accent) 14%, transparent), transparent 60%); opacity: 0; transition: opacity .3s ease; }
.show:hover::after { opacity: 1; }
.show__stage { position: relative; height: 340px; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, #34302a 0%, #222 55%, #1c1c1c 100%); }
.show__stage::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 28px 28px; }
.show__win { position: absolute; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 24px 48px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3); transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.show__win img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.show__win--main { left: 12%; right: 12%; top: 40px; bottom: -40px; z-index: 2; }
.show__win--main img { height: calc(100% - 30px); }
.show__win--photo img { object-position: 50% 60%; }
.show__bar { height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 12px; background: #f1efe9; border-bottom: 1px solid #e2dfd8; font: 500 12px/1 var(--font-text); color: #6b6760; }
.show__bar i { width: 9px; height: 9px; border-radius: 50%; background: #d6d2c9; display: block; }
.show__bar span { margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.show__win--a, .show__win--b { width: 34%; height: 46%; z-index: 1; opacity: .92; }
.show__win--a { left: 3%; top: 26%; transform: rotate(-7deg); }
.show__win--b { right: 3%; top: 18%; transform: rotate(6deg); }
.show:hover .show__win--main { transform: translateY(-14px) scale(1.02); }
.show:hover .show__win--a { transform: translate(-18px, -10px) rotate(-11deg); }
.show:hover .show__win--b { transform: translate(18px, -14px) rotate(10deg); }
.show__body { padding: var(--s-6); display: grid; gap: var(--s-2); }
.show__body h3 { margin: 0; font-size: var(--t-card); }
.show__body p { margin: 0; color: color-mix(in oklab, var(--ink) 82%, transparent); }
.show__kicker { font-size: var(--t-label) !important; font-weight: 500; color: var(--accent) !important; letter-spacing: .02em; }
.show__more { display: inline-flex; align-items: center; gap: 8px; margin-top: var(--s-2); font-weight: 500; color: var(--accent); }
.show__more svg { width: 14px; height: 14px; transition: transform .25s ease; }
.show:hover .show__more svg { transform: translateX(4px); }
@media (max-width: 1023px) { .proj .show { grid-column: 1 / -1; } .show__stage { height: 300px; } }
@media (max-width: 639px) { .show__stage { height: 220px; } .show__win--main { left: 8%; right: 8%; top: 24px; } .show__body { padding: var(--s-5); } }

/* skills on the light band: rows and certificate list sit on one line pair; tiles lift on hover */
.icon-row > span { transition: transform .2s ease, border-color .2s ease; }
.icon-row > span:hover { transform: translateY(-3px); border-color: var(--ink); }
@media (max-width: 1023px) { #ky-nang .grid > .span-6 { grid-column: 1 / -1; } #ky-nang .grid > .span-6 + .span-6 { margin-top: var(--s-7); } }

/* hero: the outline word drifts slowly, the kicker dot breathes */
.hero-portrait__word { animation: word-drift 18s ease-in-out infinite alternate; }
@keyframes word-drift { from { transform: translateX(-3%); } to { transform: translateX(3%); } }
.hero__kicker .dot { animation: dot-breathe 2.4s ease-in-out infinite; }
@keyframes dot-breathe { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 45%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }

/* scroll reveal (anim.js adds .rv on <html>; without script everything shows) */
/* slow enough to be seen: 1.2 s, rising 40px; anim.js staggers what comes into view together */
.rv [data-reveal], .rv [data-reveal-list] > * { opacity: 0; transform: translateY(40px); transition: opacity 1.2s cubic-bezier(.33,1,.68,1), transform 1.2s cubic-bezier(.33,1,.68,1); transition-delay: var(--d, 0s); }
.rv [data-reveal].is-in, .rv [data-reveal-list] > .is-in { opacity: 1; transform: none; }
.rv-init [data-reveal], .rv-init [data-reveal-list] > * { transition: none !important; }
/* the nav word of the section on screen */
.nav__link.is-current { color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .rv [data-reveal], .rv [data-reveal-list] > * { opacity: 1 !important; transform: none !important; transition: none !important; }
  .hero-portrait__word, .hero__kicker .dot { animation: none; }
  .show, .show__win, .icon-row > span { transition: none; }
}
/* tablet and phone: sections follow their content, no forced full-screen gaps */
@media (max-width: 1023px) { main > section:not(.hero), footer.closing { min-height: 0 !important; } }

/* desktop: a two-screen section keeps its first group on the first screen; the AI steps run straight into the prototype */
@media (min-width: 1024px) {
  main > section.g2 > .wrap { grid-template-rows: auto auto !important; }
  main > section.g2 > .wrap > .group:first-child { min-height: calc(100svh - var(--padt) - var(--padb)); }
  #ai { min-height: 0 !important; padding-bottom: var(--s-8); }
  #prototype { padding-top: var(--s-8); }
}

/* case-study tables (the Cyclistic cleaning plan): scroll sideways inside their own box on a phone */
.cs-table { --tbl-line: color-mix(in oklab, var(--ink) 24%, transparent); overflow-x: auto; margin: var(--s-5) 0 0; border: 1px solid var(--tbl-line); border-radius: var(--r-md, 12px); }
.cs-table:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cs-table table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.cs-table caption { caption-side: bottom; padding: var(--s-3) var(--s-4); text-align: left; font-size: 14px; color: var(--muted, color-mix(in oklab, var(--ink) 62%, transparent)); border-top: 1px solid var(--tbl-line); }
.cs-table th, .cs-table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--tbl-line); border-right: 1px solid var(--tbl-line); }
.cs-table tr > :last-child { border-right: 0; }
.cs-table thead th { border-bottom: 1.5px solid color-mix(in oklab, var(--ink) 40%, transparent); }
.cs-table tbody tr:nth-child(even) { background: color-mix(in oklab, var(--ink) 3%, transparent); }
.cs-table thead th { font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--ink); background: var(--p-surface); white-space: nowrap; }
.cs-table tbody tr:last-child > * { border-bottom: 0; }
.cs-table tbody th { font-weight: 500; white-space: nowrap; }
.cs-table td { color: color-mix(in oklab, var(--ink) 86%, transparent); }
.cs-table code { white-space: nowrap; }
.cs-table--plan thead th:nth-child(2) { width: 30%; } .cs-table--plan thead th:nth-child(3) { width: 26%; } .cs-table--plan thead th:nth-child(4) { width: 30%; }
.cs-table--schema thead th:nth-child(3) { width: 18%; }
/* phone: each row becomes a small card, the column name above each value */
@media (max-width: 639px) {
  .cs-table { overflow: visible; }
  .cs-table table, .cs-table tbody, .cs-table tr, .cs-table th, .cs-table td { display: block; min-width: 0; width: auto; }
  .cs-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cs-table caption { display: block; border-top: 0; border-bottom: 1px solid var(--tbl-line); }
  .cs-table tbody tr { padding: 14px 16px; border-bottom: 1px solid var(--tbl-line); }
  .cs-table tbody tr:last-child { border-bottom: 0; }
  .cs-table tbody th, .cs-table td, .cs-table tr > :last-child { padding: 0; border: 0; }
  .cs-table tbody th { margin-bottom: 8px; }
  .cs-table td + td, .cs-table th + td { margin-top: 8px; }
  .cs-table td::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted, color-mix(in oklab, var(--ink) 62%, transparent)); }
  .cs-table code { white-space: normal; }
}

/* hero: the email and LinkedIn right under the CV button */
.hero-contact { margin: var(--s-4) 0 0; font-size: 15px; color: var(--muted, color-mix(in oklab, var(--ink) 66%, transparent)); }
.hero-contact a { color: var(--ink); text-underline-offset: 3px; }
/* certificates open their proof */
.certs a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in oklab, currentColor 35%, transparent); text-underline-offset: 3px; }
.certs a::after { content: " ↗"; font-size: .85em; color: var(--accent); }
.certs a:hover { text-decoration-color: currentColor; }
/* hero: the name above the headline, readable at a glance */
.hero__kicker--name { font-size: 18px; font-weight: 500; color: var(--ink); letter-spacing: .01em; }
@media (max-width: 639px) { .hero__kicker--name { font-size: 16px; } }

/* footer: only as tall as what it holds; the CV call and its button share one row, a line above the links */
footer.closing { height: auto !important; min-height: 0 !important; padding-top: var(--s-9, 96px); padding-bottom: var(--s-6); }
footer.closing > .wrap { height: auto; grid-template-rows: auto auto; row-gap: var(--s-7); }
.closing__cta.close--row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-5) var(--s-7); }
.closing__cta.close--row .section-head { max-width: 36rem; }
.closing__cta.close--row .btn-row { margin: 0; }
.close-cv { min-width: 220px; justify-content: center; }
.closing__links { border-top: 1px solid color-mix(in oklab, var(--ink) 14%, transparent); padding-top: var(--s-7); }
@media (max-width: 639px) {
  footer.closing { padding-top: var(--s-8, 64px); }
  .closing__cta.close--row { flex-direction: column; align-items: stretch; }
  .close-cv { width: 100%; }
}
/* the footer columns: room for the whole email address (tablet: half each; phone: one under the other) */
@media (min-width: 640px) and (max-width: 1023px) { .closing__links .footer__col { grid-column: auto / span 6 !important; } }
@media (max-width: 639px) { .closing__links .footer__col { grid-column: 1 / -1 !important; } .closing__links .footer__col a { overflow-wrap: normal; } }

/* ===================== the change-request portal (crx) ===================== */
.crx.ui {
  --x-bg: #fbfaf7; --x-panel: #ffffff; --x-ink: #1b1b1b; --x-muted: #5e5b55; --x-line: #e6e2da; --x-soft: #f3f1ec; --x-acc: #EDAE49; --x-red: #b4321f;
  position: relative; margin-top: var(--s-7); background: var(--x-bg); color: var(--x-ink); border: 1px solid var(--x-line); border-radius: 16px;
  overflow: hidden; font: 400 14px/1.45 var(--font-text); box-shadow: 0 40px 80px -30px rgba(0,0,0,.6);
  display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: clamp(640px, 84svh, 780px);
}
.crx button, .crx input, .crx select, .crx textarea { font: inherit; color: inherit; }
.crx button { cursor: pointer; }
.x-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.x-top { display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: var(--x-panel); border-bottom: 1px solid var(--x-line); flex-wrap: wrap; }
.x-dots { display: flex; gap: 6px; } .x-dots i { width: 10px; height: 10px; border-radius: 50%; background: #dcd8cf; display: block; }
.x-app { font-weight: 500; font-size: 15px; margin-right: auto; }
.x-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--x-line); border-radius: 10px; background: var(--x-bg); min-width: 240px; }
.x-search svg { width: 15px; height: 15px; fill: none; stroke: var(--x-muted); stroke-width: 1.6; }
.x-search input { border: 0; background: none; outline: 0; width: 100%; font-size: 14px; }
.x-search:focus-within { outline: 2px solid #181818; outline-offset: 2px; }
.x-roles { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: var(--x-soft); }
.x-roles__label { font-size: 12px; color: var(--x-muted); padding: 0 8px 0 6px; }
.x-roles button { border: 0; background: none; min-height: 34px; padding: 0 12px; border-radius: 8px; font-weight: 500; font-size: 13px; line-height: 1.2; transition: background .2s ease, box-shadow .2s ease; }
.x-roles button[aria-pressed="true"] { background: var(--x-panel); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.x-btn { min-height: 40px; padding: 0 16px; border: 0; border-radius: 2px; background: var(--x-acc); color: #181818 !important; font-weight: 500 !important; transition: transform .15s ease, filter .2s ease; }
.x-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.x-btn:active { transform: translateY(1px); }
.x-btn--ghost { background: none; text-decoration: underline; text-underline-offset: 4px; padding: 0 8px; }
.x-btn--line { background: var(--x-panel); border: 1px solid var(--x-line); min-height: 36px; padding: 0 12px; font-size: 13px; }
.x-btn--danger { background: var(--x-red); color: #fff !important; }
.x-btn--line.x-btn--danger { background: var(--x-panel); color: var(--x-red) !important; border-color: #e9c2bc; }
.x-btn[aria-disabled="true"], .x-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.x-link { border: 0; background: none; padding: 6px 2px; min-height: 32px; font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; color: var(--x-ink); }
.crx :focus-visible { outline: 2px solid #181818; outline-offset: 2px; }
.x-search input:focus-visible { outline: 0; }

/* KPI cards double as quick filters */
.x-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--x-line); }
.x-kpi { background: var(--x-panel); border: 1px solid var(--x-line); border-radius: 12px; padding: 10px 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; text-align: left; transition: border-color .2s, box-shadow .2s; }
.x-kpi:hover { border-color: #cfc9bd; }
.x-kpi[aria-pressed="true"] { border-color: var(--x-ink); box-shadow: inset 0 0 0 1px var(--x-ink); }
.x-kpi span { font-size: 12px; color: var(--x-muted); }
.x-kpi b { font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.x-kpi--mine { border-color: #f3d08f; background: #fff8ea; }
.x-kpi--late b { color: var(--x-red); }
.x-kpi.is-bump { animation: x-bump .5s ease; }
@keyframes x-bump { 40% { transform: scale(1.04); } }

.x-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); min-height: 0; }
.x-list { border-right: 1px solid var(--x-line); display: flex; flex-direction: column; min-height: 0; }
.x-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--x-line); }
.x-sel { display: grid; gap: 2px; font-size: 12px; color: var(--x-muted); min-width: 0; }
.x-sel select { min-height: 36px; border: 1px solid var(--x-line); border-radius: 8px; background: var(--x-panel); padding: 0 8px; font-size: 13px; color: var(--x-ink); width: 100%; }
.x-sortbar { display: flex; align-items: center; gap: 4px; padding: 6px 14px; border-bottom: 1px solid var(--x-line); background: var(--x-soft); font-size: 12px; flex-wrap: wrap; }
.x-all { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: 0 4px 0 -8px; cursor: pointer; }
.x-all input, .x-row__pick { width: 18px; height: 18px; accent-color: #181818; cursor: pointer; margin: 0; }
.x-sortbar__l { color: var(--x-muted); margin-right: 2px; }
.x-sort { border: 0; background: none; min-height: 32px; padding: 0 8px; border-radius: 6px; font-weight: 500; font-size: 12px; color: var(--x-muted); }
.x-sort[aria-pressed="true"] { background: var(--x-panel); color: var(--x-ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.x-sort__dir { display: inline-block; min-width: 10px; margin-left: 2px; }
.x-bulk { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: #fff3d6; border-bottom: 1px solid #f0d79f; font-size: 13px; font-weight: 500; flex-wrap: wrap; }
.x-bulk[hidden] { display: none; }
.x-bulk span { margin-right: auto; }
.x-rows { list-style: none; margin: 0; padding: 0; overflow: auto; min-height: 0; flex: 1; scrollbar-width: thin; }
.x-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; border-bottom: 1px solid var(--x-line); position: relative; transition: background .2s ease; }
.x-row:hover { background: var(--x-soft); }
.x-row.is-sel { background: var(--x-panel); box-shadow: inset 3px 0 0 var(--x-acc); }
.x-row.is-new { animation: x-row-in .6s cubic-bezier(.2,.7,.2,1); }
@keyframes x-row-in { from { opacity: 0; transform: translateY(-12px); background: #fff3d6; } }
.x-row__pick { margin: 14px 0 0 14px; }
.x-row__main { display: grid; gap: 4px; width: 100%; text-align: left; padding: 11px 14px 11px 4px; border: 0; background: none; min-width: 0; }
.x-row__top, .x-row__foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.x-row__title { font-weight: 500; line-height: 1.35; }
.x-id { font-size: 12px; color: var(--x-muted); }
.x-cat { font-size: 11px; color: var(--x-muted); border: 1px solid var(--x-line); border-radius: 4px; padding: 0 6px; }
.x-prio { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; margin-right: 6px; vertical-align: middle; }
.x-row .x-prio { margin-right: 0; }
.x-prio--h { background: #d2452c; }
.x-prio--m { background: #e0a22e; }
.x-prio--l { background: #8a9a8e; }
.x-sla { font-size: 12px; color: var(--x-muted); }
.x-row .x-sla { margin-left: auto; }
.x-sla.is-soon { color: #8a5a00; font-weight: 500; }
.x-sla.is-met { color: #1f6332; }
.crx .is-late { color: var(--x-red) !important; font-weight: 500; }
.x-sla.is-late::before { content: "●"; font-size: 8px; vertical-align: 2px; margin-right: 4px; animation: x-blink 1.4s ease-in-out infinite; }
@keyframes x-blink { 50% { opacity: .2; } }
.x-chip { font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--x-soft); transition: background .3s ease, color .3s ease; white-space: nowrap; }
.x-chip[data-s="new"] { background: #eef0f3; color: #3b4452; }
.x-chip[data-s="wait"] { background: #fbecd0; color: #7a4d00; }
.x-chip[data-s="work"] { background: #e3ecf8; color: #1d4b86; }
.x-chip[data-s="done"] { background: #e2f1e5; color: #1f6332; }
.x-chip[data-s="back"] { background: #f7e1df; color: #8f2a1f; }
.x-risk { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.x-risk[data-l="0"] { background: #e2f1e5; color: #1f6332; }
.x-risk[data-l="1"] { background: #fbecd0; color: #7a4d00; }
.x-risk[data-l="2"] { background: #fadccb; color: #8f3a12; }
.x-risk[data-l="3"] { background: var(--x-red); color: #fff; }
.x-me { font-size: 11px; font-weight: 500; color: #7a4d00; border: 1px solid #f0c977; border-radius: 999px; padding: 1px 8px; }
.x-empty { padding: 24px 14px; color: var(--x-muted); }
.x-foot { display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-top: 1px solid var(--x-line); background: var(--x-panel); font-size: 12px; color: var(--x-muted); flex-wrap: wrap; }
.x-foot__sp { flex: 1; }

/* detail */
.x-detail { padding: 18px 22px; overflow: auto; min-height: 0; scrollbar-width: thin; scroll-margin-top: 88px; }
.x-none { color: var(--x-muted); padding: 24px 0; }
.x-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.crx .x-title { margin: 6px 0 8px; font-size: 20px; line-height: 1.3; color: var(--x-ink); font-family: var(--font-text); font-weight: 500; letter-spacing: 0; }
.crx .x-title:focus { outline: 0; }
.crx .x-title:focus-visible { outline: 2px solid #181818; }
.x-rec { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.x-why { display: inline-flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--x-muted); flex: 1 1 220px; }
.x-why svg, .x-hint svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; margin-top: 1px; }
.x-progress { height: 4px; border-radius: 4px; background: var(--x-soft); overflow: hidden; margin-bottom: 12px; }
.x-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2f8a4a, var(--x-acc)); transition: width .8s cubic-bezier(.2,.7,.2,1); }
.x-progress i.is-on { width: var(--p); }
.x-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--x-line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.x-tabs button { border: 0; background: none; padding: 10px 12px; min-height: 40px; font-weight: 500; color: var(--x-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .2s, border-color .2s; white-space: nowrap; }
.x-tabs button[aria-selected="true"] { color: var(--x-ink); border-bottom-color: var(--x-acc); }
.x-tabs small { font-size: 11px; background: var(--x-soft); border-radius: 999px; padding: 1px 6px; margin-left: 2px; }
.x-pane { animation: x-pane-in .35s ease; }
@keyframes x-pane-in { from { opacity: 0; transform: translateY(6px); } }
.x-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.x-meta div { background: var(--x-panel); border: 1px solid var(--x-line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.x-meta dt { font-size: 12px; color: var(--x-muted); }
.x-meta dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.x-reason { margin: 0 0 10px; }
.x-scope { margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.x-scope span { background: #fff3d6; border-radius: 6px; padding: 2px 8px; font-size: 13px; }
.x-hint { display: flex; gap: 8px; align-items: flex-start; background: var(--x-soft); border-radius: 10px; padding: 10px 12px; color: var(--x-muted); margin: 0 0 12px; }
.x-warn { background: #fff3d6; border-left: 3px solid var(--x-acc); padding: 8px 12px; border-radius: 6px; margin: 0 0 10px; font-size: 13px; }
.x-note { background: #e9eef8; border-left: 3px solid #1d4b86; padding: 8px 12px; border-radius: 6px; margin: 0 0 10px; font-size: 13px; color: #1d3557; }
.x-form { display: grid; gap: 10px; margin-bottom: 12px; }
.x-form .x-warn, .x-form .x-acts { margin: 0; }
.x-field { display: grid; gap: 4px; border: 0; padding: 0; margin: 0; min-width: 0; align-content: start; }
.x-field label, .x-field legend { font-size: 13px; font-weight: 500; padding: 0; }
.x-field legend { margin-bottom: 4px; }
.x-field :is(input[type="text"], input[type="number"], input[type="date"], select, textarea) { border: 1px solid var(--x-line); border-radius: 8px; background: var(--x-panel); padding: 9px 11px; min-height: 42px; font-size: 15px; width: 100%; color: var(--x-ink); }
.x-field select:disabled { background: var(--x-soft); color: var(--x-muted); }
.x-field [aria-invalid="true"]:not([type="radio"]):not([type="checkbox"]) { border-color: var(--x-red); box-shadow: 0 0 0 1px var(--x-red); }
.x-field.is-bad .x-seg, .x-field.is-bad .x-checks label { border-color: var(--x-red); }
.x-help { font-size: 12px; color: var(--x-muted); margin: 0; }
/* required fields: a star after the label, explained once at the top of the form */
.x-req { margin-left: 3px; color: #d64545; font-weight: 600; }
.x-reqnote { margin: 0 0 4px; }
.x-seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--x-line); border-radius: 8px; overflow: hidden; background: var(--x-panel); }
.x-seg label { position: relative; font-weight: 500; }
.x-seg label + label { border-left: 1px solid var(--x-line); }
.x-seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.x-seg span { display: grid; place-items: center; min-height: 40px; transition: background .15s, color .15s; }
.x-seg input:checked + span { background: var(--x-ink); color: #fff; }
.x-seg input:focus-visible + span { outline: 2px solid #181818; outline-offset: -4px; box-shadow: inset 0 0 0 4px #fff; }
.x-preview { display: grid; gap: 4px; font-size: 13px; background: var(--x-soft); border-radius: 10px; padding: 10px 12px; }
.x-preview p { margin: 0; }
.x-preview .x-warn { margin: 4px 0 0; }
.x-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.x-checks label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--x-line); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 400; background: var(--x-panel); min-height: 36px; }
.x-checks input { accent-color: #181818; width: 16px; height: 16px; margin: 0; }
.x-checks label:has(input:checked) { border-color: var(--x-ink); background: #fff8ea; }
.x-err { color: var(--x-red); font-size: 13px; margin: 0; }
.x-err[hidden], .x-warn[hidden], .x-help[hidden] { display: none; }
.x-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.x-rules { border-top: 1px solid var(--x-line); padding-top: 10px; }
.x-rules summary { cursor: pointer; font-weight: 500; min-height: 32px; }
.x-rules ul { margin: 6px 0 0; padding-left: 18px; color: var(--x-muted); display: grid; gap: 4px; list-style: disc; }
.x-rules li { padding-left: 2px; }
.x-rules b { color: var(--x-ink); font-weight: 500; margin-right: 4px; }
.x-rules li.is-hit { color: var(--x-ink); }
.x-rules em { font-style: normal; font-size: 11px; font-weight: 500; color: #7a4d00; background: #fbecd0; border-radius: 999px; padding: 0 6px; white-space: nowrap; }
.x-flow { list-style: none; margin: 0 0 14px; padding: 0; position: relative; }
.x-flow li { display: flex; gap: 12px; padding: 0 0 16px; position: relative; }
.x-flow li::before { content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--x-line); }
.x-flow li:last-child::before { display: none; }
.x-flow__dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--x-line); background: var(--x-panel); flex: none; transition: all .4s ease; }
.x-flow li[data-state="done"] .x-flow__dot { background: #2f8a4a; border-color: #2f8a4a; }
.x-flow li[data-state="done"]::before { background: #2f8a4a; }
.x-flow li[data-state="now"] .x-flow__dot { border-color: var(--x-acc); box-shadow: 0 0 0 5px #fbecd0; animation: x-now 1.6s ease-in-out infinite; }
.x-flow li[data-state="stop"] .x-flow__dot { background: var(--x-red); border-color: var(--x-red); }
.x-flow li[data-state="skip"] .x-flow__dot { border-style: dashed; }
.x-flow li[data-state="skip"] b { color: var(--x-muted); text-decoration: line-through; }
@keyframes x-now { 50% { box-shadow: 0 0 0 9px rgba(251, 236, 208, 0); } }
.x-flow b { display: block; font-weight: 500; }
.x-flow div span, .x-flow small { display: block; font-size: 12px; color: var(--x-muted); }
.x-flow small { color: var(--x-ink); margin-top: 2px; }
.x-log { list-style: none; margin: 0 0 12px; padding: 0; }
.x-log > li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--x-line); animation: x-pane-in .35s ease; }
.x-log > li > div { min-width: 0; overflow-wrap: anywhere; }
.x-avatar { min-width: 32px; height: 32px; padding: 0 4px; border-radius: 16px; background: #181818; color: #fff; font-size: 11px; font-weight: 500; display: grid; place-items: center; flex: none; }
.x-log time { display: block; font-size: 12px; color: var(--x-muted); }
.x-who { font-weight: 500; font-size: 13px; }
.x-cmt__t { margin: 2px 0; }
.x-diff { list-style: none; margin: 4px 0; padding: 6px 8px; background: var(--x-soft); border-radius: 6px; font-size: 13px; display: grid; gap: 2px; }
.x-diff del { color: var(--x-red); }
.x-diff ins { text-decoration: none; color: #1f6332; font-weight: 500; }

/* create/edit sheet */
.x-sheet { position: absolute; inset: 0; z-index: 5; background: rgba(24, 24, 24, .35); display: flex; justify-content: flex-end; opacity: 0; transition: opacity .3s ease; }
.x-sheet.is-on { opacity: 1; }
.x-new { width: min(500px, 100%); height: 100%; background: var(--x-panel); padding: 20px 22px; overflow: auto; transform: translateX(40px); transition: transform .35s cubic-bezier(.2,.7,.2,1); box-shadow: -20px 0 40px rgba(0,0,0,.15); overscroll-behavior: contain; }
.x-new > form { display: grid; align-content: start; gap: 12px; }
.x-sheet.is-on .x-new { transform: none; }
.x-new__head { display: flex; align-items: center; justify-content: space-between; }
.crx .x-new h3, .crx .x-dialog h3 { margin: 0; font-size: 18px; color: var(--x-ink); font-family: var(--font-text); font-weight: 500; letter-spacing: 0; line-height: 1.3; }
.x-x { width: 40px; height: 40px; border: 0; background: var(--x-soft); border-radius: 50%; font-size: 20px; }
.x-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* confirm dialog */
.x-modal { position: absolute; inset: 0; z-index: 7; background: rgba(24, 24, 24, .45); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s ease; }
.x-modal.is-on { opacity: 1; }
.x-modal[hidden] { display: none; }
.x-dialog { width: min(440px, 100%); max-height: 100%; overflow: auto; background: var(--x-panel); border-radius: 14px; padding: 20px 22px 8px; box-shadow: 0 30px 60px rgba(0,0,0,.3); display: grid; gap: 12px; transform: translateY(8px) scale(.98); transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.x-modal.is-on .x-dialog { transform: none; }
.x-dialog__body { display: grid; gap: 8px; }
.x-dialog__body p { margin: 0; }
.x-dialog__body ul { margin: 0; padding-left: 18px; list-style: disc; display: grid; gap: 4px; font-size: 13px; color: var(--x-muted); }
.x-dialog__body b { color: var(--x-ink); font-weight: 500; }

/* toasts */
.x-toasts { position: absolute; right: 16px; bottom: 16px; z-index: 8; display: grid; gap: 8px; pointer-events: none; }
.x-toast { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; background: #181818; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 13px; opacity: 0; transform: translateY(10px); transition: opacity .3s ease, transform .3s ease; border-left: 3px solid var(--x-acc); max-width: 360px; }
.x-toast.is-on { opacity: 1; transform: none; }
.x-toast__undo { pointer-events: auto; border: 0; background: none; color: var(--x-acc); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; padding: 0 4px; margin-left: auto; white-space: nowrap; }
.x-toast__undo:focus-visible { outline-color: #fff; }
.x-toast__bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--x-acc); transform-origin: left; animation: x-undo var(--undo, 6s) linear forwards; }
@keyframes x-undo { to { transform: scaleX(0); } }

@media (max-width: 1279px) { .x-search { min-width: 180px; } .x-sortbar__l { display: none; } .x-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1023px) {
  .crx.ui { height: auto; grid-template-rows: auto; }
  .x-body { grid-template-columns: minmax(0, 1fr); }
  .x-list { border-right: 0; border-bottom: 1px solid var(--x-line); }
  .x-rows { max-height: 340px; }
  .x-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .x-search { order: 5; flex: 1 1 100%; }
  .x-detail { overflow: visible; }
}
@media (max-width: 639px) {
  .x-top { padding: 12px; gap: 10px; }
  .x-app { flex: 1 1 100%; }
  .x-btn--new { flex: 1; }
  .x-roles { flex: 1 1 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .x-roles button { padding: 0 4px; font-size: 12px; }
  .x-roles__label { display: none; }
  .x-kpis { padding: 12px; gap: 8px; }
  .x-kpi { flex-direction: column; gap: 0; padding: 8px 10px; }
  .x-kpi b { font-size: 20px; }
  .x-tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px 12px; }
  .x-tools .x-sel:first-child { grid-column: 1 / -1; }
  .x-sortbar { padding: 4px 12px; }
  .x-sortbar__l { display: none; }
  .x-sort { padding: 0 6px; }
  .x-detail { padding: 14px; }
  .x-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .x-two { grid-template-columns: 1fr; }
  .x-new { padding: 16px; }
  /* .wrap is a stacking context below the site's fixed nav, so the overlays start under the nav instead of over it */
  .x-sheet, .x-modal { position: fixed; top: var(--nav-h, 56px); }
  .x-toasts { position: fixed; left: 16px; right: 16px; }
  .x-toast { max-width: none; }
  #prototype { --hm: 2; }
}
@media (prefers-reduced-motion: reduce) { .crx *, .crx *::before { animation: none !important; transition: none !important; } }
