/* =========================================================
   菜连 remote.xcpls.cn 页面样式（暗色）
   公共头部 / 页脚 / 表格卡片 / 弹窗来自 https://xcpls.cn/static/css/site.css
   这里负责本页布局，并把 site.css 的浅色部分覆盖成暗色。
   ========================================================= */

:root {
    --brand: #10b981;
    --brand-dark: #059669;
    --brand-deep: #6ee7b7;
    --brand-soft: #064e3b;
    --line: #27303a;
    --line-soft: #1c2522;
    --ink: #e5e7eb;
    --muted: #9ca3af;
    --page-bg: #0b0f0e;
    --panel: #161b1a;
    --panel-2: #1f2937;

    /* 覆盖 site.css 的浅色 token */
    --nh-brand: #10b981;
    --nh-brand-dark: #059669;
    --nh-brand-soft: #064e3b;
    --nh-line: #27303a;
    --nh-ink: #e5e7eb;
    --nh-muted: #9ca3af;
}

html { height: 100%; color-scheme: dark; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    background: var(--page-bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

main { flex: 1; width: 100%; min-width: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; }

/* ---------------- 按钮 ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    height: 42px;
    padding: 0 1.1rem;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.btn-primary { background: var(--brand); color: #052e16; }
.btn-primary:hover { background: var(--brand-dark); color: #052e16; }
.btn-ghost { background: var(--panel); color: var(--brand-deep); border-color: var(--brand-soft); }
.btn-ghost:hover { background: var(--brand-soft); border-color: var(--brand); color: #a7f3d0; }

/* ---------------- 首页 ---------------- */

.remote-main { padding-top: 2rem; padding-bottom: 1.5rem; }

.hero {
    max-width: 46rem;
    padding: 1.5rem 0 2.25rem;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.02em;
}

.hero-lead {
    margin: .7rem 0 0;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--muted);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.4rem; }

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem;
    margin-top: 1.6rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--line-soft);
}

.hero-stats[hidden] { display: none; }

.hero-stat { display: flex; flex-direction: column; gap: .1rem; }
.hero-stat-value {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--brand-deep);
    font-variant-numeric: tabular-nums;
}
.hero-stat-label { font-size: .78rem; color: var(--muted); }

/* ---------------- 管理后台 ---------------- */

.admin-shell {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 65px - 3.25rem);
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
}

.admin-aside { background: #0f1513; flex-shrink: 0; }
.admin-aside-title {
    margin-bottom: .75rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.admin-content { flex: 1; min-width: 0; padding: 1.25rem; }

@media (min-width: 1024px) {
    .admin-shell { flex-direction: row; }
    .admin-aside {
        width: 15rem;
        padding: 1rem;
        border-right: 1px solid var(--line);
    }
    .admin-content { padding: 1.75rem 2rem; }
}

.admin-nav .nav-item + .nav-item { margin-top: .4rem; }

.nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    padding: .7rem .85rem;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    font-size: .875rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.nav-item i { width: 1rem; text-align: center; color: #6b7280; transition: color .18s ease; }
.nav-item:hover { background: var(--panel-2); color: var(--brand-deep); }
.nav-item:hover i { color: var(--brand-deep); }
.nav-item.active { background: var(--brand-soft); color: #a7f3d0; }
.nav-item.active i { color: var(--brand-deep); }

.section-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.15rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--ink);
}

.section-title i { color: var(--brand); }
.section-sub { margin: .3rem 0 0; font-size: .82rem; color: var(--muted); }

.panel-card {
    padding: 1.1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    padding: 1.05rem 1.1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.stat-card-label { font-size: .78rem; color: var(--muted); }
.stat-card-value {
    margin-top: .25rem;
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--brand-deep);
    font-variant-numeric: tabular-nums;
}
.stat-card-sub { margin-top: .3rem; font-size: .75rem; color: #6b7280; }

.overview-panel { margin-top: 1.25rem; }
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .55rem;
}
.panel-head h2 { margin: 0; font-size: .95rem; font-weight: 700; }

.link-btn {
    padding: .2rem .35rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #34d399;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
}
.link-btn:hover { background: var(--brand-soft); color: #a7f3d0; }

.audit-list { display: flex; flex-direction: column; }
.audit-item {
    display: flex;
    align-items: baseline;
    gap: .9rem;
    padding: .55rem 0;
    border-bottom: 1px dashed var(--line-soft);
    font-size: .83rem;
}
.audit-item:last-child { border-bottom: 0; }
.audit-time {
    flex: 0 0 auto;
    font-size: .75rem;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}
.audit-text { min-width: 0; color: #cbd5e1; overflow-wrap: anywhere; }
.audit-empty { padding: 1.5rem 0; text-align: center; font-size: .85rem; color: #6b7280; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: .9rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: .5rem;
    height: 40px;
    width: min(100%, 260px);
    padding: 0 .85rem;
    background: #0f1513;
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.search-box i { color: #6b7280; font-size: .85rem; }
.search-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-family: inherit;
    font-size: .875rem;
}
.search-box input::placeholder { color: #6b7280; }
.search-box:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
}

.table-wrap {
    overflow-x: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    scrollbar-color: var(--line) transparent;
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }

table { width: 100%; border-collapse: collapse; }

th, td {
    padding: .72rem .8rem;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    font-size: .85rem;
    vertical-align: middle;
}

th {
    background: #111827;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 600;
    white-space: nowrap;
}

td { white-space: nowrap; color: var(--ink); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }

/* 主值 + 副标题两层，留在一个 div 里，手机转卡片时不会被 td 的 flex 拆成两列 */
.cell-stack { min-width: 0; }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub {
    margin-top: .1rem;
    font-size: .75rem;
    color: var(--muted);
    white-space: normal;
    overflow-wrap: anywhere;
}
@media (max-width: 900px) {
    .cell-stack { text-align: right; }
    .cell-stack .cell-main { overflow-wrap: anywhere; }
}
.cell-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .78rem;
    color: #cbd5e1;
    white-space: normal;
    overflow-wrap: anywhere;
}
.cell-wrap { white-space: normal; overflow-wrap: anywhere; max-width: 18rem; }

.row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .35rem;
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    height: 30px;
    padding: 0 .6rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--ink);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.btn-sm:hover { background: var(--line); }
.btn-sm.danger { color: #fca5a5; border-color: #7f1d1d; }
.btn-sm.danger:hover { background: #450a0a; }
.btn-sm.primary { color: var(--brand-deep); border-color: var(--brand-soft); }
.btn-sm.primary:hover { background: var(--brand-soft); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-ok { background: var(--brand-soft); color: var(--brand-deep); }
.badge-off { background: var(--panel-2); color: var(--muted); }
.badge-warn { background: #422006; color: #fbbf24; }
.badge-danger { background: #450a0a; color: #fca5a5; }
.badge-info { background: #172554; color: #93c5fd; }

.table-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: #6b7280;
    font-size: .85rem;
}

.state-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    min-height: 16rem;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--muted);
}
.state-panel i { font-size: 1.9rem; color: #4b5563; }
.state-panel h2 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 640px) {
    .remote-main { padding-top: 1.25rem; }
    .hero-lead { font-size: .95rem; }
    .hero-stats { gap: 1.35rem; }
    .admin-content { padding: 1rem; }
    .section-title { font-size: 1.3rem; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .stat-card { padding: .9rem .95rem; }
    .stat-card-value { font-size: 1.45rem; }
    .panel-card { padding: .85rem; }
    th, td { padding: .6rem .55rem; font-size: .82rem; }
    .audit-item { gap: .6rem; }
}

@media (max-width: 480px) {
    .hero-actions .btn { flex: 1 1 0; }
    .search-box { width: 100%; }
}

@media (max-width: 380px) {
    .stat-grid { grid-template-columns: minmax(0, 1fr); }
}

/* =========================================================
   site.css 覆盖（头部 / 页脚 / 手机抽屉 / 弹窗 / 提醒）
   ========================================================= */

.site-header { background: var(--page-bg); border-bottom-color: var(--line); }
.brand, .brand:hover { color: var(--ink); }
.auth-slot img { border-color: var(--brand); }
.auth-slot .login-btn { background: var(--brand); color: #052e16; }
.auth-slot .login-btn:hover { background: var(--brand-dark); color: #052e16; }
.auth-loading { color: var(--muted); }

.site-footer { background: #111827; border-top: 1px solid var(--line); color: #cbd5e1; }
.footer-link { color: #cbd5e1; }
.footer-link i { color: var(--brand-deep); }
.footer-link:hover { color: var(--brand-deep); }

.nh-nav-toggle { color: var(--muted); }
.nh-nav-toggle:hover { background: var(--brand-soft); color: var(--brand-deep); }
body.nh-has-mobile-nav .nh-mobile-nav.admin-aside { background: #111827; }
body.nh-nav-open .nh-nav-global { background: #111827; border-bottom-color: var(--line); }
.nh-nav-global-link { background: var(--panel-2); color: #cbd5e1; }
.nh-nav-global-link:hover { background: var(--brand-soft); color: var(--brand-deep); }

.nh-modal-backdrop { background: rgba(0, 0, 0, .72); }
.nh-modal {
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--ink);
}
.nh-modal-title { color: var(--ink); }
.nh-modal-message { color: var(--muted); }
.nh-field-label { color: var(--muted); }
.nh-field-input,
.nh-field-textarea,
.nh-field-select {
    background: #0f1513;
    border-color: var(--line);
    color: var(--ink);
}
.nh-field-input::placeholder,
.nh-field-textarea::placeholder { color: #6b7280; }
.nh-field-input:focus,
.nh-field-textarea:focus,
.nh-field-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
}
.nh-btn-cancel { background: var(--panel-2); border-color: var(--line); color: var(--ink); }
.nh-btn-cancel:hover { background: var(--line); }
.nh-btn-confirm { background: var(--brand); color: #052e16; }
.nh-btn-confirm:hover { background: var(--brand-dark); color: #052e16; }
.nh-btn-danger { background: #dc2626; color: #fee2e2; }
.nh-btn-danger:hover { background: #b91c1c; }

body .notification-item { border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
