/* The Journal (journal.fadlanamada.web.id): menu, entry pages, dialogs, Markdown reading view.
   Look: calm warm-grey paper, muted clay accent, soft filled icon tiles, one highly legible typeface (Atkinson Hyperlegible). */
/* Atkinson Hyperlegible Next + Mono (Braille Institute, SIL OFL 1.1, licence in fonts/): drawn so look-alike letters
   (I l 1, O 0, rn m, b d p q) stay distinct. Self-hosted: no request ever goes to Google. Variable weight 200-800. */
@font-face { font-family: 'Atkinson Hyperlegible Next'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(/assets/journal/fonts/atkinson-hyperlegible-next-latin-wght-normal.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: 'Atkinson Hyperlegible Next'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(/assets/journal/fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.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-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Atkinson Hyperlegible Next'; font-style: italic; font-weight: 200 800; font-display: swap; src: url(/assets/journal/fonts/atkinson-hyperlegible-next-latin-wght-italic.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: 'Atkinson Hyperlegible Next'; font-style: italic; font-weight: 200 800; font-display: swap; src: url(/assets/journal/fonts/atkinson-hyperlegible-next-latin-ext-wght-italic.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-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Atkinson Hyperlegible Mono'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(/assets/journal/fonts/atkinson-hyperlegible-mono-latin-wght-normal.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: 'Atkinson Hyperlegible Mono'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(/assets/journal/fonts/atkinson-hyperlegible-mono-latin-ext-wght-normal.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-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
:root {
  --bg: #f6f5f0;
  --panel: #fdfcfa;
  --panel-2: #f0eee7;
  --hover: #eeece4;
  --line: rgba(43, 41, 36, 0.09);
  --line-strong: rgba(43, 41, 36, 0.17);
  --ink: #2c2b28;
  --ink-2: #4a4843;
  --muted: #7b7972;
  --accent: #a5664f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(165, 102, 79, 0.12);
  --danger: #a8483f;
  --shadow: 0 1px 2px rgba(43, 41, 36, 0.035), 0 1px 6px rgba(43, 41, 36, 0.03);
  --shadow-lg: 0 12px 40px rgba(43, 41, 36, 0.13), 0 2px 8px rgba(43, 41, 36, 0.05);
  --radius: 14px;
  --sans: 'Atkinson Hyperlegible Next', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: var(--sans); /* headings use the same legible face, just heavier */
  --mono: 'Atkinson Hyperlegible Mono', ui-monospace, 'SF Mono', Consolas, Menlo, monospace;
  --bar: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #232321;
    --panel: #2c2c2a;
    --panel-2: #282826;
    --hover: #343432;
    --line: rgba(240, 238, 230, 0.08);
    --line-strong: rgba(240, 238, 230, 0.16);
    --ink: #ebe9e2;
    --ink-2: #d2cfc6;
    --muted: #9c998f;
    --accent: #c98c74;
    --accent-ink: #1f1e1c;
    --accent-soft: rgba(201, 140, 116, 0.16);
    --danger: #d9776d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

/* colour codes (muted, calm): --c the colour itself, --ct readable text/icon in that colour, --tint the soft tile */
.c-clay { --c: #b87a63; }
.c-amber { --c: #b39150; }
.c-olive { --c: #7f8c5e; }
.c-teal { --c: #5d8c83; }
.c-sky { --c: #6b89ab; }
.c-indigo { --c: #7d7aae; }
.c-plum { --c: #94749b; }
.c-rose { --c: #b07384; }
.c-stone { --c: #8c877e; }
.c-ink { --c: #55524c; }
:is(.c-clay, .c-amber, .c-olive, .c-teal, .c-sky, .c-indigo, .c-plum, .c-rose, .c-stone, .c-ink) {
  --ct: color-mix(in oklab, var(--c), black 22%);
  --tint: color-mix(in oklab, var(--c) 15%, var(--panel));
}
@media (prefers-color-scheme: dark) {
  .c-ink { --c: #8a867e; }
  :is(.c-clay, .c-amber, .c-olive, .c-teal, .c-sky, .c-indigo, .c-plum, .c-rose, .c-stone, .c-ink) {
    --ct: color-mix(in oklab, var(--c), white 28%);
    --tint: color-mix(in oklab, var(--c) 22%, var(--panel));
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.j-muted { color: var(--muted); }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.j-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.j-btn:hover { background: var(--hover); }
.j-btn:active { transform: scale(0.98); }
.j-btn .ic { width: 18px; height: 18px; }
.j-btn--primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.j-btn--primary:hover { background: color-mix(in oklab, var(--accent), black 8%); }
.j-btn--danger { background: var(--danger); border-color: transparent; color: #fff; }
.j-btn--danger:hover { background: color-mix(in oklab, var(--danger), black 8%); }
.j-btn--wide { width: 100%; min-height: 46px; }
.j-btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.j-iconbtn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.j-iconbtn:hover { background: var(--hover); color: var(--ink); }
.j-iconbtn:focus-visible, .j-btn:focus-visible, .j-tab:focus-visible, .j-item__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- tiles and badges ---------- */
.j-tile {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--tint, var(--panel-2)); color: var(--ct, var(--ink-2));
}
.j-tile .ic { width: 22px; height: 22px; stroke-width: 1.8; }
/* the uploaded page's own favicon, on a soft tile of the entry's colour */
.j-tile--img img { width: 62%; height: 62%; object-fit: contain; display: block; }
.j-picker__btn--img img { width: 26px; height: 26px; object-fit: contain; }
.j-badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; flex: none;
}

/* ---------- login / 404 ---------- */
.j-login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.j-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.j-login__card { width: min(380px, 100%); padding: 32px 24px 24px; text-align: center; }
.j-login__tile { width: 52px; height: 52px; border-radius: 15px; }
.j-login__tile .ic { width: 26px; height: 26px; }
.j-login__title { font: 700 28px/1.15 var(--serif); margin: 16px 0 6px; letter-spacing: -0.01em; }
.j-login__card .j-muted { margin: 0 0 20px; }
.j-form { display: grid; gap: 14px; text-align: left; }
.j-alert { margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; background: color-mix(in oklab, var(--danger) 12%, transparent); color: var(--danger); font-size: 14px; text-align: left; }

/* ---------- form fields ---------- */
.j-field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.j-field > span, .j-field > legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0; }
.j-field input, .j-field select, .j-addr {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--bg); font-size: 16px;
}
.j-field input:focus, .j-field select:focus, .j-addr:focus-within { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.j-hint { font-size: 12.5px; color: var(--muted); }
.j-addr { display: flex; align-items: center; padding: 0 4px 0 12px; gap: 2px; }
.j-addr__base { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.j-addr input { border: 0; background: transparent; padding: 0; min-height: 42px; box-shadow: none !important; flex: 1; min-width: 60px; }
.j-addr .j-iconbtn { width: 36px; height: 36px; }

/* ---------- app (menu) ---------- */
.j-shell { width: min(760px, 100%); margin: 0 auto; padding: 8px 16px calc(40px + env(safe-area-inset-bottom)); }
.j-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 12px; }
.j-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font: 700 27px/1 var(--serif); letter-spacing: -0.02em; }
.j-brand__tile { width: 38px; height: 38px; border-radius: 11px; }
.j-brand__tile .ic { width: 20px; height: 20px; }
.j-top__actions { display: flex; align-items: center; gap: 4px; }
.j-search {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; padding: 0 14px; min-height: 46px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); color: var(--muted);
}
.j-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.j-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); min-height: 44px; }
.j-search input::-webkit-search-cancel-button { cursor: pointer; }
.j-kbd { font: 600 12px/1 var(--sans); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 7px; }
.j-search:focus-within .j-kbd, .j-search:has(input:not(:placeholder-shown)) .j-kbd { display: none; }
@media (hover: none) { .j-kbd { display: none; } }
.j-count { font-size: 13px; color: var(--muted); margin: -4px 4px 2px; }

.j-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.j-tab {
  display: inline-flex; align-items: center; gap: 7px; flex: none; height: 32px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.j-tab:hover { background: var(--hover); }
.j-tab__dot { width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.j-tab__n { color: var(--muted); font-weight: 500; font-size: 12px; }
.j-tab[aria-pressed='true'] { background: var(--tint); border-color: color-mix(in oklab, var(--c) 45%, transparent); color: var(--ct); }
.j-tab--all[aria-pressed='true'] { background: var(--ink-2); border-color: var(--ink-2); color: var(--panel); }
.j-tab--all[aria-pressed='true'] .j-tab__n, .j-tab[aria-pressed='true'] .j-tab__n { color: inherit; opacity: 0.75; }
.j-tab--edit { padding: 0; width: 32px; justify-content: center; color: var(--muted); border-style: dashed; background: transparent; }
.j-tab--edit .ic { width: 16px; height: 16px; }

.j-list { display: grid; gap: 10px; }
.j-item {
  position: relative; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px;
  padding: 12px 8px 12px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.j-item:hover { border-color: color-mix(in oklab, var(--c) 40%, var(--line)); box-shadow: 0 2px 10px rgba(43, 41, 36, 0.06); }
.j-item.is-new { animation: j-flash 1.8s ease-out; }
@keyframes j-flash { 0%, 30% { background: var(--tint); border-color: color-mix(in oklab, var(--c) 55%, transparent); } }
.j-item__link { position: static; display: contents; text-decoration: none; }
.j-item__link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.j-item__text { display: grid; gap: 3px; min-width: 0; }
.j-item__title { font-weight: 700; font-size: 15.5px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.j-item__sub { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--muted); font-size: 13px; }
.j-item__when { flex: none; white-space: nowrap; }
.j-item__desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--ink-2); font-size: 13.5px; }
.j-item__sub { margin-top: 2px; }
.j-item__snip { font-size: 13px; color: var(--ink-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.j-item__snip mark, .j-item__title mark { background: color-mix(in oklab, var(--accent) 25%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.j-item:has(.j-item__link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.j-item > .j-item__link > .j-tile { grid-column: 1; grid-row: 1; }
.j-item__text { grid-column: 2; grid-row: 1; }
.j-item__more { grid-column: 3; grid-row: 1; position: relative; z-index: 1; width: 36px; height: 36px; color: var(--muted); }
.j-item__chev { grid-column: 4; grid-row: 1; color: var(--ct); display: grid; place-items: center; }
.j-item__chev .ic { width: 22px; height: 22px; stroke-width: 2; }
.j-empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.j-empty .j-tile { width: 52px; height: 52px; margin-bottom: 12px; }
.j-empty h2 { font: 700 21px/1.2 var(--serif); color: var(--ink); margin: 0 0 6px; }
.j-empty p { margin: 0 auto; max-width: 34ch; }
.j-section-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 10px 4px 0; }
.j-note { font-size: 13px; color: var(--muted); padding: 4px; }
.j-dropzone { position: fixed; inset: 12px; z-index: 900; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 22px; background: color-mix(in oklab, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); pointer-events: none; }
.j-dropzone div { display: grid; justify-items: center; gap: 10px; font: 700 21px/1.3 var(--serif); color: var(--ink); }
.j-dropzone .ic { width: 34px; height: 34px; color: var(--accent); }
/* password field with a show/hide button */
.j-pass { position: relative; display: block; }
.j-pass input { padding-right: 48px; }
.j-pass .j-iconbtn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }

/* ---------- entry page ---------- */
.j-entry-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.j-entry-shell--html { height: 100dvh; }
.j-bar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--bar) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0;
  display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr); align-items: center; gap: 8px;
  background: color-mix(in oklab, var(--bg) 88%, transparent); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.j-bar__side { display: flex; align-items: center; gap: 2px; min-width: 0; }
.j-bar__side--end { justify-content: flex-end; }
.j-bar__title { display: flex; align-items: center; gap: 10px; min-width: 0; justify-content: center; }
.j-bar__title .j-tile { width: 30px; height: 30px; border-radius: 9px; }
.j-bar__title .j-tile .ic { width: 17px; height: 17px; }
.j-bar__name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.j-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.j-frame { flex: 1; width: 100%; border: 0; background: #fff; display: block; }
.j-pdf { flex: 1; background: var(--panel-2); }
.j-pdf .viewer { width: min(980px, 100%); margin: 0 auto; display: flex; flex-direction: column; align-items: center; padding: 16px 0 40px; gap: 12px; }
.viewer__page { width: 100%; position: relative; background: #fff; box-shadow: var(--shadow); }
.viewer__page canvas { width: 100%; height: 100%; display: block; }
.viewer__page.is-loading { background: linear-gradient(110deg, #ecebe5 30%, #f7f6f2 50%, #ecebe5 70%) 0 0 / 300% 100%; animation: j-shimmer 1.4s linear infinite; }
@keyframes j-shimmer { to { background-position: -150% 0; } }
.j-doc__loading { text-align: center; padding: 48px 16px; }

/* ---------- Markdown reading view ---------- */
.j-doc { width: min(700px, 100%); margin: 0 auto; padding: 40px 20px calc(80px + env(safe-area-inset-bottom)); font: 400 18px/1.7 var(--sans); color: var(--ink); overflow-wrap: break-word; }
.j-doc__meta { font: 500 13px/1.4 var(--sans); color: var(--muted); margin: 0 0 28px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.j-doc h1, .j-doc h2, .j-doc h3, .j-doc h4, .j-doc h5, .j-doc h6 { font-family: var(--serif); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; margin: 1.9em 0 0.55em; scroll-margin-top: calc(var(--bar) + 16px); }
.j-doc > :first-child, .j-doc .j-doc__meta + * { margin-top: 0; }
.j-doc > h1:first-child { margin-bottom: 0.35em; }
.j-doc h1 { font-size: 2em; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.6em; }
.j-doc h2 { font-size: 1.45em; font-weight: 700; padding-bottom: 0.3em; border-bottom: 1px solid var(--line); }
.j-doc h3 { font-size: 1.22em; }
.j-doc h4 { font-size: 1.05em; }
.j-doc h5, .j-doc h6 { font-size: 0.95em; color: var(--ink-2); }
.j-doc p, .j-doc ul, .j-doc ol, .j-doc blockquote, .j-doc pre, .j-doc table, .j-doc figure, .j-doc .j-table, .j-doc .j-callout, .j-doc hr { margin: 0 0 1.1em; }
.j-doc a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.j-doc a:hover { text-decoration-color: currentColor; }
.j-doc strong { font-weight: 700; }
.j-doc mark { background: color-mix(in oklab, #f2c94c 45%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }
.j-doc ul, .j-doc ol { padding-left: 1.5em; }
.j-doc li { margin: 0.3em 0; padding-left: 0.2em; }
.j-doc li > ul, .j-doc li > ol { margin: 0.3em 0 0.4em; }
.j-doc li::marker { color: var(--muted); }
.j-doc li.j-task { list-style: none; margin-left: -1.4em; display: flex; gap: 0.55em; align-items: baseline; }
.j-doc li.j-task input { width: 1em; height: 1em; accent-color: var(--accent); transform: translateY(0.12em); flex: none; }
.j-doc li.j-task--done > span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.j-doc blockquote { margin-left: 0; padding: 0.1em 0 0.1em 1.1em; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.j-doc blockquote > :last-child { margin-bottom: 0; }
.j-doc hr { border: 0; height: 1px; background: var(--line-strong); margin: 2.4em auto; width: 40%; }
.j-doc img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 1.4em auto; }
.j-doc code { font: 0.84em/1.5 var(--mono); background: var(--panel-2); border: 1px solid var(--line); padding: 0.1em 0.38em; border-radius: 6px; }
.j-code { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel-2); }
.j-code__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 14px; border-bottom: 1px solid var(--line); font: 600 12px/1 var(--sans); color: var(--muted); }
.j-code__head .j-iconbtn { width: 32px; height: 32px; }
.j-code__head .ic { width: 16px; height: 16px; }
.j-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 13.5px/1.6 var(--mono); tab-size: 2; }
.j-code pre code { background: none; border: 0; padding: 0; font: inherit; }
.j-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.j-table table { border-collapse: collapse; width: 100%; font: 400 15px/1.5 var(--sans); margin: 0; }
.j-table th, .j-table td { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.j-table th { background: var(--panel-2); font-weight: 700; font-size: 13.5px; }
.j-table tr:last-child td { border-bottom: 0; }
.j-table tbody tr:nth-child(even) td { background: color-mix(in oklab, var(--panel-2) 45%, transparent); }
.j-callout { border-radius: 12px; padding: 12px 16px; border: 1px solid color-mix(in oklab, var(--c) 30%, transparent); background: color-mix(in oklab, var(--c) 9%, var(--bg)); font-size: 0.95em; }
.j-callout__title { display: flex; align-items: center; gap: 8px; font: 700 13px/1.4 var(--sans); color: var(--ct); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.j-callout__title .ic { width: 16px; height: 16px; }
.j-callout > :last-child { margin-bottom: 0; }
.j-toc { font: 500 14px/1.5 var(--sans); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 0 0 32px; background: var(--panel); }
.j-toc summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
.j-toc ol { list-style: none; padding: 0; margin: 8px 0 2px; }
.j-toc li { margin: 4px 0; }
.j-toc li.j-toc__sub { padding-left: 16px; }
.j-toc a { color: var(--muted); text-decoration: none; }
.j-toc a:hover { color: var(--accent); }
.j-doc .j-docnav { font: 500 14px/1.4 var(--sans); }

/* ---------- dialogs ---------- */
.j-dialog {
  width: min(560px, calc(100% - 32px)); max-height: min(88dvh, 860px); padding: 0; border: 1px solid var(--line);
  border-radius: 18px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden;
}
.j-dialog--sm { width: min(420px, calc(100% - 32px)); }
.j-dialog::backdrop { background: rgba(20, 20, 19, 0.38); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.j-dialog[open] { animation: j-pop 0.18s ease-out; }
@keyframes j-pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
.j-sheet { display: flex; flex-direction: column; max-height: inherit; margin: 0; }
.j-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 10px 10px 20px; }
.j-sheet__head h2 { margin: 0; font: 700 20px/1.25 var(--serif); letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; min-width: 0; }
.j-sheet__body { padding: 4px 20px 16px; overflow-y: auto; display: grid; gap: 16px; overscroll-behavior: contain; }
.j-sheet__foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
.j-sheet__foot .j-alert { flex: 1 1 100%; margin: 0; }
.j-sheet__foot .j-grow { flex: 1; }
.j-progress { flex: 1 1 100%; height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.j-progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.2s; }
.j-progress-label { flex: 1 1 100%; font-size: 13px; color: var(--muted); margin: -2px 0 0; }
.j-text { margin: 0; color: var(--ink-2); }

.j-drop {
  display: grid; justify-items: center; gap: 6px; padding: 24px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: 14px; background: var(--bg); color: var(--muted); transition: border-color 0.15s, background 0.15s;
}
.j-drop:hover, .j-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.j-drop .ic { width: 28px; height: 28px; color: var(--accent); }
.j-drop strong { color: var(--ink); font-size: 15px; }
.j-drop span { font-size: 13px; max-width: 40ch; }
.j-folderpick { margin: -8px 0 0; text-align: center; }
@media (hover: none) { .j-folderpick { display: none; } } /* phones can't pick folders */
.j-linkbtn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 8px; border-radius: 8px; color: var(--ct, var(--accent)); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.j-linkbtn:hover { background: var(--hover); }
.j-linkbtn .ic { width: 16px; height: 16px; }
.j-info { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14.5px; }
.j-info dt { color: var(--muted); font-weight: 600; }
.j-info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.j-info a { color: var(--accent); }
.j-info code { font: 13px var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.j-files summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
.j-files ul { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; max-height: 280px; overflow: auto; }
.j-files li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; font: 13px/1.4 var(--mono); border-bottom: 1px solid var(--line); }
.j-files li:last-child { border-bottom: 0; }
.j-files li a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.j-files li a:hover { color: var(--accent); }
.j-files li span { color: var(--muted); flex: none; }
.j-filesum { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.j-filesum__row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.j-filesum__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.j-filesum__meta { font-size: 13px; color: var(--muted); }
.j-filesum .j-grow { display: grid; min-width: 0; }
.j-filesum .j-iconbtn { margin-left: auto; }
.j-ident { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: end; }
.j-ident .j-tile { width: 46px; height: 46px; border: 0; cursor: pointer; position: relative; }
.j-ident .j-tile::after { content: ''; position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2373716b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z'/%3E%3C/svg%3E") center / 10px no-repeat; box-shadow: 0 0 0 1px var(--line-strong); }
.j-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.j-swatch { width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--c); cursor: pointer; display: grid; place-items: center; color: #fff; }
.j-swatch .ic { width: 16px; height: 16px; stroke-width: 3; opacity: 0; }
.j-swatch[aria-checked='true'] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); }
.j-swatch[aria-checked='true'] .ic { opacity: 1; }
.j-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.j-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.j-chip .ic { width: 14px; height: 14px; stroke-width: 2.6; display: none; }
.j-chip[aria-pressed='true'] { background: var(--tint); border-color: color-mix(in oklab, var(--c) 50%, transparent); color: var(--ct); }
.j-chip[aria-pressed='true'] .ic { display: block; }
.j-chip .j-tab__dot { display: inline-block; }
.j-chip[aria-pressed='true'] .j-tab__dot { display: none; }

/* icon picker */
.j-picker__search { position: sticky; top: 0; z-index: 1; background: var(--panel); padding-bottom: 4px; }
.j-picker__cat { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 6px 0 8px; }
.j-picker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.j-picker__btn { aspect-ratio: 1; border-radius: 12px; border: 1px solid transparent; background: var(--bg); cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.j-picker__btn:hover { background: var(--hover); color: var(--ink); }
.j-picker__btn[aria-pressed='true'] { background: color-mix(in oklab, var(--c) 30%, var(--panel)); color: var(--ct); }
.j-picker__btn .ic { width: 22px; height: 22px; }

/* tag manager */
.j-tagrow { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 6px; align-items: center; }
.j-tagrow input { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg); font-size: 16px; min-width: 0; }
.j-tagrow input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.j-tagrow .j-swatch { width: 28px; height: 28px; border-radius: 8px; }
.j-tagrow .j-iconbtn { width: 36px; height: 36px; }
.j-tagrow .j-iconbtn .ic { width: 18px; height: 18px; }
.j-tagrow__colors { grid-column: 1 / -1; padding: 4px 0 6px; }
.j-taglist { display: grid; gap: 8px; }

/* popover menu */
.j-menu {
  position: fixed; z-index: 1000; min-width: 210px; padding: 6px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: j-pop 0.12s ease-out;
}
.j-menu button, .j-menu a { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; font-size: 14.5px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; color: var(--ink); }
.j-menu button:hover, .j-menu a:hover, .j-menu button:focus-visible { background: var(--hover); outline: none; }
.j-menu .ic { width: 18px; height: 18px; color: var(--muted); }
.j-menu .is-danger, .j-menu .is-danger .ic { color: var(--danger); }
.j-menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 6px; }

.j-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 2000; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 12px; background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: j-pop 0.18s ease-out;
}

/* ---------- desktop ---------- */
@media (min-width: 761px) {
  .j-shell { padding-top: 28px; }
  .j-brand { font-size: 32px; }
  .j-list { gap: 12px; }
  .j-item { padding: 14px 10px 14px 14px; }
  .j-tile { width: 48px; height: 48px; border-radius: 13px; }
  .j-bar { padding-inline: 12px; }
  .j-doc { padding-top: 56px; font-size: 19px; }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  .j-top { padding-top: 8px; }
  .j-top .j-btn--primary span { display: none; }
  .j-top .j-btn--primary { width: 40px; padding: 0; border-radius: 12px; }
  .j-top .j-btn--primary .ic { width: 22px; height: 22px; }
  .j-item { gap: 12px; padding: 10px 4px 10px 10px; border-radius: 13px; }
  .j-tile { width: 42px; height: 42px; border-radius: 11px; }
  .j-item__title { font-size: 15px; }
  .j-item__more { width: 32px; }
  .j-bar { padding-inline: 4px; gap: 4px; }
  .j-bar .j-iconbtn { width: 38px; }
  .j-bar__title { gap: 8px; }
  .j-bar__title .j-badge { display: none; }
  .j-dialog { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .j-dialog--sm { width: 100%; }
  .j-dialog[open] { animation: j-sheet 0.22s ease-out; }
  @keyframes j-sheet { from { transform: translateY(40px); opacity: 0.6; } }
  .j-sheet__body { padding-inline: 16px; }
  .j-sheet__head { padding-left: 16px; }
  .j-sheet__foot { padding-inline: 16px; }
  .j-doc { font-size: 17.5px; padding-top: 28px; }
  .j-doc h1 { font-size: 1.85em; }
  .j-pdf .viewer { padding: 0; gap: 0; }
  .viewer__page { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
