:root {
  --pri: #0f766e; --pri-2: #14b8a6; --pri-soft: #e6f6f4; --warm: #f59e0b;
  --bg: #f3f6f6; --card: #fff; --line: #e3eae9; --text: #1f2a2a; --sub: #5f6f6d; --mute: #94a3a1;
  --good: #16a34a; --normal: #0ea5e9; --attention: #f59e0b; --alert: #dc2626;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--pri); }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(135deg, #0f766e, #14b8a6); }
.login-box { background: #fff; border-radius: 20px; padding: 32px 28px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.login-box h2 { margin: 0 0 4px; }

.layout { display: flex; min-height: 100vh; }
.side { width: 210px; background: #0d3b37; color: #cfe7e3; flex: none; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .logo { padding: 20px 18px; font-size: 17px; font-weight: 700; color: #fff; }
.side .logo small { display: block; font-size: 12px; font-weight: 400; opacity: .7; }
.nav { flex: 1; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 20px; border: 0; background: none; color: inherit; text-align: left; font-size: 14px; }
.nav button:hover { background: rgba(255,255,255,.06); }
.nav button.on { background: rgba(20,184,166,.22); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #14b8a6; }
.side .bottom { padding: 14px 20px; font-size: 13px; }
.side .bottom button { background: none; border: 0; color: #9fc9c3; padding: 0; }
.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title h2 { margin: 0; font-size: 21px; }
.page-title .sp { flex: 1; }

.card { background: var(--card); border-radius: 14px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card h3 .sp { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: 14px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.kpi .v { font-size: 28px; font-weight: 700; color: var(--pri); line-height: 1.2; }
.kpi .l { color: var(--sub); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--pri-2); }
.btn.pri { background: var(--pri); color: #fff; border-color: var(--pri); }
.btn.pri:hover { background: #0b5f59; }
.btn.danger { color: var(--alert); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--sub); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--pri-2); }
textarea { resize: vertical; width: 100%; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 5px; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 10px; }
.switch input { width: 18px; height: 18px; accent-color: var(--pri); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--sub); font-weight: 600; background: #f8fbfa; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f6fbfa; }
td.sum { max-width: 420px; color: var(--sub); }
.nowrap { white-space: nowrap; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--bg); color: var(--sub); white-space: nowrap; }
.tag.ai { background: #f3e8ff; color: #7e22ce; }
.tag.alert { background: #fee2e2; color: #991b1b; }
.tag.good { background: #dcfce7; color: #166534; }
.tag.off { background: #f1f5f9; color: #94a3b8; }
td.detail { font-size: 13px; line-height: 1.7; min-width: 220px; }
.detail .dk { color: var(--mute); }
.tag.warn { background: #fef3c7; color: #92400e; }
.muted { color: var(--mute); font-size: 13px; }
.empty { text-align: center; color: var(--mute); padding: 30px 0; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars .b i { display: block; width: 100%; max-width: 30px; background: linear-gradient(180deg, #14b8a6, #0f766e); border-radius: 5px 5px 0 0; min-height: 2px; }
.bars .b span { font-size: 11px; color: var(--mute); }
.bars .b em { font-style: normal; font-size: 11px; color: var(--sub); }
.hbar { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13px; }
.hbar .n { width: 72px; flex: none; }
.hbar .t { flex: 1; background: var(--bg); border-radius: 5px; height: 14px; overflow: hidden; }
.hbar .t i { display: block; height: 100%; background: var(--pri-2); border-radius: 5px; }
.hbar .c { width: 36px; text-align: right; color: var(--sub); }

.modal-mask { position: fixed; inset: 0; background: rgba(10,30,30,.45); z-index: 50; display: none; align-items: flex-start; justify-content: center; padding: 50px 16px; overflow-y: auto; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; flex: 1; font-size: 17px; }
.modal-head .x { border: 0; background: none; font-size: 24px; color: var(--mute); }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin-bottom: 12px; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; }
.linkcell { display: flex; gap: 6px; align-items: center; }
.linkcell code { font-size: 12px; background: var(--bg); padding: 2px 6px; border-radius: 5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.sec { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; }
.dot.good { background: var(--good); } .dot.normal { background: var(--normal); } .dot.attention { background: var(--attention); } .dot.alert { background: var(--alert); }
.letter { background: #fff7ed; border-radius: 10px; padding: 12px; margin-top: 10px; }
.notice { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.pre { white-space: pre-wrap; word-break: break-all; background: #f8fbfa; border-radius: 8px; padding: 10px; font-size: 12px; max-height: 360px; overflow: auto; font-family: ui-monospace, Consolas, monospace; }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #1f2a2a; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 99; display: none; }
.toast.show { display: block; }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; }
  .side .logo { padding: 14px 16px; display: flex; align-items: center; }
  .side .logo small { display: none; }
  .nav { display: flex; overflow-x: auto; }
  .nav button { padding: 10px 14px; white-space: nowrap; width: auto; }
  .nav button.on { box-shadow: inset 0 -3px 0 #14b8a6; }
  .side .bottom { display: none; }
  .main { padding: 16px; }
  .grid2, .row2 { grid-template-columns: 1fr; }
}
