* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #ef4444;
    --primary-dark: #dc2626;
    --danger: #dc2626;
    --warning: #f59e0b;
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

html, body {
    margin: 0;
    padding: 0;
    background: linear-gradient(180deg, #fff7f7 0%, var(--bg) 25%);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

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

button, input, textarea, select {
    font: inherit;
}

body {
    min-height: 100vh;
}

.app-shell {
    max-width: 720px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 0 14px 96px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.78);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 2px;
    margin-bottom: 12px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

.brand-version {
    font-size: 12px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ghost-link,
.topbar-user {
    font-size: 14px;
    color: var(--muted);
}

.login-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    font-weight: 800;
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.08);
}

.login-pill .btn-icon {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
}

.login-pill .btn-icon svg {
    width: 18px;
    height: 18px;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.08);
    min-width: 0;
}

.user-pill-avatar {
    width: 30px;
    height: 30px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ef4444, #fb7185);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 900;
    flex-shrink: 0;
}

.user-pill-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-link {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.08);
    color: var(--muted);
}

.icon-link:hover {
    color: var(--primary);
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.22);
}

.icon-link svg {
    width: 18px;
    height: 18px;
}

.page-content {
    display: grid;
    gap: 18px;
}

.flash {
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 12px;
    font-size: 14px;
    box-shadow: var(--shadow);
}

.flash-success {
    background: rgba(16, 185, 129, 0.12);
    color: #065f46;
}

.flash-error {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
}

.hero-card,
.section-block,
.auth-card,
.panel-card,
.profile-card,
.merchant-info-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 18px;
}

.hero-card {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(251, 113, 133, 0.94));
    color: #ffffff;
    display: grid;
    gap: 16px;
}

.hero-card h1,
.section-head h1,
.section-head h2,
.auth-card h1,
.profile-card h1,
.merchant-info-card h1 {
    margin: 0;
}

.hero-eyebrow {
    margin: 0 0 8px;
    opacity: 0.85;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-text {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, 0.9);
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-form input,
.search-form button,
.form-stack input,
.form-stack textarea,
.form-stack select {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 14px 16px;
    outline: none;
}

.search-form input {
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
}

.search-form button,
.primary-btn,
.secondary-btn,
.danger-btn,
.favorite-btn {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.search-form button:hover,
.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover,
.favorite-btn:hover {
    transform: translateY(-1px);
}

.search-form button,
.primary-btn {
    background: var(--text);
    color: #ffffff;
    border: none;
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 700;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.btn-leading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.btn-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.btn-icon svg,
.btn-trailing svg {
    width: 20px;
    height: 20px;
    display: block;
}

.btn-trailing {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.06);
    flex-shrink: 0;
}

.primary-btn .btn-trailing {
    background: rgba(255, 255, 255, 0.18);
}

.primary-btn.icon-btn {
    background: linear-gradient(135deg, #0f172a, #111827);
}

.primary-btn.icon-btn:hover {
    background: linear-gradient(135deg, #0b1220, #0f172a);
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 700;
}

.secondary-btn.icon-btn {
    justify-content: space-between;
}

.danger-btn {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.18);
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 700;
}

.favorite-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--primary);
    border: 1px solid rgba(239, 68, 68, 0.18);
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 700;
}

.favorite-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.full-width {
    width: 100%;
}

.section-block {
    display: grid;
    gap: 16px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-head a,
.meta-tip {
    color: var(--muted);
    font-size: 14px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.category-card {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px 12px;
    text-align: center;
    display: grid;
    gap: 8px;
    min-height: 92px;
    place-items: center;
}

.category-icon {
    font-size: 26px;
}

.category-name {
    font-size: 14px;
    font-weight: 700;
}

.merchant-list,
.review-list,
.table-stack,
.action-list,
.form-stack,
.info-stack {
    display: grid;
    gap: 14px;
}

.merchant-card,
.review-card,
.table-card {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 14px;
}

.merchant-card {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 14px;
    align-items: stretch;
}

.merchant-card.compact {
    grid-template-columns: 84px 1fr;
}

.merchant-cover {
    min-height: 120px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-size: 42px;
    font-weight: 800;
    box-shadow: inset 0 -30px 50px rgba(0, 0, 0, 0.12);
}

.merchant-cover.small {
    min-height: 84px;
    font-size: 32px;
}

.merchant-cover.large {
    min-height: 220px;
    font-size: 72px;
}

.merchant-body {
    display: grid;
    gap: 8px;
}

.merchant-row,
.review-row,
.table-card,
.checkbox-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.inline-form {
    margin: 0;
}

.qty-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-input {
    width: 84px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    outline: none;
}

.btn-col {
    display: grid;
    gap: 10px;
    justify-items: stretch;
    align-content: start;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.12);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
}

.address-list {
    display: grid;
    gap: 12px;
}

.address-card {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.address-card input[type="radio"] {
    margin-top: 6px;
}

.address-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.trend-grid {
    display: grid;
    gap: 12px;
}

.trend-item {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.trend-bars {
    display: grid;
    gap: 8px;
}

.trend-bar {
    height: 10px;
    border-radius: 999px;
}

.trend-bar.orders {
    background: rgba(239, 68, 68, 0.6);
}

.trend-bar.gmv {
    background: rgba(15, 23, 42, 0.25);
}

.trend-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
}

.merchant-subline,
.merchant-desc,
.auth-tip,
.review-date {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

.merchant-meta,
.tag-list,
.chip-row,
.stats-grid,
.detail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rating,
.tag,
.chip {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 999px;
}

.chip.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.review-card p {
    margin: 8px 0;
}

.review-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.review-thumb {
    display: block;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #fff;
}

.review-thumb-img {
    display: block;
    width: 100%;
    height: 110px;
    object-fit: cover;
}

.review-image-link {
    display: block;
    margin-top: 10px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #fff;
}

.review-image {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: cover;
}

.map-embed {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.map-frame {
    width: 100%;
    height: 260px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
}

.map-actions {
    display: flex;
    justify-content: flex-end;
}

.moderation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.autocomplete-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.autocomplete-item {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text);
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(239, 68, 68, 0.08);
}

.copy-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
}

.copy-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    outline: none;
}

.share-pool {
    display: grid;
    gap: 12px;
}

.share-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.share-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.share-foot {
    display: flex;
    justify-content: flex-end;
}

.ig-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.ig-tile {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #fff;
}

.ig-tile::before {
    content: "";
    display: block;
    padding-top: 100%;
}

.ig-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ig-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.62) 90%);
    color: rgba(255, 255, 255, 0.95);
    font-size: 12px;
}

.ig-user,
.ig-checkin {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 50%;
}

.post-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.post-user {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.post-avatar {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ef4444, #fb7185);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 900;
    flex-shrink: 0;
}

.post-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.post-img {
    display: block;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #fff;
}

.post-img img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    display: block;
}

.post-actions {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.post-metrics {
    display: flex;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

.comment-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.comment-item {
    padding: 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.comment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.comment-body {
    margin-top: 8px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.quick-btn {
    display: grid;
    gap: 10px;
    place-items: center;
    padding: 14px 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    min-height: 92px;
}

.quick-btn:hover {
    transform: translateY(-1px);
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.22);
}

.quick-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
}

.quick-text {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    text-align: center;
}

.quick-btn.primary {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.92), rgba(251, 113, 133, 0.92));
    border-color: rgba(239, 68, 68, 0.22);
}

.quick-btn.primary .quick-icon {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.quick-btn.primary .quick-text {
    color: #ffffff;
}

.quick-btn.danger {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.18);
}

.quick-btn.danger .quick-icon {
    background: rgba(220, 38, 38, 0.14);
    color: var(--danger);
}

.quick-btn.danger .quick-text {
    color: var(--danger);
}

.review-link {
    color: var(--primary);
    font-size: 14px;
}

.stars {
    color: var(--warning);
}

.empty-state {
    background: var(--surface-soft);
    border: 1px dashed var(--border);
    border-radius: 18px;
    padding: 22px 16px;
    text-align: center;
    color: var(--muted);
}

.auth-wrap {
    display: grid;
    place-items: center;
    min-height: 60vh;
}

.auth-card {
    width: min(100%, 460px);
    display: grid;
    gap: 16px;
}

.form-stack label {
    display: grid;
    gap: 8px;
}

.form-stack span {
    font-size: 14px;
    color: var(--muted);
}

.form-stack input,
.form-stack textarea,
.form-stack select {
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.auth-foot {
    display: flex;
    gap: 8px;
    font-size: 14px;
}

.auth-foot a {
    color: var(--primary);
    font-weight: 700;
}

.merchant-hero {
    display: grid;
    gap: 16px;
}

.detail-card {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    padding: 14px 16px;
    border-radius: 18px;
    min-width: 120px;
    display: grid;
    gap: 6px;
}

.detail-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    background: linear-gradient(135deg, #ef4444, #fb7185);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 30px;
    font-weight: 800;
    flex-shrink: 0;
}

.table-card.wide {
    align-items: center;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: min(680px, calc(100% - 28px));
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 22px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    overflow: hidden;
}

.bottom-nav-item {
    text-align: center;
    padding: 14px 8px;
    font-size: 14px;
    color: var(--muted);
}

.bottom-nav-item:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--primary);
}

@media (max-width: 640px) {
    .app-shell {
        padding-left: 12px;
        padding-right: 12px;
    }

    .merchant-card,
    .merchant-card.compact {
        grid-template-columns: 1fr;
    }

    .merchant-cover,
    .merchant-cover.small {
        min-height: 120px;
    }

    .search-form {
        flex-direction: column;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .review-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .copy-row {
        grid-template-columns: 1fr;
    }

    .ig-grid {
        gap: 6px;
    }

    .ig-tile {
        border-radius: 16px;
    }

    .post-gallery {
        grid-template-columns: 1fr;
    }

    .quick-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-head,
    .merchant-row,
    .review-row,
    .table-card,
    .profile-card {
        flex-direction: column;
        align-items: stretch;
    }

    .bottom-nav {
        width: calc(100% - 20px);
        bottom: 10px;
    }
}
