* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif; background: #f3f5f9; color: #26303b; font-size: 14px; }
a { color: #3b82f6; text-decoration: none; cursor: pointer; }
b { font-weight: 600; }
.boot { padding: 60px; text-align: center; color: #98a2b3; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.side { width: 210px; background: #1e2733; color: #cdd6e0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 20px 14px; font-size: 16px; font-weight: 700; color: #fff; letter-spacing: 1px; border-bottom: 1px solid #2c3947; white-space: nowrap; }
nav { flex: 1; padding: 10px 0; overflow-y: auto; }
nav a { display: block; padding: 11px 20px; color: #b6c2cf; transition: .15s; }
nav a:hover { background: #283442; color: #fff; }
nav a.on { background: #3b82f6; color: #fff; }
.side-foot { padding: 14px 18px; border-top: 1px solid #2c3947; font-size: 12px; }
.me-line { margin-bottom: 6px; color: #e8edf2; }
.me-ops a { color: #8fa5ba; }
.me-ops a:hover { color: #fff; }
.content { flex: 1; padding: 20px 24px; min-width: 0; }

/* ---------- 页头与组件 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.page-head h2 { margin: 0; font-size: 19px; }
.head-ops { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sep { color: #98a2b3; }
.input { border: 1px solid #d5dbe3; border-radius: 6px; padding: 7px 10px; font-size: 13px; background: #fff; color: #26303b; outline: none; }
.input:focus { border-color: #3b82f6; }
.input.sm { padding: 5px 8px; }
textarea.input { resize: vertical; width: 100%; }
.btn { border: 1px solid #d5dbe3; background: #fff; border-radius: 6px; padding: 7px 14px; cursor: pointer; font-size: 13px; color: #26303b; transition: .15s; }
.btn:hover { border-color: #9db4d0; }
.btn.primary { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.btn.primary:hover { background: #2f6fd8; }
.btn.danger { color: #d64545; border-color: #eec3c3; }
.btn.danger:hover { background: #fdeeee; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; padding: 10px; font-size: 14px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: #e8edf4; color: #4a5a6c; }
.tag.warn { background: #fff3e0; color: #b26a00; }
.tag.active { background: #e5f5ea; color: #1d8a45; }
.tag.waiting { background: #fff3e0; color: #b26a00; }
.tag.closed { background: #eceff3; color: #8593a3; }
.tag.role { background: #e9efff; color: #3061c9; }
.empty { color: #98a2b3; text-align: center; padding: 30px 10px; }
.tip { color: #8a97a6; font-size: 12px; line-height: 1.6; }
.form-err { background: #fdeeee; color: #c0392b; border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; font-size: 13px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(20,40,80,.06); }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef1f5; font-size: 13px; white-space: nowrap; }
.table th { background: #f7f9fc; color: #6b7a8c; font-weight: 600; }
.table tr:hover td { background: #fafcff; }
.table .ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.ops a { margin-right: 10px; font-size: 12px; }

/* ---------- 面板 / 卡片 ---------- */
.panel { background: #fff; border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(20,40,80,.06); }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.rep-range { font-size: 12px; color: #98a2b3; font-weight: 400; margin-left: 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: #fff; border-radius: 10px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(20,40,80,.06); }
.card-num { font-size: 24px; font-weight: 700; color: #2f6fd8; }
.card-name { color: #8593a3; font-size: 12px; margin-top: 4px; }
.chart { width: 100%; max-width: 760px; }

/* ---------- 表单 ---------- */
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.form-row > label { width: 170px; flex-shrink: 0; color: #4a5a6c; font-size: 13px; text-align: right; }
.form-row.col { flex-direction: column; align-items: flex-start; }
.form-row.col > label { width: auto; text-align: left; margin-bottom: 6px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.check-line { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check-line.inline { display: inline-flex; margin-right: 14px; }
.radio-line { display: block; padding: 7px 4px; font-size: 13px; cursor: pointer; border-bottom: 1px dashed #eef1f5; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a5f, #2f6fd8); }
.login-box { width: 340px; background: #fff; border-radius: 14px; padding: 34px 30px; box-shadow: 0 12px 40px rgba(10,30,60,.25); }
.login-box h1 { margin: 0 0 4px; font-size: 24px; text-align: center; }
.login-box .sub { text-align: center; color: #8a97a6; font-size: 12px; margin: 0 0 20px; }
.login-box label { display: block; font-size: 12px; color: #6b7a8c; margin: 12px 0 5px; }
.login-box input { width: 100%; }
.login-box .btn { margin-top: 20px; }
.login-box .tip { text-align: center; margin-top: 14px; }

/* ---------- 工作台 ---------- */
.wb { display: flex; gap: 14px; height: calc(100vh - 120px); }
.wb-list { width: 270px; background: #fff; border-radius: 10px; overflow-y: auto; box-shadow: 0 1px 3px rgba(20,40,80,.06); }
.conv-item { padding: 12px 14px; border-bottom: 1px solid #f0f3f7; cursor: pointer; position: relative; }
.conv-item:hover { background: #f7faff; }
.conv-item.on { background: #eaf2ff; }
.conv-name { font-weight: 600; }
.conv-last { color: #8a97a6; font-size: 12px; margin-top: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 200px; }
.conv-time { position: absolute; right: 12px; top: 13px; font-size: 11px; color: #aab6c4; }
.wb-chat { flex: 1; background: #fff; border-radius: 10px; display: flex; flex-direction: column; box-shadow: 0 1px 3px rgba(20,40,80,.06); min-width: 0; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid #eef1f5; display: flex; justify-content: space-between; align-items: center; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; background: #f7f9fc; }
.chat-msgs.static { max-height: 420px; border-radius: 8px; }
.msg { margin-bottom: 14px; display: flex; flex-direction: column; }
.msg .bubble { max-width: 70%; padding: 9px 12px; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(20,40,80,.08); line-height: 1.55; word-break: break-all; white-space: pre-wrap; }
.msg.left { align-items: flex-start; }
.msg.right { align-items: flex-end; }
.msg.right .bubble.me { background: #3b82f6; color: #fff; }
.msg .meta { font-size: 11px; color: #aab6c4; margin-top: 4px; }
.msg.sys { align-items: center; }
.msg.sys span { background: #e8edf4; color: #6b7a8c; border-radius: 20px; padding: 4px 12px; font-size: 12px; max-width: 80%; text-align: center; }
.loc { min-width: 150px; }
.loc b { font-size: 13px; }
.loc-addr { font-size: 12px; opacity: .8; margin: 3px 0 6px; }
.loc a { color: #fff; font-size: 12px; background: rgba(255,255,255,.18); border-radius: 6px; padding: 3px 8px; text-decoration: none; }
.msg.left .loc a { color: #2f6fd8; background: #eaf2ff; }
.chat-input { display: flex; gap: 10px; padding: 12px; border-top: 1px solid #eef1f5; }
.chat-input textarea { flex: 1; border: 1px solid #d5dbe3; border-radius: 8px; padding: 8px 10px; resize: none; outline: none; font-family: inherit; }
.chat-input textarea:focus { border-color: #3b82f6; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,25,40,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: 460px; max-width: 92vw; max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 16px 50px rgba(10,30,60,.3); }
.modal-head { padding: 14px 18px; border-bottom: 1px solid #eef1f5; display: flex; justify-content: space-between; align-items: center; }
.modal-x { cursor: pointer; color: #98a2b3; padding: 0 4px; }
.modal-x:hover { color: #26303b; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid #eef1f5; text-align: right; display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- 排班日历 ---------- */
.cal { background: #fff; border-radius: 10px; padding: 12px; box-shadow: 0 1px 3px rgba(20,40,80,.06); }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head div { text-align: center; color: #8593a3; font-size: 12px; padding: 6px 0; }
.cal-cell { min-height: 84px; border: 1px solid #eef1f5; border-radius: 8px; padding: 6px; overflow: hidden; }
.cal-cell.blank { border: none; background: transparent; }
.cal-cell.dis { background: #fafbfc; color: #c3cbd5; }
.cal-cell.today { border-color: #3b82f6; background: #f3f8ff; }
.cal-date { font-size: 12px; color: #6b7a8c; margin-bottom: 4px; }
.cal-cell.today .cal-date { color: #2f6fd8; font-weight: 700; }
.cal-chips { display: flex; flex-direction: column; gap: 3px; }
.chip { font-size: 11px; border-radius: 4px; padding: 2px 6px; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.chip.am { background: #e5f5ea; color: #1d8a45; }
.chip.pm { background: #e9efff; color: #3061c9; }
.chip i { font-style: normal; cursor: pointer; opacity: .55; }
.chip i:hover { opacity: 1; color: #d64545; }

/* ---------- Toast ---------- */
#toast { position: fixed; top: 22px; left: 50%; transform: translateX(-50%) translateY(-16px); background: #26303b; color: #fff; padding: 9px 18px; border-radius: 8px; font-size: 13px; opacity: 0; transition: .25s; z-index: 99; pointer-events: none; max-width: 80vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #c0392b; }
#toast.ok { background: #1d8a45; }
