* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #ffffff; color: #1a1a1a;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #f7f8fa; border-bottom: 1px solid #e0e2e5;
  position: sticky; top: 0; z-index: 30;
}
.brand { font-size: 16px; font-weight: 600; color: #1a1a1a; }
.brand .sub { font-size: 12px; color: #888; font-weight: 400; margin-left: 6px; }
.tools { display: flex; gap: 8px; align-items: center; }
.tools button, .tools input {
  background: #ffffff; color: #1a1a1a; border: 1px solid #d0d2d6;
  border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 13px;
}
.tools button:hover { background: #f0f2f5; }
.tools button.primary { background: #0a84ff; border-color: #0a84ff; color: #fff; }
.tools button.primary:hover { background: #0a6fd6; }
.tools input[type="month"] { cursor: default; }

.legend {
  display: flex; gap: 16px; flex-wrap: wrap; padding: 8px 16px;
  background: #fafbfc; border-bottom: 1px solid #e5e7ea; color: #444;
}
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.table-wrap { overflow: auto; max-height: calc(100vh - 110px); padding: 0 8px 16px; }
table#board { border-collapse: collapse; min-width: 100%; }
table#board th, table#board td {
  border: 1px solid #dcdde0; padding: 0; text-align: center; min-width: 46px;
}
table#board thead th {
  position: sticky; top: 0; background: #f2f3f5; z-index: 10; padding: 4px 2px;
}
table#board thead th.date { font-weight: 600; }
table#board thead th.dow { font-size: 11px; color: #777; font-weight: 400; }
table#board th.corner, table#board td.name {
  position: sticky; left: 0; background: #f2f3f5; z-index: 15; text-align: left;
  padding: 4px 8px; min-width: 90px; white-space: nowrap;
}
table#board thead th.corner { z-index: 20; }
td.region-head {
  position: sticky; left: 0; background: #e3f0ff; color: #174a7d;
  font-weight: 600; text-align: left; padding: 4px 8px; z-index: 14;
}
td.cell { height: 54px; vertical-align: middle; cursor: pointer; position: relative; padding: 2px 4px; text-align: left; }
td.cell:hover { outline: 2px solid #0a84ff; outline-offset: -2px; }
td.cell .code { font-weight: 600; color: #1a1a1a; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.cell.empty { color: #999; }
td.cell .att {
  position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%;
}
td.cell .att.on { background: #2ecc71; }
td.cell .att.off { background: #ff5b5b; }
td.cell .att-info {
  font-size: 10px; line-height: 1.2; color: #1a73e8; margin-top: 2px;
  max-height: 2.5em; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-all;
}
td.cell .att-tag {
  display: inline-block; font-size: 11px; line-height: 1.4; padding: 0 5px;
  border-radius: 8px; margin-top: 2px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
td.cell .att-tag.on { color: #0e6b35; background: #b8eccb; border: 1px solid #7fd3a0; }
td.cell .att-tag.leave { color: #d93025; background: #fff0f0; border: 1px solid #d93025; font-weight: 600; }
td.cell.st-merged { background: #e6f4ea; }
td.cell .att-info.merged { font-size: 12px; color: #0a84ff; }
.att-view { margin-top: 10px; padding: 8px 10px; background: #fafbfc; border: 1px solid #e0e2e5; border-radius: 8px; }
.att-view .av-head { font-weight: 700; color: #1a7f37; margin-bottom: 6px; }
.att-view .av-head.leave { color: #d93025; }
.att-view .av-row { display: flex; gap: 8px; font-size: 12px; line-height: 1.5; }
.att-view .av-row > span { color: #888; min-width: 36px; }
.att-view .av-row > b { color: #1a1a1a; font-weight: 500; word-break: break-all; }
.att-view .av-remark > b { color: #1a73e8; }
td.name .did { font-size: 10px; color: #999; }
.col-weekend { background: #f7f8fa; }

/* 状态色（作为单元格底色，文字深色保证可读） */
.st-pre { background: #FFD966; }
.st-implementing { background: #ED7D31; }
.st-done { background: #9DC3E6; }
.st-leave { background: #FF6B6B; }
.st-att { background: #d8f5e3; }
.st-oncall400 { background: #9B59B6; }
.st-pre .code, .st-implementing .code, .st-done .code, .st-leave .code, .st-oncall400 .code { color: #1a1a1a; }
.st-att .code { color: #0e5c2f; }
.st-oncall400 .code.oncall { font-weight: 700; font-size: 13px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex;
  align-items: center; justify-content: center; z-index: 100; }
.modal.hidden, .tab-pane.hidden { display: none; }
.modal-box { background: #ffffff; border: 1px solid #d8dade; border-radius: 10px;
  width: 360px; max-width: 92vw; max-height: 90vh; overflow: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,.15); }
.modal-box.wide { width: 560px; }
.modal-head { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #e5e7ea; font-weight: 600; color: #1a1a1a; }
.modal-head .x { background: none; border: none; color: #999; font-size: 16px; cursor: pointer; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.modal-body label { font-size: 12px; color: #777; margin-top: 6px; }
.modal-body input, .modal-body select {
  background: #ffffff; color: #1a1a1a; border: 1px solid #d0d2d6; border-radius: 6px;
  padding: 8px; font-size: 13px; width: 100%;
}
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }
.modal-actions button { flex: 1; padding: 8px; border-radius: 6px; border: 1px solid #d0d2d6;
  background: #f2f3f5; color: #1a1a1a; cursor: pointer; }
.modal-actions button.primary { background: #0a84ff; border-color: #0a84ff; color: #fff; }
.modal-actions button:hover { filter: brightness(0.97); }

.status-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.status-btns button { padding: 8px; border-radius: 6px; border: 1px solid #c8cacc;
  cursor: pointer; font-size: 12px; color: #1a1a1a; font-weight: 600; background: #fff; }
.status-btns button.sel { outline: 3px solid #0a84ff; }

.tabs { display: flex; gap: 4px; padding: 8px 16px 0; }
.tabs .tab { background: #f2f3f5; color: #666; border: 1px solid #e0e2e5; border-bottom: none;
  border-radius: 6px 6px 0 0; padding: 6px 12px; cursor: pointer; }
.tabs .tab.active { background: #ffffff; color: #1a1a1a; }

.list-row { display: grid; grid-template-columns: 160px 1fr 80px; gap: 8px; align-items: center; margin-bottom: 6px; }
.list-row select { width: 100%; padding: 6px; }
.list-row input { width: 100%; padding: 6px; }
.list-row .mini { width: 100%; padding: 6px 8px; }
.list-row .del { background: #fde8e8; border-color: #e2a8a8; color: #b03a3a; }
.list-header { display: grid; grid-template-columns: 160px 1fr 80px; gap: 8px; padding: 4px 0; font-size: 12px; color: #888; }
.list-header > div { padding: 0 6px; }

.hint { font-size: 12px; color: #999; margin: 0 0 4px; }
.ding-msg { font-size: 12px; color: #1a7f37; min-height: 16px; white-space: pre-wrap; }
.ding-msg.err { color: #d93025; }
.ding-msg.ok { color: #1a7f37; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0a84ff; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.hidden { display: none; }
.toast.err { background: #d04545; }

/* ---- 400值班报到 ---- */
.oncall-btn { background: #9B59B6; border-color: #b97fd1; color: #fff; font-weight: 600; }
.oncall-btn:hover { background: #ab6cc7; }
.oncall-members { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.oncall-member { flex: 1 1 120px; padding: 10px 6px; text-align: center; cursor: pointer;
  background: #f7f8fa; border: 1px solid #d0d2d6; border-radius: 8px; color: #1a1a1a; font-size: 15px; }
.oncall-member:hover { border-color: #9B59B6; background: #f0eaf6; }
.oncall-member.active { background: #9B59B6; border-color: #b97fd1; color: #fff; }
.oncall-member em { display: block; font-style: normal; font-size: 11px; opacity: .85; margin-top: 2px; }
