/* RM Manifold R&D Workspace — brand palette and Roboto only. */
:root {
  --navy: #2a3853; --blue: #234699; --gray-d: #97999b; --gray-l: #c8c9c7; --red: #b11f33; --black: #101820; --white: #fff;
  --blue-10: rgba(35,70,153,.08); --blue-20: rgba(35,70,153,.16); --red-10: rgba(177,31,51,.08);
  --ok: #1a8754; --ok-bg: rgba(26,135,84,.1); --warn: #cc8800; --warn-bg: rgba(204,136,0,.12);
  --bg: #f2f4f7; --line: #e3e6ea; --line-2: #eef1f5; --text: #101820; --text-2: #5b6470; --heading: #2a3853; --link: #234699;
  --surface: #fff; --surface-2: #fafbfc; --surface-3: #eef1f5; --tint: #eef2fa; --side-bg: #2a3853;
  --side-w: 236px; --top-h: 58px; --ai-w: 420px; --radius: 10px; --radius-sm: 6px;
  --sh-sm: 0 1px 3px rgba(16,24,32,.08); --sh-md: 0 4px 16px rgba(16,24,32,.1); --sh-xl: 0 16px 48px rgba(16,24,32,.18);
  --t: .2s cubic-bezier(.4,0,.2,1);
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { color-scheme: light; margin: 0; font-family: 'Roboto', Arial, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
[hidden] { display: none !important; }
a { color: var(--link); cursor: pointer; }
h1, h2, h3, h4 { margin: 0; color: var(--heading); }
button, input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--gray-l); border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: var(--gray-d); }

/* ── Sign-in (mirrors the CRM) ── */
#login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 9999;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 50%, var(--navy) 100%); transition: opacity .5s ease, visibility .5s ease; }
#login-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.login-bg-pattern { position: absolute; inset: 0; overflow: hidden; opacity: .06; }
.login-bg-pattern::before { content: ''; position: absolute; width: 200%; height: 200%; top: -50%; left: -50%;
  background: repeating-linear-gradient(45deg, transparent, transparent 40px, rgba(255,255,255,.3) 40px, rgba(255,255,255,.3) 42px); animation: drift 20s linear infinite; }
@keyframes drift { to { transform: translate(60px, 60px); } }
.login-card { position: relative; width: 420px; max-width: 92vw; background: var(--surface); border-radius: 16px; padding: 48px 40px; box-shadow: var(--sh-xl); animation: slide .6s ease-out; }
@keyframes slide { from { opacity: 0; transform: translateY(30px); } }
.login-logo { text-align: center; margin-bottom: 10px; } .login-logo img { height: 46px; max-width: 100%; }
.login-subtitle { text-align: center; font-size: .85rem; color: var(--gray-d); letter-spacing: 3px; text-transform: uppercase; font-weight: 500; margin-bottom: 32px; }
.login-h { font-weight: 700; color: var(--heading); margin-bottom: 12px; }
.login-small { font-size: .74rem; color: var(--gray-d); margin-top: 10px; line-height: 1.45; }
.login-demo-note { margin-top: 20px; text-align: center; font-size: .78rem; color: var(--gray-d); line-height: 1.5; }
.login-error { background: var(--red-10); color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm); font-size: .82rem; margin-bottom: 16px; display: none; border-left: 3px solid var(--red); }
.login-error.show { display: block; } .login-error.ok { background: var(--ok-bg); color: var(--ok); border-left-color: var(--ok); }
.forgot-link { text-align: right; margin: -8px 0 16px; } .forgot-link a, .login-mode-toggle a { color: var(--link); font-size: .82rem; text-decoration: none; }
.forgot-link a:hover, .login-mode-toggle a:hover { text-decoration: underline; }
.login-mode-toggle { text-align: center; margin-top: 16px; }

/* ── Form controls ── */
.form-group { margin-bottom: 16px; }
.form-group label, .lbl { display: block; font-size: .7rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--heading); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--gray-l); border-radius: var(--radius-sm); background: var(--surface); outline: none; transition: border-color var(--t), box-shadow var(--t); }
input:focus, select:focus, textarea:focus { border-color: var(--link); box-shadow: 0 0 0 3px var(--blue-10); }
textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
.btn-primary { width: 100%; padding: 12px 20px; background: var(--blue); color: #fff; border: 0; border-radius: var(--radius-sm); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; font-size: .85rem; cursor: pointer; transition: var(--t); }
.btn-primary:hover { background: var(--navy); } .btn-primary:disabled { opacity: .6; cursor: default; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1.5px solid transparent; background: var(--blue); color: #fff; font-weight: 700; font-size: .78rem; letter-spacing: .5px; text-transform: uppercase; cursor: pointer; transition: var(--t); white-space: nowrap; }
.btn:hover { background: var(--navy); } .btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--link); border-color: var(--link); } .btn.ghost:hover { background: var(--blue-10); }
.btn.quiet { background: var(--blue-10); color: var(--link); } .btn.quiet:hover { background: var(--blue-20); }
.btn.danger { background: var(--red); } .btn.danger:hover { background: #8e1828; }
.btn.sm { padding: 5px 10px; font-size: .7rem; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 1.05rem; padding: 6px 8px; border-radius: 6px; color: var(--heading); position: relative; line-height: 1; }
.icon-btn:hover { background: var(--blue-10); }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .right { margin-left: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.muted { color: var(--text-2); } .small { font-size: .8rem; } .tiny { font-size: .72rem; } .b { font-weight: 700; } .nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Layout ── */
#app { display: flex; min-height: 100vh; }
#sidebar { width: var(--side-w); background: var(--side-bg); color: #fff; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 60; transition: transform var(--t); }
.side-logo { display: block; padding: 18px 18px 14px; text-decoration: none; color: #fff; border-bottom: 3px solid var(--red); }
.side-logo img { height: 30px; display: block; } .side-logo span { display: block; margin-top: 8px; font-size: .66rem; letter-spacing: 3px; text-transform: uppercase; color: var(--gray-l); font-weight: 500; }
#nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-label { font-size: .62rem; letter-spacing: 2px; text-transform: uppercase; color: var(--gray-d); padding: 14px 12px 6px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #dfe3ea; text-decoration: none; font-size: .9rem; font-weight: 500; cursor: pointer; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; } .nav-item.on { background: var(--blue); color: #fff; }
.nav-item .ic { width: 18px; text-align: center; opacity: .9; } .nav-item .ext { margin-left: auto; opacity: .5; font-size: .75rem; }
.nav-count { margin-left: auto; background: var(--red); color: #fff; border-radius: 10px; font-size: .64rem; font-weight: 700; padding: 1px 7px; }
.side-user { padding: 12px; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; gap: 10px; }
.side-user .nm { font-size: .85rem; font-weight: 700; } .side-user .rl { font-size: .68rem; color: var(--gray-l); }
.side-user a { color: var(--gray-l); font-size: .72rem; }
#main { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; transition: margin-right var(--t); }
body.ai-open #main { margin-right: var(--ai-w); }
#topbar { height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 40; }
#topbar h1 { font-size: 1.15rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#menu-btn { display: none; }
.search-wrap { margin-left: auto; position: relative; width: min(380px, 34vw); } .search-wrap input { background: var(--bg); border-color: transparent; }
.bell-wrap { position: relative; }
.badge { position: absolute; top: 0; right: 0; background: var(--red); color: #fff; font-size: .58rem; font-weight: 700; border-radius: 8px; padding: 1px 4px; min-width: 14px; }
.btn-ai { background: var(--navy); color: #fff; border: 0; border-radius: 20px; padding: 8px 16px; font-weight: 700; font-size: .8rem; cursor: pointer; white-space: nowrap; }
.btn-ai:hover { background: var(--blue); }
#view { padding: 20px; flex: 1; min-width: 0; }
.pop { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-width: 92vw; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-xl); z-index: 80; }
.pop .hd { padding: 10px 14px; font-weight: 700; color: var(--heading); border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.pop .it { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); cursor: pointer; }
.pop .it:hover { background: var(--bg); } .pop .it.unread { border-left: 3px solid var(--red); background: #fbf6f7; }
.pop .sec { font-size: .64rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gray-d); font-weight: 700; padding: 10px 14px 4px; }

/* ── Cards, tables, pills ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-sm); }
.card > .hd { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card > .hd h3 { font-size: .95rem; font-weight: 700; } .card > .bd { padding: 14px 16px; }
.stat { padding: 16px; } .stat .n { font-size: 1.9rem; font-weight: 900; color: var(--heading); line-height: 1; } .stat .l { font-size: .68rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-2); margin-top: 6px; font-weight: 700; }
.stat.red .n { color: var(--red); } .stat.warn .n { color: var(--warn); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .66rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-2); padding: 9px 12px; border-bottom: 1.5px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .88rem; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }
.tbl tr.grp td { background: var(--surface-2); font-weight: 700; color: var(--heading); font-size: .78rem; letter-spacing: .5px; text-transform: uppercase; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: .68rem; font-weight: 700; letter-spacing: .3px; white-space: nowrap; background: var(--surface-3); color: var(--heading); }
.pill.todo { background: var(--surface-3); color: var(--text-2); } .pill.in_progress { background: var(--blue-20); color: var(--link); } .pill.blocked { background: var(--red-10); color: var(--red); }
.pill.review { background: var(--warn-bg); color: #8a5a00; } .pill.done { background: var(--ok-bg); color: var(--ok); }
.pill.urgent { background: var(--red); color: #fff; } .pill.high { background: var(--red-10); color: var(--red); } .pill.medium { background: var(--surface-3); color: var(--text-2); } .pill.low { background: var(--surface-3); color: var(--gray-d); }
.pill.new { background: #fbe7ea; color: var(--red); } .pill.reviewing { background: #fdf3dc; color: #8a5a00; } .pill.planned { background: var(--tint); color: var(--link); } .pill.declined { background: var(--surface-3); color: var(--text-2); }
.stage-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.late { color: var(--red); font-weight: 700; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .66rem; font-weight: 700; flex-shrink: 0; position: relative; }
.avatar.lg { width: 36px; height: 36px; font-size: .78rem; } .avatar.sm { width: 22px; height: 22px; font-size: .56rem; }
.avatar.online::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: #2bbf6a; border: 2px solid var(--surface); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.tabs { display: flex; gap: 2px; border-bottom: 1.5px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 16px; font-weight: 700; font-size: .8rem; letter-spacing: .6px; text-transform: uppercase; color: var(--text-2); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap; cursor: pointer; }
.tab:hover { color: var(--heading); } .tab.on { color: var(--link); border-bottom-color: var(--red); }
.seg { display: inline-flex; border: 1.5px solid var(--gray-l); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg a { padding: 6px 12px; font-size: .76rem; font-weight: 700; color: var(--text-2); cursor: pointer; text-decoration: none; } .seg a.on { background: var(--navy); color: #fff; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); } .empty .big { font-size: 1.05rem; font-weight: 700; color: var(--heading); margin-bottom: 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; padding: 6px 10px; }

/* ── Dashboard / project cards ── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.feed .it { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .86rem; } .feed .it:last-child { border-bottom: 0; }
.kanban { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px; }
.kcol { background: var(--surface-3); border-radius: var(--radius); width: 270px; flex-shrink: 0; padding: 10px; }
.kcol.over { outline: 2px dashed var(--blue); outline-offset: -2px; }
.kcol > .hd { font-weight: 700; font-size: .76rem; letter-spacing: .8px; text-transform: uppercase; color: var(--heading); padding: 2px 4px 10px; display: flex; align-items: center; gap: 6px; }
.kcard { background: var(--surface); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--sh-sm); cursor: pointer; border-left: 3px solid transparent; }
.kcard:hover { box-shadow: var(--sh-md); } .kcard.dragging { opacity: .4; }
.kcard .t { font-weight: 700; font-size: .88rem; color: var(--heading); margin-bottom: 6px; } .kcard .m { display: flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--text-2); flex-wrap: wrap; }

/* ── Project page ── */
.proj-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.proj-head h2 { font-size: 1.5rem; font-weight: 900; } .proj-head .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: .82rem; color: var(--text-2); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: .88rem; } .kv dt { color: var(--text-2); font-size: .72rem; letter-spacing: 1px; text-transform: uppercase; font-weight: 700; padding-top: 2px; } .kv dd { margin: 0; }
.quick-add { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); } .quick-add input { flex: 1; }
td.chk { width: 30px; } .tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--gray-l); display: inline-block; cursor: pointer; vertical-align: middle; }
.tick:hover { border-color: var(--ok); } .tick.on { background: var(--ok); border-color: var(--ok); position: relative; } .tick.on::after { content: '✓'; color: #fff; font-size: .68rem; position: absolute; inset: 0; text-align: center; line-height: 14px; font-weight: 900; }
tr.is-done .ttl { text-decoration: line-through; color: var(--text-2); }

/* ── Gantt ── */
.gantt { display: flex; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; position: relative; }
.g-left { width: 300px; flex-shrink: 0; border-right: 1.5px solid var(--line); background: var(--surface); z-index: 2; }
.g-right { flex: 1; overflow-x: auto; overflow-y: hidden; position: relative; }
.g-head { height: 46px; border-bottom: 1.5px solid var(--line); background: var(--surface-2); position: relative; }
.g-left .g-head { display: flex; align-items: flex-end; padding: 0 12px 8px; font-size: .66rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-2); font-weight: 700; }
.g-row { height: 34px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; padding: 0 12px; gap: 8px; font-size: .84rem; position: relative; }
.g-left .g-row { cursor: pointer; } .g-left .g-row:hover { background: var(--surface-2); } .g-row.grp { background: var(--surface-2); font-weight: 700; font-size: .72rem; letter-spacing: .6px; text-transform: uppercase; color: var(--heading); }
.g-month { position: absolute; top: 0; height: 23px; border-left: 1px solid var(--line); padding: 4px 8px; font-size: .72rem; font-weight: 700; color: var(--heading); white-space: nowrap; overflow: hidden; }
.g-tick { position: absolute; top: 23px; height: 23px; border-left: 1px solid var(--line-2); font-size: .62rem; color: var(--text-2); padding: 5px 0 0 3px; white-space: nowrap; overflow: hidden; }
.g-body { position: relative; } .g-wk { position: absolute; top: 0; bottom: 0; background: var(--surface-2); } .g-line { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-2); }
.g-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--red); z-index: 3; pointer-events: none; }
.g-today::before { content: 'Today'; position: absolute; top: 2px; left: 4px; font-size: .58rem; color: var(--red); font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.g-bar { position: absolute; height: 20px; top: 7px; border-radius: 5px; background: var(--blue); color: #fff; font-size: .68rem; font-weight: 700; display: flex; align-items: center; overflow: hidden; cursor: grab; z-index: 2; box-shadow: var(--sh-sm); touch-action: none; user-select: none; }
.g-bar > .pg { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0,0,0,.22); pointer-events: none; } .g-bar > .tx { position: relative; padding: 0 8px; white-space: nowrap; pointer-events: none; }
.g-bar.fixed { cursor: pointer; } .g-bar.moving { cursor: grabbing; opacity: .85; z-index: 5; }
.g-bar .hl, .g-bar .hr { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; } .g-bar .hl { left: 0; } .g-bar .hr { right: 0; }
.g-bar.todo { background: #7d8798; } .g-bar.in_progress { background: var(--blue); } .g-bar.blocked { background: var(--red); } .g-bar.review { background: var(--warn); } .g-bar.done { background: var(--ok); }
.g-ms { position: absolute; top: 8px; width: 18px; height: 18px; background: var(--red); transform: rotate(45deg); border-radius: 2px; z-index: 2; cursor: pointer; margin-left: -9px; box-shadow: var(--sh-sm); }
.g-ms.done { background: var(--ok); } .g-mslabel { position: absolute; top: 9px; font-size: .68rem; font-weight: 700; color: var(--heading); white-space: nowrap; z-index: 1; }
.g-ghost { position: absolute; top: 7px; height: 20px; border: 1.5px dashed var(--gray-l); border-radius: 5px; color: var(--gray-d); font-size: .66rem; display: flex; align-items: center; padding: 0 8px; cursor: pointer; white-space: nowrap; }
.g-ghost:hover { border-color: var(--link); color: var(--link); }
svg.g-deps { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 1; }

/* ── Notes editor ── */
.notes { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.page-list a { display: block; padding: 8px 12px; border-radius: 6px; text-decoration: none; color: var(--text); font-size: .88rem; cursor: pointer; } .page-list a:hover { background: var(--bg); } .page-list a.on { background: var(--blue-10); color: var(--link); font-weight: 700; }
.ed-bar { display: flex; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; position: sticky; top: var(--top-h); background: var(--surface); z-index: 5; border-radius: var(--radius) var(--radius) 0 0; }
.ed-bar button { background: none; border: 0; padding: 5px 9px; border-radius: 5px; cursor: pointer; font-weight: 700; font-size: .82rem; color: var(--heading); } .ed-bar button:hover { background: var(--blue-10); }
.ed-title { width: 100%; border: 0 !important; box-shadow: none !important; font-size: 1.5rem; font-weight: 900; color: var(--heading); padding: 18px 24px 4px !important; }
.doc { padding: 8px 24px 40px; min-height: 380px; outline: none; line-height: 1.6; font-size: .95rem; }
.doc h2 { font-size: 1.2rem; margin: 20px 0 8px; } .doc h3 { font-size: 1.02rem; margin: 16px 0 6px; } .doc p { margin: 0 0 10px; } .doc ul, .doc ol { margin: 0 0 10px; padding-left: 24px; }
.doc ul.todo { list-style: none; padding-left: 4px; } .doc ul.todo li { position: relative; padding-left: 26px; } .doc ul.todo li::before { content: ''; position: absolute; left: 0; top: 4px; width: 15px; height: 15px; border: 2px solid var(--gray-d); border-radius: 3px; cursor: pointer; }
.doc ul.todo li.done { color: var(--text-2); text-decoration: line-through; } .doc ul.todo li.done::before { background: var(--ok); border-color: var(--ok); }
.doc table { border-collapse: collapse; width: 100%; margin: 0 0 12px; } .doc td, .doc th { border: 1px solid var(--gray-l); padding: 6px 10px; min-width: 60px; vertical-align: top; } .doc th { background: var(--surface-2); }
.doc blockquote { border-left: 3px solid var(--red); margin: 0 0 10px; padding: 4px 14px; color: var(--text-2); } .doc pre, .doc code { background: var(--surface-2); border-radius: 4px; font-size: .86rem; } .doc pre { padding: 10px 12px; overflow: auto; } .doc code { padding: 1px 5px; } .doc img { max-width: 100%; }

/* ── Files ── */
.dropzone { border: 2px dashed var(--gray-l); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--text-2); cursor: pointer; background: var(--surface); transition: var(--t); margin-bottom: 14px; }
.dropzone:hover, .dropzone.over { border-color: var(--link); background: var(--tint); color: var(--link); } .dropzone b { color: var(--heading); }
#drop-overlay { position: fixed; inset: 0; background: rgba(35,70,153,.88); z-index: 500; display: flex; align-items: center; justify-content: center; pointer-events: none; }
#drop-overlay div { border: 3px dashed #fff; border-radius: 16px; padding: 40px 60px; color: #fff; font-size: 1.4rem; font-weight: 900; }
.ficon { display: inline-flex; width: 30px; height: 30px; border-radius: 6px; background: var(--blue-10); color: var(--link); align-items: center; justify-content: center; font-size: .56rem; font-weight: 900; letter-spacing: .3px; margin-right: 10px; vertical-align: middle; text-transform: uppercase; }
.upl { font-size: .8rem; padding: 6px 0; display: flex; gap: 10px; align-items: center; } .upl .bar { flex: 1; }

/* ── Chat ── */
.chat { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: calc(100vh - var(--top-h) - 40px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat.has-thread { grid-template-columns: 240px minmax(0, 1fr) 340px; } .chat.embed { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--top-h) - 210px); min-height: 380px; } .chat.embed.has-thread { grid-template-columns: minmax(0, 1fr) 320px; }
.ch-list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--surface-2); padding: 8px; }
.ch-sec { display: flex; align-items: center; font-size: .62rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-2); font-weight: 700; padding: 12px 8px 4px; } .ch-sec a { margin-left: auto; text-decoration: none; font-size: 1rem; line-height: 1; }
.ch { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: .88rem; color: var(--text); text-decoration: none; } .ch:hover { background: var(--surface-3); } .ch.on { background: var(--blue); color: #fff; } .ch.unread { font-weight: 700; }
.ch .n { margin-left: auto; background: var(--red); color: #fff; border-radius: 10px; font-size: .62rem; font-weight: 700; padding: 1px 6px; }
.ch-main, .ch-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; } .ch-thread { border-left: 1px solid var(--line); }
.ch-hd { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; min-height: 50px; } .ch-hd .nm { font-weight: 900; color: var(--heading); } .ch-hd .tp { font-size: .78rem; color: var(--text-2); }
.msgs { flex: 1; overflow-y: auto; padding: 10px 0; }
.day { text-align: center; font-size: .68rem; color: var(--text-2); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin: 12px 0 6px; position: relative; } .day::before { content: ''; position: absolute; left: 16px; right: 16px; top: 50%; border-top: 1px solid var(--line); } .day span { background: var(--surface); padding: 0 12px; position: relative; }
.msg { display: flex; gap: 10px; padding: 5px 16px; position: relative; } .msg:hover { background: var(--surface-2); } .msg.cont { padding-top: 1px; } .msg.cont .avatar { visibility: hidden; height: 1px; }
.msg .who { font-weight: 700; font-size: .88rem; color: var(--heading); } .msg .at { font-size: .68rem; color: var(--text-2); margin-left: 6px; font-weight: 400; }
.msg .tx { font-size: .92rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; } .msg .tx code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: .86rem; }
.msg .gone { color: var(--text-2); font-style: italic; font-size: .85rem; } .mention { background: var(--blue-10); color: var(--link); border-radius: 4px; padding: 0 3px; font-weight: 700; }
.msg-acts { position: absolute; right: 14px; top: -12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--sh-sm); display: none; z-index: 3; } .msg:hover .msg-acts { display: flex; }
.msg-acts button { background: none; border: 0; padding: 4px 7px; cursor: pointer; font-size: .82rem; border-radius: 6px; } .msg-acts button:hover { background: var(--blue-10); }
.reacts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; } .react { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 1px 8px; font-size: .78rem; cursor: pointer; } .react.me { border-color: var(--link); background: var(--blue-10); }
.thread-link { font-size: .76rem; font-weight: 700; color: var(--link); cursor: pointer; margin-top: 4px; display: inline-block; }
.att { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 4px 6px 0 0; font-size: .8rem; cursor: pointer; background: var(--surface); max-width: 280px; } .att:hover { border-color: var(--link); }
.att-img { display: block; max-width: 320px; max-height: 220px; border-radius: 8px; margin-top: 6px; border: 1px solid var(--line); cursor: pointer; }
.composer { border-top: 1px solid var(--line); padding: 10px 14px; position: relative; } .composer textarea { min-height: 42px; max-height: 180px; resize: none; }
.composer .ft { display: flex; align-items: center; gap: 8px; margin-top: 6px; } .typing { font-size: .72rem; color: var(--text-2); height: 16px; padding: 0 16px; }
.pending-att { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; } .pending-att span { background: var(--blue-10); color: var(--link); border-radius: 12px; padding: 2px 10px; font-size: .74rem; }
.mention-pop { position: absolute; bottom: 100%; left: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--sh-md); min-width: 220px; z-index: 10; overflow: hidden; } .mention-pop div { padding: 6px 12px; cursor: pointer; font-size: .86rem; } .mention-pop div.on, .mention-pop div:hover { background: var(--blue-10); }
.emoji-pop { position: absolute; right: 14px; top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--sh-md); padding: 4px; z-index: 6; display: flex; } .emoji-pop button { background: none; border: 0; font-size: 1.1rem; cursor: pointer; padding: 4px 6px; border-radius: 6px; } .emoji-pop button:hover { background: var(--blue-10); }

/* ── Drawer (task detail) & modals ── */
#drawer { position: fixed; inset: 0; z-index: 200; background: rgba(16,24,32,.35); display: flex; justify-content: flex-end; }
.drawer-box { width: min(620px, 100vw); background: var(--surface); height: 100%; overflow-y: auto; box-shadow: var(--sh-xl); animation: in-right .2s ease-out; }
@keyframes in-right { from { transform: translateX(40px); opacity: 0; } }
.drawer-hd { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 18px; display: flex; align-items: center; gap: 8px; z-index: 2; }
.drawer-bd { padding: 16px 20px 40px; } .drawer-bd .ttl-in { font-size: 1.25rem; font-weight: 900; color: var(--heading); border-color: transparent; padding-left: 0; } .drawer-bd .ttl-in:hover { border-color: var(--gray-l); padding-left: 12px; } .drawer-bd .ttl-in:focus { padding-left: 12px; }
.sect { margin-top: 20px; } .sect > .lbl { margin-bottom: 8px; }
.cl-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; } .cl-item.done span { text-decoration: line-through; color: var(--text-2); } .cl-item .x { margin-left: auto; opacity: 0; } .cl-item:hover .x { opacity: 1; }
.cmt { display: flex; gap: 10px; padding: 8px 0; } .cmt .bd { background: var(--bg); border-radius: 8px; padding: 8px 12px; flex: 1; font-size: .88rem; white-space: pre-wrap; overflow-wrap: anywhere; } .cmt .hd { font-size: .74rem; color: var(--text-2); margin-bottom: 2px; } .cmt .hd b { color: var(--heading); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chip { background: var(--blue-10); color: var(--link); border-radius: 12px; padding: 3px 10px; font-size: .76rem; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; } .chip a { text-decoration: none; color: inherit; opacity: .7; }
#modal-root:empty { display: none; }
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,32,.45); z-index: 300; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--sh-xl); width: 540px; max-width: 100%; animation: slide .25s ease-out; } .modal.wide { width: 900px; }
.modal > .hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; } .modal > .hd h3 { font-size: 1.05rem; font-weight: 900; } .modal > .bd { padding: 18px 20px; } .modal > .ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.preview-frame { width: 100%; height: 76vh; border: 0; background: var(--surface-2); } .preview-img { max-width: 100%; max-height: 76vh; display: block; margin: 0 auto; }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: var(--sh-md); font-size: .86rem; animation: slide .25s ease-out; max-width: 90vw; } .toast.err { background: var(--red); }
.switch { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; } .switch input { width: 18px; height: 18px; accent-color: var(--link); }

/* ── AI panel ── */
#ai-panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--ai-w); max-width: 100vw; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--sh-xl); transform: translateX(105%); transition: transform var(--t); z-index: 90; display: flex; flex-direction: column; }
body.ai-open #ai-panel { transform: none; }
.ai-hd { background: var(--side-bg); color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 8px; border-bottom: 3px solid var(--red); } .ai-hd .ttl { font-weight: 900; letter-spacing: .5px; } .ai-hd button { color: #fff; } .ai-hd button:hover { background: rgba(255,255,255,.15); }
.ai-sub { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); align-items: center; background: var(--surface-2); } .ai-sub select { width: auto; padding: 4px 8px; font-size: .76rem; } .ai-ctx { font-size: .7rem; color: var(--text-2); margin-left: auto; max-width: 150px; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 14px; }
.ai-m { margin-bottom: 14px; font-size: .9rem; line-height: 1.5; } .ai-m.user { background: var(--blue); color: #fff; border-radius: 14px 14px 4px 14px; padding: 9px 13px; margin-left: 40px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-m.assistant { overflow-wrap: anywhere; } .ai-m.assistant p { margin: 0 0 8px; } .ai-m.assistant ul, .ai-m.assistant ol { margin: 0 0 8px; padding-left: 20px; } .ai-m.assistant h4 { margin: 10px 0 4px; font-size: .92rem; } .ai-m.assistant code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: .84rem; } .ai-m.assistant pre { background: var(--surface-3); padding: 10px; border-radius: 6px; overflow: auto; font-size: .8rem; }
.ai-m.assistant table { border-collapse: collapse; font-size: .82rem; margin-bottom: 8px; } .ai-m.assistant td, .ai-m.assistant th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.ai-m.error { color: var(--red); font-size: .82rem; } .ai-status { font-size: .76rem; color: var(--text-2); font-style: italic; margin-bottom: 10px; }
.ai-prop { border: 1.5px solid var(--blue); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; background: var(--surface-2); } .ai-prop .t { font-weight: 700; color: var(--heading); font-size: .86rem; } .ai-prop ul { margin: 6px 0 8px; padding-left: 18px; font-size: .8rem; color: var(--text); } .ai-prop li { margin-bottom: 2px; white-space: pre-wrap; }
.ai-prop.applied { border-color: var(--ok); background: #f3faf6; } .ai-prop.rejected { border-color: var(--gray-l); background: var(--surface-3); opacity: .75; }
.ai-starters { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; } .ai-starters a { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: .84rem; text-decoration: none; color: var(--heading); cursor: pointer; } .ai-starters a:hover { border-color: var(--link); background: var(--blue-10); }
.ai-in { border-top: 1px solid var(--line); padding: 10px 12px; } .ai-in textarea { min-height: 44px; max-height: 160px; resize: none; } .ai-in .ft { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

/* ── Suggestions ── */
.sg-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.sg-kinds { display: flex; flex-wrap: wrap; gap: 8px; } .sg-kinds label { position: relative; } .sg-kinds input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.sg-kinds span { display: inline-block; padding: 7px 13px; border: 1.5px solid var(--gray-l); border-radius: 6px; font-size: .86rem; } .sg-kinds input:checked + span { background: var(--blue); border-color: var(--link); color: #fff; } .sg-kinds input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.sg-item { border-top: 1px solid var(--line-2); padding: 12px 0; } .sg-item:first-child { border-top: 0; padding-top: 0; } .sg-t { font-weight: 700; color: var(--heading); } .sg-m { font-size: .74rem; color: var(--text-2); margin-top: 2px; } .sg-b { font-size: .86rem; margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sg-reply { margin-top: 8px; background: var(--tint); border-left: 3px solid var(--blue); padding: 8px 10px; font-size: .86rem; border-radius: 0 6px 6px 0; white-space: pre-wrap; } .sg-reply b { display: block; font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--link); margin-bottom: 2px; }
details.sg-ib { background: var(--surface); border: 1px solid var(--gray-l); border-left: 4px solid #b8c0cc; border-radius: 8px; margin-bottom: 10px; } details.sg-ib.new { border-left-color: var(--red); } details.sg-ib.reviewing { border-left-color: var(--warn); } details.sg-ib.planned { border-left-color: var(--link); } details.sg-ib.done { border-left-color: var(--ok); }
details.sg-ib > summary { list-style: none; cursor: pointer; padding: 12px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; } details.sg-ib > summary::-webkit-details-marker { display: none; }
.sg-ib-body { padding: 0 16px 16px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }

@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } .cols, .sg-grid, .sg-ib-body, .notes { grid-template-columns: 1fr; } body.ai-open #main { margin-right: 0; } }
@media (max-width: 820px) {
  #sidebar { transform: translateX(-100%); } body.menu-open #sidebar { transform: none; box-shadow: var(--sh-xl); } #main { margin-left: 0; } #menu-btn { display: block; }
  #view { padding: 12px; } .search-wrap { width: auto; flex: 1; } #topbar h1 { display: none; } .btn-ai { padding: 8px 10px; }
  .chat, .chat.has-thread { grid-template-columns: 1fr; } .chat .ch-list { display: none; } .chat.show-list .ch-list { display: block; } .chat.show-list .ch-main { display: none; } .chat.has-thread .ch-main { display: none; }
  .g-left { width: 150px; } .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* ── Dark theme (same brand palette, lighter tints for text on dark) ── */
html[data-theme="dark"] {
  --bg: #12161d; --surface: #1b212b; --surface-2: #202733; --surface-3: #2a3240; --tint: #1d2b4a; --line: #323a47; --line-2: #2a313d;
  --text: #e6e9ee; --text-2: #a3acb9; --heading: #dfe6f3; --link: #8fb3ee; --gray-l: #4a5361; --side-bg: #171c25;
  --blue-10: rgba(143,179,238,.12); --blue-20: rgba(143,179,238,.22); --red-10: rgba(232,96,115,.16); --ok: #5fd39a; --ok-bg: rgba(95,211,154,.14); --warn: #ecc479; --warn-bg: rgba(236,196,121,.16);
  --sh-sm: 0 1px 3px rgba(0,0,0,.4); --sh-md: 0 4px 16px rgba(0,0,0,.45); --sh-xl: 0 16px 48px rgba(0,0,0,.6);
}
html[data-theme="dark"] body { color-scheme: dark; }
html[data-theme="dark"] #login-screen { background: linear-gradient(135deg, #1d2b4a 0%, var(--blue) 50%, #1d2b4a 100%); }
html[data-theme="dark"] .late, html[data-theme="dark"] .login-error, html[data-theme="dark"] .pill.blocked, html[data-theme="dark"] .pill.high, html[data-theme="dark"] .pill.new, html[data-theme="dark"] .stat.red .n, html[data-theme="dark"] .ai-m.error { color: #f08a9a; }
html[data-theme="dark"] .pill.new { background: #3f181e; } html[data-theme="dark"] .pill.reviewing, html[data-theme="dark"] .pill.review { background: #3f3318; color: #ecc479; }
html[data-theme="dark"] .pill.done { color: #82e3ad; } html[data-theme="dark"] .pill.planned, html[data-theme="dark"] .pill.in_progress { color: #8fb3ee; }
html[data-theme="dark"] .pill.declined { color: #b8b8b8; } html[data-theme="dark"] .toast { background: #323a47; } html[data-theme="dark"] .toast.err { background: var(--red); }
html[data-theme="dark"] .tab.on { color: #8fb3ee; } html[data-theme="dark"] .seg a.on { background: var(--blue); }
html[data-theme="dark"] .btn.ghost { border-color: var(--link); } html[data-theme="dark"] .btn-ai { background: var(--blue); }
html[data-theme="dark"] .g-bar.todo { background: #6b7688; } html[data-theme="dark"] .g-mslabel { color: var(--text); }
html[data-theme="dark"] .pop .it.unread { background: #2b2026; } html[data-theme="dark"] .ai-prop.applied { background: #17281f; }
html[data-theme="dark"] .ai-m.user, html[data-theme="dark"] .ch.on, html[data-theme="dark"] .nav-item.on { color: #fff; }
html[data-theme="dark"] .ficon { color: #8fb3ee; } html[data-theme="dark"] .doc ul.todo li::before { border-color: var(--text-2); }
.logo-dark { display: none; } html[data-theme="dark"] .logo-dark { display: inline; } html[data-theme="dark"] .logo-light { display: none; }
.theme-fab { position: absolute; top: 18px; right: 18px; background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 20px; padding: 7px 14px; cursor: pointer; font-size: .8rem; font-weight: 700; }
.theme-fab:hover { background: rgba(255,255,255,.26); }
