:root {
    --bg: #141822;
    --panel: #1d2330;
    --panel-2: #252c3b;
    --border: rgba(255, 255, 255, 0.1);
    --text: #e8ecf3;
    --muted: #9aa6b8;
    --primary: #5b8def;
    --primary-2: #8a6df0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
}

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

/* ---------- 登录页 ---------- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 30% 20%, #26304a 0%, var(--bg) 60%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px 28px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

.login-brand {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.login-sub {
    color: var(--muted);
    font-size: 13px;
    margin: 6px 0 20px;
}

.login-alert {
    background: rgba(255, 99, 99, 0.15);
    color: #ff8a8a;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 16px;
}

.field {
    display: block;
    margin-bottom: 16px;
}

.field span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.field input:focus {
    border-color: var(--primary);
}

.login-hint {
    margin-top: 18px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid transparent;
    background: var(--panel-2);
    color: var(--text);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border: none;
    font-weight: 600;
}

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
}

.btn-sm {
    padding: 7px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* ---------- 侧边栏布局 ---------- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 232px;
    height: 100vh;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    z-index: 30;
}

.side-brand {
    font-size: 18px;
    font-weight: 700;
    padding: 4px 8px 18px;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 14px;
}

.side-link.active {
    background: var(--panel-2);
    color: var(--text);
}

.side-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
}

.side-user {
    margin-top: auto;
    padding: 12px 10px;
    border-top: 1px solid var(--border);
}

.side-user-name {
    font-size: 14px;
}

.side-user-role {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.main {
    margin-left: 232px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
}

.topbar-right {
    display: flex;
    gap: 10px;
}

.nav-toggle {
    display: none;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    cursor: pointer;
}

.content {
    padding: 24px 22px;
}

.content h1 {
    margin: 0 0 6px;
    font-size: 22px;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 22px;
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-body {
    font-size: 13px;
    color: var(--muted);
}

/* ---------- 表单 ---------- */

.input {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.input:focus {
    border-color: var(--primary);
}

.input-sm {
    padding: 6px 8px;
    font-size: 12px;
}

.panel-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 16px 0;
}

.create-row {
    display: flex;
    gap: 10px;
    margin: 16px 0;
}

.create-row .input {
    flex: 1;
    max-width: 320px;
}

/* ---------- 标签 ---------- */

.tag {
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    padding: 3px 10px;
    font-size: 12px;
    background: var(--panel-2);
    color: var(--muted);
}

.tag-warn {
    background: rgba(255, 180, 60, 0.15);
    color: #ffc861;
}

.tag-ok {
    background: rgba(80, 200, 130, 0.15);
    color: #63d99a;
}

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

.btn-danger {
    background: rgba(255, 99, 99, 0.15);
    border-color: rgba(255, 99, 99, 0.3);
    color: #ff8a8a;
}

/* ---------- 表格 ---------- */

.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th,
.table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.table th {
    color: var(--muted);
    font-weight: 600;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.row-actions form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

/* ---------- 统计卡片 ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.stat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
}

.stat-num {
    font-size: 26px;
    font-weight: 700;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

/* ---------- 房间与麦位 ---------- */

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

.room-action {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
}

.seat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.seat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
}

.seat-owner {
    border-color: var(--primary);
}

.seat-empty {
    opacity: 0.55;
}

.seat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--panel-2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 16px;
}

.seat-name {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seat-role {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* ---------- 留言 ---------- */

.chat {
    margin-top: 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

.chat-list {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.chat-item {
    font-size: 13px;
}

.chat-name {
    color: var(--primary);
    margin-right: 6px;
}

.chat-text {
    color: var(--text);
}

.chat-time {
    color: var(--muted);
    font-size: 11px;
    margin-left: 8px;
}

.chat-empty {
    text-align: center;
    padding: 16px 0;
}

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

.chat-form .input {
    flex: 1;
}

/* ---------- 卡片跳转 ---------- */

.card-link-card {
    display: block;
    transition: border-color 0.15s ease;
}

.card-link-card:hover {
    border-color: var(--primary);
}

.card-link {
    margin-top: 12px;
}

/* ---------- 登录页 tabs ---------- */

.login-tabs {
    display: flex;
    gap: 18px;
    margin: 4px 0 18px;
}

.login-tabs a {
    font-size: 14px;
    color: var(--muted);
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
}

.login-tabs a.on {
    color: var(--text);
    border-bottom-color: var(--primary);
}

/* ---------- 验证码 ---------- */

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

.captcha-row input {
    flex: 1;
    min-width: 0;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.captcha-row input:focus {
    border-color: var(--primary);
}

.captcha-img {
    width: 110px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
    object-fit: cover;
    flex-shrink: 0;
}

.captcha-tip {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
    cursor: pointer;
}

/* ---------- 安装向导 ---------- */

.install-card {
    max-width: 460px;
}

.install-checks {
    display: grid;
    gap: 6px;
    margin: 4px 0 18px;
}

.install-check {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--panel-2);
}

.install-check.ok {
    color: #63d99a;
}

.install-check.bad {
    color: #ff8a8a;
}

.install-check-note {
    color: var(--muted);
}

.install-options {
    display: grid;
    gap: 10px;
    margin: 4px 0 18px;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

.login-success {
    background: rgba(80, 200, 130, 0.15);
    color: #63d99a;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 15px;
    margin-bottom: 16px;
}

.install-list {
    margin: 0 0 18px;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.9;
}

/* ---------- 移动端 ---------- */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ================= v1.3 新增组件 ================= */

.panel {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 16px 18px;
    margin: 18px 0;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
}

.panel-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
}

.search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
}

.search-row .input {
    max-width: 260px;
}

.request-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.request-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--panel-2);
    border-radius: 10px;
}

.request-name {
    font-weight: 600;
}

.request-actions {
    display: flex;
    gap: 8px;
}

.kv {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kv-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.kv-row > span:first-child {
    color: var(--muted, #8b95a7);
}

.cell-text {
    max-width: 420px;
    word-break: break-word;
}

.link-btn {
    background: none;
    border: none;
    padding: 0;
    color: #8b95a7;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}

.link-btn:hover {
    color: #ff6b6b;
}

.seat-act {
    margin-top: 6px;
}

.chat-del {
    display: inline;
    margin-left: 6px;
}

.side-logout {
    display: block;
    margin-top: 10px;
    font-size: 12px;
    color: #8b95a7;
    text-decoration: none;
}

.side-logout:hover {
    color: #fff;
}
