:root {
    color-scheme: light;
    --accent: #6d28d9;
    --accent-soft: #ede9fe;
    --bg: #f5f3ff;
    --panel: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --danger: #dc2626;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.shell { max-width: 1440px; margin: 0 auto; padding: 20px; }
.topbar, .panel, .banner, .status { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; }
.topbar {
    display: flex; justify-content: space-between; gap: 16px; align-items: center;
    padding: 20px; margin-bottom: 16px;
}
.topbar h1 { margin: 0 0 6px; }
.authbox { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; }
.panel { padding: 18px; min-height: 200px; }
.panel-header, .detail-header, .dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.small-stack { gap: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
input, textarea, button, select {
    font: inherit;
}
input, textarea {
    width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: white; color: var(--text);
}
textarea { resize: vertical; }
button, .button-link {
    border: 1px solid transparent; border-radius: 12px; padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
button.primary, .button-link.primary { background: var(--accent); color: white; }
button.ghost, .button-link.ghost { background: white; border-color: var(--border); color: var(--text); }
button.danger { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
button.small { padding: 8px 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.status, .banner { padding: 14px 18px; margin-bottom: 16px; }
.banner { display: flex; justify-content: space-between; gap: 16px; align-items: center; background: var(--accent-soft); }
.banner-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 60px 20px; }
.tabs { display: flex; gap: 8px; margin: 16px 0; }
.tab { background: white; border-color: var(--border); }
.tab.active { background: var(--accent); color: white; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.sticky-tools { position: sticky; top: 0; z-index: 2; background: linear-gradient(var(--panel), rgba(255,255,255,.92)); padding-bottom: 12px; }
.toolbar-grid { display: grid; gap: 10px; }
.list-tools { grid-template-columns: minmax(0,1fr) auto 180px auto; }
.recipe-tools { grid-template-columns: minmax(0,1fr) auto; }
.section-title { font-weight: 700; margin: 8px 0 10px; }
.list-card, .item-row, .recipe-card, .result-card { border: 1px solid var(--border); border-radius: 14px; background: white; }
.list-card, .recipe-card, .result-card { padding: 14px; }
.list-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(109,40,217,.12); }
.item-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; }
.item-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    text-align: left;
}
.item-meta.ghost {
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
}
.item-meta strong,
.item-meta span {
    width: 100%;
    text-align: left;
}
.item-photo { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.item-dialog-photo-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    cursor: pointer;
}
.item-dialog-photo-thumb {
    width: 88px !important;
    height: 88px !important;
    max-width: 88px !important;
    max-height: 88px !important;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.item-dialog-photo-large {
    width: min(640px, calc(100vw - 64px));
    max-height: 75vh;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #000;
}
dialog { border: none; border-radius: 18px; padding: 0; width: min(720px, calc(100vw - 24px)); }
.dialog-content { padding: 18px; display: flex; flex-direction: column; gap: 12px; max-height: 82vh; overflow: auto; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.recipe-ingredient { display: flex; gap: 10px; align-items: center; }
.direction-step { padding: 10px 12px; background: #f9fafb; border-radius: 12px; }
code { overflow-wrap: anywhere; }
@media (max-width: 980px) {
    .layout { grid-template-columns: 1fr; }
    .list-tools { grid-template-columns: minmax(0,1fr) auto; }
}
.banner.read-only-banner {
    background: #fef3c7;
    border-color: #f59e0b;
    margin-bottom: 12px;
}
