:root {
    --ink: #1b1f23;
    --muted: #667085;
    --line: #d8dee4;
    --panel: #ffffff;
    --page: #f4f7fb;
    --red: #b60000;
    --gold: #ffcc00;
    --blue: #2557a7;
    --green: #147d64;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
}

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

button,
.primary-btn,
.secondary-btn {
    cursor: pointer;
}

.shell-header,
.front-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 28px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.shell-brand,
.front-title strong {
    color: var(--red);
    font-size: 22px;
    font-weight: 800;
    text-decoration: none;
}

.shell-nav,
.front-nav,
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.shell-nav a,
.front-nav a,
.admin-tabs a {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}

.shell-main,
.front-main {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 22px 0 48px;
}

.front-body {
    background: var(--site-bg);
}

.front-header {
    background: var(--site-primary);
    color: #fff;
}

.front-title {
    display: grid;
    gap: 2px;
}

.front-title strong {
    color: #fff;
}

.front-title span {
    font-size: 12px;
    opacity: 0.86;
}

.front-nav a {
    border-color: rgba(255,255,255,0.28);
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.top-text-ad {
    display: block;
    min-height: 34px;
    padding: 7px 18px;
    background: var(--site-accent);
    color: #260900;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.install-body {
    background: #eef3f8;
}

.install-wrap {
    width: min(980px, calc(100% - 28px));
    margin: 28px auto;
}

.install-card,
.panel {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}

.install-head {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.install-head h1,
.page-head h1,
.panel h1,
.panel h2 {
    margin: 0;
}

.install-head p,
.muted {
    color: var(--muted);
    line-height: 1.7;
}

.pill {
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: #e8f2ff;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

.check-grid,
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0 24px;
}

.check-row,
.stat {
    min-height: 78px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.check-row strong,
.stat span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.check-row.ok {
    border-color: rgba(20, 125, 100, 0.35);
}

.check-row.bad {
    border-color: rgba(180, 35, 24, 0.38);
    background: #fff1f0;
}

.stat strong {
    display: block;
    margin-top: 8px;
    font-size: 26px;
}

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

.form-grid h2,
.span-2 {
    grid-column: 1 / -1;
}

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

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    outline: 0;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 87, 167, 0.14);
}

.primary-btn,
.secondary-btn,
.mini-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 6px;
    font-weight: 800;
    text-decoration: none;
}

.primary-btn {
    border: 1px solid var(--red);
    background: var(--red);
    color: #fff;
}

.secondary-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.mini-btn {
    min-height: 30px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.mini-btn.danger {
    border-color: var(--danger);
    color: var(--danger);
}

.alert {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 6px;
}

.alert.error {
    background: #fff1f0;
    color: var(--danger);
}

.alert.ok {
    background: #e9f8f4;
    color: var(--green);
}

.narrow {
    width: min(460px, 100%);
    margin: 42px auto;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 16px;
}

.page-head h1 {
    margin-top: 8px;
}

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

.panel {
    margin-bottom: 16px;
    overflow-x: auto;
}

.data-table th,
.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
}

.preview-box {
    min-height: 120px;
    padding: 14px;
    overflow: auto;
    border-radius: 8px;
    background: #111827;
    color: #d1fae5;
    white-space: pre-wrap;
}

.template-banner {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 2px solid var(--site-primary);
    background: #fff;
    color: var(--site-primary);
    font-weight: 800;
}

.publish-table-wrap {
    overflow-x: auto;
    border: 2px solid var(--site-primary);
    background: #fff;
}

.publish-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

.publish-table th {
    padding: 7px 8px;
    background: var(--site-primary);
    color: #fff;
    font-size: 13px;
}

.publish-table td {
    padding: 6px 8px;
    border: 1px solid #efd0d0;
    font-size: 13px;
    line-height: 1.35;
}

.publish-table td span {
    display: block;
    color: #6b7280;
    font-size: 12px;
}

.time-cell {
    width: 168px;
    color: var(--site-primary);
    font-weight: 900;
    text-align: center;
}

.type-all_day_premium td {
    background: #fff3c4;
    color: #7a1600;
    font-weight: 800;
}

.type-all_day_yellow td {
    background: #ffe16a;
}

.status-removed td {
    background: #f3f4f6;
    color: #6b7280;
}

.table-link {
    display: inline-flex;
    min-width: 54px;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: var(--site-primary);
    color: #fff;
    text-decoration: none;
}

.classic-board {
    display: grid;
    gap: 8px;
}

.classic-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) 70px;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-left: 5px solid var(--site-primary);
    background: #fff;
}

.classic-row h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.classic-row p {
    margin: 0;
    color: var(--muted);
}

.classic-time {
    color: var(--site-primary);
    font-weight: 900;
}

.classic-row a,
.night-item a {
    color: var(--site-primary);
    font-weight: 800;
}

.template-night {
    --site-bg: #161922;
    color: #eef2ff;
}

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

.night-item {
    padding: 14px;
    border: 1px solid #374151;
    border-radius: 8px;
    background: #202633;
}

.night-item span {
    color: var(--site-accent);
    font-weight: 900;
}

.night-item strong {
    display: block;
    margin-top: 8px;
    font-size: 18px;
}

.night-item p {
    color: #cbd5e1;
}

.template-options,
.permission-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.template-option {
    min-width: 180px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

@media (max-width: 780px) {
    .shell-header,
    .front-header,
    .page-head,
    .template-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .check-grid,
    .stat-grid,
    .form-grid,
    .night-grid,
    .classic-row {
        grid-template-columns: 1fr;
    }
}
