:root {
  --bg: #F5F6F8; --surface: #FFFFFF; --line: #E3E6EA; --line-2: #D5DAE0; --ink: #16191D; --ink-2: #3A424C; --muted: #5B6470;
  --brand: #0B6B63; --brand-ink: #08524C; --brand-soft: #E3F1EF; --warn: #9A4A0C; --warn-soft: #FBEBDD; --danger: #B42318; --danger-soft: #FDECEA;
  --radius: 12px; --side: 232px; --ai: 380px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.55; }
h1, h2, h3, h4 { margin: 0; }
h3 { font-size: 16px; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 0 12px; height: 40px; width: 100%; }
textarea { height: auto; padding: 10px 12px; resize: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
select:disabled { background: var(--bg); color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; } .upper { text-transform: uppercase; }
.warn { color: var(--warn); } .danger { color: var(--danger); } .struck { text-decoration: line-through; color: var(--muted); }
.row { display: flex; align-items: center; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; } .gap { gap: 10px; } .gap-s { gap: 6px; } .grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack-lg { display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card.tight { padding: 10px 12px; }
.h2 { font-size: 22px; margin: 2px 0; } .page-h1 { font-size: 22px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-soft { background: var(--brand-soft); border-color: #9CC9C3; color: var(--brand-ink); }
.btn-warm { background: var(--warn-soft); border-color: #E8B98F; color: #7A3B0A; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-ghost { color: var(--danger); border-color: #E8B4AE; }
.btn-block { width: 100%; min-height: 44px; }
.icon-only { width: 42px; padding: 0; }
.icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--ink-2); position: relative; }
.icon-btn:hover { background: var(--bg); } .icon-btn.sm { width: 30px; height: 30px; }
.link-btn { border: 0; background: none; color: var(--brand); cursor: pointer; padding: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; min-height: 36px; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--ink); color: #fff; }
.seg.big { align-self: flex-start; background: var(--line); border: 0; padding: 3px; gap: 3px; border-radius: 10px; }
.seg.big button { border: 0; border-radius: 8px; min-height: 38px; padding: 0 16px; font-weight: 500; }
.seg.big button.on { background: var(--surface); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 13px; text-align: left; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tag { font-size: 12px; border-radius: 6px; padding: 2px 8px; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.pill { font-size: 12px; font-weight: 500; border-radius: 999px; padding: 3px 10px; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.pill.sm { font-size: 11px; padding: 2px 8px; } .danger-pill { background: var(--danger-soft); color: var(--danger); }
.avatar { border-radius: 50%; background: #EEF0F3; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.avatar.dark { background: var(--ink); color: #fff; }
.logo { width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.logo.small { width: 30px; height: 30px; font-size: 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.err { margin: 0; font-size: 13px; color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 10px 12px; }
.notice-warn { margin: 0; font-size: 13px; color: #7A3B0A; background: var(--warn-soft); border-radius: 8px; padding: 10px 12px; }
.notice-ok { margin: 0; font-size: 13px; color: var(--brand-ink); background: var(--brand-soft); border-radius: 8px; padding: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.pw-wrap { position: relative; } .pw-wrap input { padding-right: 64px; } .pw-wrap .link-btn { position: absolute; right: 4px; top: 4px; }
.grid-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* login / standalone pages */
.center-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 14px; }
.narrow { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; padding: 28px 24px; }
.narrow-top { width: 100%; max-width: 420px; display: flex; justify-content: flex-end; }

/* shell */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
.shell.with-ai { grid-template-columns: var(--side) minmax(0, 1fr) var(--ai); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.nav-item.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 19px; flex: 1 1 auto; }
.content { padding: 22px 24px 48px; }
.menu-wrap { position: relative; }
.avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(22, 25, 29, .14); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.menu.wide { width: 320px; max-height: 70vh; overflow: auto; }
.menu-head { display: flex; gap: 10px; align-items: center; }
.badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.notice-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.notice-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.notice-list li.unread div:first-child { font-weight: 600; }

/* home */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat span { font-size: 13px; color: var(--muted); } .stat strong { font-size: 26px; } .stat .small-strong { font-size: 18px; }
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #EEF0F3; }
.check-box { width: 24px; height: 24px; flex: none; border-radius: 6px; border: 1.5px solid #9AA2AC; background: var(--surface); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.check-box.on { background: var(--brand); border-color: var(--brand); }
.time { width: 44px; flex: none; }

/* tasks */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.column { background: #EBEDF0; border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.column h3 { font-size: 14px; }
.count { font-size: 12px; background: var(--surface); border-radius: 999px; padding: 2px 8px; }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.task h4 { font-size: 14px; line-height: 1.5; }

/* schedule */
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: start; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 220px; }
.day.today { border-color: var(--brand); } .day.today h3 { color: var(--brand); }
.day-head { border-bottom: 1px solid #EEF0F3; padding-bottom: 6px; } .day h3 { font-size: 14px; }
.slot { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; gap: 8px; align-items: flex-start; }
.slot.done { background: var(--bg); } .slot.done .slot-title { text-decoration: line-through; color: var(--muted); }
.slot-title { font-weight: 500; margin-top: 2px; }
.timeline { position: relative; height: 14px; background: #EEF0F3; border-radius: 7px; overflow: hidden; }
.timeline span { position: absolute; top: 0; bottom: 0; }
.timeline i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 8px; border-radius: 2px; display: inline-block; } .legend i.line { width: 2px; height: 12px; background: var(--ink); }
.team-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(200px, 2fr); gap: 8px 16px; align-items: center; padding: 12px 0; border-top: 1px solid #EEF0F3; }
.bar { height: 10px; background: #EEF0F3; border-radius: 5px; overflow: hidden; } .bar span { display: block; height: 10px; background: var(--brand); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px; }
td { padding: 10px 8px; border-top: 1px solid #EEF0F3; }
.perm { min-height: 32px; font-size: 12px; border-radius: 6px; padding: 3px 10px; border: 1px dashed #C9CED5; cursor: pointer; }
.perm.manage { background: var(--brand-soft); color: var(--brand-ink); } .perm.edit { background: #E6EDFB; color: #2457C5; }
.perm.view { background: #EEF0F3; color: var(--ink-2); } .perm.none { background: transparent; color: #6B7380; }
.proj-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #EEF0F3; }
.proj-row input { flex: 1 1 150px; width: auto; }
.swatches { display: flex; gap: 4px; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.sw i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; } .sw.on { border-color: var(--ink); }

/* dialogs */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(22, 25, 29, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { width: 100%; max-width: 540px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-head { display: flex; align-items: center; gap: 10px; } .dialog-head h2 { flex: 1; font-size: 18px; }
.dialog-body { display: flex; flex-direction: column; gap: 12px; }
.dialog-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid #EEF0F3; padding-top: 14px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 90; background: var(--ink); color: #fff; border-radius: 10px; padding: 12px 16px; max-width: calc(100% - 32px); }

/* AI panel */
.ai { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.ai.full { position: fixed; inset: 0; z-index: 70; height: auto; border: 0; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ai-msgs { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; flex-direction: column; gap: 8px; max-width: 92%; } .msg.me { align-self: flex-end; align-items: flex-end; }
.bubble { border-radius: 12px; padding: 10px 12px; white-space: pre-line; line-height: 1.65; }
.ai-b { background: var(--bg); border-top-left-radius: 4px; align-self: flex-start; }
.me-b { background: var(--brand); color: #fff; border-top-right-radius: 4px; }
.act-card { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.act-card.done { border-color: #9CC9C3; } .act-card ul { margin: 0; padding-left: 18px; font-size: 13px; }
.ai-ex { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; border-top: 1px solid #EEF0F3; }
.ai-ex .chip { font-size: 12px; min-height: 30px; }
.ai-input { display: flex; gap: 8px; padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); align-items: flex-end; }
.ai-input textarea { min-height: 42px; max-height: 140px; }
.ai .err { margin: 0 14px; }

/* mobile */
.tabbar { display: none; }
.sheet-wrap { position: fixed; inset: 0; z-index: 35; background: rgba(22, 25, 29, .45); display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--surface); border-radius: 16px 16px 0 0; padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 759px) {
  .shell, .shell.with-ai { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 10px 14px; gap: 8px; } .topbar h1 { font-size: 17px; }
  .topbar .btn { padding: 0 10px; }
  .content { padding: 16px 14px 100px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar button { flex: 1 1 0; min-height: 54px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); cursor: pointer; }
  .tabbar button.on { color: var(--brand); font-weight: 600; }
  .team-row { grid-template-columns: minmax(0, 1fr); }
  input, select, textarea { font-size: 16px; }
  .menu.wide { position: fixed; left: 12px; right: 12px; width: auto; top: 60px; }
}
