input[type="checkbox"] {
  -webkit-appearance: checkbox;
  -moz-appearance: checkbox;
  appearance: checkbox;
  width: auto;
  height: auto;
}

/* The native search-cancel "x" (WebKit/mobile) can render outside the
   input's visible box depending on layout -- we already have our own
   Clear control, so drop the native decorations entirely. */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

:root {
  --pico-font-size: 14px;
  --pico-font-family: 'Inter', system-ui, sans-serif;
  --pico-line-height: 1.6;
  --pico-border-radius: 6px;
}

html {
  /* Reuses the same variable already applied at body>main (line ~822) so
     this always matches the active theme -- prevents a WKWebView rubber-band
     overscroll bounce from revealing a mismatched native background behind
     the page, confirmed necessary on a sibling Capacitor app. `contain`
     alone still allows the local bounce; `none` fully suppresses it. */
  background: var(--pico-background-color, #fff);
  overscroll-behavior-y: none;
}

/* Body scroll lock while a bottom sheet is open (toggled from openSheet()/
   closeSheet() in base.html). position:fixed (not just overflow:hidden) is
   required for this to actually block touch-scroll-through on iOS/WKWebView;
   `top` is set inline to the negative scroll offset so the page doesn't
   visually jump when locked. */
body.sheet-scroll-locked {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

/* Native app only (env/--safe-area-inset-* is 0 everywhere else, so these
   collapse to nothing on desktop/regular mobile web): color the top status
   bar and bottom gesture-nav strips brand green instead of showing the
   page's white background through them. Targeting SDK 36 means Android
   enforces edge-to-edge and ignores the native android:statusBarColor theme
   attribute entirely, so this has to be painted as web content.
   Retry of the earlier reverted attempt (see feedback_sticky_header_regression
   memory) -- that attempt's real bug was header's stacking context (fixed
   separately above), not these pseudo-elements, which were pointer-events:none
   and uninvolved. z-index deliberately above #security-nag-bar's 10001 (the
   highest other z-index in the app) so this is genuinely always on top,
   matching the "tippy top, above all" ask -- purely decorative, never
   intercepts anything real underneath it. */
body::before,
body::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  background: #1e8449;
  z-index: 20000;
  pointer-events: none;
}
body::before {
  top: 0;
  height: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
}
body::after {
  bottom: 0;
  height: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

body {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem .75rem;
}

h1,
h2,
h3 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  letter-spacing: -.01em;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.25rem;
}

header, body > header {
  padding: 0 !important;
  /* Initial-paint clearance only -- header is NOT sticky, so this just
     keeps its own content (logo, scope picker, Add Recipe button) from
     starting underneath the status-bar strip below. No sticky/z-index/
     background needed: the green safe-area strips (body::before/::after,
     further down this file) are independently position:fixed and cover
     that zone on their own regardless of header's scroll position -- an
     entire sticky header (scope picker + Add Recipe persistently
     following scroll) doesn't make sense on every page, and making it
     sticky earlier caused a real stacking-context bug (see
     feedback_sticky_header_regression memory) that needed its own fix.
     Simpler to just not make header sticky at all. */
  padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) !important;
  margin-bottom: 0;
}

/* header-after-banner: applied (base.html) whenever a banner above header
   (security nag, pinned notice, tip-of-the-day, admin preview) already
   claimed the safe-area clearance -- without this override, header's own
   unconditional padding-top above stacks with it into a large gap. */
header.header-after-banner, body > header.header-after-banner {
  padding-top: 0 !important;
}

body > main {
  padding: 0;
  margin-top: 0;
  max-width: none;
}

header nav, body > header nav {
  border-bottom: 1px solid var(--pico-muted-border-color);
  padding: .3rem 0 !important;
  margin-bottom: 0;
}

header nav a {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  color: inherit;
  letter-spacing: .02em;
}

.badge {
  display: inline-block;
  padding: .15em .55em;
  border-radius: 3px;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #fff;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .875rem;
  margin-top: var(--sp-4, 1rem);
}

.recipe-card {
  background: var(--bg-elevated, var(--pico-card-background-color, transparent));
  border: 1px solid var(--line, var(--pico-muted-border-color));
  border-radius: var(--r-md, 14px);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm, 0 2px 12px rgba(0,0,0,.07));
  transition: box-shadow .18s, transform .18s, border-color .18s;
}

.recipe-card:hover {
  box-shadow: var(--shadow, 0 8px 28px rgba(0,0,0,.13));
  border-color: var(--muted, #bbb);
  transform: translateY(-2px);
}

.card-thumb {
  width: 100%;
  height: 160px;
  background-size: cover;
  background-position: center;
}

.card-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: .85;
}

.card-body {
  padding: var(--sp-3, .875rem) var(--sp-4, 1rem);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.recipe-card h3 {
  font-family: var(--font-display, 'Lora', Georgia, serif);
  margin: var(--sp-2, .35rem) 0 var(--sp-1, .25rem);
  font-size: var(--text-lg, .95rem);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-card small {
  color: var(--muted, var(--pico-muted-color));
  font-size: var(--text-sm, .8rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.card-date {
  font-size: var(--text-xs, .72rem);
  color: var(--muted, var(--pico-muted-color));
  margin-top: var(--sp-1, .3rem);
}

.card-actions {
  display: flex;
  gap: var(--sp-2, .3rem);
  margin-top: auto;
  padding-top: var(--sp-2, .5rem);
}

.card-overflow-btn { display: none !important; }

.card-more-btn { letter-spacing: .05em; font-size: var(--text-xs, .75rem); }

#card-overflow-menu {
  display: none;
  position: absolute;
  z-index: 9999;
  background: var(--pico-card-background-color, #fff);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  padding: .3rem 0;
  min-width: 175px;
}
.card-menu-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .55rem 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: .85rem;
  text-align: left;
  color: inherit;
  font-family: inherit;
  white-space: nowrap;
}
.card-menu-item:hover { background: var(--pico-muted-background-color, rgba(0,0,0,.04)); }
.card-menu-item.active { color: var(--success, #27ae60); }
.card-menu-item.danger { color: #c0392b; }
.card-menu-icon { font-size: 1em; width: 1.2em; text-align: center; flex-shrink: 0; }
[data-theme="dark"] #card-overflow-menu { background: #1e1e2e; border-color: #333; }
[data-style="moody"] #card-overflow-menu { background: #1e293b; border-color: #334155; }
[data-style="cosmic"] #card-overflow-menu { background: #120426; border-color: rgba(139,0,255,.4); }

/* --pico-code-background is a pico v1 name; define it theme-aware so every
   template that uses it gets the right background in light and dark mode. */
:root { --pico-code-background: #f4f5f6; }
[data-theme="dark"] { --pico-code-background: #1b2433; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --pico-code-background: #1b2433; }
}

/* Form element text: force readable colour in dark mode regardless of
   how individual elements set color:var(--pico-color).
   Targets inputs/textareas/selects with explicit background overrides. */
[data-theme="dark"] input:not([type=submit]):not([type=button]):not([type=reset]):not([type=checkbox]):not([type=radio]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  color: #c2cad4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input:not([type=submit]):not([type=button]):not([type=reset]):not([type=checkbox]):not([type=radio]),
  :root:not([data-theme="light"]) textarea,
  :root:not([data-theme="light"]) select {
    color: #c2cad4;
  }
}

.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; width: 1.25em; height: 1.25em; }
.card-action-btn {
  background: none;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--r-xs, 4px);
  cursor: pointer;
  font-size: .85rem;
  padding: .15em .45em;
  line-height: 1;
  color: var(--pico-muted-color);
  transition: background .1s, color .1s, border-color .1s;
  width: auto;
  margin: 0;
  position: relative;
}

.card-action-btn:hover {
  border-color: #aaa;
  color: inherit;
  background: var(--pico-muted-border-color);
}

/* Recipe-detail top action row -- one consistent pill shape for every
   action (Share, Cook, Timer, Log a cook, etc.) instead of a mix of
   square buttons, circles, and text links. */
.recipe-action-pill {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  padding: .4em .9em;
  font-size: .85em;
  line-height: 1;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--pico-muted-border-color);
  background: transparent;
  color: var(--pico-muted-color);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  margin: 0;
}
.recipe-action-pill:hover {
  border-color: #aaa;
  color: inherit;
  background: var(--pico-muted-border-color);
}
.recipe-action-pill.recipe-action-pill-primary {
  background: var(--accent, #1e8449);
  color: var(--accent-ink, #fff);
  border-color: var(--accent, #1e8449);
  font-weight: 500;
}
.recipe-action-pill.recipe-action-pill-primary:hover {
  background: var(--accent-hover, #1a7a4a);
  border-color: var(--accent-hover, #1a7a4a);
  color: var(--accent-ink, #fff);
}
.recipe-action-pill svg { flex-shrink: 0; }
.recipe-action-pill { flex-shrink: 0; }
.recipe-action-row::-webkit-scrollbar { display: none; }

.cart-btn.cart-on,
.wtt-btn.wtt-on,
.cook-btn.cook-on,
.cart-icon.cart-on {
  color: var(--success, #27ae60);
  border-color: var(--success, #27ae60);
}

.card-made-badge {
  position: absolute;
  top: .45rem;
  right: .45rem;
  color: #fff;
  opacity: .92;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.55));
  pointer-events: none;
  z-index: 7;
  line-height: 1;
}
.card-variation-badge {
  position: absolute;
  bottom: .45rem;
  left: .45rem;
  color: #fff;
  opacity: .92;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.55));
  pointer-events: none;
  z-index: 7;
  line-height: 1;
  display: flex;
  align-items: center;
}

.hide-btn.hide-on {
  color: #1e8449;
  border-color: #1e8449;
  opacity: .7;
}

.cart-btn.cart-on::after,
.wtt-btn.wtt-on::after,
.cook-btn.cook-on::after {
  content: "✓";
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: .55rem;
  line-height: 1;
  background: var(--success, #27ae60);
  color: var(--success-ink, #fff);
  border-radius: 50%;
  width: 10px;
  height: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fav-btn.fav-on, .fav-icon.fav-on {
  color: #e74c3c;
  border-color: #e74c3c;
}

.del-btn:hover {
  border-color: #1e8449;
  color: #1e8449;
  background: #fdf0ef;
}

.stars {
  display: inline-flex;
  gap: .1rem;
}

.star {
  cursor: pointer;
  font-size: 1.1rem;
  color: #ddd;
  transition: color .1s;
  line-height: 1;
}

.star.on {
  color: #f39c12;
}

.star-sm {
  font-size: .8rem;
}

.stars:hover .star, .rating-stars:hover .star {
  color: #f39c12;
}

.stars .star:hover~.star, .rating-stars .star:hover~.star {
  color: #ddd;
}

.ai-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: #8e44ad;
  border: 1px solid #c39bd3;
  border-radius: 3px;
  padding: .1em .4em;
  vertical-align: middle;
}

.category-tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: var(--sp-4, 1rem);
}

.category-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: .32em .9em;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
  border: 2px solid rgba(0,0,0,.15);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 3px 0 rgba(0,0,0,.2);
  transition: transform .1s, box-shadow .1s;
}

.category-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 rgba(0,0,0,.2);
}

.category-tab:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
}

.category-tab.active {
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(0,0,0,.25), inset 0 1px 3px rgba(0,0,0,.15);
}
.category-tab.active::after {
  content: "✓";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  color: #222;
  font-size: 8px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,.25);
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  line-height: 1;
}

.filter-bar {
  display: flex;
  gap: var(--sp-3, .75rem);
  flex-wrap: wrap;
  align-items: flex-end;
}

label {
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--pico-muted-color);
}


.recipe-content h1 {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  font-size: 1.5rem;
  margin-bottom: var(--sp-1, .25rem);
}

.recipe-content h2 {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  font-size: 1.05rem;
  margin-top: var(--sp-5, 1.5rem);
  border-bottom: 1px solid var(--pico-muted-border-color);
  padding-bottom: var(--sp-1, .25rem);
}

.recipe-content img {
  max-width: 100%;
  border-radius: 6px;
}

.recipe-content p {
  font-size: .9rem;
}

.recipe-content li {
  font-size: .9rem;
}

/* Ingredients (markdown renders these as a plain <ul>) get banded rows so
   they read as a scannable checklist; instructions (<ol>) get generous
   spacing and a divider between steps instead -- distinctly different
   from ingredients rather than both looking like a plain bullet list. */
.recipe-content ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.recipe-content ul li {
  padding: .55rem .8rem;
  margin-bottom: .35rem;
  border-radius: 6px;
  background: var(--bg-sunken, rgba(0, 0, 0, .035));
}
.recipe-content ol {
  padding-left: 1.4rem;
}
.recipe-content ol li {
  padding: .3rem 0 .3rem .3rem;
  margin-bottom: .6rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}
.recipe-content ol li:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

nav.breadcrumb {
  margin-bottom: var(--sp-4, 1rem);
  font-size: .82rem;
}

#toast {
  position: fixed;
  top: calc(1.2rem + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
  left: 50%;
  transform: translateX(-50%);
  background: var(--success, #27ae60);
  color: var(--success-ink, #fff);
  padding: .6rem 1.4rem;
  border-radius: 24px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  transition: opacity .4s ease;
  z-index: 999;
}

button,
[type="submit"] {
  font-size: .85rem;
}

.theme-toggle {
  display: flex;
  gap: .15rem;
}

.theme-btn {
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  margin: 0;
  border: 1.5px solid #888;
  border-radius: var(--r-xs, 4px);
  background: transparent;
  color: #888;
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s, border-color .1s, color .1s;
}

.theme-btn:hover {
  border-color: #555;
  color: #555;
}

.theme-btn.active {
  border-color: #1e8449;
  color: #1e8449;
}

/* View toggle */
.view-toggle {
  display: flex;
  gap: var(--sp-1, .25rem);
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--r-xs, 4px);
  text-decoration: none;
  color: var(--pico-muted-color);
  font-size: .78rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: background .1s, border-color .1s;
}

.view-btn:hover {
  border-color: #aaa;
  color: inherit;
  background: var(--pico-muted-border-color);
}

.view-btn.active {
  border-color: var(--pico-color, #1a1a2e);
  color: var(--pico-color, #1a1a2e);
  background: var(--pico-muted-border-color);
}

/* List view */
.recipe-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: var(--sp-4, 1rem);
}

.recipe-list-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3, .75rem);
  padding: var(--sp-2, .55rem) var(--sp-3, .875rem);
  background: var(--bg-elevated, var(--pico-card-background-color, transparent));
  border: 1px solid var(--line, var(--pico-muted-border-color));
  border-radius: var(--r-sm, 6px);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, border-color .15s;
}

.recipe-list-row:hover {
  box-shadow: var(--shadow-sm, 0 2px 6px rgba(0, 0, 0, .07));
  border-color: var(--muted, #bbb);
}

.list-thumb {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border-radius: var(--r-sm, 4px);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  opacity: .9;
}

.list-main {
  flex: 1;
  min-width: 0;
}

.list-title {
  font-family: var(--font-display, inherit);
  font-weight: 600;
  font-size: var(--text-base, .9rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--sp-1, .15rem);
}

.list-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2, .45rem);
  flex-wrap: wrap;
  font-size: var(--text-sm, .75rem);
  color: var(--muted, var(--pico-muted-color));
}

.list-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2, .5rem);
  flex-shrink: 0;
}

/* Table view */
.recipe-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  margin-top: var(--sp-4, 1rem);
}

.recipe-table th {
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pico-muted-color);
  padding: .4rem .6rem;
  border-bottom: 2px solid var(--pico-muted-border-color);
  white-space: nowrap;
}

.recipe-table td {
  padding: .42rem .6rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  vertical-align: middle;
  font-size: .85rem;
}

.recipe-table tbody tr:hover td {
  background: var(--pico-code-background, #f9f9f9);
}

.tbl-title {
  font-weight: 500;
  text-decoration: none;
  color: inherit;
}

.tbl-title:hover {
  text-decoration: underline;
}

.tbl-actions {
  display: flex;
  gap: var(--sp-1, .25rem);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  margin-top: var(--sp-5, 1.5rem);
  flex-wrap: wrap;
}

.pagination a,
.pg-num {
  padding: .28em .65em;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--r-xs, 4px);
  font-size: .82rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  background: transparent;
}

.pagination a:hover,
.pg-num:hover {
  border-color: #aaa;
  background: var(--pico-muted-border-color);
}

.pg-current {
  padding: .28em .65em;
  border: 1px solid var(--accent, #1e8449);
  border-radius: var(--r-xs, 4px);
  font-size: .82rem;
  font-weight: 600;
  background: var(--accent, #1e8449);
  color: var(--accent-ink, #fff);
}

.pg-ellipsis {
  font-size: .82rem;
  color: var(--pico-muted-color);
  padding: 0 .2em;
}

/* Avatar menu */
.avatar-menu {
  position: relative;
}

.avatar-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #1e8449;
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
}

.avatar-btn:hover {
  opacity: .85;
}

.avatar-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + .4rem);
  min-width: 240px;
  background: var(--pico-background-color, #fff);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--r-sm, 8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
  z-index: 1000;
  overflow: hidden;
}

.avatar-dropdown.open {
  display: block;
}

/* Desktop: the Admin sub menu is long, so it scrolls inside the More menu
   instead of being clipped by the dropdown's overflow:hidden. (Mobile already
   turns the whole dropdown into a scrolling bottom panel -- see components.css.) */
@media (min-width: 640px) {
  .avatar-dropdown { max-height: calc(100vh - 5rem); overflow-y: auto; }
  #admin-flyout {
    max-height: min(55vh, 28rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.avatar-dropdown-header {
  padding: .7rem .85rem .6rem;
}

.avatar-dropdown-name {
  display: flex;
  align-items: center;
  gap: .3em;
  font-weight: 600;
  font-size: .88rem;
  color: inherit;
  text-decoration: none;
}
.avatar-dropdown-name:hover { text-decoration: underline; }

.avatar-dropdown-family {
  display: flex;
  align-items: center;
  gap: .3em;
  font-size: .72rem;
  color: var(--pico-muted-color);
  margin-top: .05rem;
  text-decoration: none;
}
.avatar-dropdown-family:hover { text-decoration: underline; }

.avatar-dropdown-item, .add-fab-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: var(--sp-2, .5rem) var(--sp-4, 1rem);
  font-size: var(--text-sm, .875rem);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  line-height: 1.2;
  text-decoration: none;
  color: inherit;
  transition: background .1s;
  border-radius: 6px;
}

.avatar-dropdown-item:hover, .add-fab-item:hover {
  background: var(--pico-code-background, #f4f4f4);
}

.avatar-dropdown-divider {
  height: 1px;
  background: var(--pico-muted-border-color);
  margin: .2rem 0;
}

.avatar-dropdown-group-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--pico-muted-color);
  padding: .5rem 1rem .15rem;
}

.avatar-dropdown-section {
  padding: .3rem .85rem .1rem;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--pico-muted-color);
}

/* Working overlay */
#working-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#working-overlay.active { display: flex; }
#working-box {
  background: var(--pico-card-background-color, #fff);
  border-radius: var(--r-md, 12px);
  padding: 2rem 2.5rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4, 1rem);
  min-width: 180px;
}
#working-spinner {
  width: 2.2rem;
  height: 2.2rem;
  border: 3px solid var(--pico-muted-border-color);
  border-top-color: #1e8449;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#working-msg {
  font-size: .9rem;
  color: var(--pico-color);
  font-weight: 500;
}

/* Tags */
.tag-chip {
  display: inline-block;
  padding: .1em .45em;
  border-radius: 10px;
  font-size: .68rem;
  font-weight: 500;
  background: #5d6d7e;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.tag-chip-global {
  display: inline-block;
  padding: .1em .45em;
  border-radius: 10px;
  font-size: .68rem;
  font-weight: 500;
  background: #0e7490;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.tag-chip-outline {
  display: inline-block;
  padding: .1em .45em;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 500;
  border: 1px solid #5d6d7e;
  color: #5d6d7e;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.tag-chip-outline.active {
  background: #5d6d7e;
  color: #fff;
}

/* Print styles */
@media print {
  header, footer, #working-overlay, #whats-new-banner,
  .card-actions, .fav-btn, .cart-btn, .del-btn,
  nav.breadcrumb, #cook-nav, .view-toggle,
  .filter-bar, .category-tabs, .pagination,
  button, [type="submit"], dialog,
  .avatar-menu, #toast,
  .ai-panels, .related-section, #tips-section,
  .cook-history-section, .scaler-ctrl {
    display: none !important;
  }

  body {
    max-width: 100%;
    padding: .5cm 1.5cm;
    font-size: 11pt;
    color: #000 !important;
    background: #fff !important;
  }

  h1.recipe-print-title {
    font-size: 22pt;
    margin-bottom: .25cm;
    page-break-after: avoid;
  }

  .recipe-content {
    max-width: 100%;
  }

  /* Two-column layout for ingredients + instructions */
  .recipe-content .recipe-print-cols {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 1cm;
    column-gap: 1.2cm;
  }

  .recipe-content img {
    max-height: 6cm;
    width: auto;
    display: block;
    margin: .5rem 0;
    float: right;
    margin-left: 1cm;
  }

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

  h1 { font-size: 18pt; }
  h2 { font-size: 12pt; margin-top: .5rem; margin-bottom: .25rem; }

  .badge, .tag-chip, .ai-badge {
    border: 1px solid #999;
    color: #333 !important;
    background: transparent !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .stars, .rating-stars { display: none !important; }

  /* QR code section — visible only in print */
  .print-qr {
    display: block !important;
    margin-top: .5cm;
    font-size: 9pt;
    color: #555;
  }

  /* Keep page breaks clean */
  li { page-break-inside: avoid; }
  h2 { page-break-after: avoid; }
}

/* Hide print-only elements on screen */
.print-qr { display: none; }
.scaler-ctrl { }

/* ─── Visual Themes ───────────────────────────────────────────── */

/* Bulk bar: adapts to theme */
.bulk-bar { background: rgba(0,0,0,.06); color: inherit; }
[data-theme="dark"] .bulk-bar { background: rgba(255,255,255,.09); color: #e0e0e0; }
.bb-outline-btn { font-size:.78rem !important; padding:.25em .65em !important; margin:0 !important; background:transparent !important; border:1px solid var(--pico-muted-border-color) !important; border-radius:4px !important; cursor:pointer !important; color:#374151 !important; min-height:unset !important; width:auto !important; }
[data-theme="dark"] .bb-outline-btn { color:#e0e0e0 !important; }
[data-style="cookbook"] .bulk-bar { background: rgba(139,94,60,.1); }
[data-style="moody"] .bulk-bar { background: #1e293b; color: #e2e8f0; }

/* ── Cookbook: parchment paper, full Lora serif, generous card proportions ── */
[data-style="cookbook"] body,
[data-style="cookbook"] main { background-color: #faf6f0 !important; }
[data-style="cookbook"] { --pico-font-family: 'Lora', Georgia, serif; --pico-border-radius: 4px; }
[data-style="cookbook"] h1, [data-style="cookbook"] h2, [data-style="cookbook"] h3 {
  font-family: 'Fraunces', Georgia, serif;
}
[data-style="cookbook"] header nav {
  border-color: #c4a882;
  border-bottom-width: 2px;
  background-color: #faf6f0;
}
[data-style="cookbook"] .recipe-card {
  background: #fffef9;
  border-color: #dfd0b8;
  border-radius: 4px;
}
[data-style="cookbook"] .recipe-card h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.1rem;
}
[data-style="cookbook"] .recipe-list-row {
  background: #fffef9;
  border-color: #dfd0b8;
  padding: .7rem 1rem;
}
[data-style="cookbook"] .recipe-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.1rem;
}
[data-style="cookbook"] .card-thumb { height: 210px; }
[data-style="cookbook"] .card-body { padding: 1.1rem 1.25rem; }
[data-style="cookbook"] .list-thumb { width: 58px; height: 58px; }
[data-style="cookbook"] label { color: #8b6f52; }

/* ── Bold: shadow cards (no borders), Fraunces display, green accent, large radius ── */
[data-style="bold"] { --pico-border-radius: 14px; }
[data-style="bold"] body { background-color: #fafafa !important; }
[data-style="bold"] h1, [data-style="bold"] h2, [data-style="bold"] h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  letter-spacing: -.02em;
}
[data-style="bold"] header nav {
  border-color: transparent;
  border-bottom: 3px solid #059669;
}
[data-style="bold"] .recipe-card {
  background: #fff;
  border: none;
  border-radius: 14px;
  box-shadow: 0 3px 16px rgba(0,0,0,.1);
}
[data-style="bold"] .recipe-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,.16);
}
[data-style="bold"] .card-thumb { height: 190px; border-radius: 14px 14px 0 0; }
[data-style="bold"] .card-action-btn { border-radius: 8px; }
[data-style="bold"] .recipe-list-row {
  background: #fff;
  border: none;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
[data-style="bold"] .recipe-list-row:hover {
  box-shadow: 0 5px 20px rgba(0,0,0,.13);
}
[data-style="bold"] .recipe-grid {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}
[data-style="bold"] .cart-btn.cart-on,
[data-style="bold"] .wtt-btn.wtt-on,
[data-style="bold"] .cook-btn.cook-on { color: #059669; border-color: #059669; }
[data-style="bold"] .cart-btn.cart-on::after,
[data-style="bold"] .wtt-btn.wtt-on::after,
[data-style="bold"] .cook-btn.cook-on::after { background: #059669; }

/* ── Moody: deep navy, amber glow on hover, Fraunces headings ── */
[data-style="moody"] body,
[data-style="moody"] main { background-color: #0f172a !important; color: #e2e8f0 !important; }
[data-style="moody"] { --pico-border-radius: 8px; }
[data-style="moody"] h1, [data-style="moody"] h2, [data-style="moody"] h3 {
  font-family: 'Fraunces', Georgia, serif;
  color: #f1f5f9;
}
[data-style="moody"] header nav { background: #0f172a; border-color: #1e3a5f; }
[data-style="moody"] .recipe-card {
  background: #1e293b;
  border-color: #334155;
  transition: box-shadow .2s, border-color .2s;
}
[data-style="moody"] .recipe-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245,158,11,.3), 0 6px 24px rgba(0,0,0,.5);
}
[data-style="moody"] .card-thumb { height: 185px; }
[data-style="moody"] .recipe-list-row {
  background: #1e293b;
  border-color: #334155;
}
[data-style="moody"] .recipe-list-row:hover {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245,158,11,.25);
}
[data-style="moody"] .recipe-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
[data-style="moody"] select, [data-style="moody"] input[type="text"],
[data-style="moody"] input[type="search"] {
  background: #1e293b; color: #e2e8f0; border-color: #334155;
}
[data-style="moody"] label { color: #94a3b8; }
[data-style="moody"] .card-action-btn { color: #94a3b8; border-color: #334155; }
[data-style="moody"] .card-action-btn:hover { background: #334155; color: #e2e8f0; }
[data-style="moody"] .cart-btn.cart-on,
[data-style="moody"] .wtt-btn.wtt-on,
[data-style="moody"] .cook-btn.cook-on { color: #f59e0b; border-color: #f59e0b; }
[data-style="moody"] .cart-btn.cart-on::after,
[data-style="moody"] .wtt-btn.wtt-on::after,
[data-style="moody"] .cook-btn.cook-on::after { background: #f59e0b; }
[data-style="moody"] .logo-text { color: #F5ECDC !important; }

/* ── Cosmic: deep space, neon glow, Orbitron headings ── */
[data-style="cosmic"] body,
[data-style="cosmic"] main {
  background-color: #07020f !important;
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(139,0,255,.18) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(0,255,200,.12) 0%, transparent 55%),
    radial-gradient(ellipse at 55% 10%, rgba(255,0,200,.10) 0%, transparent 45%);
  color: #e0d4ff !important;
}
[data-style="cosmic"] { --pico-border-radius: 12px; }
[data-style="cosmic"] h1, [data-style="cosmic"] h2, [data-style="cosmic"] h3 {
  font-family: 'Orbitron', sans-serif;
  letter-spacing: .03em;
  background: linear-gradient(90deg, #ff00cc, #00ffe0, #ffcc00, #ff00cc);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: cosmic-shift 6s linear infinite;
}
@keyframes cosmic-shift { 0% { background-position: 0% 50% } 100% { background-position: 300% 50% } }
[data-style="cosmic"] body, [data-style="cosmic"] p, [data-style="cosmic"] li,
[data-style="cosmic"] td, [data-style="cosmic"] label, [data-style="cosmic"] small {
  font-family: 'Space Grotesk', sans-serif;
}
[data-style="cosmic"] header nav {
  /* No backdrop-filter here -- it makes this element a new containing block
     for position:fixed descendants (in supporting browsers), and
     notif_panel_markup()/avatar_dropdown_markup() are rendered inside this
     same <nav> and switch to position:fixed on mobile to anchor to the true
     viewport bottom. With the filter present, they got trapped relative to
     the header instead (rendered near the top, clipped/hidden behind other
     content) -- reproduced on prod, Cosmic theme only, since it's the only
     skin using backdrop-filter anywhere in the app. The opaque background
     below already reads fine without the blur. */
  background: rgba(10,2,25,.85);
  border-color: rgba(139,0,255,.4);
  box-shadow: 0 0 24px rgba(139,0,255,.25), 0 0 48px rgba(0,255,200,.08);
}
[data-style="cosmic"] .logo-text { color: #cc44ff !important; }
[data-style="cosmic"] .recipe-card {
  background: rgba(18,4,38,.85);
  border: 1px solid rgba(139,0,255,.35);
  box-shadow: 0 0 12px rgba(139,0,255,.15);
  transition: box-shadow .2s, border-color .2s;
}
[data-style="cosmic"] .recipe-card:hover {
  border-color: #ff00cc;
  box-shadow: 0 0 0 1px rgba(255,0,204,.4), 0 0 28px rgba(255,0,204,.3), 0 8px 30px rgba(0,0,0,.6);
}
[data-style="cosmic"] .recipe-card h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: .82rem;
  letter-spacing: .04em;
  background: linear-gradient(90deg, #ff00cc, #00ffe0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: none;
}
[data-style="cosmic"] .recipe-list-row {
  background: rgba(18,4,38,.8);
  border-color: rgba(139,0,255,.3);
}
[data-style="cosmic"] .recipe-list-row:hover {
  border-color: #00ffe0;
  box-shadow: 0 0 0 1px rgba(0,255,224,.3), 0 0 16px rgba(0,255,224,.15);
}
[data-style="cosmic"] .card-thumb { height: 190px; }
[data-style="cosmic"] .badge {
  font-family: 'Orbitron', sans-serif;
  font-size: .6rem;
  letter-spacing: .06em;
}
[data-style="cosmic"] .category-tab {
  font-family: 'Orbitron', sans-serif;
  font-size: .62rem;
  letter-spacing: .05em;
  box-shadow: 0 0 8px rgba(0,0,0,.5);
}
[data-style="cosmic"] .category-tab.active {
  box-shadow: 0 0 12px rgba(255,0,204,.5);
}
[data-style="cosmic"] select, [data-style="cosmic"] input[type="text"],
[data-style="cosmic"] input[type="search"] {
  background: rgba(18,4,38,.9);
  color: #e0d4ff;
  border-color: rgba(139,0,255,.4);
}
[data-style="cosmic"] input[type="search"]:focus,
[data-style="cosmic"] input[type="text"]:focus {
  border-color: #ff00cc;
  box-shadow: 0 0 0 2px rgba(255,0,204,.25);
  outline: none;
}
[data-style="cosmic"] label { color: #a78bfa; }
[data-style="cosmic"] .bulk-bar { background: rgba(139,0,255,.15); color: #e0d4ff; border: 1px solid rgba(139,0,255,.25); }
[data-style="cosmic"] .card-action-btn { color: #a78bfa; border-color: rgba(139,0,255,.4); }
[data-style="cosmic"] .card-action-btn:hover { background: rgba(139,0,255,.2); color: #ff00cc; border-color: #ff00cc; }
[data-style="cosmic"] .cart-btn.cart-on,
[data-style="cosmic"] .wtt-btn.wtt-on,
[data-style="cosmic"] .cook-btn.cook-on { color: #00ffe0; border-color: #00ffe0; }
[data-style="cosmic"] .cart-btn.cart-on::after,
[data-style="cosmic"] .wtt-btn.wtt-on::after,
[data-style="cosmic"] .cook-btn.cook-on::after { background: #00ffe0; color: #07020f; }
[data-style="cosmic"] .fav-btn.fav-on { color: #ff00cc; border-color: #ff00cc; box-shadow: 0 0 8px rgba(255,0,204,.5); }
[data-style="cosmic"] .recipe-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

/* ─── Tutu Green ─────────────────────────────────────────────── */
[data-style="tutu"] body,
[data-style="tutu"] main { background-color: #b9f0c8 !important; }
[data-style="tutu"] { --pico-primary: #00701a; --pico-primary-hover: #004d12;
                      --pico-border-radius: 20px; --pico-font-family: 'Nunito', 'Comic Sans MS', 'Segoe UI', sans-serif; }
[data-style="tutu"] h1, [data-style="tutu"] h2, [data-style="tutu"] h3 { color: #004d12; font-weight: 800; }
[data-style="tutu"] header nav {
  background: linear-gradient(135deg, #00701a, #00a82a);
  border-bottom: 3px solid #004d12;
}
[data-style="tutu"] header nav > div > a,
[data-style="tutu"] header nav > div > button,
[data-style="tutu"] header nav > div > span { color: #fff !important; }
[data-style="tutu"] .avatar-dropdown a, [data-style="tutu"] .avatar-dropdown span,
[data-style="tutu"] .avatar-dropdown button { color: var(--pico-color) !important; }
[data-style="tutu"] #notif-panel a, [data-style="tutu"] #notif-panel span,
[data-style="tutu"] #notif-panel button { color: var(--pico-color) !important; }
[data-style="tutu"] .logo-text { color: #fff !important; }
[data-style="tutu"] a { color: #00701a; }
[data-style="tutu"] a:hover { color: #004d12; }
[data-style="tutu"] .recipe-card {
  border: 2.5px solid #00a82a; border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0,112,26,.2);
  background: #edfff2;
}
[data-style="tutu"] .recipe-card:hover { box-shadow: 0 8px 28px rgba(0,112,26,.35); transform: translateY(-3px); }
[data-style="tutu"] .recipe-list-row { border: 2px solid #00a82a; background: #edfff2; border-radius: 16px; margin-bottom:.5rem; }
[data-style="tutu"] .recipe-list-row:hover { background: #d4ffe1; }
[data-style="tutu"] .card-thumb { border-radius: 18px 18px 0 0; }
[data-style="tutu"] .list-thumb { border-radius: 12px; }
[data-style="tutu"] .card-body { padding: 1rem 1.2rem; }
[data-style="tutu"] .card-action-btn { color: #00701a; border-color: #00a82a; border-width: 2px; }
[data-style="tutu"] .card-action-btn:hover { background: #b9f0c8; color: #004d12; border-color: #004d12; }
[data-style="tutu"] .fav-btn.fav-on { color: #d10000; border-color: #d10000; }
[data-style="tutu"] .cart-btn.cart-on,
[data-style="tutu"] .wtt-btn.wtt-on,
[data-style="tutu"] .cook-btn.cook-on { color: #00701a; border-color: #00701a; }
[data-style="tutu"] .cart-btn.cart-on::after,
[data-style="tutu"] .wtt-btn.wtt-on::after,
[data-style="tutu"] .cook-btn.cook-on::after { background: #00701a; color: #fff; }
[data-style="tutu"] .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
[data-style="tutu"] #card-overflow-menu { background: #edfff2; border-color: #00a82a; }
[data-style="tutu"] .bulk-bar { background: #b9f0c8; color: #004d12; }

/* ─── Cookbook (flipbook) View ──────────────────────────────── */
.cb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: .5rem 0 2rem;
}
.cb-card {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
  cursor: pointer;
  transition: opacity .18s ease;
}
.cb-card.fading { opacity: 0; }
.cb-hero {
  width: 100%;
  height: 42vh;
  min-height: 200px;
  max-height: 340px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
}
.cb-body {
  padding: 1.4rem 1.6rem 1.2rem;
}
.cb-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2, .5rem);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3, .75rem);
  font-size: .82rem;
  color: var(--pico-muted-color);
}
.cb-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: .6rem;
  letter-spacing: -.01em;
}
.cb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: var(--sp-2, .5rem);
}
.cb-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-4, 1rem);
  width: 100%;
  max-width: 560px;
}
.cb-nav-btn {
  flex: 1;
  padding: .6rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--r-sm, 8px);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  transition: background .1s, border-color .1s;
}
.cb-nav-btn:hover { background: var(--pico-muted-border-color); border-color: #aaa; }
.cb-nav-btn:disabled { opacity: .3; cursor: default; }
.cb-counter {
  font-size: .82rem;
  color: var(--pico-muted-color);
  white-space: nowrap;
  text-align: center;
  min-width: 70px;
}
.cb-open {
  width: 100%;
  max-width: 560px;
  padding: .7rem;
  border-radius: var(--r-sm, 8px);
  background: var(--accent, #1e8449);
  color: var(--accent-ink, #fff);
  border: none;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
}
.cb-open:hover { background: var(--accent-hover, #1a7a4a); }
[data-style="moody"] .cb-card { border-color: #334155; background: #1e293b; }
[data-style="cookbook"] .cb-title { font-size: 1.8rem; }
[data-style="bold"] .cb-card { border: none; box-shadow: 0 6px 28px rgba(0,0,0,.13); border-radius: 18px; }
[data-style="bold"] .cb-hero { border-radius: 18px 18px 0 0; }
[data-style="bold"] .cb-nav-btn { border-radius: 12px; }
[data-style="bold"] .cb-open { border-radius: 12px; background: #059669; }
[data-style="bold"] .cb-open:hover { background: #047857; }

/* ─── Global Timer Widget ─────────────────────────────────────── */
#timerWidget { position: relative; }

#timerNavBtn {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-base, 1rem);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  padding: 0;
  margin: 0;
  color: inherit;
  width: auto;
  min-height: unset;
  position: relative;
  line-height: 1;
}

#timerNavBadge {
  display: none;
  position: absolute;
  top: -.45rem;
  right: -.55rem;
  background: #1e8449;
  color: #fff;
  font-size: .58rem;
  font-weight: 700;
  border-radius: 9px;
  padding: .05em .32em;
  line-height: 1.4;
  min-width: .9rem;
  text-align: center;
}

#timerPanel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + .55rem);
  width: 220px;
  background: var(--pico-card-background-color, #fff);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  z-index: 1001;
  padding: var(--sp-3, .75rem);
}

#timerPanel.open { display: block; }

.tp-title {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pico-muted-color);
  margin: 0 0 .6rem;
}

.tp-presets {
  display: flex;
  gap: .35rem;
  margin-bottom: .55rem;
}

.tp-preset {
  flex: 1;
  font-size: .78rem;
  font-weight: 700;
  padding: .28rem 0;
  border-radius: var(--r-md, 12px);
  border: 1.5px solid var(--pico-muted-border-color);
  background: transparent;
  color: var(--pico-muted-color);
  cursor: pointer;
  margin: 0;
  width: auto;
  min-height: unset;
  line-height: 1.3;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .1s, color .1s, background .1s;
}

.tp-preset:hover { border-color: #1e8449; color: #1e8449; }
.tp-preset:active { background: rgba(192,57,43,.1); }

.tp-custom-row {
  display: flex;
  gap: .35rem;
  align-items: center;
}

#tp-custom {
  flex: 1;
  font-size: .82rem;
  padding: .28rem .4rem;
  border-radius: 6px;
  border: 1.5px solid var(--pico-muted-border-color) !important;
  background: transparent !important;
  color: var(--pico-color) !important;
  text-align: center;
  margin: 0;
  min-height: unset;
  height: 2rem;
  appearance: textfield;
  -moz-appearance: textfield;
  outline: none;
}
#tp-custom::-webkit-outer-spin-button,
#tp-custom::-webkit-inner-spin-button { -webkit-appearance: none; }
#tp-custom:focus { border-color: #1e8449 !important; }

#tp-go-btn {
  font-size: .82rem;
  font-weight: 700;
  padding: .28rem .6rem;
  border-radius: var(--r-md, 12px);
  border: 1.5px solid #1e8449;
  background: transparent;
  color: #1e8449;
  cursor: pointer;
  margin: 0;
  width: auto;
  min-height: unset;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
}
#tp-go-btn:hover { background: rgba(192,57,43,.1); }

.tp-running-row {
  display: flex;
  align-items: center;
  gap: .6rem;
}

#tp-display {
  flex: 1;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1e8449;
  letter-spacing: .02em;
  text-align: center;
}

#tp-display.tp-done { color: var(--success, #27ae60); font-size: 1rem; }

@keyframes tp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
@keyframes tp-badge-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
#tp-display.tp-running { animation: tp-pulse 2s ease-in-out infinite; }

#tp-action-btn {
  font-size: .8rem;
  font-weight: 600;
  padding: .28rem .7rem;
  border-radius: var(--r-md, 12px);
  border: 1.5px solid var(--pico-muted-border-color);
  background: transparent;
  color: var(--pico-muted-color);
  cursor: pointer;
  margin: 0;
  width: auto;
  min-height: unset;
  line-height: 1.3;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .1s, color .1s;
}
#tp-action-btn:hover { border-color: #1e8449; color: #1e8449; }

[data-theme="dark"] #timerPanel { background: var(--pico-card-background-color, #1e1e2e); border-color: #333; }
[data-style="moody"] #timerPanel { background: #1e293b; border-color: #334155; }
[data-style="cosmic"] #timerPanel { background: rgba(18,4,38,.95); border-color: rgba(139,0,255,.4); }

/* ─── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  body { padding: .6rem .4rem; }
  .recipe-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: .6rem;
  }
  .card-thumb { height: 125px; }
  .card-body { padding: .65rem .75rem; }
  .recipe-card h3 { font-size: .88rem; }
  .card-action-btn { padding: .35em .6em; font-size: .9rem; min-height: 30px; }
  .category-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: var(--sp-2, .5rem);
    padding-bottom: .3rem;
    scrollbar-width: none;
  }
  .category-tabs::-webkit-scrollbar { display: none; }
  .filter-bar { gap: .4rem; }
  header nav svg:not(.icon) { height: 52px !important; }
  .cat-label-text { display: none; }
}


/* Premium member badge -- shown next to a name for genuinely paid members
   (real paid_until), not for grandfathered access. Lives here rather than in
   base.html because the inline <style> there is gated behind a feature flag. */
.premium-badge {
  display: inline-flex; align-items: center; gap: .2em;
  margin-left: .4em; padding: .1em .45em;
  font-size: .62rem; font-weight: 700; letter-spacing: .02em;
  border-radius: 20px; white-space: nowrap; vertical-align: middle;
  background: #fff3cd; color: #7a5c00;
}
:root:not([data-theme="light"]) .premium-badge,
:root[data-theme="dark"] .premium-badge { background: #4a3c00; color: #ffd75e; }
