/* Chef Carlos — kitchen dashboard. Paper, ink and Le Cuistot red. */
:root {
  --paper: #f6f1e8;
  --paper-2: #efe7da;
  --card: #fffdf9;
  --ink: #1d1a17;
  --ink-2: #4b443c;
  --muted: #8a8075;
  --line: #e4dbcc;
  --line-2: #d6cbb8;
  --red: #e8452c;
  --red-ink: #c4321b;
  --red-soft: #fce6df;
  --green: #2f7d4f;
  --green-soft: #e2f1e6;
  --amber: #a8690f;
  --amber-soft: #fbefd6;
  --blue-soft: #e7ecf6;
  --blue: #3c5a99;
  --radius: 16px;
  --radius-s: 11px;
  --shadow-1: 0 1px 2px rgba(29, 26, 23, .05), 0 1px 1px rgba(29, 26, 23, .03);
  --shadow-2: 0 10px 30px -12px rgba(29, 26, 23, .25), 0 2px 6px rgba(29, 26, 23, .06);
  --shadow-3: 0 24px 60px -18px rgba(29, 26, 23, .38);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --side: 252px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 8px; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.display { font: 600 clamp(28px, 3.2vw, 40px)/1.08 var(--serif); letter-spacing: -.01em; margin: 0; font-variation-settings: "opsz" 96; }
.display em { font-style: italic; font-weight: 500; color: var(--red); }
.lede { margin: 6px 0 0; color: var(--ink-2); font-size: 15.5px; }
.fine { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.fine .i { width: 16px; height: 16px; margin-top: 1px; }
.fine a { color: var(--red-ink); }
.demo-line { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px; text-decoration: none; white-space: nowrap;
  transition: transform .15s var(--ease), background .15s, box-shadow .2s, border-color .15s, color .15s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn .i { width: 18px; height: 18px; }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px -8px rgba(232, 69, 44, .8); }
.btn.primary:hover { background: var(--red-ink); }
.btn.ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--line-2); background: #fff; }
.btn.danger { background: var(--red-ink); color: #fff; }
.btn.danger-ghost { background: transparent; border-color: #f0c7bd; color: var(--red-ink); }
.btn.danger-ghost:hover { background: var(--red-soft); }
.btn.glass { background: rgba(255, 253, 249, .88); backdrop-filter: blur(8px); border-color: rgba(255, 255, 255, .6); color: var(--ink); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn.xl { min-height: 56px; padding: 0 28px; font-size: 16.5px; }
.btn.pop { animation: pop .5s var(--ease); }
@keyframes pop { 30% { transform: scale(1.12); } 60% { transform: scale(.96); } }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none;
  border: 0; background: transparent; color: var(--ink-2); text-decoration: none;
  transition: background .15s, color .15s, transform .15s;
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red-ink); }
.icon-btn.glass { background: rgba(255, 253, 249, .88); backdrop-filter: blur(8px); color: var(--ink); }
.icon-btn.ghosted, [aria-disabled="true"].icon-btn { opacity: .35; pointer-events: none; }
.icon-btn.star.on { color: #e0a412; }
.icon-btn.star.on .i { fill: #f2b33d; stroke: #d9960b; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--paper-2); border-radius: 999px; border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; min-height: 36px;
  font-weight: 600; font-size: 13.5px; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .2s var(--ease), color .2s, box-shadow .2s;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.seg.small button { padding: 4px 10px; min-height: 30px; font-size: 12px; }
.seg.big { display: flex; flex-wrap: wrap; margin-top: 12px; }
.seg.big button { flex: 1; min-height: 44px; }
.seg .i { width: 16px; height: 16px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill .i { width: 13px; height: 13px; }
.pill.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.status.published { background: var(--green-soft); color: var(--green); }
.pill.status.draft { background: var(--amber-soft); color: var(--amber); }
.pill.kind.recipe { background: var(--red-soft); color: var(--red-ink); }
.pill.kind.story { background: var(--blue-soft); color: var(--blue); }
.pill.demo { background: var(--ink); color: var(--paper); letter-spacing: .04em; text-transform: uppercase; font-size: 10.5px; height: 20px; }

/* ---------- welcome ---------- */
.welcome { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--paper); }
.welcome-photo { position: relative; overflow: hidden; }
.welcome-photo img { width: 100%; height: 100%; object-fit: cover; animation: kenburns 18s ease-out both; }
.welcome-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(29, 26, 23, .05), rgba(246, 241, 232, .0) 60%, var(--paper)); }
@keyframes kenburns { from { transform: scale(1.12); } to { transform: scale(1); } }
.welcome-card { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 48px clamp(28px, 6vw, 88px); }
.welcome-card > * { animation: rise .7s var(--ease) both; }
.welcome-card > :nth-child(2) { animation-delay: .05s; } .welcome-card > :nth-child(3) { animation-delay: .1s; }
.welcome-card > :nth-child(4) { animation-delay: .15s; } .welcome-card > :nth-child(5) { animation-delay: .2s; }
.welcome-card > :nth-child(6) { animation-delay: .25s; } .welcome-card > :nth-child(7) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.welcome-lang { position: absolute; top: 24px; right: 24px; }
.welcome-lang button { min-height: 32px; padding: 4px 11px; font-size: 12px; }
.welcome-logo { width: 112px; height: 112px; border-radius: 50%; margin-bottom: 26px; box-shadow: var(--shadow-2); background: #fff; }
.welcome-title { font: 500 clamp(52px, 7vw, 92px)/.95 var(--serif); margin: 6px 0 18px; letter-spacing: -.02em; font-variation-settings: "opsz" 144; }
.welcome-title em { color: var(--red); font-weight: 400; }
.welcome-sub { font-size: 18px; color: var(--ink-2); max-width: 30ch; margin: 0 0 8px; }
.welcome-hint { margin: 0 0 30px; color: var(--muted); font-size: 14.5px; }
.welcome-card .demo-line { margin-top: 22px; }
.welcome.leaving { animation: fadeAway .42s var(--ease) forwards; }
@keyframes fadeAway { to { opacity: 0; transform: scale(1.02); visibility: hidden; } }

/* ---------- shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 20;
  display: flex; flex-direction: column; gap: 18px; padding: 22px 16px 18px;
  background: var(--paper-2); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; padding: 4px 6px; }
.brand img { border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); }
.brand strong { display: block; font: 600 18px/1.1 var(--serif); }
.brand small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.new-btn { width: 100%; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  text-decoration: none; font-weight: 500; color: var(--ink-2); transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .55); color: var(--ink); }
.nav a.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.nav a.active .ico { color: var(--red); }
.nav .ico { display: grid; }
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.nav-count:empty { display: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 6px; }
.site-link { display: flex; align-items: center; gap: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.site-link:hover { color: var(--red-ink); }
.site-link .ico { display: grid; }
.site-link .i { width: 18px; height: 18px; }

.topbar { display: none; }
.tabbar { display: none; }
.view { margin-left: var(--side); min-height: 100vh; outline: none; }
.view-host.enter > * { animation: viewIn .38s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.page { max-width: 1180px; margin: 0 auto; padding: 36px clamp(18px, 3.4vw, 44px) 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-1); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-title { font: 600 19px/1.2 var(--serif); margin: 0; }
.card-title { margin-bottom: 14px; }
.link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13.5px; color: var(--red-ink); text-decoration: none; }
.link .i { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.link:hover .i { transform: translateX(3px); }

/* ---------- overview ---------- */
.hello { display: flex; gap: 18px; align-items: center; margin-bottom: 26px; }
.hello-avatar { width: 64px; height: 64px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-2); flex: none; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.quick-btn {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); text-align: left;
  border: 1px solid var(--line); background: var(--card); text-decoration: none; box-shadow: var(--shadow-1);
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.quick-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.quick-btn:active { transform: scale(.98); }
.quick-btn > .i { width: 44px; height: 44px; padding: 11px; border-radius: 13px; background: var(--paper-2); color: var(--ink); }
.quick-btn b { display: block; font-size: 15.5px; }
.quick-btn small { display: block; color: var(--muted); font-size: 13px; }
.quick-btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.quick-btn.primary > .i { background: var(--red); color: #fff; }
.quick-btn.primary small { color: #b9ae9f; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stat {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 2px 8px; padding: 16px 18px;
  border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); text-decoration: none; box-shadow: var(--shadow-1);
  transition: transform .2s var(--ease), box-shadow .2s; animation: rise .5s var(--ease) both; animation-delay: var(--d);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat-n { font: 600 38px/1 var(--serif); grid-column: 1; font-variant-numeric: tabular-nums; }
.stat > span:last-child { grid-column: 1 / -1; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-ico { grid-column: 2; grid-row: 1; align-self: start; color: var(--red); opacity: .9; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ov-main, .ov-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.continue { padding: 0; overflow: hidden; }
.continue-link { display: grid; grid-template-columns: 200px 1fr; text-decoration: none; }
.continue-link img { width: 100%; height: 100%; min-height: 190px; object-fit: cover; transition: transform .6s var(--ease); }
.continue-link:hover img { transform: scale(1.04); }
.continue-link > div { padding: 20px 22px; display: flex; flex-direction: column; align-items: flex-start; }
.continue-link h2 { font: 600 24px/1.15 var(--serif); margin: 2px 0 6px; }
.continue-link p { margin: 0 0 16px; color: var(--ink-2); }
.continue-link .eyebrow { color: var(--amber); }
.continue.empty { padding: 20px; }
.mini-list { list-style: none; margin: 0 -8px; padding: 0; }
.mini-list a { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 12px; text-decoration: none; transition: background .15s; }
.mini-list a:hover { background: var(--paper); }
.mini-list img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; background: var(--paper-2); }
.mini-txt { min-width: 0; flex: 1; }
.mini-txt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-txt small { color: var(--muted); font-size: 12.5px; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.bar-label { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars b { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); grid-row: 1; grid-column: 2; }
.bar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, var(--red), #f08a6f); transform-origin: left; animation: grow .9s var(--ease) both; animation-delay: var(--d); }
@keyframes grow { from { transform: scaleX(0); } }
.site-card { padding: 0; overflow: hidden; display: grid; grid-template-columns: 110px 1fr; }
.site-card img { width: 100%; height: 100%; object-fit: cover; }
.site-card > div { padding: 16px 18px; }
.site-card h2 { font: 600 18px/1.2 var(--serif); margin: 0 0 4px; }
.site-card p { margin: 0 0 12px; color: var(--ink-2); font-size: 13.5px; }

/* ---------- posts ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; flex: none;
  border: 1px solid var(--line); background: transparent; font-weight: 600; font-size: 14px; color: var(--ink-2); transition: all .18s var(--ease);
}
.tabs button span { font-size: 12px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--paper-2); display: grid; place-items: center; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tabs button[aria-selected="true"] span { background: rgba(255, 255, 255, .16); }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.search { position: relative; flex: 1; display: flex; align-items: center; }
.search > .i { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 46px; padding: 0 44px 0 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px rgba(232, 69, 44, .12); }
.search kbd { position: absolute; right: 12px; font: 600 11px var(--sans); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: var(--paper); }
.select { position: relative; display: flex; align-items: center; }
.select select { width: 100%; appearance: none; min-height: 46px; padding: 0 40px 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-weight: 500; cursor: pointer; }
.select .i { position: absolute; right: 12px; pointer-events: none; width: 16px; color: var(--muted); }
.post-list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 10px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: box-shadow .2s, border-color .2s, transform .2s var(--ease);
  animation: rise .4s var(--ease) both; animation-delay: var(--d);
}
.row:hover { box-shadow: var(--shadow-2); border-color: var(--line-2); }
.row-main { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; text-decoration: none; }
.thumb { position: relative; width: 92px; height: 72px; border-radius: 11px; overflow: hidden; flex: none; background: var(--paper-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-star { position: absolute; top: 5px; left: 5px; width: 22px; height: 22px; border-radius: 50%; background: rgba(29, 26, 23, .7); display: grid; place-items: center; }
.thumb-star .i { width: 13px; height: 13px; fill: #f2b33d; stroke: #f2b33d; }
.row-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font: 600 17px/1.25 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-ex { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.row-date { color: var(--muted); font-size: 12.5px; margin-left: 4px; }
.row-actions { display: flex; align-items: center; gap: 2px; }
.narrow-only { display: none !important; }
.empty-state { text-align: center; padding: 56px 20px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: rgba(255, 253, 249, .5); grid-column: 1 / -1; }
.empty-state > .i { width: 44px; height: 44px; color: var(--red); margin: 0 auto 10px; }
.empty-state h3 { font: 600 21px var(--serif); margin: 0 0 4px; }
.empty-state p { color: var(--muted); margin: 0 0 18px; }

/* ---------- media ---------- */
.media-top { display: grid; grid-template-columns: 1fr 320px; gap: 14px; margin-bottom: 20px; }
.dropzone {
  display: flex; align-items: center; justify-content: center; gap: 16px; padding: 22px; min-height: 120px; text-align: left;
  border: 2px dashed var(--line-2); border-radius: var(--radius); background: rgba(255, 253, 249, .6); color: var(--ink-2);
  transition: border-color .2s, background .2s;
}
.dropzone:hover { border-color: var(--red); background: var(--card); }
.dropzone > .i { width: 48px; height: 48px; padding: 12px; border-radius: 50%; background: var(--red-soft); color: var(--red-ink); }
.dropzone b { display: block; font-size: 15.5px; color: var(--ink); }
.dropzone small { color: var(--muted); }
.meter-top { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px; }
.meter-top span { display: flex; align-items: center; gap: 8px; }
.meter-top .i { color: var(--muted); }
.meter-bar { height: 10px; border-radius: 99px; background: var(--paper-2); margin: 10px 0 8px; overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); transition: width .6s var(--ease); }
.meter.warn .meter-bar i { background: #e0a412; }
.meter.danger .meter-bar i { background: var(--red); }
.meter p { margin: 0; font-size: 12.5px; color: var(--muted); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile {
  position: relative; padding: 0; border: 0; border-radius: 14px; overflow: hidden; aspect-ratio: 1; background: var(--paper-2);
  box-shadow: var(--shadow-1); animation: rise .45s var(--ease) both; animation-delay: var(--d);
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.tile:hover img { transform: scale(1.05); }
.tile-cap {
  position: absolute; inset: auto 0 0 0; padding: 22px 10px 8px; text-align: left; color: #fff; font-size: 12.5px; font-weight: 500;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize;
}
.tile-badge { position: absolute; top: 8px; display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.tile-badge.new { left: 8px; background: var(--red); color: #fff; }
.tile-badge.used { right: 8px; background: rgba(255, 253, 249, .92); color: var(--ink); }
.tile-badge .i { width: 12px; height: 12px; stroke-width: 2.4; }
.media-detail { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.md-img { border-radius: 14px; overflow: hidden; background: var(--paper-2); }
.md-img img { width: 100%; max-height: 60vh; object-fit: contain; }
.choose-list { display: flex; flex-direction: column; gap: 4px; }
.choose-list button { display: flex; align-items: center; gap: 12px; padding: 8px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.choose-list button:hover { background: var(--paper); }
.choose-list img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; }
.choose-list span { flex: 1; min-width: 0; }
.choose-list b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choose-list small { color: var(--muted); }
.drop-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(232, 69, 44, .14); backdrop-filter: blur(3px); display: grid; place-items: center; pointer-events: none; }
.drop-overlay > div { background: var(--card); border: 2px dashed var(--red); border-radius: 22px; padding: 32px 44px; text-align: center; box-shadow: var(--shadow-3); }
.drop-overlay .i { width: 40px; height: 40px; color: var(--red); margin: 0 auto 8px; }
.drop-overlay p { margin: 0; font-weight: 600; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span:first-child { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field > span:first-child .i { width: 16px; height: 16px; color: var(--muted); }
.field small { color: var(--muted); font-size: 12.5px; }
.field input, .field textarea, .paste-area {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  transition: border-color .15s, box-shadow .15s; resize: none;
}
.field textarea { line-height: 1.45; }
.field input:focus, .field textarea:focus, .paste-area:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px rgba(232, 69, 44, .12); }
.paste-area { resize: vertical; margin-top: 10px; font-size: 15px; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; transition: color .2s; }
.save-state .i { width: 16px; height: 16px; }
.save-state.ok { color: var(--green); }
.save-state.err { color: var(--red-ink); font-weight: 600; }
.save-state .dot { width: 7px; height: 7px; border-radius: 50%; background: #e0a412; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; cursor: pointer; background: #fff; }
.switch-row b { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.switch-row b .i { width: 16px; height: 16px; color: #d9960b; }
.switch-row small { display: block; color: var(--muted); font-size: 12.5px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 48px; height: 28px; border-radius: 99px; background: var(--line-2); flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.switch-row input:checked + .switch { background: var(--red); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.profile-hero { display: flex; align-items: center; gap: 14px; margin: -4px 0 18px; }
.profile-hero img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: top; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--red); }
.profile-hero h2 { font: 600 22px/1.1 var(--serif); margin: 0; }
.profile-hero p { margin: 2px 0 0; color: var(--muted); }
.danger-card p { margin: 0; color: var(--ink-2); font-size: 14px; }
.full-box { display: flex; gap: 12px; align-items: flex-start; }
.full-box .i { color: var(--red); width: 26px; height: 26px; }
.full-box p { margin: 0; }
.confirm-text { margin: 0; color: var(--ink-2); }

/* ---------- editor ---------- */
.ed-bar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 8px; padding: 10px clamp(12px, 2vw, 24px);
  background: rgba(246, 241, 232, .96); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.ed-crumb { display: flex; align-items: center; gap: 6px; margin-right: auto; min-width: 0; }
.ed-bar .save-state { margin-right: 6px; }
.ed-mode { display: none; }
.ed-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr); align-items: start; }
.pv-off .ed-body { grid-template-columns: minmax(0, 1fr); }
.pv-off .ed-preview { display: none; }
.pv-off .ed-write { max-width: 760px; margin: 0 auto; }
.ed-write { padding: 26px clamp(16px, 3vw, 44px) 80px; min-width: 0; }
.ed-preview { position: sticky; top: 63px; height: calc(100vh - 63px); padding: 20px 22px 20px 0; }
.pv-frame { height: 100%; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-2); overflow: hidden; }
.pv-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.pv-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.pv-bar span { margin-left: 8px; flex: 1; min-width: 0; font-size: 12px; color: var(--muted); background: var(--card); border-radius: 8px; padding: 4px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.cover-block { position: relative; margin-bottom: 22px; border-radius: 18px; overflow: hidden; transition: box-shadow .2s; }
.cover-block.has { aspect-ratio: 16 / 8; background: var(--paper-2); box-shadow: var(--shadow-2); }
.cover-block.has img { width: 100%; height: 100%; object-fit: cover; animation: fadeIn .4s ease both; }
.cover-block.drop { box-shadow: 0 0 0 3px var(--red); }
@keyframes fadeIn { from { opacity: 0; } }
.cover-acts { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
.cover-empty {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 2px dashed var(--line-2); border-radius: 18px;
  background: rgba(255, 253, 249, .55); text-align: left; color: var(--ink-2); transition: border-color .2s, background .2s;
}
.cover-empty:hover { border-color: var(--red); background: var(--card); }
.cover-empty > .i { width: 44px; height: 44px; padding: 11px; border-radius: 12px; background: var(--red-soft); color: var(--red-ink); }
.cover-empty b { display: block; color: var(--ink); }
.cover-empty small { color: var(--muted); }
.ed-title, .ed-excerpt {
  width: 100%; border: 0; background: transparent; resize: none; padding: 0; overflow: hidden; display: block;
}
.ed-title { font: 600 clamp(30px, 3.4vw, 44px)/1.1 var(--serif); letter-spacing: -.015em; margin-bottom: 10px; font-variation-settings: "opsz" 120; }
.ed-excerpt { font: 400 18px/1.5 var(--serif); font-style: italic; color: var(--ink-2); margin-bottom: 10px; }
.ed-title:focus, .ed-excerpt:focus { outline: none; }
.ed-title::placeholder, .ed-excerpt::placeholder { color: #bdb2a3; }
.ed-title.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.ed-sec { margin-top: 22px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-1); }
.sec-title { display: flex; align-items: center; gap: 9px; margin: 0 0 16px; font: 600 18px/1.2 var(--serif); }
.sec-title .i { color: var(--red); }
.meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.meta-grid > .field:last-child { grid-column: 1 / -1; }
.seg.level { display: flex; }
.seg.level button { flex: 1; padding: 6px 4px; min-height: 40px; }
.stepper { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.stepper:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px rgba(232, 69, 44, .12); }
.stepper input { border: 0 !important; box-shadow: none !important; text-align: center; padding: 0 2px; min-width: 0; border-radius: 0; }
.stepper button { width: 38px; border: 0; background: var(--paper); font-size: 18px; font-weight: 600; color: var(--ink-2); flex: none; }
.stepper button:active { background: var(--paper-2); }
.list-sec { margin-top: 8px; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 8px; }
.list-head h4 { margin: 0; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--red-soft); color: var(--red-ink); font-size: 12px; display: grid; place-items: center; letter-spacing: 0; }
.count:empty { display: none; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item {
  display: flex; align-items: flex-start; gap: 6px; padding: 4px 4px 4px 2px; border-radius: 12px; background: #fff;
  border: 1px solid var(--line); transition: box-shadow .2s, border-color .15s, opacity .16s, transform .16s;
}
.item:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px rgba(232, 69, 44, .1); }
.item.dragging { box-shadow: var(--shadow-3); border-color: var(--red); transform: scale(1.015); z-index: 2; position: relative; }
.item.leaving { opacity: 0; transform: translateX(16px); }
.sorting { user-select: none; }
.grip { display: grid; place-items: center; width: 30px; height: 40px; color: #c0b4a3; cursor: grab; touch-action: none; flex: none; }
.grip:active { cursor: grabbing; color: var(--red); }
.num { flex: none; width: 26px; height: 26px; margin-top: 7px; border-radius: 50%; background: var(--ink); color: var(--paper); font: 600 13px/26px var(--serif); text-align: center; }
.dot-b { flex: none; width: 8px; height: 8px; margin: 16px 6px 0 4px; border-radius: 50%; background: var(--red); }
.item-in { flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 4px; resize: none; line-height: 1.4; min-height: 40px; overflow: hidden; font-size: 15px; }
.item-in:focus { outline: none; }
.item-btns { display: flex; flex: none; opacity: .5; transition: opacity .15s; }
.item:hover .item-btns, .item:focus-within .item-btns { opacity: 1; }
.item-btns button { width: 34px; height: 40px; border: 0; background: transparent; border-radius: 9px; color: var(--ink-2); display: grid; place-items: center; }
.item-btns button:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.item-btns button[data-rm]:hover { color: var(--red-ink); background: var(--red-soft); }
.item-btns button:disabled { opacity: .25; cursor: default; }
.item-btns .i { width: 17px; height: 17px; }
.add-row {
  margin-top: 8px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: 1.5px dashed var(--line-2); border-radius: 12px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14px; transition: all .15s;
}
.add-row:hover { border-color: var(--red); color: var(--red-ink); background: var(--red-soft); }
.list-tip { margin: 14px 0 16px; }
.tip-field textarea { background: #fffaf0; border-color: #f0dfbd; }
.writer { border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.writer:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px rgba(232, 69, 44, .1); }
.fmt-bar { display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; }
.fmt-bar button { width: 38px; height: 36px; border: 0; border-radius: 9px; background: transparent; display: grid; place-items: center; color: var(--ink-2); }
.fmt-bar button:hover { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.fmt-bar .i { width: 18px; height: 18px; }
.fmt-sep { flex: 1; }
.wc { font-size: 12px; color: var(--muted); padding-right: 8px; }
.ed-bodytext { width: 100%; border: 0; padding: 16px 18px; min-height: 180px; resize: none; font: 400 17px/1.7 var(--serif); background: transparent; overflow: hidden; display: block; }
.ed-bodytext:focus { outline: none; }
.slug-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.slug-input:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px rgba(232, 69, 44, .12); }
.slug-input em { font-style: normal; color: var(--muted); padding-left: 12px; font-size: 13.5px; white-space: nowrap; }
.slug-input input { border: 0 !important; box-shadow: none !important; padding-left: 2px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 7px; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: text; }
.chips:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px rgba(232, 69, 44, .12); }
.chip { display: inline-flex; align-items: center; gap: 2px; height: 30px; padding: 0 4px 0 11px; border-radius: 99px; background: var(--paper-2); font-size: 13.5px; font-weight: 500; animation: chipIn .25s var(--ease); }
@keyframes chipIn { from { transform: scale(.7); opacity: 0; } }
.chip button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: var(--muted); }
.chip button:hover { background: var(--line); color: var(--ink); }
.chip .i { width: 14px; height: 14px; }
.chips input { flex: 1; min-width: 140px; border: 0 !important; box-shadow: none !important; min-height: 32px !important; padding: 0 6px !important; background: transparent !important; }
.status-seg { display: flex; }
.status-seg button { flex: 1; min-height: 42px; }
.status-seg button[data-status="published"][aria-pressed="true"] { color: var(--green); }
.status-seg button[data-status="draft"][aria-pressed="true"] { color: var(--amber); }
.ed-danger { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.ed-danger:empty { display: none; }
.ed-write > .demo-line { margin-top: 20px; text-align: center; }

/* preview (looks like the public recipe page) */
.pv-post { font-family: var(--sans); color: var(--ink); }
.pv-cover { position: relative; aspect-ratio: 16 / 10; background: var(--paper-2); }
.pv-cover img { width: 100%; height: 100%; object-fit: cover; }
.pv-nocover { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 13px; background: repeating-linear-gradient(-45deg, var(--paper-2) 0 12px, var(--paper) 12px 24px); }
.pv-draft { position: absolute; top: 12px; left: 12px; background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .06em; }
.pv-inner { padding: 22px 24px 32px; }
.pv-kicker { margin: 0 0 8px; color: var(--red); font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.pv-title { font: 600 30px/1.08 var(--serif); margin: 0 0 10px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.pv-title .ph, .pv .ph { color: #c2b7a8; font-style: italic; }
.pv-lede { font: italic 400 17px/1.5 var(--serif); color: var(--ink-2); margin: 0 0 14px; }
.pv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.pv-tags span { font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--ink-2); }
.pv-meta { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 18px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.pv-meta div { padding: 10px 6px; text-align: center; }
.pv-meta div + div { border-left: 1px solid var(--line-2); }
.pv-meta dt { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pv-meta dd { margin: 2px 0 0; font: 600 15px var(--serif); }
.pv-body { font: 400 16px/1.7 var(--serif); }
.pv-body p { margin: 0 0 14px; }
.pv-body h3 { font: 600 20px var(--serif); margin: 18px 0 8px; }
.pv-body ul { padding-left: 20px; margin: 0 0 14px; }
.pv-recipe { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 8px; }
.pv-recipe h2 { font: 600 20px var(--serif); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--red); display: inline-block; }
.pv-ing ul { list-style: none; margin: 0; padding: 0; }
.pv-ing li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.pv-ing li i { flex: none; width: 16px; height: 16px; border: 1.5px solid var(--ink-2); border-radius: 4px; margin-top: 2px; }
.pv-steps ol { list-style: none; margin: 0; padding: 0; }
.pv-steps li { display: flex; gap: 12px; margin-bottom: 14px; }
.pv-steps li span { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; font: 600 14px/28px var(--serif); text-align: center; }
.pv-steps li p { margin: 3px 0 0; font-size: 15px; line-height: 1.55; }
.pv-tip { margin-top: 18px; padding: 16px 18px; border-radius: 14px; background: var(--ink); color: var(--paper); position: relative; }
.pv-tip b { font: italic 600 17px var(--serif); color: #f6a48f; }
.pv-tip p { margin: 6px 0 4px; font-size: 14.5px; line-height: 1.55; }
.pv-sign { font: italic 14px var(--serif); color: #b9ae9f; }
.pv-scroll .pv-recipe { grid-template-columns: 1fr; }
@container (min-width: 560px) { .pv-recipe { grid-template-columns: 0.9fr 1.1fr; } }
.ed-preview .pv-scroll { container-type: inline-size; }

/* picker */
.picker-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.picker-grid button { padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: var(--paper-2); transition: transform .15s var(--ease), box-shadow .15s; }
.picker-grid button:hover { transform: scale(1.03); box-shadow: 0 0 0 3px var(--red); }
.picker-grid img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(29, 26, 23, .42); backdrop-filter: blur(2px); opacity: 0; transition: opacity .22s; }
.modal {
  position: relative; width: min(520px, 100%); max-height: min(86vh, 860px); display: flex; flex-direction: column;
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow-3); opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .22s var(--ease), transform .26s var(--ease);
}
.modal.wide { width: min(880px, 100%); }
.modal.small { width: min(420px, 100%); }
.modal-wrap.in .modal-backdrop { opacity: 1; }
.modal-wrap.in .modal { opacity: 1; transform: none; }
.modal-wrap.out .modal-backdrop { opacity: 0; }
.modal-wrap.out .modal { opacity: 0; transform: translateY(10px) scale(.98); }
.modal-grab { display: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 4px 22px; }
.modal-head h2 { font: 600 21px/1.2 var(--serif); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 10px 22px 18px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sheet-list { display: flex; flex-direction: column; gap: 4px; margin: 0 -8px; }
.sheet-item { display: flex; align-items: center; gap: 14px; padding: 10px; border: 0; border-radius: 14px; background: transparent; text-align: left; text-decoration: none; min-height: 56px; }
.sheet-item:hover { background: var(--paper); }
.sheet-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--paper-2); display: grid; place-items: center; flex: none; }
.sheet-item b { display: block; font-weight: 600; }
.sheet-item small { display: block; color: var(--muted); font-size: 13px; }
.sheet-item.danger { color: var(--red-ink); }
.sheet-item.danger .sheet-ico { background: var(--red-soft); }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(520px, calc(100% - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; min-height: 50px; width: auto; max-width: 100%;
  border-radius: 16px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-3); animation: toastIn .3s var(--ease) both; font-size: 14px;
}
.toast.out { animation: toastOut .22s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.96); } }
.toast-ico { display: grid; color: #8fd3a6; }
.toast.error .toast-ico { color: #ff9b86; }
.toast-msg { flex: 1; min-width: 0; }
.toast-act { border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-weight: 700; padding: 8px 12px; border-radius: 10px; text-decoration: none; white-space: nowrap; font-size: 13.5px; }
.toast-act:hover { background: rgba(255, 255, 255, .2); }
.toast-x { border: 0; background: transparent; color: #b9ae9f; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; flex: none; }
.toast-x .i { width: 16px; height: 16px; }

.confetto { position: fixed; z-index: 95; width: 9px; height: 14px; border-radius: 2px; pointer-events: none; will-change: transform; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08); }
.confetto.round { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- mid widths: editor toggles instead of side-by-side ---------- */
@media (max-width: 1180px) {
  .ed-body { grid-template-columns: minmax(0, 1fr); }
  .ed-mode { display: inline-flex; }
  #pvToggle { display: none; }
  .ed.mode-write .ed-preview { display: none; }
  .ed.mode-preview .ed-write { display: none; }
  .ed.mode-preview .ed-preview { display: block; position: static; height: auto; padding: 20px clamp(12px, 3vw, 40px) 90px; }
  .ed.mode-preview .pv-frame { max-width: 720px; margin: 0 auto; height: auto; }
  .ed-write { max-width: 820px; margin: 0 auto; width: 100%; }
  .pv-off .ed.mode-preview .ed-preview { display: block; }
}
@media (max-width: 1100px) {
  .ov-grid { grid-template-columns: 1fr; }
  .media-top { grid-template-columns: 1fr; }
}

/* ---------- phone ---------- */
@media (max-width: 860px) {
  :root { --side: 0px; }
  body { font-size: 15.5px; }
  .sidebar { display: none; }
  .view { margin-left: 0; padding-bottom: calc(84px + var(--safe-b)); }
  .topbar {
    display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 25; height: 58px; padding: 0 10px 0 14px;
    background: rgba(246, 241, 232, .88); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; }
  .topbar-title { flex: 1; margin: 0 0 0 4px; font: 600 19px var(--serif); }
  .lang-btn { font-weight: 700; font-size: 13px; border: 1px solid var(--line); width: 42px; height: 34px; border-radius: 10px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    height: calc(70px + var(--safe-b)); padding: 0 6px var(--safe-b);
    background: rgba(255, 253, 249, .94); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px); border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--muted); padding: 8px 0; font-weight: 600; transition: color .15s; }
  .tabbar a small { font-size: 11px; }
  .tabbar a span { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 99px; transition: background .2s var(--ease); }
  .tabbar a.active { color: var(--ink); }
  .tabbar a.active span { background: var(--red-soft); color: var(--red-ink); }
  .tab-fab { justify-self: center; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--red); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 22px -8px rgba(232, 69, 44, .9); transform: translateY(-10px); transition: transform .2s var(--ease); }
  .tab-fab:active { transform: translateY(-10px) scale(.92); }
  .tab-fab .i { width: 26px; height: 26px; stroke-width: 2.2; }
  body.in-editor .topbar, body.in-editor .tabbar { display: none; }
  body.in-editor .view { padding-bottom: 0; }
  .page { padding: 20px 16px 32px; }
  .page-head { margin-bottom: 18px; }
  .page-head .display { font-size: 30px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .hello { gap: 14px; margin-bottom: 18px; }
  .hello-avatar { width: 52px; height: 52px; }
  .hello .display { font-size: 28px; }
  .hello .lede { font-size: 14.5px; }
  .quick { grid-template-columns: 1fr 1fr; }
  .quick-btn.primary { grid-column: 1 / -1; }
  .quick-btn { padding: 14px; gap: 12px; }
  .quick-btn:not(.primary) small { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat-n { font-size: 32px; }
  .continue-link { grid-template-columns: 1fr; }
  .continue-link img { min-height: 0; aspect-ratio: 16 / 8; }
  .toolbar { flex-direction: column; }
  .search kbd { display: none; }
  .tabs { margin: 0 -16px 12px; padding: 0 16px 2px; }
  .row { padding: 8px; gap: 2px; }
  .row-main { gap: 12px; }
  .thumb { width: 72px; height: 72px; }
  .row-title { font-size: 16px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .row-ex { display: none; }
  .row-actions { flex-direction: column; }
  .wide-only { display: none !important; }
  .narrow-only { display: inline-grid !important; }
  .media-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .dropzone { min-height: 0; padding: 16px; justify-content: flex-start; }
  .media-detail { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .field input, .field textarea { font-size: 16px; } /* no iOS zoom */

  .ed-bar { padding: 8px 8px; gap: 4px; padding-top: max(8px, env(safe-area-inset-top)); }
  .ed-crumb { display: none; }
  .ed-bar .save-state { font-size: 12px; margin-right: auto; min-width: 0; overflow: hidden; }
  .ed-bar .save-state:not(.err):not(.busy) .ss-txt { display: none; }
  .ed-bar .save-state.ok { width: 30px; height: 30px; justify-content: center; border-radius: 50%; background: var(--green-soft); }
  .ed-bar .save-state .ss-txt { overflow: hidden; text-overflow: ellipsis; }
  .hello-avatar { display: none; }
  .dropzone { display: none; }
  .media-top { margin-bottom: 14px; }
  .ed-mode button { padding: 6px 10px; }
  .ed-mode button span { display: none; }
  .ed-bar .btn { padding: 0 14px; min-height: 40px; }
  .ed-bar .btn .i { display: none; }
  .ed-write { padding: 14px 14px 60px; }
  .cover-block.has { aspect-ratio: 4 / 3; border-radius: 14px; margin: -2px 0 18px; }
  .ed-title { font-size: 30px; }
  .ed-excerpt { font-size: 17px; }
  .ed-sec { padding: 16px 14px; border-radius: 16px; margin-left: -4px; margin-right: -4px; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .meta-grid > .field:last-child { grid-column: 1 / -1; }
  .item-btns { opacity: 1; }
  .item-btns button[data-mv] { display: none; }
  .item-in { font-size: 16px; }
  .ed-bodytext { font-size: 17px; padding: 14px; }
  .chips input { font-size: 16px; }
  .slug-input em { display: none; }
  .ed.mode-preview .ed-preview { padding: 0 0 40px; }
  .ed.mode-preview .pv-frame { border-radius: 0; border: 0; box-shadow: none; }
  .ed.mode-preview .pv-bar { display: none; }
  .pv-inner { padding: 18px 16px 28px; }
  .pv-title { font-size: 28px; }

  .toasts { bottom: calc(84px + var(--safe-b)); }
  body.in-editor .toasts { bottom: calc(16px + var(--safe-b)); }

  /* modals become bottom sheets */
  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal, .modal.wide, .modal.small { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; transform: translateY(100%); padding-bottom: var(--safe-b); }
  .modal-wrap.in .modal { transform: none; }
  .modal-wrap.out .modal { transform: translateY(100%); opacity: 1; }
  .modal-grab { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line-2); margin: 8px auto 0; }
  .modal-head { padding: 8px 12px 0 20px; }
  .modal-body { padding: 8px 18px 16px; }
  .modal-foot { padding: 12px 16px 16px; }
  .modal-foot .btn { flex: 1; }
  .picker-grid { grid-template-columns: repeat(3, 1fr); }

  /* welcome stacks */
  .welcome { grid-template-columns: 1fr; grid-template-rows: 38vh 1fr; overflow-y: auto; }
  .welcome-photo::after { background: linear-gradient(180deg, rgba(29, 26, 23, .05) 40%, var(--paper)); }
  .welcome-card { justify-content: flex-start; padding: 0 22px 32px; margin-top: -64px; }
  .welcome-logo { width: 96px; height: 96px; margin-bottom: 18px; box-shadow: 0 0 0 5px var(--paper), var(--shadow-2); }
  .welcome-lang { top: calc(-38vh + 64px + 14px); right: 14px; background: rgba(255, 253, 249, .85); }
  .welcome-title { font-size: 56px; }
  .welcome-sub { font-size: 16.5px; }
  .welcome .btn.xl { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   ROUND 3: login, server saving, consultation requests
   ===================================================================== */
/* entry screen: one password field right above the button */
.login { display: grid; gap: 8px; width: min(100%, 380px); margin-top: 8px; }
.login-label { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }
.login-field { position: relative; display: flex; align-items: center; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 16px; transition: border-color .15s, box-shadow .15s; }
.login-field:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px rgba(232, 69, 44, .12); }
.login-field > .i { position: absolute; left: 16px; color: var(--muted); pointer-events: none; }
.login-field input { flex: 1; min-width: 0; height: 56px; border: 0; background: transparent; padding: 0 8px 0 48px; font-size: 20px; letter-spacing: .32em; font-variant-numeric: tabular-nums; border-radius: 16px; }
.login-field input::placeholder { color: var(--line-2); letter-spacing: .2em; }
.login-field input:focus { outline: none; }
.pw-eye { width: 48px; height: 48px; margin-right: 4px; border: 0; background: transparent; border-radius: 12px; color: var(--muted); display: grid; place-items: center; }
.pw-eye:hover, .pw-eye.on { color: var(--ink); background: var(--paper-2); }
.login-msg { margin: 0; min-height: 20px; font-size: 14px; font-weight: 500; color: var(--muted); }
.login-msg.err { color: var(--red-ink); font-weight: 600; }
.login-msg.info { color: var(--ink-2); }
.login .btn.xl { width: 100%; margin-top: 6px; }
.btn.busy .i { animation: nudgeR .7s ease-in-out infinite; }
@keyframes nudgeR { 50% { transform: translateX(5px); } }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* save indicator */
.save-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); min-height: 22px; }
.save-dot .i { width: 15px; height: 15px; }
.save-dot .dot { width: 7px; height: 7px; border-radius: 50%; background: #e0a412; animation: pulse 1s infinite; }
.save-dot.saved { color: var(--green); }
.save-dot.offline, .save-dot.error { color: var(--red-ink); }
.save-dot.compact span { display: none; }
.save-dot.compact { width: 30px; height: 30px; justify-content: center; border-radius: 50%; }
.save-dot.compact.saved { opacity: 0; transition: opacity .6s .8s; }
.save-dot.compact.offline, .save-dot.compact.error { background: var(--red-soft); }
.logout-link { background: none; border: 0; padding: 0; text-align: left; font: inherit; font-weight: 500; font-size: 14px; cursor: pointer; }

/* badges */
.nav-count.hot { background: var(--red); color: #fff; }
.pill.hot { background: var(--red); color: #fff; }
.tab-badge { position: absolute; top: 3px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--card); }
.tab-badge:empty { display: none; }
.tabbar a { position: relative; }
.unread-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }

/* media library count */
.lib-count { display: flex; align-items: baseline; gap: 10px; }
.lib-count b { font: 600 34px/1 var(--serif); }
.lib-count span { color: var(--ink-2); font-size: 13.5px; }

/* overview: requests card */
.req-card .card-head .pill { height: 22px; }
.req-card.has { border-color: #f0c7bd; box-shadow: var(--shadow-1), 0 0 0 3px var(--red-soft); }
.req-mini { margin-bottom: 8px; }
.req-av { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 600 15px var(--serif); letter-spacing: .02em; }
.req-av.big { width: 58px; height: 58px; font-size: 20px; background: var(--red); color: #fff; }
.req-empty { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.req-empty .i { color: var(--red); flex: none; }

/* requests list */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1); text-decoration: none; transition: box-shadow .2s, border-color .2s, transform .2s var(--ease); animation: rise .4s var(--ease) both; animation-delay: var(--d); }
.req-row:hover { box-shadow: var(--shadow-2); border-color: var(--line-2); transform: translateY(-1px); }
.req-row.unread { border-left: 4px solid var(--red); }
.req-row.unread .req-top b { font-weight: 700; }
.req-main { display: grid; gap: 3px; min-width: 0; }
.req-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.req-top b { font: 600 18px/1.2 var(--serif); }
.req-biz { color: var(--ink-2); font-weight: 600; font-size: 14px; }
.req-sub { color: var(--muted); font-size: 13px; font-weight: 500; }
.req-ex { color: var(--ink-2); font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 2px; }
.req-needs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pill.need { background: var(--paper-2); color: var(--ink-2); height: 22px; font-size: 11.5px; }
.req-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.req-when { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pill.rstatus i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.rstatus.new { background: var(--red-soft); color: var(--red-ink); }
.pill.rstatus.progress { background: var(--amber-soft); color: var(--amber); }
.pill.rstatus.done { background: var(--green-soft); color: var(--green); }
.pill.rstatus.archived { background: var(--paper-2); color: var(--muted); }
#reqReload.spin .i { animation: spinI .8s linear infinite; }
@keyframes spinI { to { transform: rotate(360deg); } }

/* request detail sheet */
.req-detail { display: grid; gap: 16px; }
.rd-head { display: flex; gap: 14px; align-items: center; }
.rd-head h3 { margin: 0; font: 600 24px/1.1 var(--serif); }
.rd-head p { margin: 3px 0 0; color: var(--ink-2); font-size: 14px; }
.rd-head .fine { margin-top: 4px; }
.qa-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); text-decoration: none; font-weight: 600; font-size: 13.5px; transition: background .15s, transform .15s var(--ease); }
.qa:hover { background: var(--paper-2); transform: translateY(-1px); }
.qa .i { width: 22px; height: 22px; color: var(--red-ink); }
.qa.wa .i { color: #1f9d55; }
.req-seg { display: flex; flex-wrap: wrap; width: 100%; }
.req-seg button { flex: 1 1 auto; }
.rd-block h4, .kvs dt { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rd-challenge { margin: 0; padding: 14px 16px; background: var(--paper); border-radius: 14px; border: 1px solid var(--line); font: 400 16px/1.55 var(--serif); }
.kvs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.kvs dd { margin: 0; font-size: 14.5px; overflow-wrap: anywhere; }
.kvs a { color: var(--red-ink); }
.notes-field textarea { min-height: 84px; }
.note-state { font-style: normal; font-weight: 500; color: var(--muted); margin-left: auto; }
.req-modal .modal-foot { justify-content: space-between; }

@media (max-width: 860px) {
  .tabbar { grid-template-columns: repeat(6, 1fr); padding: 0 2px var(--safe-b); }
  .tabbar a small { font-size: 10.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .tabbar a span { width: 46px; }
  .tab-fab { width: 52px; height: 52px; }
  .req-row { grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px; }
  .req-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; order: 3; }
  .req-av { width: 38px; height: 38px; font-size: 13px; }
  .qa-row { grid-template-columns: repeat(4, 1fr); }
  .qa { padding: 10px 4px; font-size: 12px; }
  .welcome-card { padding-bottom: calc(32px + var(--safe-b)); }
  .login { width: 100%; }
}
@media (max-width: 380px) {
  .tabbar a small { font-size: 9.5px; }
  .kvs { grid-template-columns: 1fr; }
}
.login { grid-template-columns: minmax(0, 1fr); }
.login-field input { width: 100%; }
@media (max-width: 860px) { .qa-row { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); } }

/* =====================================================================
   Round 4: phone chrome. Opaque top bar under the status bar, 5-tab bar,
   "+ New" as a compact pill in the top bar (no raised FAB).
   ===================================================================== */
html { background: var(--paper); }
.top-new { display: none; }
@media (max-width: 860px) {
  .topbar {
    height: auto; min-height: calc(58px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none;
    border-bottom: 1px solid var(--line); box-shadow: 0 10px 22px -20px rgba(29, 26, 23, .5);
  }
  .topbar::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 200px; background: var(--paper); pointer-events: none; }
  .topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-new {
    display: inline-flex; align-items: center; gap: 5px; flex: none; height: 36px; padding: 0 14px 0 10px; margin-right: 2px;
    border: 0; border-radius: 99px; background: var(--red); color: #fff; font-weight: 700; font-size: 14px;
    box-shadow: 0 6px 14px -8px rgba(232, 69, 44, .9); transition: transform .15s var(--ease), background .15s;
  }
  .top-new:active { transform: scale(.95); background: var(--red-ink); }
  .top-new .i { width: 18px; height: 18px; stroke-width: 2.4; }
  .top-new:focus-visible { outline: 3px solid var(--red-soft); outline-offset: 2px; }

  .tabbar {
    grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch;
    height: auto; padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + var(--safe-b)) max(6px, env(safe-area-inset-left));
    background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none;
    border-top: 1px solid var(--line); box-shadow: 0 -10px 24px -22px rgba(29, 26, 23, .5);
  }
  .tabbar a { padding: 4px 0 2px; gap: 3px; min-width: 0; }
  .tabbar a span { width: 54px; height: 30px; }
  .tabbar a small { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .view { padding-bottom: calc(76px + var(--safe-b)); }
  .toasts { bottom: calc(80px + var(--safe-b)); }
}
@media (max-width: 380px) {
  .tabbar a small { font-size: 10.5px; }
  .tabbar a span { width: 46px; }
  .top-new { padding: 0 12px 0 8px; }
}
