:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e3e6eb;
  --text: #1f2329;
  --muted: #6b7280;
  --primary: #2f6fed;
  --primary-weak: #eaf1ff;
  --success: #1a9b5a;
  --success-weak: #e7f6ee;
  --warn: #c27a00;
  --warn-weak: #fff4dc;
  --danger: #d43c3c;
  --danger-weak: #fdeaea;
  --radius: 8px;
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
input, select, textarea, button { font: inherit; color: inherit; }

/* ---------- layout ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 216px; flex-shrink: 0; background: #1d2433; color: #cfd6e4;
  display: flex; flex-direction: column; overflow-y: auto;
}
.brand { padding: 18px 18px 14px; color: #fff; font-weight: 600; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--primary); display: grid; place-items: center; font-size: 14px; }
.nav-group { padding: 6px 10px; }
.nav-title { font-size: 12px; color: #7f8aa3; padding: 10px 8px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
  color: #cfd6e4; cursor: pointer; position: relative;
}
.nav-item:hover { background: #2a3347; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; }
.nav-item .count {
  margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px;
  font-size: 11px; padding: 0 7px; line-height: 18px;
}
.sidebar-foot { margin-top: auto; padding: 12px 16px; font-size: 12px; color: #7f8aa3; border-top: 1px solid #2a3347; }
.sidebar-foot button { background: none; border: 1px solid #3a445c; color: #cfd6e4; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 12px; }

.workspace { flex: 1; display: flex; min-width: 0; }
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 54px; flex-shrink: 0; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
}
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.proto-tag { font-size: 12px; background: var(--warn-weak); color: var(--warn); padding: 2px 8px; border-radius: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; position: relative; padding: 4px 8px; border-radius: 6px; }
.user-chip:hover { background: var(--bg); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; font-weight: 600; }
.menu {
  position: absolute; right: 0; top: 44px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); min-width: 160px; z-index: 50; padding: 4px; display: none;
}
.menu.open { display: block; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: none; background: none; cursor: pointer; color: var(--text); border-radius: 4px; }
.menu a:hover, .menu button:hover { background: var(--bg); text-decoration: none; }
.content { flex: 1; overflow-y: auto; padding: 20px; }
.content.narrow > * { max-width: 1080px; }

/* ---------- common ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head .spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1100px) { .grid3, .grid4 { grid-template-columns: 1fr 1fr; } }
.spacer { flex: 1; }
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--panel); cursor: pointer; white-space: nowrap; line-height: 20px;
}
.btn:hover { border-color: #c5cbd5; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #255fd6; }
.btn.danger { color: var(--danger); border-color: #f1c4c4; }
.btn.danger:hover { background: var(--danger-weak); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); padding: 4px 8px; }
.btn.ghost:hover { background: var(--primary-weak); }
.btn.sm { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.field .req { color: var(--danger); }
.input, select.input, textarea.input {
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; background: #fff; outline: none; width: 100%;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
.input.inline { width: auto; }
.hint { font-size: 12px; color: var(--muted); }
.err { font-size: 12px; color: var(--danger); }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.blue { background: var(--primary-weak); color: var(--primary); }
.badge.green { background: var(--success-weak); color: var(--success); }
.badge.orange { background: var(--warn-weak); color: var(--warn); }
.badge.red { background: var(--danger-weak); color: var(--danger); }

table.table { width: 100%; border-collapse: collapse; background: var(--panel); }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-weight: 500; color: var(--muted); font-size: 13px; background: #fafbfc; }
.table tr:hover td { background: #fafbff; }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
.table-wrap .table tr:last-child td { border-bottom: none; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cdd2da; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }

.stat { padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 4px; }

.progress { height: 6px; background: #edf0f4; border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); transition: width .3s; }
.progress.warn > div { background: var(--warn); }
.progress.danger > div { background: var(--danger); }

.note {
  background: var(--primary-weak); border: 1px solid #cfe0ff; color: #234; padding: 10px 14px;
  border-radius: var(--radius); font-size: 13px; margin-bottom: 16px;
}
.note.warn { background: var(--warn-weak); border-color: #f3dca6; }
.note b { color: var(--primary); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
mark { background: #fff1a8; padding: 0 1px; border-radius: 2px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; }
.kv .k { color: var(--muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 14px; padding: 2px 10px; cursor: pointer; font-size: 12px; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip .x { margin-left: 4px; color: var(--muted); cursor: pointer; }
.chip .x:hover { color: var(--danger); }

/* ---------- multi-select ---------- */
.ms { position: relative; min-width: 160px; }
.ms-btn { border: 1px solid var(--border); border-radius: 6px; padding: 7px 28px 7px 10px; background: #fff; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.ms-btn::after { content: "▾"; position: absolute; right: 10px; color: var(--muted); }
.ms-pop { position: absolute; top: 38px; left: 0; z-index: 40; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); padding: 6px; min-width: 100%; max-height: 260px; overflow-y: auto; display: none; }
.ms.open .ms-pop { display: block; }
.ms-pop label { display: flex; gap: 8px; padding: 4px 6px; cursor: pointer; white-space: nowrap; border-radius: 4px; }
.ms-pop label:hover { background: var(--bg); }

/* ---------- modal & toast ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); display: grid; place-items: center; z-index: 100; }
.modal { background: #fff; border-radius: 10px; width: 520px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal.wide { width: 760px; }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head .close { margin-left: auto; cursor: pointer; border: none; background: none; font-size: 20px; color: var(--muted); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1f2329; color: #fff; padding: 8px 16px; border-radius: 6px; box-shadow: var(--shadow); font-size: 13px; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- preview drawer ---------- */
.drawer { width: 460px; flex-shrink: 0; background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; position: relative; min-width: 300px; max-width: 75vw; }
.drawer-resize { position: absolute; left: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 5; }
.drawer-resize:hover, .drawer-resize.dragging { background: var(--primary); opacity: .4; }
.drawer-tabs { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); height: 40px; background: #fafbfc; }
.drawer-tabs .tabs-scroll { display: flex; overflow-x: auto; flex: 1; }
.dtab { display: flex; align-items: center; gap: 6px; padding: 0 10px 0 12px; border-right: 1px solid var(--border); cursor: pointer; white-space: nowrap; max-width: 200px; font-size: 13px; color: var(--muted); }
.dtab span.name { overflow: hidden; text-overflow: ellipsis; }
.dtab.active { background: #fff; color: var(--text); box-shadow: inset 0 -2px 0 var(--primary); }
.dtab .x { border: none; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; font-size: 15px; }
.dtab .x:hover { color: var(--danger); }
.drawer-tools { display: flex; align-items: center; gap: 2px; padding: 0 6px; }
.icon-btn { border: none; background: none; cursor: pointer; padding: 4px 7px; border-radius: 4px; color: var(--muted); font-size: 15px; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.drawer-meta { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.drawer-body { flex: 1; overflow: auto; padding: 16px; }
.drawer-body pre { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; margin: 0; }
.drawer-body img { max-width: 100%; border-radius: 6px; border: 1px solid var(--border); }
.drawer-body iframe { width: 100%; height: 100%; min-height: 480px; border: 1px solid var(--border); border-radius: 6px; }
.md h1 { font-size: 20px; margin: 12px 0 8px; } .md h2 { font-size: 17px; margin: 12px 0 6px; } .md h3 { font-size: 15px; margin: 10px 0 6px; }
.md p { margin: 6px 0; } .md ul { padding-left: 20px; margin: 6px 0; } .md code { background: var(--bg); padding: 1px 4px; border-radius: 3px; }
.preview-toggle { position: fixed; right: 0; top: 50%; transform: translateY(-50%); background: var(--panel); border: 1px solid var(--border); border-right: none; border-radius: 8px 0 0 8px; padding: 10px 6px; cursor: pointer; writing-mode: vertical-rl; font-size: 12px; color: var(--muted); box-shadow: var(--shadow); z-index: 30; }
.preview-toggle:hover { color: var(--primary); }

/* ---------- upload panel ---------- */
.up-panel { position: fixed; right: 20px; bottom: 20px; width: 420px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 60; display: flex; flex-direction: column; max-height: 60vh; }
.up-head { padding: 10px 14px; display: flex; align-items: center; gap: 8px; background: #1d2433; color: #fff; border-radius: 10px 10px 0 0; }
.up-head .icon-btn { color: #cfd6e4; }
.up-head .icon-btn:hover { background: #2a3347; color: #fff; }
.up-sum { padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.up-filter { display: flex; gap: 6px; padding: 8px 14px 0; }
.up-list { overflow-y: auto; padding: 4px 0; }
.up-item { padding: 8px 14px; display: grid; grid-template-columns: 24px 1fr auto; gap: 4px 10px; align-items: center; border-bottom: 1px solid #f1f3f6; }
.up-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .st { font-size: 12px; color: var(--muted); grid-column: 2 / 4; display: flex; gap: 8px; align-items: center; }
.up-item .progress { grid-column: 2 / 4; }
.up-panel.collapsed .up-sum, .up-panel.collapsed .up-filter, .up-panel.collapsed .up-list, .up-panel.collapsed .up-foot { display: none; }
.up-foot { padding: 8px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }

/* ---------- assistant (home) ---------- */
.chat { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; min-height: 100%; }
.chat-msgs { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }
.msg { display: flex; gap: 10px; }
.msg.me { justify-content: flex-end; }
.msg .bubble { max-width: 82%; padding: 10px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--border); }
.msg.me .bubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.msg .who { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-weak); display: grid; place-items: center; flex-shrink: 0; }
.intent { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.result-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 8px; background: #fcfcfd; }
.result-card .actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.hit { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 8px; display: flex; gap: 12px; background: #fff; }
.hit .thumb { width: 72px; height: 54px; border-radius: 4px; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.hit .snip { font-size: 13px; color: #374151; margin: 4px 0; background: #fafbfc; border-left: 3px solid var(--primary); padding: 4px 8px; }
.composer { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 4px; }
.composer-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.composer-box textarea { width: 100%; border: none; outline: none; resize: none; min-height: 48px; max-height: 160px; }
.composer-bar { display: flex; align-items: center; gap: 8px; }
.welcome { text-align: center; padding: 28px 0 10px; }
.welcome h1 { font-size: 22px; margin-bottom: 6px; }
.diff { display: grid; grid-template-columns: 64px 1fr 20px 1fr; gap: 4px 8px; align-items: center; font-size: 13px; }
.diff .old { color: var(--muted); text-decoration: line-through; }
.diff .new { color: var(--success); font-weight: 500; }

/* ---------- files ---------- */
.files-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.tree { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 6px; }
.tree-item { padding: 5px 10px; border-radius: 5px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.tree-item:hover { background: var(--bg); }
.tree-item.active { background: var(--primary-weak); color: var(--primary); }
.tree-item .n { margin-left: auto; color: var(--muted); font-size: 12px; }
.ficon { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 5px; font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0; }
.ficon.text { background: #4b7bec; } .ficon.image { background: #20bf6b; } .ficon.pdf { background: #eb3b5a; }
.ficon.audio { background: #8854d0; } .ficon.video { background: #fa8231; } .ficon.doc { background: #2d98da; } .ficon.other { background: #a5b1c2; }

/* ---------- todos ---------- */
.todo-row td:first-child { width: 36px; }
.todo-title { font-weight: 500; }
.todo-done .todo-title { text-decoration: line-through; color: var(--muted); }
.day-group { margin-bottom: 18px; }
.day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.day-head h3 { font-size: 15px; }
.rem-item { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
.rem-item.overdue { border-left-color: var(--danger); }
.rem-item .time { width: 56px; font-weight: 600; }
.rem-item .body { flex: 1; min-width: 0; }

/* ---------- inbox ---------- */
.mt-group { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
.mt-head { padding: 12px 16px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.mt-head .arrow { transition: transform .2s; color: var(--muted); }
.mt-group.open .mt-head .arrow { transform: rotate(90deg); }
.mt-body { display: none; padding: 0 16px 16px; border-top: 1px solid var(--border); }
.mt-group.open .mt-body { display: block; }
.ai-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.ai-item:last-child { border-bottom: none; }
.owner { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--bg); white-space: nowrap; }
.owner.me { background: var(--primary-weak); color: var(--primary); }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #1d2433 0%, #2f6fed 100%); padding: 20px; }
.login-card { width: 380px; background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.demo-accts { background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 12px; margin-top: 16px; }
.demo-accts a { cursor: pointer; }
.table.nowrap th, .table.nowrap td { white-space: nowrap; }
.msg { scroll-margin-bottom: 150px; }
.up-panel { transition: right .15s; }

/* ---------- todo views ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: #fff; }
.seg button { border: none; background: none; padding: 6px 14px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary-weak); color: var(--primary); font-weight: 500; }
.group-row td { background: #f7f8fa !important; font-weight: 600; font-size: 13px; padding: 7px 10px; }
.group-row .gc { color: var(--muted); font-weight: 400; margin-left: 6px; }
.group-row.overdue td { color: var(--danger); }
.legend { display: inline-flex; gap: 10px; font-size: 12px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.src-text { --c: #2f6fed; --bgc: #eaf1ff; } .src-manual { --c: #0f9f8f; --bgc: #e3f6f3; } .src-meeting { --c: #d97706; --bgc: #fff3dc; }

.cal-wrap { display: flex; gap: 14px; align-items: flex-start; }
.cal-main { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cal-title { font-size: 16px; font-weight: 600; min-width: 150px; }
.ev { display: block; font-size: 12px; line-height: 18px; padding: 1px 6px; border-radius: 4px; background: var(--bgc); color: #1f2329; border-left: 3px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; margin-bottom: 2px; }
.ev:hover { filter: brightness(.97); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.ev .t { color: var(--c); font-weight: 600; margin-right: 4px; }
.ev.overdue { box-shadow: inset 3px 0 0 var(--danger); border-left-color: var(--danger); }
.ev.done, .ev.archived { opacity: .5; text-decoration: line-through; }
.ev.dragging { opacity: .4; }
.drop-ok { background: var(--primary-weak) !important; outline: 2px dashed var(--primary); outline-offset: -2px; }

.month { display: grid; grid-template-columns: repeat(7, 1fr); }
.month .dow { padding: 6px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); background: #fafbfc; }
.mcell { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 5px; cursor: pointer; min-width: 0; }
.mcell:nth-child(7n) { border-right: none; }
.mcell:hover { background: #fbfcff; }
.mcell .dn { font-size: 12px; margin-bottom: 3px; display: flex; align-items: center; gap: 4px; }
.mcell .dn b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 11px; font-weight: 500; }
.mcell.today .dn b { background: var(--primary); color: #fff; }
.mcell.other { background: #fafafa; } .mcell.other .dn { color: #b5bcc7; }
.mcell.weekend .dn b { color: #9aa3af; } .mcell.today.weekend .dn b { color: #fff; }
.more { font-size: 12px; color: var(--muted); padding: 0 6px; cursor: pointer; } .more:hover { color: var(--primary); }

.week { display: grid; }
.week .hd { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); font-size: 12px; color: var(--muted); background: #fafbfc; cursor: pointer; }
.week .hd b { display: block; font-size: 18px; color: var(--text); font-weight: 500; }
.week .hd.today b { color: var(--primary); }
.week .allday-l, .week .gutter { font-size: 11px; color: var(--muted); text-align: right; padding: 4px 6px; }
.week .allday { border-left: 1px solid var(--border); border-bottom: 2px solid var(--border); padding: 3px; min-height: 34px; cursor: pointer; }
.tgrid-scroll { max-height: 560px; overflow-y: auto; }
.tgrid { display: grid; position: relative; }
.tcol { position: relative; border-left: 1px solid var(--border); }
.slot { height: 22px; border-bottom: 1px solid #f1f3f6; cursor: pointer; }
.slot:nth-child(2n) { border-bottom-color: #e6e9ee; }
.slot:hover { background: #f5f8ff; }
.hour-l { height: 44px; font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px; transform: translateY(-7px); }
.tev { position: absolute; left: 2px; right: 2px; border-radius: 5px; background: var(--bgc); border-left: 3px solid var(--c); font-size: 12px; padding: 2px 5px; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.06); line-height: 16px; z-index: 2; }
.tev:hover { z-index: 3; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.tev .t { color: var(--c); font-weight: 600; display: block; }
.tev .loc { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tev.overdue { box-shadow: inset 3px 0 0 var(--danger); border-left-color: var(--danger); }
.tev.done, .tev.archived { opacity: .5; text-decoration: line-through; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 4; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 4px; background: var(--danger); }

.agenda .ad { display: grid; grid-template-columns: 120px 1fr; border-bottom: 1px solid var(--border); }
.agenda .ad-date { padding: 10px 12px; font-size: 13px; color: var(--muted); }
.agenda .ad-date b { display: block; font-size: 15px; color: var(--text); }
.agenda .ad.today .ad-date b { color: var(--primary); }
.agenda .ad-items { padding: 6px 12px 6px 0; }
.agenda .ai { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; border-left: 3px solid var(--c); margin: 3px 0; background: #fff; }
.agenda .ai:hover { background: var(--bgc); }
.agenda .ai .tm { width: 48px; font-weight: 600; color: var(--c); font-size: 13px; }
.agenda .ai.done, .agenda .ai.archived { opacity: .5; } .agenda .ai.done .tt, .agenda .ai.archived .tt { text-decoration: line-through; }

.unsched { width: 240px; flex-shrink: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.unsched-h { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.unsched-b { padding: 8px; min-height: 120px; max-height: 600px; overflow-y: auto; }
.unsched .ev { white-space: normal; padding: 5px 8px; margin-bottom: 6px; }
.unsched.collapsed { width: auto; } .unsched.collapsed .unsched-b, .unsched.collapsed .unsched-hint { display: none; }

.peek { position: fixed; top: 54px; right: 0; bottom: 0; width: 400px; background: #fff; border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(15,23,42,.08); z-index: 70; display: flex; flex-direction: column; animation: slidein .15s; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.peek-h { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.peek-b { padding: 16px; overflow-y: auto; flex: 1; }
.peek-f { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; }
.popover { position: fixed; z-index: 90; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); width: 260px; padding: 10px; }
