/* Komponenty vycházejí ze stylu aplikace Devět. Barvy jen přes tokeny. */
.card { background: var(--surface); border-radius: var(--radius); padding: var(--space-4) 18px; margin-bottom: var(--space-4); box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }

.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 13px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 0.85rem; font-weight: 600; border: 0; text-decoration: none; cursor: pointer; box-shadow: var(--shadow); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }
.chip.active { background: var(--accent-strong); color: var(--accent-contrast); }
.chip .emoji { margin-right: 1px; }
.chip .count { font-size: 0.75rem; opacity: 0.75; }
.filter-chips { display: flex; gap: var(--space-2); overflow-x: auto; margin: 0 calc(-1 * var(--space-4)) var(--space-4); padding: 2px var(--space-4) 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips .chip { flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 20px; border-radius: 999px; border: 0; background: var(--surface); color: var(--text); font-weight: 700; font-size: 0.95rem; text-decoration: none; cursor: pointer; line-height: 1.2; box-shadow: var(--shadow); }
.btn.primary { background: var(--accent-strong); color: var(--accent-contrast); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--accent-text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }

.field { margin-bottom: var(--space-4); }
.field label:not(.choice), .field .label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 0.9rem; }
.field .hint { font-size: 0.82rem; color: var(--text-muted); margin-top: 5px; }
input[type="text"], input[type="password"], input[type="search"], input[type="url"], textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: var(--radius-s); border: 1.5px solid var(--border); background: var(--surface); font-size: 16px;
}
input[type="file"] { width: 100%; font-size: 0.9rem; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 180px; resize: vertical; line-height: 1.45; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-s); font-weight: 600; font-size: 0.92rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.page-head h1 { margin: 0; }
h1 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.01em; }

.search { position: relative; margin-bottom: var(--space-3); }
.search svg { position: absolute; left: 14px; top: 13px; width: 20px; height: 20px; color: var(--text-muted); pointer-events: none; }
.search input { padding-left: 42px; border-radius: 999px; border-color: transparent; box-shadow: var(--shadow); -webkit-appearance: none; appearance: none; }

.recipe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 620px) { .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.recipe-card { position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.recipe-link { display: block; height: 100%; color: inherit; text-decoration: none; }
.recipe-cover { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.recipe-cover.empty { display: flex; align-items: center; justify-content: center; font-size: 2.6rem; background: var(--accent-soft); }
.recipe-text { padding: 10px 12px 12px; }
.recipe-text h2 { font-size: 0.96rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; margin: 0 0 3px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-text p { margin: 0; font-size: 0.8rem; }

.heart { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 0; border-radius: 50%; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--shadow); color: var(--text-muted); cursor: pointer; }
.heart svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.heart.on { color: var(--danger); }
.heart.on svg { fill: currentColor; }
.recipe-card .heart { position: absolute; top: 6px; right: 6px; }

.back { display: inline-block; font-weight: 600; text-decoration: none; margin-bottom: var(--space-2); padding: 6px 0; }
.recipe-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.recipe-title { margin-bottom: var(--space-2); overflow-wrap: anywhere; }
.recipe-meta { margin-bottom: var(--space-4); }
.recipe-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.04rem; line-height: 1.6; }
.source-link { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; font-size: 0.9rem; font-weight: 600; }
.source-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.photo-stack { display: grid; gap: var(--space-2); margin-bottom: var(--space-4); }
.photo-open { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.photo-open img { width: 100%; height: auto; }
.wake { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; font-size: 0.95rem; }
.wake input { width: 20px; height: 20px; accent-color: var(--accent); }

.empty-state { text-align: center; padding: var(--space-6) var(--space-4); }
.empty-state p { margin-bottom: var(--space-2); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: var(--space-2); min-height: 52px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.category-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-3); padding: 8px 0; color: inherit; text-decoration: none; }
.category-emoji { font-size: 1.4rem; }
.category-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
[data-editable]:not(.editing) [data-edit-only] { display: none !important; }
.editing .category-row { color: var(--accent-text); }
.drag-handle { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; color: var(--text-muted); border-radius: 12px; }
.drag-handle:active { cursor: grabbing; }
li.dragging { opacity: 0.35; }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; list-style: none; margin: 0; padding: 0 12px; display: flex; align-items: center; gap: var(--space-2); background: var(--surface); box-shadow: var(--shadow-lg); border-radius: var(--radius-s); transform: scale(1.02) rotate(-0.5deg); }

.choice-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice { position: relative; display: inline-flex; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 13px; border-radius: 999px; background: var(--surface-2); font-size: 0.87rem; font-weight: 600; }
.choice input:checked + span { background: var(--accent-strong); color: var(--accent-contrast); }
.choice input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emoji-grid label { position: relative; margin: 0 !important; cursor: pointer; }
.emoji-grid input { position: absolute; opacity: 0; inset: 0; }
.emoji-grid span { display: flex; align-items: center; justify-content: center; height: 46px; font-size: 1.45rem; border-radius: var(--radius-s); background: var(--surface-2); }
.emoji-grid input:checked + span { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.emoji-grid input:focus-visible + span { outline: 2px solid var(--focus); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.photo-remove { font-weight: 500 !important; font-size: 0.8rem; margin: 0 !important; }
.photo-remove img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-s); margin-bottom: 4px; }

.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); width: 58px; height: 58px; border-radius: 50%; background: var(--accent-strong); color: var(--accent-contrast); font-size: 2rem; line-height: 1; display: flex; align-items: center; justify-content: center; text-decoration: none; box-shadow: var(--shadow-lg); z-index: 25; }
@media (min-width: 900px) { .fab { bottom: 24px; right: 24px; } }

dialog.sheet { border: 0; padding: 0; margin: 0; width: 100%; max-width: 100%; max-height: 92dvh; background: transparent; position: fixed; inset: auto 0 0 0; overflow: visible; }
dialog.sheet::backdrop { background: rgb(20 10 15 / 0.45); backdrop-filter: blur(3px); }
dialog.sheet:not([open]) { display: none; }
.sheet-inner { background: var(--surface); border-radius: var(--radius-l) var(--radius-l) 0 0; padding: 10px var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto; box-shadow: 0 -10px 40px rgb(0 0 0 / 0.22); }
.sheet-inner::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 10px; }
.sheet-page .sheet-inner { border-radius: var(--radius); box-shadow: var(--shadow); max-height: none; }
.sheet-page .sheet-inner::before { display: none; }
.sheet-page [data-close-sheet] { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.sheet-head h2 { margin: 0; }
.sheet-danger { margin-top: var(--space-3); }
@media (min-width: 900px) { dialog.sheet { inset: 0; margin: auto; width: 560px; max-height: 90dvh; } .sheet-inner { border-radius: var(--radius-l); max-height: 90dvh; } .sheet-inner::before { display: none; } }
html.sheet-open { overflow: hidden; }

dialog.viewer { border: 0; padding: 0; margin: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; background: #000; overflow: auto; }
dialog.viewer:not([open]) { display: none; }
dialog.viewer::backdrop { background: #000; }
dialog.viewer img { width: 100%; min-height: 100%; object-fit: contain; }
.viewer-close { position: fixed; top: calc(env(safe-area-inset-top) + 10px); right: 10px; z-index: 2; background: rgb(0 0 0 / .55); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; }

.auth-wrap { padding-top: var(--space-6); text-align: center; }
.auth-wrap form { text-align: left; }
.auth-logo { margin: 0 auto var(--space-3); border-radius: 20px; box-shadow: var(--shadow); }
.steps { padding-left: 22px; margin: 0 0 var(--space-3); }
.steps li { margin-bottom: 6px; }
details summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
code { font-size: 0.85em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; overflow-wrap: anywhere; }
.copy-row { display: flex; gap: var(--space-2); }
.copy-row input { flex: 1; min-width: 0; }

.update-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; background: var(--text); color: var(--bg); padding: 8px 12px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: .9rem; }
.update-bar .btn { background: var(--bg); color: var(--text); box-shadow: none; }
.offline-bar { display: none; background: var(--warn-soft); color: var(--warn-text); text-align: center; font-size: .85rem; padding: calc(env(safe-area-inset-top) + 6px) 12px 6px; }
html.is-offline .offline-bar { display: block; }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 0.9rem; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 60; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
main.content { padding-top: calc(env(safe-area-inset-top) + var(--space-4)); }
@media (max-width: 899px) { .side .topbar { display: none; } }
@media (min-width: 900px) { main.content { padding-top: var(--space-5); } }

/* Skryté jen pro oko — Klíčenka pole se jménem potřebuje vidět, display:none by přehlédla. */
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
