* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Microsoft YaHei", sans-serif; background: #f4f6f9; color: #1f2937; }
.screen { min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: #9ca3af; font-weight: 400; font-size: 14px; }
.err { color: #dc2626; font-size: 13px; min-height: 18px; }

/* 登录 */
#login { display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; padding: 40px; border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.08); width: 320px; text-align: center; }
.login-card h1 { font-size: 20px; }
.login-card .sub { color: #2563eb; margin: 4px 0 20px; font-size: 13px; }
.login-card input { width: 100%; padding: 10px 12px; margin: 8px 0; border: 1px solid #d1d5db; border-radius: 8px; }
.login-card button { width: 100%; padding: 11px; margin-top: 10px; background: #2563eb; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 15px; }
.login-card button:hover { background: #1d4ed8; }

/* 主面板 */
header { background: #fff; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
header button { background: #ef4444; color: #fff; border: none; padding: 7px 14px; border-radius: 6px; cursor: pointer; }
main { padding: 24px; }
h2 { font-size: 17px; margin-bottom: 14px; }
.tag { background: #dbeafe; color: #1d4ed8; padding: 2px 8px; border-radius: 10px; font-size: 12px; margin-left: 6px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.05); cursor: pointer; transition: .15s; }
.card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.1); transform: translateY(-2px); }
.card h3 { font-size: 15px; margin-bottom: 6px; }
.card .loc { color: #6b7280; font-size: 12px; margin-bottom: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.on { background: #22c55e; } .off { background: #9ca3af; }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; border-top: 1px dashed #eee; }
.kv span:last-child { font-weight: 600; }

/* 管理 */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.box { background: #fff; padding: 18px; border-radius: 12px; }
.box h3 { font-size: 14px; margin-bottom: 12px; }
.box input, .box select { width: 100%; padding: 9px 11px; margin: 6px 0; border: 1px solid #d1d5db; border-radius: 8px; }
.box button { margin-top: 10px; background: #16a34a; color: #fff; border: none; padding: 9px 16px; border-radius: 8px; cursor: pointer; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
.modal-box { background: #fff; width: 420px; max-width: 92vw; padding: 24px; border-radius: 14px; position: relative; }
.modal-box .x { position: absolute; right: 14px; top: 10px; border: none; background: none; font-size: 24px; cursor: pointer; color: #6b7280; }
.state { background: #f8fafc; border-radius: 8px; padding: 12px; font-size: 13px; margin: 10px 0; }
.state .kv { border: none; }
.cmds { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cmds button { background: #2563eb; color: #fff; border: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.cmds label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.cmds input { width: 64px; padding: 6px; border: 1px solid #d1d5db; border-radius: 6px; }
.cmdlog { margin-top: 14px; font-size: 12px; color: #16a34a; min-height: 16px; }
