/* 取自大港開打 IG 的視覺：海軍藍、牛皮紙米色、琥珀黃，朱紅只用在提醒。直角、無陰影、無漸層。 */
:root {
  --navy: #12233f;
  --navy-2: #1c3254;
  --ink: #1b1f27;
  --paper: #f6f0e2;
  --surface: #fffbf2;
  --line: #e0d5bd;
  --amber: #e9a23b;
  --red: #c8402a;
  --muted: #7a705c;
  --tc: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --num: "Barlow Condensed", "Noto Sans TC", sans-serif;
  --tabs: 54px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.65 var(--tc); -webkit-font-smoothing: antialiased; }
a { color: var(--navy); }
h1 { font-size: 24px; font-weight: 900; color: var(--navy); margin: 0; line-height: 1.3; }
h2 { font-size: 15px; font-weight: 900; color: var(--navy); margin: 28px 0 10px; }
.num { font-family: var(--num); font-weight: 600; letter-spacing: .02em; }
.dim { color: var(--muted); }
.strong { font-weight: 700; text-decoration: none; }
.strong:hover { text-decoration: underline; }
.empty { color: var(--muted); font-size: 14px; margin: 14px 0; }
.lede { color: var(--muted); font-size: 14px; margin: 4px 0 18px; }

/* 表單 */
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], select, textarea {
  font: 400 15px/1.5 var(--tc); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; width: 100%; min-width: 0;
}
select { -webkit-appearance: none; appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%2312233F'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: -1px; }
button, .btn {
  display: inline-block; font: 700 14px/1.4 var(--tc); background: var(--navy); color: var(--paper);
  border: 1px solid var(--navy); border-radius: 3px; padding: 8px 16px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--navy-2); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
button:disabled { opacity: .5; cursor: default; }
button.ghost, .btn.ghost { background: transparent; color: var(--navy); border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--navy); }
.small { padding: 4px 10px; font-size: 13px; }
.linkbtn { background: none; border: 0; color: var(--muted); font: 400 13px var(--tc); padding: 0; text-decoration: underline; }
.linkbtn:hover { background: none; color: var(--red); }
form { margin: 0; }
.form { max-width: 560px; }
.form.wide { max-width: 800px; }
.field { margin-bottom: 14px; }
.field label:not(.check) { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.two { display: flex; gap: 12px; }
.two > .field { flex: 1; min-width: 0; }
.two > .grow { flex: 2; }
.actions { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks.sub { margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--line); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.inline { display: flex; gap: 8px; }
.inline select { width: auto; }
.addrow { display: flex; gap: 8px; margin: 10px 0; }
.addrow input[type=text], .addrow input[type=email] { flex: 2; }
.addrow select, .addrow input[type=date], .addrow input[type=time] { flex: 1; }
.notice { padding: 10px 12px; font-size: 14px; margin-bottom: 14px; background: var(--surface); border-left: 3px solid var(--navy); }
.notice.err { border-color: var(--red); color: var(--red); }
.notice.ok { border-color: var(--amber); }
.break { word-break: break-all; }

/* 未登入頁 */
body.plain { display: flex; justify-content: center; }
.plainbox { width: 100%; max-width: 400px; padding: 56px 20px; }
.plainhead { margin-bottom: 32px; }
.plainhead .wm b { color: var(--navy); }
.plainhead .wm small { color: var(--muted); }
.plainbox .card { background: var(--surface); border: 1px solid var(--line); padding: 20px; margin-top: 16px; }
.plainbox button { width: 100%; }
.plainbox label { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-top: 14px; flex-wrap: wrap; }

/* 版面 */
.app { display: flex; height: 100%; height: 100dvh; }
aside { width: 228px; flex: none; background: var(--navy); color: var(--paper); display: flex; flex-direction: column; }
.wm { display: inline-flex; align-items: center; gap: 10px; }
.wm .sun { width: 22px; height: 22px; border-radius: 50%; background: var(--red); flex: none; }
.wm span { display: flex; flex-direction: column; line-height: 1.2; }
.wm b { font-size: 17px; font-weight: 900; letter-spacing: .08em; }
.wm small { font-size: 11px; opacity: .7; letter-spacing: .1em; }
.sidehead { padding: 18px 16px 14px; }
.sidescroll { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.nav, .ch { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; color: var(--paper); text-decoration: none; font-size: 14.5px; border-left: 3px solid transparent; }
.nav { font-weight: 700; }
.nav:hover, .ch:hover { background: var(--navy-2); }
.nav.on, .ch.on { border-left-color: var(--amber); color: var(--amber); background: var(--navy-2); }
.ch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch em { font: 700 12px var(--num); background: var(--amber); color: var(--navy); padding: 0 6px; }
.sect { display: flex; justify-content: space-between; align-items: center; padding: 16px 10px 4px; font-size: 12px; opacity: .65; }
.plus { background: none; border: 0; color: var(--paper); padding: 0 2px; font-size: 15px; }
.plus:hover { background: none; color: var(--amber); }
.sidefoot { display: flex; gap: 12px; align-items: center; padding: 10px 16px; font-size: 13px; border-top: 1px solid var(--navy-2); }
.sidefoot span { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidefoot a, .sidefoot .linkbtn { color: var(--paper); opacity: .75; }
main { flex: 1; min-width: 0; }
main.pad { padding: 26px 30px 48px; overflow-y: auto; }
main.fill { display: flex; flex-direction: column; overflow: hidden; }
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.tabs, .scrim { display: none; }

/* 戰績表風格的表格 */
.tablewrap { overflow-x: auto; }
table.board { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.board th { text-align: left; font: 700 14px var(--num); letter-spacing: .04em; color: var(--navy); padding: 6px 10px; border-bottom: 2px solid var(--navy); white-space: nowrap; }
table.board td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.board tbody tr:hover { background: var(--surface); }
tr.total td { font-weight: 700; border-top: 2px solid var(--navy); }
.rowacts { display: flex; gap: 12px; justify-content: flex-end; white-space: nowrap; }
.late { color: var(--red); font-weight: 700; }
.segtabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; font-size: 14px; }
.segtabs a { text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.segtabs a.on { color: var(--navy); font-weight: 700; border-color: var(--amber); }
.segtabs.tight { margin: 0; border: 0; }
.prose { background: var(--surface); padding: 14px 18px; border: 1px solid var(--line); }

/* 聊天 */
.chathead { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); flex: none; }
.titleform { flex: 1; display: flex; align-items: center; gap: 4px; }
.hash { color: var(--muted); font-weight: 700; }
.titleform input { border: 1px solid transparent; background: none; font-weight: 900; font-size: 17px; color: var(--navy); padding: 2px 4px; }
.titleform input:hover { border-color: var(--line); }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.stream { flex: 1; overflow-y: auto; padding: 14px 20px; }
.m { display: flex; gap: 10px; padding: 5px 0; }
.av { width: 32px; height: 32px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--navy); color: var(--paper); }
.av.agent { background: var(--amber); color: var(--navy); }
.mb { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mh { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.mh time { font: 600 12.5px var(--num); color: var(--muted); }
.mt p { margin: 0 0 6px; } .mt p:last-child { margin: 0; }
.mt ul { margin: 0 0 6px; padding-left: 20px; }
.mt h3, .mt h4, .mt h5, .mt h6 { font-size: 15px; color: var(--navy); margin: 8px 0 4px; }
.mt code { background: var(--line); padding: 0 4px; font-size: 13px; }
.mt pre { background: var(--surface); border: 1px solid var(--line); padding: 10px; overflow-x: auto; }
.mt pre code { background: none; padding: 0; }
.mt table { border-collapse: collapse; font-size: 14px; margin: 4px 0; }
.mt th, .mt td { border-bottom: 1px solid var(--line); padding: 4px 10px; text-align: left; }
.at { color: var(--navy); background: rgba(233, 162, 59, .32); font-weight: 700; padding: 0 2px; }
.tasktag { color: var(--navy); background: rgba(18, 35, 63, .1); font-weight: 700; padding: 0 3px; text-decoration: none; }
.tasktag:hover { background: rgba(18, 35, 63, .2); }
.tasktag.done { text-decoration: line-through; color: var(--muted); }
.tasktag.gone { color: var(--muted); font-weight: 400; background: none; }
.sys { text-align: center; font-size: 12.5px; color: var(--muted); padding: 6px 0; }
.atts { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.atts img { max-width: 220px; max-height: 220px; display: block; border: 1px solid var(--line); }
.file { display: inline-block; background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; font-size: 13px; }

.pcard { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--amber); padding: 10px 14px; margin-top: 2px; max-width: 520px; }
.pcard.cancelled { border-left-color: var(--line); opacity: .65; }
.pcard.confirmed { border-left-color: var(--navy); }
.ptitle { font-weight: 700; color: var(--navy); }
.pline { font-size: 14px; }
.pacts { display: flex; gap: 8px; margin-top: 10px; }
.pstate { font-size: 13px; color: var(--muted); margin-top: 6px; }

.step { padding: 0 20px 6px; font-size: 13px; color: var(--muted); }
.composer { padding: 6px 20px 16px; position: relative; flex: none; }
.inputrow { display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); padding: 6px; }
.inputrow:focus-within { border-color: var(--navy); }
.inputrow textarea { border: 0; background: none; resize: none; max-height: 180px; padding: 6px 4px; }
.inputrow textarea:focus { outline: 0; }
.attach { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--muted); cursor: pointer; }
.attach:hover { color: var(--navy); }
.filelist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; font-size: 13px; }
.filelist span { background: var(--surface); border: 1px solid var(--line); padding: 2px 8px; }
.composeropts { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.composeropts label { margin: 0; }
select.aimode { width: auto; border: 0; background-color: transparent; font-size: 13px; color: var(--navy); font-weight: 700; padding: 2px 22px 2px 4px; background-position: right 6px center; }
select.aimode:hover { background-color: var(--line); }
.senderr { color: var(--red); font-size: 13px; margin-top: 4px; }
.mentions { position: absolute; bottom: 100%; left: 20px; width: 260px; background: var(--surface); border: 1px solid var(--navy); z-index: 20; }
.mentions button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ink); font-weight: 400; border-radius: 0; }
.mentions button.on, .mentions button:hover { background: var(--line); }

/* 工作項目詳情 */
.itemgrid { flex: 1; display: flex; min-height: 0; }
.itemside { flex: 1; min-width: 0; overflow-y: auto; padding: 20px 26px 40px; }
.itemchat { width: 44%; min-width: 340px; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.chatlabel { margin: 0; padding: 14px 20px 8px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumb a { color: var(--muted); }
input.bigtitle { font-size: 21px; font-weight: 900; color: var(--navy); background: none; border-color: transparent; padding: 2px 0 8px; }
input.bigtitle:hover { border-bottom-color: var(--line); }
.archive { margin-top: 26px; }

/* 任務 */
.bare { width: auto; border: 0; background: transparent; padding: 1px 4px; margin-left: -4px; font-size: 13px; color: var(--ink); -webkit-appearance: none; appearance: none; cursor: pointer; border-radius: 2px; }
.bare:hover { background: var(--line); }
.bare.none, .due.none { color: var(--muted); }
.due { position: relative; display: inline-block; font-size: 14px; padding: 0 4px; border-radius: 2px; cursor: pointer; white-space: nowrap; }
.due:hover { background: var(--line); }
.due input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.due input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; cursor: pointer; }
.due.late { color: var(--red); font-weight: 700; }
.tktitle { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14.5px; }
.tkdel button { background: none; border: 0; color: var(--muted); padding: 0 2px; font-size: 16px; line-height: 1.2; font-weight: 400; opacity: 0; }
.tkdel button:hover { background: none; color: var(--red); }
.tkdel button:focus-visible, .tk:hover .tkdel button, .card:hover .tkdel button { opacity: 1; }
.tk { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.tkmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; }
.tk.done .tktitle { text-decoration: line-through; color: var(--muted); }

.people { position: relative; display: inline-block; min-width: 0; }
.people summary { list-style: none; cursor: pointer; font-size: 13px; padding: 1px 4px; margin-left: -4px; border-radius: 2px; }
.people summary::-webkit-details-marker { display: none; }
.people summary:hover { background: var(--line); }
.people summary.none { color: var(--muted); }
.people .pop { position: absolute; top: 100%; left: -4px; z-index: 30; min-width: 140px; margin-top: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--navy); }
.people label { display: flex; align-items: center; gap: 8px; padding: 5px 6px; font-size: 14px; font-weight: 400; color: var(--ink); cursor: pointer; white-space: nowrap; margin: 0; }
.people label:hover { background: var(--line); }
.addrow .people, .field .people { flex: 1; display: block; }
.addrow .people summary, .field .people summary { font-size: 15px; line-height: 1.5; margin: 0; padding: 8px 30px 8px 10px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%2312233F'/%3E%3C/svg%3E") no-repeat right 11px center; border: 1px solid var(--line); border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 任務看板 */
.columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: start; }
.col h2 { display: flex; justify-content: space-between; border-bottom: 2px solid var(--navy); padding-bottom: 4px; margin: 14px 0 8px; }
.tklist { min-height: 120px; }
.card { background: var(--surface); border: 1px solid var(--line); padding: 10px 12px; margin-bottom: 8px; cursor: grab; }
.card:hover { border-color: var(--navy); }
.cardtop { display: flex; align-items: flex-start; gap: 8px; }
.cardtop .tktitle { font-weight: 700; line-height: 1.45; }
.cardmeta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.card.done .tktitle { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.tklink { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tklink:hover { color: var(--navy); text-decoration: underline; }
.touchonly { display: none; }
.dragging { opacity: .4; }
.tklist.over { background: rgba(233, 162, 59, .14); }
.boarderr { color: var(--red); font-size: 13px; }
@media (hover: none) { .tkdel button { opacity: 1; } .touchonly { display: inline-block; } .card { cursor: default; } }

.evrow { display: flex; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.evrow span:nth-child(2) { flex: 1; }

/* 行事曆 */
.calnav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.calnav b { font-size: 22px; color: var(--navy); min-width: 130px; text-align: center; }
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 2px solid var(--navy); border-left: 1px solid var(--line); }
.dow { font-size: 13px; font-weight: 700; color: var(--navy); padding: 4px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cell { min-height: 104px; padding: 4px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.calgrid.week .cell { min-height: 320px; }
.cell.out { background: rgba(224, 213, 189, .3); }
.cell.out .daynum { color: var(--muted); }
.cell.sel { background: var(--surface); }
.daynum { display: inline-block; font-size: 17px; text-decoration: none; color: var(--navy); padding: 0 4px; }
.cell.today .daynum { background: var(--red); color: #fff; }
.chip { display: block; font-size: 12.5px; line-height: 1.5; padding: 1px 5px; margin-bottom: 2px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.event { background: var(--navy); color: var(--paper); }
.chip.task { background: rgba(233, 162, 59, .4); color: var(--ink); }
.chip.item { border: 1px solid var(--navy); color: var(--navy); }
.chip.done { opacity: .5; text-decoration: line-through; }
.agenda { display: none; }
.dayhead { margin-top: 24px; }

/* 會議記錄 */
.meetmeta { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 14px; color: var(--muted); margin: 2px 0 16px; }
.meetmeta b { color: var(--navy); }
.meetbody { font-size: 15.5px; line-height: 1.8; max-width: 760px; }
.meetbody h3, .meetbody h4, .meetbody h5 { color: var(--navy); font-size: 16px; font-weight: 900; margin: 20px 0 6px; }
.meetbody p { margin: 0 0 10px; }
.meetbody ul { margin: 0 0 10px; padding-left: 22px; }
.meetbody table { border-collapse: collapse; font-size: 14.5px; margin: 6px 0 14px; }
.meetbody th { text-align: left; color: var(--navy); border-bottom: 2px solid var(--navy); padding: 4px 12px 4px 0; }
.meetbody td { border-bottom: 1px solid var(--line); padding: 5px 12px 5px 0; vertical-align: top; }
.meetsearch { margin-bottom: 12px; max-width: 420px; }

/* 預算表 */
.stats { display: flex; gap: 34px; margin: 4px 0 18px; }
.stats div span { display: block; font-size: 13px; color: var(--muted); }
.stats b { font: 700 28px/1.2 var(--num); color: var(--navy); }
.stats b.late { color: var(--red); }
table.sheet { border-collapse: collapse; font-size: 14.5px; width: 100%; min-width: 620px; }
table.sheet th { background: var(--navy); color: var(--paper); font-weight: 700; font-size: 13.5px; padding: 7px 10px; text-align: right; white-space: nowrap; }
table.sheet th.l, table.sheet td.l { text-align: left; }
table.sheet td { border-bottom: 1px solid var(--line); padding: 0 10px; height: 38px; text-align: right; white-space: nowrap; background: var(--paper); }
table.sheet tbody tr:hover td { background: var(--surface); }
table.sheet tfoot td { font-weight: 700; border-top: 2px solid var(--navy); border-bottom: 0; color: var(--navy); }
table.sheet th:first-child, table.sheet td:first-child { position: sticky; left: 0; z-index: 1; }
table.sheet .num { font-size: 16px; }
.amt { width: 100%; min-width: 64px; border: 0; background: transparent; padding: 7px 0; text-align: right; font: 600 16px var(--num); letter-spacing: .02em; color: var(--ink); }
.amt.t { text-align: left; font: 400 14.5px var(--tc); min-width: 74px; }
.amt:hover { background: var(--line); }
.amt:focus { background: var(--surface); outline: 2px solid var(--navy); outline-offset: -2px; }
.amt.bad { outline: 2px solid var(--red); outline-offset: -2px; }
td.rm { width: 22px; padding: 0 2px 0 6px; }
.rm button { background: none; border: 0; color: var(--muted); padding: 0; font-size: 15px; font-weight: 400; opacity: 0; }
.rm button:hover { background: none; color: var(--red); }
tr:hover .rm button, .rm button:focus-visible { opacity: 1; }
.sheetadd { margin: 8px 0 0; }
.sheetgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; margin-top: 26px; }
.sheetgrid h2 { margin-top: 0; }
.saveerr { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 6px; }
@media (hover: none) { .rm button { opacity: 1; } }

/* 手機 */
@media (max-width: 860px) {
  .app { height: calc(100dvh - var(--tabs)); }
  aside { position: fixed; inset: 0 auto var(--tabs) 0; z-index: 30; transform: translateX(-100%); transition: transform .18s; }
  body.navopen aside { transform: none; }
  body.navopen .scrim { display: block; position: fixed; inset: 0 0 var(--tabs) 0; background: rgba(18, 35, 63, .4); z-index: 25; }
  .tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabs); background: var(--navy); z-index: 40; }
  .tabs a, .tabs button { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--paper); font: 700 13.5px var(--tc); text-decoration: none; background: none; border: 0; border-top: 3px solid transparent; border-radius: 0; padding: 0; }
  .tabs a.on { color: var(--amber); border-top-color: var(--amber); }
  main.pad { padding: 18px 14px 36px; }
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], select, textarea { font-size: 16px; }
  .two { flex-direction: column; gap: 0; }
  .addrow { flex-wrap: wrap; }
  .addrow input[type=text], .addrow input[type=email] { flex: 1 1 100%; }
  .columns { grid-template-columns: 1fr; gap: 0; }
  .tkmain { flex-wrap: wrap; gap: 4px 12px; }
  .tk .tktitle { flex: 0 0 100%; }
  .tklist { min-height: 56px; }
  .stream { padding: 10px 14px; }
  .composer { padding: 6px 14px 10px; }
  .chathead { padding: 8px 14px; }
  .step { padding: 0 14px 4px; }
  .mentions { left: 14px; }
  .itemgrid { flex-direction: column; overflow-y: auto; display: block; }
  .itemside { overflow: visible; padding: 16px 14px 20px; }
  .itemchat { width: auto; min-width: 0; border-left: 0; border-top: 2px solid var(--navy); height: 72dvh; }
  .chatlabel { padding: 10px 14px 4px; }
  .stats { gap: 20px; }
  .stats b { font-size: 22px; }
  .sheetgrid { grid-template-columns: 1fr; }
  .calgrid { display: none; }
  .agenda { display: block; }
  .agday { margin-bottom: 14px; }
  .agdate { display: block; font-weight: 700; color: var(--navy); text-decoration: none; border-bottom: 2px solid var(--navy); padding-bottom: 2px; margin-bottom: 4px; }
  .agdate.today { color: var(--red); border-color: var(--red); }
  .agrow { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
  .agrow.done { color: var(--muted); text-decoration: line-through; }
  .tag { font-size: 11.5px; font-weight: 700; padding: 0 5px; flex: none; }
  .tag.event { background: var(--navy); color: var(--paper); }
  .tag.task { background: rgba(233, 162, 59, .4); }
  .tag.item { border: 1px solid var(--navy); color: var(--navy); }
}

/* 任務：篩選、標記、清單分組、詳情頁 */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.filters select { width: auto; max-width: 220px; font-size: 14px; padding-top: 5px; padding-bottom: 5px; }
.filters .clear { font-size: 13px; color: var(--muted); }
a.tktitle { color: var(--ink); text-decoration: none; }
a.tktitle:hover { color: var(--navy); text-decoration: underline; }
.tk.done a.tktitle { text-decoration: line-through; color: var(--muted); }
.tkitem { font-size: 12.5px; color: var(--muted); max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bdgs { display: inline-flex; gap: 6px; flex-shrink: 0; }
.bdg { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 0 6px; border-radius: 2px; white-space: nowrap; line-height: 1.6; }
.bdg.full { color: var(--navy); border-color: var(--navy); }
.bdg.new { color: #fff; background: var(--red); border-color: var(--red); font-weight: 700; }
.cardfoot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.cardfoot .tklink { margin-top: 0; min-width: 0; }
.tkgroup h2 { display: flex; justify-content: space-between; border-bottom: 2px solid var(--navy); padding-bottom: 4px; margin: 20px 0 4px; }
.tkgroup h2.late { color: var(--red); border-color: var(--red); }
.moredone { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--muted); }
.tkform .bigtitle { margin-bottom: 10px; }
.ck { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.ckmain { flex: 1; display: flex; align-items: center; gap: 8px; }
.ckmain input[type=checkbox] { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--navy); }
.ckmain input[type=text] { border: 0; background: transparent; padding: 7px 4px; font-size: 14.5px; }
.ckmain input[type=text]:focus { background: var(--surface); outline: 1px solid var(--line); }
.ck.done input[type=text] { text-decoration: line-through; color: var(--muted); }
@media (hover: none) { .ck .tkdel button { opacity: 1; } }
@media (max-width: 860px) { .tkitem { display: none; } .filters select { max-width: 46%; } }
.ck:hover .tkdel button { opacity: 1; }
.tkgroup .tk .people { width: 150px; flex-shrink: 0; }
.tkgroup .tk .due { width: 84px; text-align: right; flex-shrink: 0; }
.tkgroup .tk select.bare { width: 76px; flex-shrink: 0; }
@media (max-width: 860px) { .tkgroup .tk .people { width: auto; } .tkgroup .tk .due { width: auto; } }

/* ───── 摺疊區、頻道列表、看板分頁：桌機版的樣子 ───── */
.fold > summary { display: none; }
.coltabs, .mtabs, .mback { display: none; }
.chlist { border-top: 1px solid var(--line); }
.chrow { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name time" "last badge"; gap: 2px 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.chrow:hover { background: var(--surface); }
.chname { grid-area: name; font-weight: 700; color: var(--navy); }
.chtime { grid-area: time; font-size: 12.5px; color: var(--muted); }
.chlast { grid-area: last; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chrow em { grid-area: badge; justify-self: end; font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: var(--red); border-radius: 9px; min-width: 18px; padding: 0 6px; text-align: center; }
.chrow.unread .chlast { color: var(--ink); }

/* ───── 手機版（研究依據：Apple HIG 點擊範圍 44pt、iOS 輸入框小於 16px 會放大、底部要留 Home 列空間） ───── */
@media (max-width: 860px) {
  :root { --safe: env(safe-area-inset-bottom, 0px); }
  .app { height: calc(100dvh - var(--tabs) - var(--safe)); }
  .tabs { height: calc(var(--tabs) + var(--safe)); padding-bottom: var(--safe); }
  aside { bottom: calc(var(--tabs) + var(--safe)); }
  body.navopen .scrim { bottom: calc(var(--tabs) + var(--safe)); }

  /* 所有輸入框 16px，iPhone 點下去才不會自動放大 */
  input, select, textarea, .filters select, .ckmain input[type=text], select.aimode, select.bare, .titleform input { font-size: 16px; }

  /* 點擊範圍 */
  button, .btn, .fold > summary { min-height: 40px; }
  .tkdel button, .ck .tkdel button { opacity: 1; font-size: 22px; padding: 4px 10px; min-height: 40px; }
  .due { padding: 8px 6px; font-size: 15px; }
  .cardmeta .people summary, .tk .people summary { padding-top: 8px; padding-bottom: 8px; }
  .ckmain input[type=checkbox] { width: 22px; height: 22px; }
  .ckmain input[type=text] { padding: 11px 4px; }

  /* 分頁列可以左右滑，不會一個字一行 */
  .segtabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; scrollbar-width: none; gap: 18px; }
  .segtabs::-webkit-scrollbar { display: none; }
  .segtabs a { flex: none; padding: 8px 0; }

  /* 篩選、新增：收成兩顆按鈕 */
  .mtools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
  .fold > summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; padding: 0 14px; border: 1px solid var(--navy); color: var(--navy); font-weight: 700; font-size: 14px; border-radius: 3px; background: var(--surface); }
  .fold > summary::-webkit-details-marker { display: none; }
  .fold > summary .num { background: var(--amber); color: var(--navy); border-radius: 8px; padding: 0 6px; font-size: 12px; }
  .fold[open] > summary { background: var(--navy); color: var(--paper); }
  .mtools .fold[open] { flex: 1 1 100%; order: 2; }
  .mtools .fold[open] > summary { margin-bottom: 8px; }
  .filters select { max-width: none; flex: 1 1 45%; }

  /* 任務看板：一次一欄 */
  .coltabs { display: flex; position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 2px solid var(--navy); margin: 6px -14px 8px; padding: 0 14px; }
  .coltabs button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; color: var(--muted); font-weight: 700; border-radius: 0; }
  .coltabs button.on { color: var(--navy); border-bottom-color: var(--amber); }
  .columns .col h2 { display: none; }
  .columns[data-show=todo] .col:not([data-col=todo]),
  .columns[data-show=doing] .col:not([data-col=doing]),
  .columns[data-show=done] .col:not([data-col=done]) { display: none; }
  .card { padding: 12px; }
  .cardtop .tktitle { font-size: 15.5px; }

  /* 詳情頁：內容／討論分頁 */
  .mhead { flex: none; padding: 10px 14px 0; font-weight: 900; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mtabs { display: flex; flex: none; background: var(--paper); border-bottom: 2px solid var(--navy); }
  .mtabs button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; color: var(--muted); font-weight: 700; border-radius: 0; min-height: 44px; }
  .mtabs button.on { color: var(--navy); border-bottom-color: var(--amber); }
  .mtabs .num { font-size: 12px; background: var(--line); border-radius: 8px; padding: 0 6px; margin-left: 2px; }
  .itemgrid[data-tab] { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
  .itemgrid[data-tab=side] .itemchat, .itemgrid[data-tab=chat] .itemside { display: none; }
  .itemgrid[data-tab=side] .itemside { flex: 1; overflow-y: auto; }
  .itemgrid[data-tab=chat] .itemchat { flex: 1; height: auto; min-height: 0; border-top: 0; }
  .itemgrid[data-tab=chat] .chatlabel { display: none; }

  /* 詳情欄位：標籤和值放同一行，畫面省一半 */
  .itemside .form .field { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 8px; margin-bottom: 8px; }
  .itemside .form .field label { margin: 0; font-size: 13.5px; color: var(--muted); }
  .itemside .form .field:has(textarea) { display: block; }
  .itemside .form .field:has(textarea) label { margin-bottom: 4px; }

  /* 工作清單：表格改成一張張卡片 */
  .itemtable thead { display: none; }
  .itemtable tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.board.itemtable td { padding: 0; border: 0; font-size: 13.5px; color: var(--muted); }
  table.board.itemtable td:nth-child(1)::after, table.board.itemtable td:nth-child(3)::after { content: "·"; margin-left: 10px; color: var(--line); }
  .itemtable td:nth-child(2) { flex: 0 0 100%; order: -1; font-size: 15.5px; }
  .itemtable td:nth-child(5) { margin-left: auto; }
  .itemtable tbody tr:hover { background: none; }

  /* 聊天頁頂端：返回頻道列表 */
  .mback { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 40px; margin-left: -8px; font-size: 30px; line-height: 1; color: var(--navy); text-decoration: none; }
  .chrow { padding: 14px 2px; }
}

/* ───── 左側選單收合（桌機、平板） ───── */
.sidehead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.navc-btn { position: relative; width: 32px; height: 32px; min-height: 0; padding: 0; flex: none; background: none; border: 0; border-radius: 3px; color: var(--paper); opacity: .75; }
.navc-btn:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
/* 三條線 */
.navc-btn span, .navc-btn span::before, .navc-btn span::after { position: absolute; left: 8px; width: 16px; height: 2px; background: currentColor; content: ""; }
.navc-btn span { top: 15px; }
.navc-btn span::before { top: -5px; left: 0; }
.navc-btn span::after { top: 5px; left: 0; }
.navc-btn.dot::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.navc-btn:not(.dot)::after { display: none; }
@media (min-width: 861px) {
  body.navc aside { width: 52px; }
  body.navc aside > *:not(.sidehead) { display: none; }
  body.navc .sidehead { padding: 14px 10px; justify-content: center; }
  body.navc .sidehead .wm { display: none; }
}
@media (max-width: 860px) { .navc-btn { display: none; } }
.chatempty { color: var(--muted); font-size: 14px; text-align: center; margin: 32px 12px; }
