/* Civil Intelligence Office — navy #0c1d31 / gold #c9a961 / ivory #e8dcc0 */
:root {
  --navy: #0c1d31; --navy-2: #13294a; --navy-3: #1b3556; --gold: #c9a961; --gold-2: #e0c07a; --ivory: #e8dcc0;
  --paper: #f5f7fa; --ink: #13253b; --muted: #677789; --line: #dce3ea; --ok: #008573; --bad: #c94353; --blue: #1466a5;
  --radius: 10px; --shadow: 0 4px 18px rgba(12, 29, 49, .08); --top-h: 76px;
  font-family: Inter, -apple-system, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); line-height: 1.6; font-size: 15px; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; color: var(--navy); }
h1 { font-size: 23px; } h2 { font-size: 16px; } h3 { font-size: 15px; }
h1 small, h2 small { font-weight: 400; color: var(--muted); font-size: .7em; margin-left: .4em; }
p { margin: 0 0 .7em; } .muted { color: var(--muted); } .meta { color: var(--muted); font-size: 13px; }
.status { color: var(--muted); font-size: 13px; } .status.bad { color: var(--bad); } .status.ok { color: var(--ok); }
button, .button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 7px 14px; display: inline-block; line-height: 1.4; }
button:hover, .button:hover { border-color: var(--gold); text-decoration: none; }
button.primary, .button.primary { background: var(--navy); color: var(--ivory); border-color: var(--navy); }
button.primary:hover, .button.primary:hover { background: var(--navy-3); }
button:disabled { opacity: .55; cursor: wait; } button.small { padding: 3px 10px; font-size: 13px; }
button.link { border: 0; background: none; padding: 0; color: var(--muted); } button.link:hover { color: var(--bad); text-decoration: underline; }
button.danger:hover { border-color: var(--bad); color: var(--bad); } .wide { width: 100%; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: #fff; color: var(--ink); }
textarea { width: 100%; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.spread { justify-content: space-between; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 16px 0; }
.notice { background: #fff6e2; border: 1px solid #ecd39a; color: #5a4300; border-radius: 8px; padding: 8px 12px; margin: 0; }
.notice.bad { background: #fdeef0; border-color: #efbcc4; color: #8a1c2c; } .notice.ok { background: #e8f6f3; border-color: #aedcd2; color: #0d5a4d; }
.tag { display: inline-block; background: #fbf5e8; color: #8a6d2b; border-radius: 4px; padding: 0 7px; font-size: 12px; font-weight: 600; }
form.inline { display: inline; }

/* top bar */
.top { background: #fff; color: var(--navy); display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: var(--top-h); padding: 0 26px; position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(12, 29, 49, .05); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--navy); font-weight: 600; } .brand:hover { text-decoration: none; }
.brand img { height: 52px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; padding-left: 14px; border-left: 1px solid var(--line); }
.brand-en { font-family: Georgia, "Noto Serif SC", serif; font-size: 18px; letter-spacing: .04em; }
.brand-zh { font-size: 12.5px; letter-spacing: .3em; color: var(--navy-3); font-weight: 500; margin-top: 2px; }
.topnav { display: flex; gap: 20px; align-items: center; font-size: 15px; flex-wrap: wrap; }
.topnav a { color: var(--navy); opacity: .75; } .topnav a.on, .topnav a:hover { opacity: 1; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.topnav a.warn { color: var(--bad); opacity: 1; }
.topnav .who { font-weight: 600; border: 1px solid var(--line); border-radius: 16px; padding: 2px 12px; opacity: 1; }
.page { max-width: 1180px; margin: 0 auto; padding: 22px 22px 60px; } .page.wide { max-width: 1400px; } .page.narrow { max-width: 520px; padding-top: 60px; }

/* login / account */
.login label { display: block; margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.login input { display: block; width: 100%; margin-top: 4px; font-size: 16px; }
.login h1 { margin-bottom: 16px; }

/* home */
.hello { font-size: 22px; margin: 10px 0 18px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.choice { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.choice-head { display: flex; gap: 16px; align-items: center; color: var(--navy); } .choice-head:hover { text-decoration: none; }
.choice-head .icon { width: 52px; height: 52px; border-radius: 12px; background: var(--navy); color: var(--gold); display: grid; place-items: center; font-size: 24px; flex: none; }
.choice-head b { font-size: 19px; display: block; } .choice-head small { color: var(--muted); font-size: 14px; }
.choice > button, .choice > .button { align-self: flex-start; }
.mini { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.mini li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.mini li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links { margin-top: 18px; }

/* room lists */
.new-team label { display: block; margin-bottom: 10px; } .new-team input[name=title] { width: 100%; max-width: 480px; display: block; margin-top: 4px; }
.invite { border: 0; padding: 0; margin: 0 0 12px; } .invite legend { padding: 0; margin-bottom: 4px; }
.check { display: inline-flex !important; gap: 6px; align-items: center; margin-right: 16px; }
.room-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.room-list a { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 15px; color: inherit; height: 100%; }
.room-list a:hover { border-color: var(--gold); text-decoration: none; box-shadow: var(--shadow); }
.room-list strong { display: block; color: var(--navy); } .room-list .meta { display: block; }
.room-list .preview { display: block; font-size: 13px; color: var(--ink); opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-list .empty { padding: 20px 0; }

/* room */
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; align-items: start; }
.thread { min-width: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.thread-head .back { font-size: 20px; color: var(--muted); } .thread-head .back:hover { color: var(--navy); text-decoration: none; }
.thread-head h1 { font-size: 20px; padding: 2px 6px; margin: 0; border-radius: 6px; flex: 1; min-width: 0; }
.thread-head h1:focus { outline: 2px solid var(--gold); background: #fff; }
.messages { display: flex; flex-direction: column; gap: 12px; min-height: 50vh; padding-bottom: 8px; }
.msg { border-radius: 12px; padding: 9px 15px 11px; max-width: 88%; overflow-wrap: anywhere; }
.msg header { display: flex; gap: 10px; align-items: baseline; font-size: 13px; margin-bottom: 2px; }
.msg header .meta { font-size: 12px; }
.msg.me { align-self: flex-end; background: var(--navy); color: var(--ivory); }
.msg.me header b { color: var(--gold-2); } .msg.me .meta { color: rgba(232, 220, 192, .65); } .msg.me a { color: var(--gold-2); }
.msg.other { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--blue); }
.msg.other header b { color: var(--blue); }
.msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--gold); width: 88%; }
.msg.ai header b { color: #8a6d2b; }
.msg.ai.streaming .body { white-space: pre-wrap; }
.msg.ai.tool { background: transparent; border: 0; color: var(--muted); font-size: 13px; padding: 0 6px; width: auto; }
.msg.notice, .msg.event { align-self: center; background: transparent; border: 0; padding: 0; width: auto; max-width: 92%; }
.msg.event p { color: var(--muted); font-size: 13px; margin: 0; }
.msg .filemade { background: #fbf5e8; border: 1px solid #ecd9a8; border-radius: 8px; padding: 8px 14px; margin: 0; }
.msg p:last-child { margin-bottom: 0; } .msg ul, .msg ol { padding-left: 1.4em; margin: .3em 0 .6em; }
.msg pre { background: #f2f4f7; color: var(--ink); padding: 8px 10px; border-radius: 6px; overflow: auto; font-size: 13px; }
.msg code { background: rgba(127, 140, 160, .15); padding: 1px 4px; border-radius: 4px; font-size: 90%; }
.msg table { border-collapse: collapse; margin: 6px 0; font-size: 14px; } .msg th, .msg td { border: 1px solid var(--line); padding: 4px 8px; }
.msg.me th, .msg.me td { border-color: rgba(232, 220, 192, .3); }
.msg .attach { list-style: none; padding: 0; margin: 6px 0 0; }
.mention { background: rgba(201, 169, 97, .25); color: inherit; border-radius: 4px; padding: 0 4px; font-weight: 600; }
.starter { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px 18px; }
.examples { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.examples .ex { text-align: left; font-size: 14px; }
.composer { position: sticky; bottom: 0; background: var(--paper); padding: 10px 0 14px; margin-top: 8px; border-top: 1px solid var(--line); }
.composer .row { margin-top: 8px; } .composer #send { margin-left: auto; }
.upload { cursor: pointer; color: var(--blue); font-size: 14px; } .upload input { display: none; }
.pending { display: flex; gap: 6px; flex-wrap: wrap; } .pending:not(:empty) { margin-bottom: 6px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1px 10px; font-size: 13px; } .chip.err { color: var(--bad); border-color: #efbcc4; }
.side { position: sticky; top: calc(var(--top-h) + 16px); display: flex; flex-direction: column; gap: 12px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 15px; }
.panel h2 { font-size: 15px; display: flex; align-items: baseline; gap: 4px; } .panel h2 .more { margin-left: auto; font-size: 13px; font-weight: 400; }
.panel p { font-size: 14px; margin: 0; }
.members { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.members li { background: var(--paper); border-radius: 12px; padding: 1px 10px; font-size: 13px; } .members li.ai { background: #fbf5e8; color: #8a6d2b; }
.invite-row select { flex: 1; padding: 4px 8px; }
.flist { list-style: none; margin: 0; padding: 0; } .flist li { padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.flist li a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .flist .meta { font-size: 12px; }

/* files */
.filesview { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.folders { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; position: sticky; top: calc(var(--top-h) + 16px); }
.folders h2 { font-size: 14px; color: var(--muted); padding: 0 6px; }
.folders ul { list-style: none; margin: 0; padding: 0; }
.folders li a { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; color: var(--ink); }
.folders li a:hover { background: var(--paper); text-decoration: none; } .folders li.on a { background: var(--navy); color: var(--ivory); }
.folders li.on .meta { color: rgba(232, 220, 192, .7); }
.folders .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .folders .ico { width: 18px; text-align: center; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 14px; text-align: center; color: var(--muted); font-size: 14px; margin: 12px 0; }
.dropzone.over { border-color: var(--gold); background: #fffaf0; }
.ftable { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.ftable th { text-align: left; background: #f0f3f7; color: var(--muted); font-weight: 500; padding: 8px 12px; }
.ftable td { padding: 8px 12px; border-top: 1px solid var(--line); }
.crumbs { margin: 0 0 8px; }
.fileview { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.viewer { width: 100%; height: 76vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-top: 10px; }
.textpreview { white-space: pre-wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; max-height: 72vh; overflow: auto; font-family: inherit; font-size: 14px; }
.versions { list-style: none; margin: 0; padding: 0; } .versions li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.versions .meta { display: block; } .vnote { font-size: 13px; background: var(--paper); border-radius: 6px; padding: 3px 8px; margin: 3px 0; }

/* budget */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; margin: 0; } .stat b { font-size: 26px; color: var(--navy); }
.stat.over { border-color: #efbcc4; } .stat.over b { color: var(--bad); }

/* calendar */
.calview { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.calhead h1 { margin: 0 6px; font-size: 21px; min-width: 7.5em; text-align: center; }
.month { width: 100%; border-collapse: collapse; table-layout: fixed; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 12px; }
.month th { background: #f0f3f7; color: var(--muted); font-weight: 500; font-size: 13px; padding: 7px 0; }
.month th.we { color: #a0602b; }
.month td { border-top: 1px solid var(--line); border-left: 1px solid var(--line); height: 108px; vertical-align: top; padding: 4px 5px; cursor: pointer; }
.month td:first-child { border-left: 0; } .month td:hover { background: #fbfcfe; }
.month td.we { background: #fcfbf8; } .month td.out { background: #f7f8fa; } .month td.out .dnum { color: #b7c0ca; }
.dnum { display: inline-block; font-size: 13px; color: var(--muted); min-width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 11px; margin-bottom: 2px; }
.month td.today .dnum { background: var(--navy); color: var(--gold-2); font-weight: 600; }
.ev { display: block; width: 100%; text-align: left; font-size: 12.5px; line-height: 1.35; padding: 2px 6px; margin: 0 0 3px; border: 0; border-left: 3px solid var(--gold);
  background: #fbf5e8; color: var(--ink); border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.ev:hover { background: #f6ead0; } .ev b { font-weight: 600; color: #8a6d2b; }
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { border-bottom: 1px dashed var(--line); }
.ev-link { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 0; border-radius: 0; font-size: 14px; }
.ev-link:hover { background: var(--paper); }
.ev-link .ad { color: var(--navy); font-weight: 600; } .ev-link .at { color: var(--muted); font-size: 13px; }
.ev-link b { grid-column: 1 / -1; font-weight: 500; } .ev-link .meta { grid-column: 1 / -1; }
.evdlg { border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; width: min(520px, 94vw); box-shadow: 0 20px 60px rgba(12, 29, 49, .25); }
.evdlg::backdrop { background: rgba(12, 29, 49, .35); }
.evdlg label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; flex: 1; }
.evdlg input, .evdlg textarea { display: block; width: 100%; margin-top: 3px; color: var(--ink); }
.evdlg .row { gap: 12px; flex-wrap: nowrap; } .evdlg .row.spread { margin-top: 6px; }

@media (max-width: 900px) {
  .calview { grid-template-columns: 1fr; }
  .month td { height: 72px; padding: 2px; } .ev { font-size: 11px; padding: 1px 3px; } .ev b { display: none; }
}

@media (max-width: 900px) {
  .workbench, .filesview, .fileview { grid-template-columns: 1fr; }
  .side, .folders { position: static; }
  .msg, .msg.ai { max-width: 100%; width: auto; }
  .top { padding: 8px 14px; } .brand img { height: 40px; } .topnav { gap: 12px; font-size: 14px; }
}
