/*
 * surya.place app kit
 * ---------------------------------------------------------------------------
 * The Jiak Simi look, lifted out so every app can share it. Read the guide
 * first: docs/design/app-design-guide.md. Live style guide: /playground/styleguide/
 *
 * Link it from any app page (PHP pages version it with assetVersion()):
 *   <link rel="stylesheet" href="/assets/css/app-kit.css?v=...">
 *
 * Everything is prefixed `k-` so it never collides with an app's own CSS.
 * Tokens are plain custom properties on :root, so an app can read them in its
 * own rules (`var(--k-outline)`) without using a single kit class.
 *
 * Light is the default. Dark comes from <html data-theme="dark">, set by the
 * head snippet in the guide (it honours the desktop's per-app override).
 */

/* ---------- fonts (self-hosted, OFL; notices in apps/jiaksimi/frontend/licenses) ---------- */
@font-face { font-family: "Bricolage Grotesque"; src: url("/assets/fonts/bricolage.ttf") format("truetype"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/assets/fonts/dmsans.ttf") format("truetype"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("/assets/fonts/caveat.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  /* ink */
  --k-primary: oklch(0.38 0.075 322);      /* plum: dark buttons, active icons, links */
  --k-ink: oklch(0.32 0.046 320);          /* body text */
  --k-muted: oklch(0.53 0.035 315);        /* secondary text, eyebrows, meta */
  --k-outline: oklch(0.43 0.05 315);       /* every border that matters, and hard shadows */
  --k-rule: oklch(0.86 0.025 314);         /* hairlines, quiet borders, dashed dividers */

  /* surfaces */
  --k-bg: oklch(0.983 0.008 77);           /* page */
  --k-paper: oklch(0.996 0.006 80);        /* cards, sidebar, inputs */

  /* pastels: one job each, see the guide */
  --k-butter: oklch(0.96 0.075 96);        /* hero banner, sticky notes, drafts */
  --k-lilac: oklch(0.92 0.039 303);        /* active/selected, placeholders, info */
  --k-lilac-strong: oklch(0.79 0.078 303); /* shadow under lilac things */
  --k-pink: oklch(0.87 0.068 355);         /* the one call-to-action, tape, private */
  --k-pink-deep: oklch(0.69 0.145 355);    /* brand dot, doodles, CTA hover */
  --k-mint: oklch(0.91 0.048 163);         /* good news: loved it, done, recent */

  --k-shadow: oklch(0.58 0.06 313 / 0.14); /* soft hard-shadow for cards */

  /* type */
  --k-font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --k-font-sans: "DM Sans", system-ui, sans-serif;
  --k-font-note: "Caveat", "Segoe Print", cursive;

  /* shape and motion */
  --k-radius-sm: 5px;   /* tags, date badges */
  --k-radius: 9px;      /* buttons, inputs, nav links, pills */
  --k-radius-lg: 12px;  /* cards */
  --k-radius-xl: 14px;  /* banners */
  --k-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --k-fast: 180ms;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --k-primary: oklch(0.82 0.07 322);
  --k-ink: oklch(0.93 0.015 320);
  --k-muted: oklch(0.74 0.03 315);
  --k-outline: oklch(0.72 0.05 315);
  --k-rule: oklch(0.36 0.025 314);
  --k-bg: oklch(0.22 0.02 315);
  --k-paper: oklch(0.26 0.022 315);
  --k-butter: oklch(0.4 0.06 96);
  --k-lilac: oklch(0.33 0.04 303);
  --k-lilac-strong: oklch(0.5 0.07 303);
  --k-pink: oklch(0.38 0.06 355);
  --k-pink-deep: oklch(0.74 0.13 355);
  --k-mint: oklch(0.38 0.045 163);
  --k-shadow: oklch(0.1 0.02 313 / 0.4);
  color-scheme: dark;
}

/* ---------- base (scoped to .k-root so linking the kit never restyles an untouched app) ---------- */
.k-root, .k-root *, .k-root *::before, .k-root *::after { box-sizing: border-box; }
.k-root {
  margin: 0;
  min-height: 100vh;
  background: var(--k-bg);
  color: var(--k-ink);
  font-family: var(--k-font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.k-root :is(h1, h2, h3, h4) { margin: 0; font-family: var(--k-font-display); font-weight: 700; color: var(--k-ink); }
.k-root h1 { font-size: 38px; line-height: 1.12; letter-spacing: -1.4px; }
.k-root h2 { font-size: 22px; line-height: 1.25; letter-spacing: -0.5px; }
.k-root h3 { font-size: 18px; line-height: 1.3; letter-spacing: -0.3px; }
.k-root p { margin: 0; line-height: 1.6; }
.k-root a { color: var(--k-primary); text-underline-offset: 3px; }
.k-root button, .k-root input, .k-root select, .k-root textarea { font: inherit; color: inherit; }
.k-root button { cursor: pointer; }
.k-root :focus-visible { outline: 2px solid var(--k-primary); outline-offset: 2px; }
.k-root img { max-width: 100%; display: block; }
.k-root svg { flex-shrink: 0; }

.k-muted { color: var(--k-muted); }
.k-eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 1.3px; text-transform: uppercase; color: var(--k-muted); }
.k-hand { font-family: var(--k-font-note); font-size: 26px; line-height: 1.25; font-weight: 400; }
.k-doodle { font-family: var(--k-font-note); color: var(--k-pink-deep); font-size: 28px; font-weight: 400; display: inline-block; transform: rotate(-6deg); }
.k-dot { color: var(--k-pink-deep); }

/* ---------- app shell: sidebar + main ---------- */
.k-app { display: flex; min-height: 100vh; }
.k-sidebar {
  width: 218px; flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 24px 14px 16px;
  background: var(--k-paper);
  border-right: 1px solid var(--k-rule);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.k-brand { display: flex; align-items: center; gap: 8px; margin: 0 0 26px 3px; text-decoration: none; color: inherit; }
.k-brand-mark { width: 44px; height: 44px; flex-shrink: 0; }
.k-brand-name { font-family: var(--k-font-display); font-size: 32px; font-weight: 800; letter-spacing: -2px; line-height: 1; }
.k-brand-tag { font-size: 13px; color: var(--k-muted); margin-top: 3px; letter-spacing: -0.2px; }
.k-nav-label { margin: 14px 8px 8px; font-size: 12.5px; font-weight: 500; letter-spacing: 0.9px; text-transform: uppercase; color: var(--k-muted); }
.k-nav-label:first-of-type { margin-top: 0; }
.k-nav { display: flex; flex-direction: column; gap: 4px; }
.k-nav-link {
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--k-radius);
  background: none; color: var(--k-ink); text-decoration: none;
  font-size: 14px; font-weight: 500; text-align: left; width: 100%;
  transition: background var(--k-fast) var(--k-ease);
}
.k-nav-link svg { width: 19px; height: 19px; stroke-width: 1.7; color: var(--k-primary); }
.k-nav-link:hover { background: var(--k-lilac); }
.k-nav-link.is-active, .k-nav-link[aria-current="page"] {
  background: var(--k-lilac); border-color: var(--k-outline);
  box-shadow: 2px 2px 0 var(--k-lilac-strong); font-weight: 700;
}
.k-sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--k-rule); display: flex; align-items: center; gap: 8px; font-weight: 600; }
.k-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid var(--k-outline); }

.k-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.k-toolbar {
  height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 28px; border-bottom: 1px solid var(--k-rule);
  color: var(--k-muted);
}
.k-toolbar b, .k-toolbar strong { color: var(--k-ink); font-weight: 500; }
.k-crumbs { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-crumbs svg { width: 16px; height: 16px; }
.k-page { padding: 26px 28px 40px; width: 100%; max-width: 1240px; animation: k-page-in 0.25s ease-out; }
@keyframes k-page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.k-menu-button, .k-btn.k-menu-button { display: none; }

/* Narrow windows (the desktop opens apps at ~70% width, phones are narrower still) */
@media (max-width: 760px) {
  .k-app { flex-direction: column; }
  .k-sidebar { position: static; height: auto; width: 100%; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--k-rule); }
  .k-sidebar .k-brand { margin: 0; }
  .k-sidebar-body { display: none; padding-top: 14px; }
  .k-sidebar.is-open .k-sidebar-body { display: block; }
  .k-sidebar-top { display: flex; align-items: center; justify-content: space-between; }
  .k-menu-button, .k-btn.k-menu-button { display: inline-flex; }
  .k-toolbar { padding: 0 16px; }
  .k-page { padding: 20px 16px 32px; }
  .k-root h1 { font-size: 30px; }
}

/* ---------- page heading ---------- */
.k-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 4px 0 24px; }
.k-page-head .k-eyebrow { margin-bottom: 8px; }
.k-page-head h1 { margin-bottom: 8px; }
.k-page-head p { font-size: 16px; color: var(--k-muted); }

.k-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 16px; min-height: 32px; }
.k-section-title:first-child { margin-top: 0; }

/* ---------- hero banner ---------- */
.k-banner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 236px; padding: 26px 32px;
  background: var(--k-butter);
  border: 1.5px solid var(--k-outline); border-radius: var(--k-radius-xl);
}
.k-banner h1 { font-size: 44px; letter-spacing: -1.6px; line-height: 1.05; margin: 8px 0 10px; }
.k-banner p { color: var(--k-muted); margin-bottom: 18px; max-width: 52ch; }
.k-banner-art { flex-shrink: 0; width: 200px; transform: rotate(6deg); filter: drop-shadow(3px 4px 0 var(--k-shadow)); }
.k-banner.is-lilac { background: var(--k-lilac); }
.k-banner.is-pink { background: var(--k-pink); }
.k-banner.is-mint { background: var(--k-mint); }
@media (max-width: 760px) { .k-banner { padding: 22px; min-height: 0; } .k-banner h1 { font-size: 32px; } .k-banner-art { display: none; } }

/* ---------- stat strip ---------- */
.k-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 18px 0 28px; color: var(--k-muted); }
.k-stats > span { display: inline-flex; align-items: center; gap: 6px; }
.k-stats svg { width: 15px; height: 15px; }
.k-stats strong { color: var(--k-ink); font-weight: 700; }

/* ---------- buttons ---------- */
.k-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border: 1.5px solid var(--k-outline); border-radius: var(--k-radius);
  background: var(--k-paper); color: var(--k-ink);
  font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none;
  box-shadow: 2px 3px 0 var(--k-shadow);
  transition: transform var(--k-fast) var(--k-ease), box-shadow var(--k-fast) var(--k-ease), background var(--k-fast);
}
.k-btn svg { width: 16px; height: 16px; }
.k-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 4px 0 var(--k-shadow); }
.k-btn:active { transform: translate(1px, 1px); box-shadow: 0 0 0 var(--k-shadow); }
.k-btn:disabled, .k-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
/* the main CTA of a page: soft pink, hard ink shadow */
.k-btn.is-cta { background: var(--k-pink); font-weight: 700; box-shadow: 2px 3px 0 var(--k-outline); }
.k-btn.is-cta:hover { background: var(--k-pink-deep); color: var(--k-paper); box-shadow: 3px 4px 0 var(--k-outline); }
/* solid plum: inside banners, confirm buttons */
.k-btn.is-dark { background: var(--k-primary); color: var(--k-paper); box-shadow: 2px 3px 0 var(--k-lilac-strong); }
.k-btn.is-dark:hover { box-shadow: 3px 4px 0 var(--k-lilac-strong); }
/* quiet: no border, no shadow */
.k-btn.is-ghost { border-color: transparent; background: none; box-shadow: none; font-weight: 500; }
.k-btn.is-ghost:hover { background: var(--k-lilac); transform: none; }
.k-btn.is-danger { color: oklch(0.5 0.16 25); }
:root[data-theme="dark"] .k-btn.is-danger { color: oklch(0.8 0.11 25); }
.k-btn.is-sm { height: 31px; padding: 0 10px; font-size: 13px; }
.k-btn.is-icon { width: 38px; padding: 0; }
.k-btn.is-icon.is-sm { width: 31px; }
.k-btn.is-round { border-radius: 50%; }

/* ---------- inputs ---------- */
.k-input, .k-select, .k-textarea {
  height: 40px; width: 100%; padding: 0 12px;
  background: var(--k-paper); color: var(--k-ink);
  border: 1px solid var(--k-rule); border-radius: var(--k-radius);
  font-size: 14px;
  transition: border-color var(--k-fast);
}
.k-textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.k-input::placeholder, .k-textarea::placeholder { color: var(--k-muted); opacity: 0.85; }
.k-input:hover, .k-select:hover, .k-textarea:hover { border-color: var(--k-lilac-strong); }
.k-input:focus, .k-select:focus, .k-textarea:focus { outline: none; border-color: var(--k-outline); box-shadow: 0 0 0 3px var(--k-lilac); }
.k-select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23887' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.k-search { position: relative; flex: 1; max-width: 360px; }
.k-search > svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--k-muted); pointer-events: none; }
.k-search > .k-input { padding-left: 34px; }
.k-field { display: flex; flex-direction: column; gap: 6px; }
.k-label { font-size: 13px; font-weight: 600; }
.k-hint { font-size: 13px; color: var(--k-muted); }

/* ---------- toolbar row + filter pills ---------- */
.k-filterbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin: 0 0 14px; }
.k-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.k-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 34px; padding: 0 13px;
  background: var(--k-paper); color: var(--k-ink);
  border: 1px solid var(--k-rule); border-radius: 8px;
  font-size: 14px; font-weight: 500;
  transition: background var(--k-fast), border-color var(--k-fast);
}
.k-pill:hover { border-color: var(--k-lilac-strong); }
.k-pill.is-on, .k-pill[aria-pressed="true"] { background: var(--k-lilac); border-color: var(--k-outline); box-shadow: 2px 2px 0 var(--k-shadow); }
.k-pill.is-strong.is-on, .k-pill.is-strong[aria-pressed="true"] { background: var(--k-primary); color: var(--k-paper); }
.k-pill .k-count { font-size: 11px; color: var(--k-muted); }
.k-pills.is-small .k-pill { height: 28px; padding: 0 10px; font-size: 13px; }
.k-result-count { font-size: 13px; color: var(--k-muted); margin-bottom: 10px; }

/* ---------- tags ---------- */
.k-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 7px;
  background: var(--k-paper); color: var(--k-ink);
  border: 1px solid var(--k-rule); border-radius: var(--k-radius-sm);
  font-size: 13px; font-weight: 500; line-height: 1.2; white-space: nowrap;
}
.k-tag svg { width: 12px; height: 12px; }
.k-tag.is-lilac { background: var(--k-lilac); border-color: transparent; }
.k-tag.is-mint { background: var(--k-mint); border-color: transparent; }
.k-tag.is-butter { background: var(--k-butter); border-color: transparent; }
.k-tag.is-pink { background: var(--k-pink); border-color: transparent; }
.k-tags { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- cards ---------- */
.k-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.k-grid.is-posters { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.k-grid.is-wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.k-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--k-paper); color: var(--k-ink);
  border: 1px solid var(--k-outline); border-radius: var(--k-radius-lg);
  box-shadow: 3px 4px 0 var(--k-shadow);
  overflow: hidden; text-decoration: none;
  transition: transform var(--k-fast) var(--k-ease), box-shadow var(--k-fast) var(--k-ease);
}
a.k-card:hover, button.k-card:hover, .k-card.is-link:hover { transform: translateY(-3px); box-shadow: 3px 7px 0 var(--k-shadow); }
.k-card-media { position: relative; aspect-ratio: 1.55; background: var(--k-lilac); overflow: hidden; }
.k-card-media > img { width: 100%; height: 100%; object-fit: cover; }
.k-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.k-card-title { font-family: var(--k-font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.2; }
.k-card-meta { display: flex; align-items: center; gap: 6px; color: var(--k-muted); font-size: 13px; }
.k-card-meta svg { width: 14px; height: 14px; }
.k-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--k-rule); color: var(--k-muted); font-size: 13px; }

/* photo card: photo sits inset in a paper frame, like a print (Jiak Simi's cook cards) */
.k-card.is-print { padding: 8px 8px 0; border-radius: 10px; box-shadow: 2px 3px 0 var(--k-shadow); }
.k-card.is-print .k-card-media { border-radius: 6px; aspect-ratio: 1.18; }
.k-card.is-print .k-card-body { padding: 13px 5px 13px; }
.k-card.is-print .k-card-title { font-size: 16.5px; }

/* poster card: films, dramas, books. Tall media, title underneath */
.k-card.is-poster .k-card-media { aspect-ratio: 2 / 3; }
.k-card.is-poster .k-card-body { padding: 10px 11px 12px; gap: 4px; }
.k-card.is-poster .k-card-title { font-size: 15px; letter-spacing: -0.2px; }

/* bits that sit on media */
.k-badge { position: absolute; left: 9px; bottom: 9px; padding: 3px 8px; background: var(--k-paper); border: 1px solid var(--k-rule); border-radius: var(--k-radius-sm); font-size: 13px; font-weight: 600; }
.k-badge.is-top { bottom: auto; top: 9px; }
.k-fav {
  position: absolute; right: 7px; top: 7px;
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--k-paper); color: var(--k-outline);
  border: 1px solid var(--k-outline); border-radius: 50%;
}
.k-fav svg { width: 15px; height: 15px; }
.k-fav.is-on { background: var(--k-pink); color: var(--k-primary); }
.k-fav.is-on svg { fill: currentColor; }

/* media with no image: lilac, a mascot, maybe a handwritten line */
.k-placeholder { width: 100%; height: 100%; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--k-lilac); color: var(--k-muted); }
.k-placeholder > svg { width: 52px; height: 52px; filter: drop-shadow(2px 3px 0 var(--k-shadow)); }
.k-placeholder small { font-family: var(--k-font-note); font-size: 22px; }

/* ---------- stars ---------- */
.k-stars { display: inline-flex; gap: 1px; color: var(--k-pink-deep); font-size: 14px; letter-spacing: 1px; line-height: 1; }
.k-stars .is-off { color: var(--k-rule); }

/* ---------- panels, sticky notes, callouts ---------- */
.k-panel { background: var(--k-paper); border: 1px solid var(--k-rule); border-radius: var(--k-radius-lg); padding: 18px 20px; }
.k-panel.is-strong { border-color: var(--k-outline); box-shadow: 3px 4px 0 var(--k-shadow); }
.k-callout { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; background: var(--k-lilac); border: 1px solid var(--k-outline); border-radius: var(--k-radius-lg); box-shadow: 3px 4px 0 var(--k-lilac-strong); }

.k-sticky {
  position: relative; padding: 24px 19px 18px;
  background: var(--k-butter);
  border: 1px solid var(--k-outline); border-radius: 2px 3px 20px 3px;
  box-shadow: 3px 4px 0 var(--k-shadow);
  transform: rotate(1.3deg);
}
.k-sticky:nth-child(even) { transform: rotate(-1.5deg); }
.k-sticky .k-hand { font-size: 24px; }
.k-tape {
  position: absolute; top: -10px; left: 50%;
  width: 76px; height: 24px;
  background: var(--k-pink); opacity: 0.75;
  transform: translateX(-50%) rotate(-5deg);
  clip-path: polygon(3% 0, 100% 4%, 97% 100%, 0 96%);
  border-left: 1px dashed var(--k-outline); border-right: 1px dashed var(--k-outline);
}

/* polaroid: a single hero photo with a handwritten caption */
.k-polaroid { display: inline-block; padding: 10px 10px 0; background: var(--k-paper); border: 1px solid var(--k-outline); border-radius: 4px; box-shadow: 4px 5px 0 var(--k-shadow); transform: rotate(-2deg); }
.k-polaroid img { border-radius: 2px; }
.k-polaroid figcaption { font-family: var(--k-font-note); font-size: 24px; text-align: center; padding: 6px 0 10px; }

/* ---------- empty, loading ---------- */
.k-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 64px 20px; text-align: center; color: var(--k-muted); }
.k-empty > svg { width: 42px; height: 42px; }
.k-empty h3 { color: var(--k-ink); }
.k-empty p { font-size: 15px; max-width: 42ch; }

.k-skeleton { background: linear-gradient(90deg, var(--k-lilac) 0%, var(--k-paper) 50%, var(--k-lilac) 100%); background-size: 200% 100%; animation: k-shimmer 1.4s ease-in-out infinite; border-radius: var(--k-radius-sm); }
@keyframes k-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.k-spinner { width: 20px; height: 20px; border: 2.5px solid var(--k-lilac-strong); border-top-color: var(--k-primary); border-radius: 50%; animation: k-spin 0.8s linear infinite; }
@keyframes k-spin { to { transform: rotate(360deg); } }

/* ---------- dialog ---------- */
.k-dialog { border: 1.5px solid var(--k-outline); border-radius: var(--k-radius-xl); background: var(--k-paper); color: var(--k-ink); padding: 22px 24px; box-shadow: 6px 6px 0 var(--k-lilac-strong); max-width: min(520px, calc(100vw - 32px)); }
.k-dialog::backdrop { background: oklch(0.3 0.04 315 / 0.35); backdrop-filter: blur(2px); }
.k-dialog h2 { margin-bottom: 6px; }
.k-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- tables (long lists: reading logs, watch history) ---------- */
.k-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--k-paper); border: 1px solid var(--k-outline); border-radius: var(--k-radius-lg); overflow: hidden; box-shadow: 3px 4px 0 var(--k-shadow); }
.k-table th { text-align: left; font-size: 12.5px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; color: var(--k-muted); padding: 11px 14px; border-bottom: 1px solid var(--k-rule); background: var(--k-bg); }
.k-table td { padding: 12px 14px; border-bottom: 1px dashed var(--k-rule); }
.k-table tr:last-child td { border-bottom: 0; }
.k-table tbody tr:hover td { background: var(--k-lilac); }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .k-root *, .k-root *::before, .k-root *::after { animation: none !important; transition: none !important; }
  .k-sticky, .k-polaroid, .k-banner-art, .k-doodle { transform: none; }
}
