:root {
    --bg: #F7F6F2;
    --text: #171717;
    --text-secondary: #77736D;
    --border: #E9E6E0;
    --surface: #FFFFFF;
    --accent: #E85D3F;
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* 导航 */
.site-nav {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.site-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.brand { font-size: 18px; font-weight: 700; }
.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}
.nav-links a:hover { color: var(--text); }

/* 页头 */
.page-head { padding: 26px 0 18px; }
.page-title { font-size: 28px; font-weight: 700; margin: 0 0 6px; }
.page-subtitle { color: var(--text-secondary); font-size: 15px; margin: 0 0 16px; }
.head-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.head-actions .page-title { margin: 0; }

/* 搜索 */
.search-bar { display: flex; gap: 8px; margin-bottom: 22px; max-width: 460px; }
.search-bar input {
    flex: 1;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
}
.search-bar input:focus { outline: none; border-color: var(--accent); }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-outline { border-color: var(--border); background: var(--surface); }
.btn-danger { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn-sm { height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }

/* 菜品网格 */
.dish-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
@media (min-width: 768px) {
    .dish-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
}
@media (min-width: 1024px) {
    .dish-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
}

.dish-card { display: block; }
.dish-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
    background: #ece7dc;
}
.dish-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    background: #ece7dc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary);
}
.dish-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}
.dish-name {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 管理卡片 */
.manage-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.manage-card .dish-info { padding: 12px 14px 14px; }
.manage-card .dish-name { margin-top: 0; }
.dish-count { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.card-actions form { flex: 1; }
.card-actions .btn { width: 100%; }

/* 表单 */
.form-card { background: var(--surface); border-radius: var(--radius); padding: 20px; max-width: 520px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-group input:not([type="file"]),
.form-group textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-group input[type="file"] { display: block; font-size: 14px; margin-top: 4px; }
.form-errors { color: var(--accent); font-size: 13px; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.form-actions .btn { flex: 1; }

/* 图片预览 */
.image-preview { width: 100%; max-width: 240px; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; margin-top: 8px; }

/* 危险区 */
.danger-zone { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.danger-zone .dz-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; }

/* Flash */
.flash-wrap { margin-top: 14px; }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; }
.flash-success { background: #e8f4ec; color: #1c6b3a; }
.flash-danger { background: #fbe9e6; color: #b0321e; }
.flash-warning { background: #fdf3e0; color: #8a5a12; }
.flash-info { background: #e8eef6; color: #24548a; }

/* 空状态 */
.empty { text-align: center; padding: 60px 16px; color: var(--text-secondary); }
.empty .icon { font-size: 44px; margin-bottom: 12px; }
.empty .title { font-size: 17px; font-weight: 600; color: var(--text); }
.empty .sub { font-size: 14px; margin-top: 6px; }

/* 总数 + 排序 同一行 */
.list-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.result-count { color: var(--text-secondary); font-size: 14px; margin: 0; }

/* 加载更多 */
.load-more { text-align: center; margin-top: 24px; }

/* 排序 */
.sort-bar { margin: 0; }
.sort-bar select {
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
}

/* 显示模式切换 */
.list-controls { display: flex; align-items: center; gap: 10px; }
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.view-toggle button {
    padding: 7px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-secondary);
    background: var(--surface);
    border: none;
    cursor: pointer;
}
.view-toggle button + button { border-left: 1px solid var(--border); }
.view-toggle button.active { color: var(--text); font-weight: 600; background: #efede8; }

/* 列表模式 */
.dish-list { display: flex; flex-direction: column; }
.dish-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.dish-list-row:last-child { border-bottom: none; }

/* 价格 */
.dish-price {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}
.dish-price-none { color: var(--text-secondary); font-weight: 400; }

/* 序号 */
.dish-image-wrap { position: relative; }
.dish-rank {
    position: absolute;
    top: 8px;
    left: 8px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
}
.dish-rank-list {
    flex-shrink: 0;
    width: 28px;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: left;
}

/* 认证 */
.auth-card { background: var(--surface); border-radius: var(--radius); padding: 28px 20px; max-width: 380px; margin: 40px auto; }
.auth-card h1 { font-size: 22px; font-weight: 700; margin: 0 0 6px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--text-secondary); font-size: 14px; margin: 0 0 22px; }
.auth-card .btn { width: 100%; }

/* 页脚 */
.site-footer {
    margin-top: 48px;
    background: var(--bg);
    border-top: 1px solid rgba(119, 115, 109, 0.22);
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 18px 16px 26px;
}
.footer-copy { line-height: 1.7; }
.footer-records {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2px 0;
    margin-top: 2px;
    line-height: 1.9;
}
.footer-records a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    color: var(--text-secondary);
    transition: color 0.15s ease;
}
.footer-records a:hover { color: var(--text); }
.footer-records .dot { margin: 0 7px; color: var(--text-secondary); opacity: 0.75; }
.footer-records img {
    width: 15px;
    height: 15px;
    object-fit: contain;
    vertical-align: middle;
    flex-shrink: 0;
}
