:root {
    --bg: #F4F1EA;
    --card: #FFFFFF;
    --ink: #1C2321;
    --muted: #7B837D;
    --faint: #A8ACA6;
    --line: #E6DFD2;
    --green: #1F5A4E;
    --green-soft: #E9F0EB;
    --amber: #C08536;
    --amber-soft: #FBF3E6;
    --red: #C1553F;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* 登录 */
.login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 40px 36px 32px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(28, 35, 33, 0.08);
}

.login-card h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 1px;
}

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

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

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

.field input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 16px;
    letter-spacing: 4px;
    background: #FFFDF9;
    color: var(--ink);
    outline: none;
}

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

button {
    font-family: inherit;
    cursor: pointer;
}

.primary {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 10px;
    background: var(--green);
    color: #fff;
    font-size: 15px;
    letter-spacing: 2px;
}

.primary:hover {
    background: #17483F;
}

.error {
    min-height: 20px;
    margin: 12px 0 0;
    color: var(--red);
    font-size: 13px;
}

/* 顶栏 */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 32px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.brand-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
}

.brand-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.pill {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--amber-soft);
    color: var(--amber);
    font-size: 12px;
}

.pill.live {
    background: var(--green-soft);
    color: var(--green);
}

.topmeta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ghost {
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
}

.ghost:hover {
    border-color: var(--green);
    color: var(--green);
}

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

/* 版面 */
main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 32px 60px;
    display: grid;
    gap: 22px;
}

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

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
}

/* 房间 */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}

.room {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 16px 14px;
    background: #FFFDFA;
}

.room.active {
    border-color: #BFD5CC;
    background: #F7FBF8;
}

.room-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.room-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 1px;
}

.room-type {
    font-size: 12px;
    color: var(--faint);
}

.room-state {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 10px 0 14px;
    font-size: 12.5px;
    color: var(--muted);
}

.state-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #CFC8B9;
}

.dot.on {
    background: var(--green);
}

.dot.warn {
    background: var(--amber);
}

.room-ops {
    display: flex;
    gap: 8px;
}

.op {
    flex: 1;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 12.5px;
    color: var(--ink);
}

.op:hover {
    border-color: #C9C1B1;
}

.op.on {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.op.danger {
    color: var(--red);
    border-color: #E4C3BB;
}

.op.danger:hover {
    background: #FBF1EF;
}

.op:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 订单 */
.sessions {
    display: grid;
    gap: 12px;
}

.session {
    display: grid;
    grid-template-columns: 1.4fr 1.6fr auto;
    align-items: center;
    gap: 18px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #FFFDFA;
}

.session-room {
    font-size: 16px;
    font-weight: 600;
}

.session-no {
    display: block;
    font-size: 11.5px;
    color: var(--faint);
    letter-spacing: 0.3px;
}

.session-times {
    font-size: 12.5px;
    color: var(--muted);
}

.session-times strong {
    color: var(--ink);
    font-weight: 600;
}

.session-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.remain {
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
    white-space: nowrap;
}

.remain.urgent {
    color: var(--amber);
}

.remain.over {
    color: var(--red);
}

.tag {
    padding: 2px 8px;
    border-radius: 6px;
    background: #F2EEE6;
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
}

.tag.on {
    background: var(--green-soft);
    color: var(--green);
}

.empty {
    padding: 26px 0;
    text-align: center;
    color: var(--faint);
    font-size: 13px;
}

/* 顶部告警 */
.alerts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.alerts.hidden {
    display: none;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
}

.alert--critical {
    background: #FCEBEB;
    border-color: #F09595;
}

.alert--warning {
    background: #FAEEDA;
    border-color: #EF9F27;
}

.alert-dot {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.alert--critical .alert-dot {
    background: #A32D2D;
}

.alert--warning .alert-dot {
    background: #854F0B;
}

.alert-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.alert-mute {
    flex-shrink: 0;
    align-self: center;
    margin-left: 12px;
    padding: 5px 12px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    color: #6b5b3f;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    cursor: pointer;
}

.alert-mute:hover {
    background: rgba(255, 255, 255, 0.9);
}

.alerts-restore {
    display: flex;
    justify-content: flex-end;
}

.alerts-restore button {
    padding: 0;
    font-size: 12px;
    color: #8a6d3b;
    background: none;
    border: none;
    text-decoration: underline;
    cursor: pointer;
}

.alert-title {
    font-size: 14px;
    font-weight: 500;
    color: #501313;
}

.alert--warning .alert-title {
    color: #633806;
}

.alert-detail {
    font-size: 13px;
    line-height: 1.6;
    color: #791F1F;
}

.alert--warning .alert-detail {
    color: #854F0B;
}

/* 记录 */
.actions {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.actions li {
    padding: 9px 12px;
    border-radius: 8px;
    background: #FAF7F1;
    font-size: 12.5px;
    color: #4B5450;
}

/* Toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translate(-50%, 20px);
    padding: 10px 20px;
    border-radius: 999px;
    background: rgba(28, 35, 33, 0.92);
    color: #fff;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 40;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 820px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 16px 18px;
    }

    main {
        padding: 18px 16px 40px;
    }

    .session {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .session-right {
        justify-content: space-between;
    }
}

/* 房间状态标签 */
.room-statusline {
    margin-top: 8px;
}

.status-chip {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    background: #F2EEE6;
    color: #7B837D;
}

.status-chip.free {
    background: #E9F0EB;
    color: #1F5A4E;
}

.status-chip.live {
    background: #FBF3E6;
    color: #A26A31;
}

.status-chip.busy {
    background: #F2EEE6;
    color: #6F7772;
}

/* 待收款 */
.session--unpaid {
    border-left: 3px solid #C08536;
}

.tag.on {
    background: #E9F0EB;
    color: #1F5A4E;
}

/* ---------------- 设备设置弹层 ---------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(24, 30, 28, 0.44);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    background: var(--card);
    border-radius: 18px;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.modal-head h2 {
    margin: 0;
    font-size: 17px;
    letter-spacing: 0.5px;
}

.modal-body {
    padding: 18px 22px 24px;
    overflow-y: auto;
}

.cfg {
    padding: 16px 0 18px;
    border-bottom: 1px dashed var(--line);
}

.cfg:last-of-type {
    border-bottom: 0;
}

.cfg h3 {
    margin: 0 0 4px;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.hint {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}

.grid2 .field {
    margin-bottom: 0;
}

.cfg .field {
    margin-bottom: 10px;
}

.cfg select {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    color: var(--ink);
}

.cfg-ops {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.cfg-ops .primary,
.cfg-ops .ghost {
    width: auto;
    height: 36px;
    padding: 0 18px;
    font-size: 13px;
    letter-spacing: 1px;
}

.bind-list {
    display: grid;
    gap: 8px;
}

.bind-head,
.bind-row {
    display: grid;
    grid-template-columns: 64px 1fr 1fr 1.4fr;
    align-items: center;
    gap: 10px;
}

@media (max-width: 900px) {
    .bind-head {
        display: none;
    }

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

    .bind-row .bind-name {
        grid-column: 1 / -1;
    }
}

.bind-head {
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--faint);
}

.bind-head span:nth-child(2),
.bind-head span:nth-child(3),
.bind-head span:nth-child(4) {
    padding-left: 2px;
}

.bind-name {
    font-size: 13px;
    color: var(--ink);
}

.bind-row select,
.bind-row input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
}

.bind-row input {
    font-family: var(--mono, monospace);
    font-size: 12px;
}

@media (max-width: 560px) {
    .grid2 {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-card {
        max-height: 94vh;
        border-radius: 18px 18px 0 0;
    }
}

/* 经营统计 */
.modal-head-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-head-right select {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.stat-card {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.stat-label {
    font-size: 11px;
    color: var(--faint);
}

.stat-value {
    font-size: 18px;
    color: var(--ink);
}

.stat-sub {
    font-size: 11px;
    color: var(--faint);
}

.stat-title {
    margin: 14px 0 8px;
    font-size: 13px;
    font-weight: 500;
}

.bar-list {
    display: grid;
    gap: 6px;
}

.bar-row {
    display: grid;
    grid-template-columns: 68px 1fr 78px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.bar-name {
    color: var(--ink);
}

.bar-track {
    height: 12px;
    border-radius: 6px;
    background: var(--line);
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: #1f5a4e;
}

.bar-value {
    text-align: right;
    color: var(--faint);
}

@media (max-width: 700px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 日结对账 */
.st-issues {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.st-issue {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #FCEBEB;
    border: 1px solid #F09595;
    border-radius: 10px;
    font-size: 13px;
}

.st-issue-room {
    font-weight: 500;
    color: #501313;
}

.st-issue-no {
    color: #791F1F;
}

.st-issue-text {
    color: #A32D2D;
}

.st-table {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.st-tr {
    display: grid;
    grid-template-columns: 68px 1.4fr 1fr 70px 88px 78px 88px;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--line);
}

.st-tr:last-child {
    border-bottom: none;
}

.st-th {
    background: var(--bg);
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 720px) {
    .st-tr {
        grid-template-columns: 60px 1fr 76px 84px;
    }

    .st-tr span:nth-child(2),
    .st-tr span:nth-child(6),
    .st-tr span:nth-child(7) {
        display: none;
    }
}

/* 抓到的天猫精灵 OpenId */
.oid-actions {
    display: flex;
    gap: 8px;
    margin: 8px 0 10px;
}

.oid-list {
    display: grid;
    gap: 8px;
}

.oid-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.oid-row code {
    font-family: var(--mono, monospace);
    font-size: 12px;
    word-break: break-all;
}

.oid-sub {
    margin-top: 2px;
    font-size: 11px;
    color: var(--faint);
    word-break: break-all;
}

/* 房间二维码弹窗 */
.modal-card--sm {
    max-width: 420px;
}

.qr-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.qr-name {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--line);
}

.qr-img {
    width: 280px;
    height: 280px;
    max-width: 100%;
    object-fit: contain;
    display: block;
    background: #fff;
}

/* 配置子区块（老板告警通知） */
.cfg-sub {
    margin-top: 16px;
    padding: 14px;
    border: 1px dashed var(--line);
    border-radius: 12px;
}

.cfg-sub h4 {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--ink);
}

/* 复选框行：checkbox 靠左，文字在右 */
.check-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.check-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: none;
    letter-spacing: 0;
}

.check-field span {
    display: inline;
    margin: 0;
    font-size: 13px;
    color: var(--ink);
}

/* ---------------- 房间卡片操作区精简 ---------------- */
.room-head {
    align-items: center;
}

.room-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.room-qr {
    flex-shrink: 0;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}

.room-qr:hover {
    border-color: var(--green);
    color: var(--green);
}

.room-ops .op.power {
    flex: 1.6;
    font-weight: 600;
}

/* ---------------- 设备与配置弹层：左侧导航 ---------------- */
.modal-card--settings {
    max-width: 920px;
}

.settings-layout {
    display: flex;
    min-height: 0;
    flex: 1;
}

.settings-nav {
    width: 168px;
    flex-shrink: 0;
    padding: 14px 10px;
    border-right: 1px solid var(--line);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    text-align: left;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: none;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

.nav-item:hover {
    background: #fff;
    color: var(--ink);
}

.nav-item.active {
    background: var(--green-soft);
    color: var(--green);
    font-weight: 600;
}

.settings-body {
    flex: 1;
    min-width: 0;
    padding: 18px 22px 24px;
    overflow-y: auto;
}

.settings-body .cfg {
    border-bottom: 0;
    padding-top: 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

@media (max-width: 700px) {
    .settings-layout {
        flex-direction: column;
    }

    .settings-nav {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 8px 10px;
        overflow-x: auto;
    }

    .nav-item {
        white-space: nowrap;
        padding: 8px 12px;
    }
}

/* ---------------- 电脑 / 手机双端操作优化 ---------------- */
@media (max-width: 820px) {
    .topmeta {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .topmeta .muted {
        flex-basis: 100%;
    }

    .topmeta .ghost {
        flex: 1 1 auto;
        min-width: 0;
        height: 40px;
    }

    main {
        gap: 16px;
    }

    .panel {
        padding: 18px 16px 20px;
    }
}

@media (max-width: 560px) {
    .panel-head {
        flex-wrap: wrap;
        gap: 6px;
    }

    .panel-head .muted {
        flex-basis: 100%;
    }

    .room-ops {
        flex-wrap: wrap;
    }

    .room-ops .op.power {
        flex: 1 1 100%;
        height: 42px;
        font-size: 14px;
    }

    .room-ops .op:not(.power) {
        flex: 1 1 30%;
        height: 40px;
        font-size: 13px;
    }

    .session-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .session-right .remain {
        flex-basis: 100%;
    }

    .session-right .op {
        flex: 1 1 auto;
        height: 40px;
    }

    .alert {
        flex-wrap: wrap;
    }

    .alert-mute {
        margin-left: 20px;
        align-self: flex-start;
    }

    .room-qr {
        height: 30px;
        padding: 0 12px;
    }

    .settings-body {
        padding: 14px 16px 20px;
    }

    .modal-card {
        max-width: 100%;
    }
}
