* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    color: #19202a;
    background: #f5f7fb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    letter-spacing: 0;
}

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

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

img {
    max-width: 100%;
    display: block;
}

code {
    background: #eef2f7;
    border-radius: 6px;
    padding: 2px 6px;
}

.muted {
    color: #6b7280;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    color: #233044;
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
}

.btn.primary {
    border-color: #0f766e;
    color: #fff;
    background: #0f766e;
}

.btn.light {
    border-color: rgba(255, 255, 255, .55);
    color: #fff;
    background: rgba(255, 255, 255, .16);
}

.btn.block {
    width: 100%;
}

.btn.small {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
}

.flash {
    width: min(100% - 24px, 1080px);
    margin: 12px auto;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #cfd8e3;
    background: #fff;
}

.flash-error {
    border-color: #fecaca;
    color: #991b1b;
    background: #fff1f2;
}

.flash-success {
    border-color: #bbf7d0;
    color: #166534;
    background: #f0fdf4;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.avatar.small {
    width: 26px;
    height: 26px;
    font-size: 13px;
}

.avatar.large {
    width: 72px;
    height: 72px;
    font-size: 28px;
}

.avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: #2563eb;
    font-weight: 700;
}

.setup-page,
.admin-login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #e9eef7;
}

.setup-card,
.admin-login {
    width: min(100%, 460px);
    padding: 28px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 50px rgba(25, 32, 42, .12);
}

.setup-card h1,
.auth-brand h1 {
    margin: 14px 0 8px;
    font-size: 28px;
    line-height: 1.2;
}

.setup-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    color: #fff;
    background: #0f766e;
    font-weight: 800;
}

.setup-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.h5-page {
    min-height: 100vh;
    padding-bottom: 78px;
    background: #f7f8fb;
}

.h5-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    padding: 0 14px;
    border-bottom: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(10px);
}

.h5-brand {
    max-width: 68vw;
    overflow: hidden;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-link {
    position: relative;
    color: #0f766e;
    font-weight: 700;
}

.badge {
    position: absolute;
    top: -8px;
    right: -12px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    color: #fff;
    background: #e11d48;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.h5-main {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 14px;
}

.h5-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding: 22px;
    border-radius: 8px;
    color: #fff;
    background: #0f766e;
}

.h5-hero h1 {
    margin: 4px 0 8px;
    font-size: 30px;
    line-height: 1.15;
}

.h5-hero p {
    margin: 0;
    color: rgba(255, 255, 255, .86);
}

.eyebrow {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.search-bar {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.search-bar input,
.form-card input,
.form-card select,
.form-card textarea,
.comment-form textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    padding: 10px 12px;
    color: #19202a;
    background: #fff;
    outline: none;
}

.search-bar button {
    min-width: 72px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: #2563eb;
}

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 3px 0 12px;
}

.chips a {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: #fff;
}

.chips a.active {
    border-color: #0f766e;
    color: #0f766e;
    font-weight: 800;
}

.waterfall {
    column-count: 2;
    column-gap: 12px;
}

.post-card {
    display: inline-block;
    width: 100%;
    margin: 0 0 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    break-inside: avoid;
}

.post-cover img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.text-cover {
    min-height: 140px;
    padding: 18px;
    color: #233044;
    background: #f0f5ff;
    line-height: 1.65;
}

.post-card-body {
    padding: 10px;
}

.post-card-body h3 {
    margin: 0 0 6px;
    font-size: 15px;
}

.post-card-body p {
    display: -webkit-box;
    min-height: 38px;
    margin: 0 0 10px;
    overflow: hidden;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.post-meta,
.mini-user,
.action-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-meta {
    justify-content: space-between;
    color: #6b7280;
    font-size: 12px;
}

.mini-user {
    min-width: 0;
}

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

.h5-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: 64px;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.h5-tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #6b7280;
    font-size: 12px;
}

.h5-tabbar a span {
    font-size: 21px;
    line-height: 1;
}

.h5-tabbar a.active {
    color: #0f766e;
}

.auth-panel,
.page-title,
.profile-head,
.detail-card,
.comment-section,
.list-card,
.form-card,
.empty-state {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.auth-panel {
    padding: 22px;
}

.auth-brand p {
    color: #6b7280;
    line-height: 1.6;
}

.form-card {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.form-card.plain {
    padding: 0;
    border: 0;
}

.form-card label {
    display: grid;
    gap: 7px;
    color: #374151;
    font-size: 14px;
    font-weight: 700;
}

.switch-line {
    margin: 0;
    text-align: center;
    color: #6b7280;
}

.switch-line a,
.login-note {
    color: #0f766e;
    font-weight: 800;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.page-title {
    margin-bottom: 14px;
    padding: 18px;
}

.page-title h1,
.section-title {
    margin: 0 0 6px;
    font-size: 24px;
}

.page-title p {
    margin: 0;
    color: #6b7280;
}

.detail-card {
    overflow: hidden;
}

.detail-author {
    padding: 14px;
}

.detail-author small {
    display: block;
    margin-top: 3px;
    color: #6b7280;
}

.detail-images {
    display: grid;
    gap: 8px;
    padding: 0 14px;
}

.detail-images img {
    width: 100%;
    border-radius: 8px;
}

.detail-body {
    padding: 14px;
}

.detail-body h1 {
    margin: 0 0 10px;
    font-size: 24px;
}

.detail-body p {
    color: #374151;
    line-height: 1.75;
}

.tag {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 8px;
    color: #92400e;
    background: #fef3c7;
    font-size: 13px;
    font-weight: 700;
}

.action-row {
    padding: 0 14px 14px;
}

.comment-section,
.list-card {
    margin-top: 14px;
    padding: 16px;
}

.comment-section h2 {
    margin: 0 0 12px;
}

.comment-form {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.comment-item {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid #eef2f7;
}

.comment-item p {
    margin: 4px 0;
    color: #374151;
    line-height: 1.55;
}

.comment-item small {
    color: #6b7280;
}

.profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
}

.profile-head h1 {
    margin: 0 0 4px;
    font-size: 23px;
}

.profile-head p {
    margin: 0 0 4px;
    color: #4b5563;
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.quick-links a {
    padding: 12px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.notice-item {
    display: block;
    padding: 13px 0;
    border-bottom: 1px solid #eef2f7;
}

.notice-item small {
    display: block;
    margin-top: 4px;
    color: #6b7280;
}

.notice-item.unread b::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: #e11d48;
}

.empty-state {
    padding: 28px 18px;
    text-align: center;
}

.empty-state.compact {
    border: 0;
    padding: 18px;
}

.empty-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto 10px;
    border-radius: 8px;
    color: #0f766e;
    background: #ccfbf1;
    font-size: 28px;
    line-height: 42px;
}

.pager {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 18px 0;
}

.admin-page {
    min-height: 100vh;
    background: #eef2f7;
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 230px;
    padding: 18px;
    color: #d9e2ef;
    background: #182234;
}

.admin-brand {
    display: block;
    margin-bottom: 24px;
    overflow: hidden;
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-sidebar nav {
    display: grid;
    gap: 6px;
}

.admin-sidebar nav a {
    padding: 11px 12px;
    border-radius: 8px;
}

.admin-sidebar nav a.active,
.admin-sidebar nav a:hover {
    color: #fff;
    background: #0f766e;
}

.admin-shell {
    margin-left: 230px;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.admin-topbar h1 {
    margin: 0 0 3px;
    font-size: 24px;
}

.admin-topbar p {
    margin: 0;
    color: #6b7280;
}

.admin-main {
    padding: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card,
.panel {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    color: #6b7280;
}

.stat-card b {
    display: block;
    margin-top: 8px;
    font-size: 30px;
}

.panel {
    padding: 18px;
}

.panel.narrow {
    max-width: 620px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel h2,
.panel-head h2 {
    margin: 0;
    font-size: 20px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid #eef2f7;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #6b7280;
    font-size: 13px;
    font-weight: 800;
}

.status {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 8px;
    color: #374151;
    background: #eef2f7;
    font-size: 12px;
    font-weight: 800;
}

.status.active,
.status.published,
.status.visible {
    color: #166534;
    background: #dcfce7;
}

.status.disabled,
.status.hidden {
    color: #991b1b;
    background: #fee2e2;
}

.inline-form {
    display: inline;
}

.empty-cell {
    color: #6b7280;
    text-align: center;
}

@media (max-width: 760px) {
    .h5-main {
        padding: 12px;
    }

    .h5-hero {
        align-items: stretch;
        flex-direction: column;
        padding: 18px;
    }

    .h5-hero h1 {
        font-size: 26px;
    }

    .waterfall {
        column-gap: 10px;
    }

    .form-grid,
    .quick-links {
        grid-template-columns: 1fr 1fr;
    }

    .profile-head {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .admin-sidebar {
        position: static;
        width: auto;
        border-radius: 0;
    }

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

    .admin-shell {
        margin-left: 0;
    }

    .admin-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-main {
        padding: 14px;
    }

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

@media (max-width: 420px) {
    .waterfall {
        column-count: 1;
    }

    .search-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .form-grid,
    .quick-links,
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
