/* ============================================================
   Meinsert — design system
   "Kertas hangat + aksen logo" (Logo.png: indigo slate ground,
   logo green / orange / red). IBM Plex Sans Condensed (display)
   · IBM Plex Sans (text) · IBM Plex Mono (literal data only).
   ============================================================ */

/* Fonts (OFL 1.1 — see assets/fonts/OFL.txt) */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-condensed-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-condensed-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-condensed-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-condensed-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-condensed-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-condensed-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #f5f4ed;
  --bg-deep: #ecebe1;
  --surface: #fdfcf7;
  --surface-2: #f2f1e8;
  --surface-3: #e9e8dd;
  --field: #fbfaf4;
  --ink: #171b24;
  --ink-soft: #323845;
  --muted: #5f6a63;
  --faint: #667065;
  --line: rgba(23, 27, 36, 0.13);
  --line-strong: rgba(23, 27, 36, 0.22);
  --brand: #44446b;
  --brand-hover: #36365a;
  --brand-soft: #e7e7f3;
  --brand-ink: #f5f5fc;
  --accent: #16a34a;
  --accent-text: #15803d;
  --accent-soft: #e4f5eb;
  --highlight: rgba(22, 163, 74, 0.30);
  --danger: #b91c1c;
  --danger-soft: #fbe3e3;
  --warning: #c2410c;
  --warning-soft: #fde8d7;
  --success: #166534;
  --success-strong: #16a34a;
  --success-soft: #e2f4e9;
  --shadow-sm: 0 1px 2px rgba(23, 27, 36, 0.06);
  --shadow-card: 0 22px 60px -34px rgba(23, 27, 54, 0.42), 0 3px 12px rgba(23, 27, 36, 0.04);
  --shadow-drop: 0 34px 90px -42px rgba(68, 68, 107, 0.5), 0 8px 30px -18px rgba(23, 27, 36, 0.22);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "IBM Plex Sans Condensed", "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --header-h: 76px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14141f;
  --bg-deep: #101019;
  --surface: #1b1b28;
  --surface-2: #22222f;
  --surface-3: #2a2a3a;
  --field: #191924;
  --ink: #ececf2;
  --ink-soft: #c9c9d6;
  --muted: #9a9aac;
  --faint: #9494a6;
  --line: rgba(236, 236, 242, 0.12);
  --line-strong: rgba(236, 236, 242, 0.22);
  --brand: #a6a6d6;
  --brand-hover: #c1c1e8;
  --brand-soft: #22222e;
  --brand-ink: #14141f;
  --accent: #3bd06f;
  --accent-text: #3bd06f;
  --accent-soft: #16241b;
  --highlight: rgba(59, 208, 111, 0.28);
  --danger: #f08080;
  --danger-soft: #2a1714;
  --warning: #f0a050;
  --warning-soft: #2a2112;
  --success: #3bd06f;
  --success-strong: #3bd06f;
  --success-soft: #152a1d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-card: 0 30px 70px -38px rgba(0, 0, 0, 0.8), 0 3px 14px rgba(0, 0, 0, 0.2);
  --shadow-drop: 0 38px 100px -42px rgba(0, 0, 0, 0.85), 0 8px 30px -18px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Keep anchored/focused content clear of the sticky header */
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 600px at 82% -10%, var(--accent-soft), transparent 62%),
    radial-gradient(900px 600px at -10% 38%, var(--brand-soft), transparent 58%);
  opacity: 0.85;
  pointer-events: none;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  scroll-margin-top: calc(var(--header-h) + 12px);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  /* Remove the double-tap zoom delay on touch devices */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

.skip-link:focus {
  transform: translateY(0);
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.icon svg {
  width: 100%;
  height: 100%;
}

.meta-row dd,
.raw-count,
.tab-count,
.section-index,
.support-number {
  font-variant-numeric: tabular-nums;
}

/* Header */
.site-header {
  position: relative;
  z-index: 20;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 10px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.brand-text small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(12px);
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-strong) 18%, transparent);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

/* Landing */
.landing {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
  min-height: calc(100vh - var(--header-h) - 120px);
  padding: 44px 0 64px;
}

.hero-copy {
  max-width: 620px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow-line {
  width: 28px;
  height: 1px;
  background: var(--line-strong);
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(46px, 5.8vw, 68px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0.002em;
  text-wrap: balance;
}

.accent-text {
  position: relative;
  display: inline;
  color: var(--brand);
  background: linear-gradient(transparent 64%, var(--highlight) 64%, var(--highlight) 93%, transparent 93%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding-inline: 0.04em;
}

.lede {
  max-width: 520px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.68;
}

.format-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 66%, transparent);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.chip-dot.image { background: #16a34a; }
.chip-dot.pdf { background: #ef4444; }
.chip-dot.audio { background: #ea580c; }
.chip-dot.video { background: #8585cc; }

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trust-row strong {
  color: var(--brand);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

/* Drop card */
.drop-wrap {
  position: relative;
}

.drop-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 438px;
  padding: 44px 32px 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  cursor: pointer;
  background:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(160deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 92%, transparent));
  box-shadow: var(--shadow-drop);
  text-align: center;
  overflow: hidden;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.drop-card::after {
  content: "";
  position: absolute;
  inset: 13px;
  z-index: -1;
  border: 1px dashed var(--line-strong);
  border-radius: 23px;
  pointer-events: none;
}

.drop-card:hover,
.drop-card.is-dragging {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--brand) 52%, var(--line-strong));
  box-shadow: 0 42px 110px -48px color-mix(in srgb, var(--brand) 62%, transparent), 0 10px 34px -20px rgba(23, 27, 36, 0.28);
  outline: none;
}

.drop-card.is-dragging {
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--brand) 26%, transparent) 1px, transparent 1px) 0 0 / 18px 18px,
    color-mix(in srgb, var(--accent-soft) 82%, var(--surface));
}

.drop-visual {
  position: relative;
  width: 128px;
  height: 128px;
  margin-bottom: 22px;
}

.tag-stack {
  position: absolute;
  top: 16px;
  left: 22px;
  width: 84px;
  height: 94px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.tag-back {
  transform: rotate(-12deg) translate(-9px, 2px);
  background: var(--brand);
  border-color: transparent;
  opacity: 0.18;
}

.tag-mid {
  transform: rotate(8deg) translate(9px, 0);
  background: var(--accent);
  border-color: color-mix(in srgb, var(--brand) 24%, transparent);
  opacity: 0.55;
}

.tag-front {
  display: block;
  transform: rotate(-2deg);
  background: var(--surface);
}

.tag-hole {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--bg);
}

.tag-line {
  position: absolute;
  left: 13px;
  top: 38px;
  width: 48px;
  height: 4px;
  border-radius: 99px;
  background: var(--line-strong);
}

.tag-line.short {
  top: 50px;
  width: 30px;
}

.drop-plus {
  position: absolute;
  right: 8px;
  bottom: 7px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 20px;
  font-weight: 300;
  box-shadow: 0 9px 20px -9px color-mix(in srgb, var(--brand) 75%, transparent);
}

.drop-card h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.002em;
  line-height: 1.05;
}

.drop-copy {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.text-button:hover {
  text-decoration-color: var(--accent);
}

.drop-meta {
  margin: 16px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.drop-formats {
  display: flex;
  gap: 6px;
  margin-top: 20px;
}

.drop-formats span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.drop-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 4px 0;
  color: var(--faint);
  font-size: 11.5px;
  text-align: center;
}

.lock-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success-strong);
}

/* Workspace */
.workspace {
  padding: 20px 0 78px;
  animation: rise-in 380ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.workspace-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.back-button:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.workspace-status {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
}

.workspace-status.is-error {
  color: var(--danger);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.side-column {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 18px;
}

.file-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

/* Kartu pratinjau di atas form: media penuh selebar kartu, info file di bawahnya */
.file-card--top {
  display: block;
}

.file-card--top .preview-frame {
  min-height: 0;
  max-height: none;
  margin: 0;
  border-radius: 0;
}

/* Video dan gambar mengikuti rasio aslinya: 4:3, 16:10, 21:9, potret, dst.
   Tinggi dibatasi lewat lebar (ratio-aware), tanpa max-height, supaya rasio
   tidak pernah dilanggar dan tidak ada scroll di dalam kartu. */
.file-card--top .preview-frame--video,
.file-card--top .preview-frame--image {
  --preview-cap: min(60vh, 720px);
  width: min(100%, calc(var(--preview-cap) * var(--media-ratio-num, 1.7778)));
  aspect-ratio: var(--media-ratio, 16 / 9);
  margin-inline: auto;
  transition: width 240ms ease;
}

.file-card--top .preview-frame--video {
  background: #0b0b10;
}

/* PDF juga selebar kartu, tetapi butuh tinggi tetap agar halamannya terbaca */
.file-card--top .preview-frame--pdf {
  width: 100%;
  height: min(70vh, 620px);
  min-height: 320px;
  background: #0b0b10;
}

.file-card--top .preview-frame--video video,
.file-card--top .preview-frame--image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
}

.file-card--top .preview-frame--pdf iframe {
  height: 100%;
}

.file-card--top .preview-frame--file {
  min-height: 200px;
}

/* Audio: thumbnail dan pemutar berdampingan, kontrol di bagian atas */
.file-card--top .preview-frame--audio {
  display: block;
  min-height: 0;
  padding: 18px 22px 20px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
}

.audio-stage {
  display: grid;
  gap: 14px;
  width: 100%;
}

.audio-cover-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
}

.audio-cover-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.audio-cover-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.audio-body {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.audio-cover {
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  padding: 0;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 0 0 / 14px 14px,
    linear-gradient(45deg, var(--surface-2) 25%, var(--surface) 25%, var(--surface) 75%, var(--surface-2) 75%) 7px 7px / 14px 14px;
  color: var(--faint);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.audio-cover:hover,
.audio-cover:focus-visible {
  border-color: var(--brand);
}

.audio-cover.is-dragover {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.audio-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.audio-cover-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 10px;
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.audio-cover-empty .icon {
  width: 24px;
  height: 24px;
  color: var(--faint);
}

.audio-player {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.audio-player audio {
  width: 100%;
}

.audio-cover-hint {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.file-card--top .file-info {
  padding: 18px 22px 20px;
  border-top: 1px solid var(--line);
}

/* Baris info dirapatkan jadi beberapa kolom supaya kartu tidak memanjang */
.file-card--top .meta-list {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  column-gap: 26px;
}

@media (max-width: 700px) {
  .file-card--top .preview-frame--pdf {
    height: min(62vh, 420px);
    min-height: 260px;
  }

  .file-card--top .preview-frame--video,
  .file-card--top .preview-frame--image {
    --preview-cap: min(52vh, 420px);
  }

  .audio-body {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
  }

  .audio-cover {
    width: 96px;
    height: 96px;
    border-radius: 12px;
  }

  .audio-cover-title {
    font-size: 9.5px;
  }

  .file-card--top .file-info {
    padding: 16px 18px 18px;
  }

  .file-card--top .meta-list {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
  }
}

/* Card pratinjau sengaja mengecil saat pinned. Matikan scroll anchoring agar
   perubahan tinggi card tidak memicu lompatan scroll dan class pinned berkedip. */
body[data-page="single"] {
  overflow-anchor: none;
}

/* Pratinjau menempel di atas saat halaman digulir, tidak tertutup apa pun */
.preview-dock {
  position: sticky;
  top: 12px;
  z-index: 15;
  min-width: 0;
  /* Jangan jadikan pratinjau titik jangkar gulir: mengecilkan kartu tidak boleh
     melompatkan halaman, cukup form di bawah yang dipertahankan posisinya. */
  overflow-anchor: none;
}

.preview-dock.is-pinned .file-card {
  box-shadow: 0 28px 64px -36px rgba(12, 16, 28, 0.55), var(--shadow-card);
}

/* Saat menempel, tinggi bidang media dibatasi lewat LEBAR (rasio terjaga)
   supaya form di bawahnya tetap terlihat. Pada layar kecil batasnya lebih ketat. */
.preview-dock.is-pinned .file-card:not(.is-minimized) .preview-frame--video,
.preview-dock.is-pinned .file-card:not(.is-minimized) .preview-frame--image {
  --preview-cap: min(26vh, 260px);
  width: min(100%, calc(var(--preview-cap) * var(--media-ratio-num, 1.7778)));
  max-height: none;
  margin-inline: auto;
}

.preview-dock.is-pinned .file-card:not(.is-minimized) .file-info {
  padding-top: 14px;
  padding-bottom: 16px;
}

/* Tombol kecilkan/tampilkan pratinjau: menyatu di baris judul kartu,
   tidak mengambang di atas media sehingga tidak menimpa kontrol */
.preview-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  min-height: 38px;
  transition: background 140ms ease, border-color 140ms ease;
}

.preview-toggle:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.preview-toggle .preview-toggle-icon {
  display: grid;
  place-items: center;
}

.preview-toggle .icon {
  width: 13px;
  height: 13px;
}

/* Mode kecil: satu baris seimbang, tombol ikut dalam alur (bukan mengambang) */
.file-card.is-minimized {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.file-card.is-minimized .preview-frame {
  display: none;
}

.file-card.is-minimized .file-info {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border-top: 0;
}

.file-card.is-minimized .file-name {
  order: -1;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card.is-minimized .file-kind {
  margin: 0 0 0 auto;
  flex: 0 0 auto;
}

.file-card.is-minimized .file-local {
  display: none;
}

.file-card.is-minimized .preview-toggle {
  flex: 0 0 auto;
}

.file-card.is-minimized .file-sub,
.file-card.is-minimized .meta-list,
.file-card.is-minimized .file-warning {
  display: none;
}

/* Catatan pendukung di bawah editor */
.side-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 210px;
  max-height: 300px;
  margin: 10px;
  border-radius: 17px;
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 0 0 / 18px 18px,
    linear-gradient(45deg, var(--surface-2) 25%, var(--surface) 25%, var(--surface) 75%, var(--surface-2) 75%) 9px 9px / 18px 18px;
  overflow: hidden;
}

.preview-frame img {
  display: block;
  max-width: calc(100% - 18px);
  max-height: 280px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}

.preview-frame video {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #000;
}

.preview-frame audio {
  width: calc(100% - 28px);
}

.preview-frame iframe {
  display: block;
  width: 100%;
  height: 280px;
  border: 0;
  background: #fff;
}


.preview-icon {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 26px;
  background: var(--surface-3);
  color: var(--brand);
  border: 1px solid var(--line);
}

.preview-icon .icon {
  width: 38px;
  height: 38px;
}

.file-info {
  padding: 7px 20px 20px;
}

.file-kind {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 7px;
}

.file-kind-aside {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
}

.file-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.file-local {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.file-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.file-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.file-warning {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 13px;
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10.5px;
  line-height: 1.45;
}

.file-warning .icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
}

.meta-list {
  display: grid;
  gap: 0;
  margin: 17px 0 0;
  border-top: 1px solid var(--line);
}

.meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.meta-row dt {
  color: var(--muted);
  white-space: nowrap;
}

.meta-row dd {
  margin: 0;
  text-align: right;
  font-family: var(--mono);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.side-note {
  display: flex;
  gap: 12px;
  padding: 17px 16px;
  border: 1px solid color-mix(in srgb, var(--success) 22%, var(--line));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--success-soft) 72%, var(--surface));
  color: var(--ink-soft);
}

.side-note.muted {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-2) 62%, transparent);
}

.side-note-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: color-mix(in srgb, var(--success) 16%, transparent);
  color: var(--success);
}

.side-note-icon:empty::before {
  content: "✓";
  font-size: 13px;
  font-weight: 700;
}

.side-note h3 {
  margin: 1px 0 3px;
  font-size: 12px;
  letter-spacing: -0.01em;
}

.side-note p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

/* Editor */
.editor-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: -1px;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 17px 12px 15px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--brand);
}

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.editor-badge {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.editor-badge.is-ready {
  border-color: color-mix(in srgb, var(--success) 26%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.panel {
  min-height: 360px;
  padding: 22px;
}

.panel-loading {
  display: grid;
  gap: 18px;
  padding: 12px 2px;
}

.skeleton-head {
  display: flex;
  align-items: center;
  gap: 13px;
}

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 20%, var(--surface-3) 40%, var(--surface-2) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton.title { width: 38%; height: 18px; }
.skeleton.sub { width: 62%; height: 11px; margin-top: 8px; }
.skeleton.line { height: 42px; width: 100%; }
.skeleton.short { width: 68%; }

.form-section + .form-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-head h2,
.cover-head h2,
.custom-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.002em;
  line-height: 1.15;
}

.section-head p,
.cover-head p,
.custom-head p {
  max-width: 620px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.section-index {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 16px;
}

.field {
  min-width: 0;
}

.field.is-full {
  grid-column: 1 / -1;
}

.field-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 19px;
  margin-bottom: 6px;
}

.field-head label {
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.field-native {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.field-dirty {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
  flex: 0 0 auto;
}

.field-clear {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.field:hover .field-clear,
.field:focus-within .field-clear {
  opacity: 1;
}

.field-clear:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.field-clear .icon {
  width: 12px;
  height: 12px;
}

.field-input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--field);
  color: var(--ink);
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.55;
}

.field-input:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field-input:focus,
.field textarea:focus,
.field select:focus {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}

.field-input::placeholder,
.field textarea::placeholder {
  color: var(--faint);
  opacity: 0.82;
}

.field-input[type="date"] {
  min-height: 40px;
  color-scheme: inherit;
}

.field-input[type="number"] {
  font-family: var(--mono);
}

.field.is-dirty .field-input,
.field.is-dirty textarea {
  border-color: color-mix(in srgb, var(--brand) 38%, var(--line));
}

.field-helper {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 5px 1px 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.4;
}

.field-error {
  margin: 5px 1px 0;
  color: var(--danger);
  font-size: 10.5px;
}

/* Cover / thumbnail */
.cover-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.cover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.cover-badge {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.cover-badge.is-ok {
  border-color: color-mix(in srgb, var(--success) 28%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.cover-badge.is-set {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
  background: var(--brand-soft);
  color: var(--brand);
}

.cover-badge.is-remove {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.cover-body {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.cover-preview {
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 0 0 / 14px 14px,
    linear-gradient(45deg, var(--surface-2) 25%, var(--surface) 25%, var(--surface) 75%, var(--surface-2) 75%) 7px 7px / 14px 14px;
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-placeholder {
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 12px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.cover-placeholder .icon {
  width: 26px;
  height: 26px;
  color: var(--faint);
}

.cover-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
}

.cover-hint {
  max-width: 460px;
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
}

.button.danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}

.custom-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.custom-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.custom-list {
  display: grid;
  gap: 8px;
}

.custom-empty {
  padding: 15px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  color: var(--faint);
  font-size: 11.5px;
  text-align: center;
}

.custom-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1.4fr) 34px;
  gap: 8px;
  align-items: center;
}

.custom-row input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--field);
  font-size: 12px;
  outline: none;
}

.custom-row input:focus {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent);
}

.custom-key {
  font-family: var(--mono);
  font-size: 11px !important;
}

.custom-delete {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--faint);
}

.custom-delete:hover {
  border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.custom-delete .icon {
  width: 14px;
  height: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.42;
}

.button.primary {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--brand) 70%, transparent);
}

.button.primary:hover:not(:disabled) {
  background: var(--brand-hover);
}

.button.ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink-soft);
}

.button.ghost:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.button.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 11px;
}

.button .icon {
  width: 15px;
  height: 15px;
}

/* Action bar */
.action-bar {
  position: relative;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin: 0 10px 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: color-mix(in srgb, var(--surface) 91%, transparent);
  box-shadow: 0 -1px 0 var(--line), 0 18px 34px -26px rgba(23, 27, 36, 0.36);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.action-summary {
  display: flex;
  flex: 1 1 160px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.dirty-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}

.dirty-dot.is-dirty {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.output-name-wrap {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.output-name-wrap label {
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.output-name-field {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--field);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.output-name-field:focus-within {
  border-color: color-mix(in srgb, var(--brand) 50%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent);
}

.output-name-field input {
  width: 180px;
  min-width: 0;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 10px;
  outline: none;
}

.output-name-field input::placeholder {
  color: var(--faint);
}

.output-ext {
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-left: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  user-select: none;
  white-space: nowrap;
}

.action-buttons {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.progress {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 2px;
}

.progress-track {
  position: relative;
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--accent) 75%, var(--brand)));
  transition: width 240ms ease;
}

.progress-label {
  max-width: 58%;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Result */
.result-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--success) 24%, var(--line));
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 20%, transparent), transparent 42%),
    color-mix(in srgb, var(--success-soft) 72%, var(--surface));
  animation: rise-in 320ms ease both;
}

.result-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--success);
  color: var(--success-soft);
}

.result-icon .icon {
  width: 22px;
  height: 22px;
}

.result-copy h2 {
  margin: 0;
  font-size: 13.5px;
  letter-spacing: -0.01em;
}

.result-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.result-copy .result-warnings {
  margin-top: 6px;
  color: var(--warning);
  font-family: var(--sans);
  font-size: 10.5px;
}

.result-download {
  min-height: 36px;
}

.result-download.is-done {
  background: var(--surface);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 26%, var(--line));
}

/* Raw tab */
.raw-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.search-wrap {
  position: relative;
  flex: 1;
}

.search-wrap .icon {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 10px 12px 10px 33px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  font-size: 12px;
  outline: none;
}

.search-wrap input:focus {
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 9%, transparent);
}

.raw-count {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.raw-table-wrap {
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.raw-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.raw-table-wrap::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 999px;
}

.raw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.raw-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 11px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.raw-table td {
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.raw-table tr:last-child td {
  border-bottom: 0;
}

.raw-table tr:hover td {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.raw-table .raw-tag {
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.raw-table .raw-group {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  white-space: nowrap;
}

.raw-table .raw-value {
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 13px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--faint);
}

.empty-icon .icon {
  width: 25px;
  height: 25px;
}

.empty-state h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 600;
  color: var(--ink);
}

.empty-state p {
  max-width: 390px;
  margin: 7px 0 0;
  font-size: 12px;
}

.error-card {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--line));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--danger-soft) 72%, var(--surface));
}

.error-card .error-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
}

.error-card h2 {
  margin: 1px 0 4px;
  font-size: 13px;
}

.error-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.error-card + .form-root,
.error-card + .result-card {
  margin-top: 16px;
}

.error-body {
  min-width: 0;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.error-card pre {
  max-height: 130px;
  margin: 9px 0 0;
  padding: 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  white-space: pre-wrap;
  overflow: auto;
}

/* Support strip */
.support-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 0 74px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.support-item {
  display: flex;
  gap: 15px;
  padding: 25px 24px;
}

.support-item + .support-item {
  border-left: 1px solid var(--line);
}

.support-number {
  color: var(--brand);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.support-item h3 {
  margin: 0 0 4px;
  font-size: 12.5px;
  letter-spacing: -0.01em;
}

.support-item p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 34px;
}

.footer-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 11px;
}

.footer-inner p {
  margin: 0;
}

.footer-inner strong {
  color: var(--ink);
}

.footer-meta {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

/* Toast */
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--ink-soft);
  font-size: 11.5px;
  pointer-events: auto;
  animation: toast-in 220ms ease both;
}

.toast.is-error {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
}

.toast.is-success {
  border-color: color-mix(in srgb, var(--success) 30%, var(--line));
}

.toast .toast-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
}

.toast.is-error .toast-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.toast.is-success .toast-icon {
  background: var(--success-soft);
  color: var(--success);
}

.toast .icon {
  width: 12px;
  height: 12px;
}

.toast p {
  margin: 1px 0 0;
}

.toast.is-leaving {
  animation: toast-out 180ms ease both;
}

/* Animations */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -20% 0; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px) scale(0.98); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.is-spinning .icon {
  animation: spin 900ms linear infinite;
}

/* Responsive */
@media (max-width: 1080px) {
  .landing {
    gap: 40px;
    grid-template-columns: minmax(0, 1fr) minmax(350px, 0.9fr);
  }

  .output-name-wrap {
    display: flex;
  }

  .output-name-field {
    flex: 1;
  }

  .output-name-field input {
    flex: 1;
    width: auto;
  }
}

@media (max-width: 860px) {
  .landing {
    grid-template-columns: 1fr;
    gap: 34px;
    min-height: auto;
    padding: 34px 0 54px;
  }

  .hero-copy {
    max-width: 660px;
  }

  .drop-card {
    min-height: 360px;
  }

  .side-notes {
    grid-template-columns: 1fr;
  }

  .side-note.muted {
    display: none;
  }

  .support-strip {
    grid-template-columns: 1fr;
  }

  .support-item + .support-item {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    padding: 12px 0;
  }

  .brand-text small,
  .privacy-pill {
    display: none;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .landing {
    padding-top: 22px;
  }

  h1 {
    font-size: clamp(40px, 11.5vw, 56px);
    line-height: 1.0;
  }

  .lede {
    font-size: 14.5px;
  }

  .trust-row {
    gap: 12px;
    font-size: 11px;
  }

  .drop-card {
    min-height: 330px;
    padding: 32px 22px 25px;
    border-radius: 25px;
  }

  .drop-visual {
    transform: scale(0.88);
    margin-bottom: 10px;
  }

  .side-column {
    grid-template-columns: 1fr;
  }

  .file-card {
    grid-row: auto;
  }

  .preview-frame {
    min-height: 170px;
  }

  .panel {
    padding: 17px 14px;
  }

  .editor-head {
    padding: 0 14px;
  }

  .editor-badge {
    display: none;
  }

  .tab {
    padding: 15px 9px 13px;
  }

  .custom-row {
    grid-template-columns: 1fr 34px;
  }

  .custom-row .custom-key {
    grid-column: 1 / -1;
  }

  .cover-body {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 13px;
  }

  .cover-preview {
    width: 96px;
    height: 96px;
    border-radius: 12px;
  }

  .action-bar {
    margin: 0 6px 6px;
    padding: 11px;
  }

  .action-summary,
  .output-name-wrap,
  .action-buttons {
    flex: 1 1 100%;
  }

  .action-buttons {
    flex-direction: column-reverse;
    margin-left: 0;
  }

  .action-buttons .button {
    width: 100%;
  }

  .output-name-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .output-name-field {
    width: 100%;
  }

  .output-name-field input {
    width: 100%;
  }

  .result-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .result-download {
    grid-column: 1 / -1;
    width: 100%;
  }

  .footer-inner {
    flex-direction: column;
    gap: 7px;
  }

  .toast-region {
    right: 14px;
    bottom: 14px;
    width: calc(100vw - 28px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Batch processing */
.batch-drop-card .drop-visual {
  transform: scale(0.92);
}

.batch-workspace,
.batch-detail {
  margin: 0 auto 52px;
}

.batch-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 10px 0 22px;
  border-bottom: 1px solid var(--line);
}

.batch-head h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.5rem, 5vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.batch-lede {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.batch-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.batch-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 12px;
}

.batch-stat {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.batch-stat strong {
  display: block;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.batch-stat span {
  color: var(--muted);
  font-size: 12px;
}

.batch-limits {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.batch-limit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 12px;
}

.batch-limit span:first-child {
  font-weight: 700;
}

.batch-limit span:nth-child(2),
.batch-limit span:nth-child(3) {
  color: var(--muted);
}

.batch-limit.is-over {
  border-color: rgba(185, 28, 28, 0.45);
  background: var(--danger-soft);
}

.batch-limit-total {
  background: var(--surface-3);
}

.batch-limit-messages {
  grid-column: 1 / -1;
  color: var(--danger);
  font-size: 12px;
}

.batch-limit-messages p {
  margin: 4px 0 0;
}

.batch-limit-messages .is-ok {
  color: var(--success);
}

.batch-groups {
  display: grid;
  gap: 12px;
}

.batch-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.batch-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.batch-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.batch-group-chevron {
  color: var(--muted);
  transform: rotate(90deg);
  transition: transform 180ms ease;
}

.batch-group-toggle[aria-expanded="false"] .batch-group-chevron {
  transform: rotate(0deg);
}

.batch-group-title {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.batch-group-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.batch-group-select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  user-select: none;
}

.batch-group-body {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
}

.batch-file-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border-right: 1px solid var(--line);
  max-height: 620px;
  overflow: auto;
}

.batch-file {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
}

.batch-file.is-error {
  border-color: rgba(185, 28, 28, 0.35);
  background: var(--danger-soft);
}

.batch-file.is-skipped {
  opacity: 0.72;
}

.batch-file-check {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
}

.batch-file-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.batch-file-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
}

.batch-file-copy {
  min-width: 0;
}

.batch-file-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.batch-file-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.batch-file-status {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--muted);
}

.batch-file-status.is-ready { background: var(--accent-soft); color: var(--success); }
.batch-file-status.is-error { background: var(--danger-soft); color: var(--danger); }
.batch-file-status.is-skipped { background: var(--warning-soft); color: var(--warning); }
.batch-file-status.is-busy { background: var(--brand-soft); color: var(--brand); }

.batch-file-progress {
  grid-column: 1 / -1;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.batch-file-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 180ms ease;
}

.batch-group-form {
  padding: 14px;
}

.batch-form-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}

.batch-form-head h2 {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.batch-form-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.batch-field {
  grid-template-columns: 1fr auto;
}

.batch-field .field-head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.batch-field .field-input,
.batch-field textarea {
  grid-column: 1 / -1;
}

.batch-remove-toggle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.batch-remove-toggle.is-active {
  border-color: rgba(185, 28, 28, 0.4);
  background: var(--danger-soft);
  color: var(--danger);
}

.batch-field.is-removing .field-input,
.batch-field.is-removing textarea {
  opacity: 0.55;
  text-decoration: line-through;
}

.batch-group-note {
  padding: 16px;
  color: var(--muted);
}

.batch-footer {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
}

.batch-footer-copy strong,
.batch-footer-copy span {
  display: block;
}

.batch-footer-copy strong {
  letter-spacing: -0.02em;
}

.batch-footer-copy span {
  color: var(--muted);
  font-size: 12px;
}

.batch-progress {
  margin-top: 12px;
}

.batch-detail-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.batch-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.batch-detail-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand);
}

.batch-detail-copy h2 {
  margin: 0 0 5px;
  font-size: 18px;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.batch-detail-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.batch-detail-status {
  margin-top: 6px !important;
  font-weight: 750;
}

.batch-detail-include {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.batch-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 18px 0;
  border-bottom: 1px solid var(--line);
}

.batch-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 10px 12px;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.batch-tab.is-active {
  color: var(--ink);
  border-color: var(--brand);
}

.batch-detail-panel {
  padding: 18px;
}

/* Pratinjau file di detail batch */
.batch-preview {
  padding: 18px 18px 0;
}

.batch-preview[hidden] {
  display: none;
}

.batch-preview-inner {
  display: grid;
  gap: 10px;
}

.batch-preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 180px;
  max-height: min(52vh, 520px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 0 0 / 18px 18px,
    linear-gradient(45deg, var(--surface-2) 25%, var(--surface) 25%, var(--surface) 75%, var(--surface-2) 75%) 9px 9px / 18px 18px;
}

.batch-preview-stage--image {
  --batch-preview-default-ratio: 4 / 3;
  --batch-preview-default-ratio-num: 1.3333;
}

.batch-preview-stage--video {
  --batch-preview-default-ratio: 16 / 9;
  --batch-preview-default-ratio-num: 1.7778;
  background: #0b0b10;
}

.batch-preview-stage--image,
.batch-preview-stage--video {
  --batch-preview-cap: min(52vh, 520px);
  width: min(100%, calc(var(--batch-preview-cap) * var(--batch-preview-ratio-num, var(--batch-preview-default-ratio-num))));
  aspect-ratio: var(--batch-preview-ratio, var(--batch-preview-default-ratio));
  max-height: var(--batch-preview-cap);
  margin-inline: auto;
  min-height: 0;
}

.batch-preview-stage--pdf {
  height: min(60vh, 640px);
  min-height: 320px;
  max-height: none;
  background: #0b0b10;
}

.batch-preview-stage img,
.batch-preview-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.batch-preview-stage--image img,
.batch-preview-stage--video video {
  position: absolute;
  inset: 0;
}

.batch-preview-stage video {
  background: #000;
}

.batch-preview-stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.batch-preview-stage--audio {
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  justify-items: stretch;
  min-height: 0;
  max-height: none;
  padding: 18px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
}

.batch-preview-cover {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 168px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 0 0 / 14px 14px,
    linear-gradient(45deg, var(--surface-2) 25%, var(--surface) 25%, var(--surface) 75%, var(--surface-2) 75%) 7px 7px / 14px 14px;
  color: var(--faint);
  font-size: 10px;
  text-align: center;
}

.batch-preview-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.batch-preview-cover .icon {
  width: 26px;
  height: 26px;
}

.batch-preview-audio-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.batch-preview-audio-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.batch-preview-audio-copy audio {
  width: 100%;
}

.batch-preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 12px;
}

.batch-preview-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-weight: 700;
}

.batch-preview-kind .icon {
  width: 15px;
  height: 15px;
  color: var(--brand);
}

.batch-preview-detail {
  color: var(--muted);
}

.batch-preview-open {
  margin-left: auto;
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.batch-preview-open:hover {
  text-decoration: underline;
}

.batch-preview-note {
  margin: 0;
  color: var(--faint);
  font-size: 11.5px;
}

.batch-preview-fallback {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  max-width: 560px;
  padding: 22px;
  text-align: left;
}

.batch-preview-fallback-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--brand);
}

.batch-preview-fallback h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.batch-preview-fallback p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.batch-preview-fallback a {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 700px) {
  .batch-preview {
    padding: 14px 14px 0;
  }

  .batch-preview-stage--image,
  .batch-preview-stage--video {
    --batch-preview-cap: min(42vh, 360px);
  }

  .batch-preview-stage--pdf {
    height: min(58vh, 460px);
    min-height: 280px;
  }

  .batch-preview-stage--audio {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .batch-preview-cover {
    width: 112px;
  }

  .batch-preview-open {
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .batch-preview-stage--audio {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 12px;
  }

  .batch-preview-audio-copy {
    width: 100%;
  }

  .batch-preview-cover {
    width: 132px;
  }
}

.batch-info-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px 18px;
  margin: 0;
}

.batch-info-grid dt {
  color: var(--muted);
  font-size: 12px;
}

.batch-info-grid dd {
  margin: 0;
  font-weight: 650;
}

.batch-warning-list,
.batch-output-note,
.batch-raw-note {
  margin-top: 16px;
}

.batch-warning-list {
  border-left: 3px solid var(--warning);
  padding-left: 12px;
  color: var(--warning);
}

.batch-warning-list h3,
.batch-output-note h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.batch-warning-list p {
  margin: 4px 0;
}

.batch-output-note {
  display: flex;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--success);
}

.batch-raw-note {
  color: var(--muted);
  font-size: 13px;
}

.batch-raw-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.batch-raw-toolbar .raw-count {
  margin-right: auto;
}

.batch-lock {
  color: var(--faint);
}

.raw-table tr.is-locked td {
  color: var(--faint);
}

@media (max-width: 980px) {
  .batch-head,
  .batch-group-body {
    grid-template-columns: 1fr;
  }

  .batch-file-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: none;
  }

  .batch-summary,
  .batch-limits {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .batch-head-actions {
    justify-content: flex-start;
  }

  .batch-footer,
  .batch-detail-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .batch-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .batch-info-grid {
    grid-template-columns: 1fr;
  }
}

.batch-groups.is-disabled {
  opacity: 0.68;
  pointer-events: none;
}

.batch-workspace {
  border-radius: 18px;
}

.batch-workspace.is-dragging {
  outline: 2px dashed var(--brand);
  outline-offset: -10px;
  background: color-mix(in srgb, var(--brand-soft) 45%, transparent);
}

/* Jeda kecil di antara bilah atas dan header proses massal, biar tombol "Kembali"
   tidak menempel langsung ke bawahnya. */
.batch-workspace > .workspace-top {
  margin-bottom: 26px;
}

/* Header route nav */
.header-inner {
  gap: 18px;
}

.header-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.header-link .nav-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.header-link:hover {
  color: var(--ink);
}

body[data-page="single"] .header-link[data-nav="single"],
body[data-page="batch"] .header-link[data-nav="batch"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Home: memilih cara kerja */
.landing-home {
  grid-template-columns: minmax(0, 0.86fr) minmax(420px, 1.14fr);
}

.mode-cards {
  display: grid;
  gap: 14px;
  align-content: center;
}

.mode-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 16px;
  padding: 20px 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl, 20px);
  background:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(160deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 92%, transparent));
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.mode-card > .mode-card-kicker,
.mode-card > h2,
.mode-card > p,
.mode-card > .mode-card-meta,
.mode-card > .mode-card-cta {
  grid-column: 2;
  min-width: 0;
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: var(--shadow-card);
}

.mode-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.mode-card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
}

.mode-card-icon svg {
  width: 24px;
  height: 24px;
}

.mode-card-kicker {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mode-card h2 {
  margin: 3px 0 7px;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.mode-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.mode-card-meta {
  display: block;
  margin-top: 10px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.mode-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 750;
}

.mode-card-cta svg {
  width: 16px;
  height: 16px;
  transition: transform 160ms ease;
}

.mode-card:hover .mode-card-cta svg {
  transform: translateX(4px);
}

.mode-card-accent {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong));
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--brand) 22%, transparent) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(160deg, color-mix(in srgb, var(--brand-soft) 88%, transparent), color-mix(in srgb, var(--surface-2) 92%, transparent));
}

.mode-card-accent .mode-card-icon {
  background: var(--brand);
  color: var(--brand-ink);
}

.hero-crosslink {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hero-crosslink a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  padding-bottom: 1px;
}

.hero-crosslink a:hover {
  border-bottom-color: var(--brand);
}

/* Batch: tombol tambah file di dalam grup */
.batch-status-full {
  flex: 1;
}

.batch-add-tile {
  display: grid;
  place-items: center;
  gap: 4px;
  width: 100%;
  padding: 16px 12px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.batch-add-tile span {
  font-size: 13px;
  font-weight: 700;
}

.batch-add-tile small {
  font-size: 11px;
  color: var(--faint);
}

.batch-add-tile:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: color-mix(in srgb, var(--brand-soft) 45%, transparent);
}

.batch-add-tile:hover small {
  color: var(--brand);
}

.batch-add-tile:disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

@media (max-width: 980px) {
  .landing-home {
    grid-template-columns: 1fr;
  }

  .mode-cards {
    grid-template-columns: 1fr;
  }
}

/* Header saja butuh wrap di tablet agar nav tidak terpotong */
@media (min-width: 701px) and (max-width: 980px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .header-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }
}

/* Theme transition: morphing toggle icon */
.icon-button {
  position: relative;
  overflow: hidden;
}

.theme-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity 340ms cubic-bezier(.34, 1.4, .64, 1), transform 340ms cubic-bezier(.34, 1.4, .64, 1);
}

.theme-icon svg {
  width: 20px;
  height: 20px;
}

html[data-theme="light"] .theme-icon-sun,
html[data-theme="dark"] .theme-icon-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(.55);
}

html[data-theme="light"] .theme-icon-moon,
html[data-theme="dark"] .theme-icon-sun {
  opacity: 1;
  transform: none;
}

/* Theme transition: circular reveal (View Transitions API) */
::view-transition-old(root) {
  animation: none;
  z-index: 0;
}

::view-transition-new(root) {
  animation: theme-reveal 560ms cubic-bezier(.4, 0, .2, 1);
  clip-path: circle(150% at var(--vt-x, 88%) var(--vt-y, 48px));
  mix-blend-mode: normal;
  z-index: 1;
}

@keyframes theme-reveal {
  from {
    clip-path: circle(0 at var(--vt-x, 88%) var(--vt-y, 48px));
  }
  to {
    clip-path: circle(150% at var(--vt-x, 88%) var(--vt-y, 48px));
  }
}

/* Theme transition: color crossfade fallback (no View Transitions API) */
html.theme-anim body,
html.theme-anim body * {
  transition: background-color 450ms ease, border-color 450ms ease, box-shadow 450ms ease, color 450ms ease !important;
}

@media (prefers-reduced-motion: reduce) {
  .theme-icon {
    transition: opacity 120ms linear, transform 120ms linear;
  }
}


/* ===== Mobile (maks. 700px): bottom navigation bar kaca + penyempurnaan sentuh ===== */
@media (max-width: 700px) {
  :root {
    --bottom-nav-h: 76px;
  }

  body {
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  }

  /* Nav mode berpindah menjadi bar kaca mengambang di bawah layar */
  .header-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    display: flex;
    align-items: stretch;
    gap: 6px;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
    border-radius: 26px;
    background: color-mix(in srgb, var(--surface-2) 74%, transparent);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    box-shadow: 0 18px 48px -16px rgba(8, 10, 18, 0.55), inset 0 1px 0 color-mix(in srgb, #ffffff 38%, transparent);
  }

  .header-nav .header-link {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    border: 1px solid transparent;
    border-radius: 20px;
    background: transparent;
    font-size: 12.5px;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
  }

  .header-nav .header-link .nav-icon {
    width: 19px;
    height: 19px;
  }

  .header-nav .header-link:hover {
    color: var(--ink);
  }

  .header-nav .header-link:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
  }

  body[data-page="single"] .header-nav .header-link[data-nav="single"],
  body[data-page="batch"] .header-nav .header-link[data-nav="batch"] {
    background: color-mix(in srgb, var(--brand) 17%, var(--surface) 83%);
    border-color: color-mix(in srgb, var(--brand) 38%, transparent);
    color: var(--brand);
    box-shadow: none;
  }

  /* Toast & bar aksi tempel di atas bottom nav */
  .toast-region {
    right: 12px;
    bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    width: calc(100vw - 24px);
  }

  .action-bar {
    position: sticky;
    bottom: calc(var(--bottom-nav-h) + 10px);
    z-index: 25;
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 -1px 0 var(--line), 0 18px 34px -26px rgba(23, 27, 36, 0.36);
  }

  .batch-footer {
    bottom: calc(var(--bottom-nav-h) + 12px);
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 -1px 0 var(--line), 0 18px 34px -26px rgba(23, 27, 36, 0.36);
  }

  /* Tabs tidak terpotong di layar sempit */
  .tabs {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 46px;
  }

  /* Target sentuh minimal */
  .button,
  .button.small {
    min-height: 42px;
  }

  .icon-button,
  .back-button,
  .text-button {
    min-height: 44px;
  }

  .text-button {
    display: inline-flex;
    align-items: center;
    padding-inline: 10px;
  }

  .preview-toggle {
    min-height: 42px;
  }

  /* Hindari auto-zoom iOS pada field */
  .field-input,
  .custom-key,
  .custom-value,
  .search-wrap input,
  .output-name-field input,
  input[type="date"],
  input[type="datetime-local"],
  input[type="time"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
  }

  /* Pratinjau menempel lebih rapat */
  .preview-dock {
    top: 8px;
  }

  /* Pinned lebih ketat di smartphone: media menyusut, rasio tetap terjaga */
  .preview-dock.is-pinned .file-card:not(.is-minimized) .preview-frame--video,
  .preview-dock.is-pinned .file-card:not(.is-minimized) .preview-frame--image {
    --preview-cap: min(20vh, 180px);
  }

  /* Landing / dropzone lebih ringkas */
  .drop-card {
    min-height: 280px;
  }

  .drop-visual {
    transform: scale(0.82);
    margin-bottom: 4px;
  }

  /* Batch: aksi header full width */
  .batch-head-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .batch-head-actions .button {
    width: 100%;
  }

  .workspace-status {
    font-size: 9.5px;
  }

  /* Target sentuh lebih besar untuk checkbox dan baris file */
  .batch-file-main {
    min-height: 44px;
  }

  .batch-file-check {
    width: 44px;
    height: 44px;
  }

  .batch-file-checkbox,
  .batch-group-select-input {
    width: 22px;
    height: 22px;
    accent-color: var(--brand);
  }
}

/* Lansekap pendek: bar bawah dipadatkan */
@media (max-height: 480px) and (max-width: 900px) {
  .header-nav .header-link {
    min-height: 44px;
  }

  .header-nav .header-link .nav-icon {
    width: 17px;
    height: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-nav .header-link {
    transition: none;
  }
}
