/* 饮水机端（8090 端口）页面样式：简洁现代的控制面板风格 */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
    background: linear-gradient(160deg, #eef4fb 0%, #e8f0f9 40%, #f2f6fb 100%);
    color: #1f2937;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.machine-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.machine-empty {
    text-align: center;
    padding-top: 120px;
    color: #64748b;
}

.machine-empty-icon { font-size: 56px; margin-bottom: 12px; }

/* 顶部 */
.machine-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

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

.machine-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #38bdf8, #0284c7);
    color: #fff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(2, 132, 199, .28);
}

.machine-brand h1 { font-size: 20px; font-weight: 700; }

.machine-brand .sub { font-size: 12.5px; color: #64748b; margin-top: 2px; }

.machine-online {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: #059669;
    background: #ecfdf5;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
}

.machine-online::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
}

/* 布局 */
.machine-grid {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 18px;
    align-items: start;
}

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

/* 卡片 */
.card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
}

.card + .card { margin-top: 18px; }

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
}

.card-title .icon { font-size: 18px; }

.card-title .sync-hint {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 400;
    margin-left: auto;
}

/* 分段选择器 */
.seg-label { font-size: 12.5px; color: #64748b; margin-bottom: 8px; font-weight: 600; }

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

.seg.cols-4 { grid-template-columns: repeat(4, 1fr); }
.seg.cols-3 { grid-template-columns: repeat(3, 1fr); }

.seg-btn {
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px 8px;
    cursor: pointer;
    text-align: center;
    transition: all .15s ease;
    font-family: inherit;
}

.seg-btn .seg-name { font-size: 14px; font-weight: 600; display: block; }
.seg-btn .seg-meta { font-size: 11.5px; color: #94a3b8; display: block; margin-top: 3px; }

.seg-btn:hover { border-color: #bae6fd; background: #f0f9ff; }

.seg-btn.active {
    border-color: #0284c7;
    background: #e0f2fe;
    color: #0369a1;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, .12);
}

.seg-btn.active .seg-meta { color: #0284c7; }

/* 放水主按钮 */
.dispense-btn {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 18px;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #38bdf8, #0284c7);
    box-shadow: 0 8px 20px rgba(2, 132, 199, .32);
    transition: transform .06s ease, box-shadow .15s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dispense-btn:active { transform: scale(.98); }

.dispense-btn:disabled { opacity: .6; cursor: not-allowed; }

/* 语音 */
.voice-result {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f0f9ff;
    border: 1px dashed #7dd3fc;
    font-size: 13px;
    color: #0369a1;
    line-height: 1.7;
    display: none;
}

.voice-result.show { display: block; }

.voice-result .cmd { font-weight: 700; font-size: 14px; }

/* 输入 */
.input {
    width: 100%;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #1f2937;
    transition: border-color .15s;
}

.input:focus { outline: none; border-color: #0284c7; }

/* 用药提醒列表 */
.reminder-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.reminder-item:last-child { border-bottom: none; }

.reminder-dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f59e0b;
    margin-top: 6px;
}

.reminder-main { flex: 1; }
.reminder-title { font-size: 14px; font-weight: 600; }
.reminder-sub { font-size: 12.5px; color: #64748b; margin-top: 3px; }
.reminder-time {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    color: #d97706;
    background: #fffbeb;
    border-radius: 6px;
    padding: 2px 8px;
    margin-right: 6px;
    font-weight: 600;
}

/* 饮水汇总 */
.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.summary-box {
    text-align: center;
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px 8px;
}

.summary-box .num { font-size: 24px; font-weight: 800; color: #0284c7; }
.summary-box .unit { font-size: 12px; color: #64748b; margin-left: 2px; }
.summary-box .label { font-size: 12px; color: #94a3b8; margin-top: 4px; }

/* 记录列表 */
.record-list { max-height: 300px; overflow-y: auto; }

.record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

.record-item:last-child { border-bottom: none; }

.record-left { display: flex; align-items: center; gap: 10px; }
.record-tag {
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    padding: 2px 8px;
    background: #eef2ff;
    color: #4f46e5;
}

.record-tag.voice { background: #fdf2f8; color: #db2777; }

.record-time { color: #94a3b8; font-size: 12px; }

.empty-hint { text-align: center; color: #94a3b8; font-size: 13px; padding: 24px 0; }

/* 按钮 */
.btn {
    border: 1.5px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    color: #334155;
    transition: all .15s;
}

.btn:hover { background: #f8fafc; }

.btn-primary {
    background: #0284c7;
    border-color: #0284c7;
    color: #fff;
}

.btn-primary:hover { background: #0369a1; }

.btn-block { width: 100%; }

.btn:disabled { opacity: .55; cursor: not-allowed; }

/* toast */
#toast-host { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 10001; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
    background: #111827;
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13.5px;
    opacity: 0;
    transform: translateY(-8px);
    transition: all .2s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }

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

.tag {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
}

.tag-success { background: #ecfdf5; color: #059669; }
.tag-warn { background: #fffbeb; color: #d97706; }

/* ---------- 设置页 ---------- */

.settings-grid { grid-template-columns: 1fr 1fr; }

.settings-qr { text-align: center; padding: 12px 12px 4px; }
.settings-qr img { width: 224px; height: 224px; image-rendering: pixelated; }

.settings-device {
    text-align: center;
    font-size: 13px;
    color: #64748b;
    margin: 6px 0 12px;
}

.settings-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.settings-hint {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    line-height: 1.6;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
}

.settings-phone {
    margin-top: 12px;
    font-size: 13px;
    color: #059669;
    background: #ecfdf5;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
}

.settings-steps { display: flex; flex-direction: column; gap: 10px; }

.settings-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
}

.settings-step span {
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
