:root {
  --navy: #04253a; --navy-2: #0b3a57; --teal: #00a396; --teal-ink: #007a70; --sand: #f6f3ee;
  --ink: #14212b; --muted: #5b6b77; --line: #d9e1e6; --card: #ffffff; --bg: #eef3f6;
  --mine: #dff5f2; --theirs: #ffffff; --danger: #b42318; --focus: #ffb703; --fb: #1877f2;
  font-family: "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
a { color: var(--teal-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--focus); color: #000; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.1rem; }
.top-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.who { color: #cfe3ee; font-size: .9rem; }
.acct select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid #5d7d92; background: var(--navy-2); color: #fff; }
button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: 8px 14px; }
button:disabled { cursor: not-allowed; opacity: .55; }
.ghost { background: transparent; border-color: currentColor; color: inherit; text-decoration: none; display: inline-block; border-radius: 10px; padding: 7px 12px; }
.top .ghost { color: #fff; border-color: #6f8ea2; }
.small { padding: 5px 10px; font-size: .9rem; }
.primary { background: var(--teal); color: #fff; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--teal-ink); }
.danger { background: #fff; color: var(--danger); border-color: var(--danger); font-weight: 600; }

.status { margin: 0; padding: 6px 20px; min-height: 2em; font-size: .92rem; color: var(--muted); background: #f8fbfc; border-bottom: 1px solid var(--line); }
main { flex: 1; padding: 16px 20px; width: 100%; max-width: 1280px; margin: 0 auto; }

.signin { display: grid; place-items: center; padding: 24px 0; }
.signin-card { background: var(--card); border-radius: 18px; padding: 36px 32px; max-width: 520px; text-align: center; box-shadow: 0 10px 30px rgba(4, 37, 58, .10); }
.signin-card h1 { margin: 14px 0 8px; color: var(--navy); }
.lead { color: var(--muted); line-height: 1.6; }
.fb-btn { display: inline-flex; align-items: center; gap: 10px; margin: 18px 0 8px; padding: 12px 22px; border-radius: 10px; background: var(--fb); color: #fff; font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.fb-btn:hover { background: #0f63d6; }
.fine { color: var(--muted); font-size: .85rem; line-height: 1.6; }
.error { color: var(--danger); background: #fff1f0; border-radius: 8px; padding: 8px 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 2px solid var(--line); }
.tabs [role=tab] { background: transparent; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 16px; color: var(--muted); font-weight: 600; margin-bottom: -2px; }
.tabs [role=tab][aria-selected=true] { color: var(--navy); border-bottom-color: var(--teal); }

.split { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 14px; height: calc(100vh - 230px); min-height: 460px; }
.col { background: var(--card); border-radius: 14px; border: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.col-head h2 { margin: 0; font-size: 1.05rem; color: var(--navy); }
.items { list-style: none; margin: 0; padding: 6px; overflow: auto; }
.item { width: 100%; text-align: left; background: transparent; border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; color: var(--ink); }
.item:hover { background: #f1f6f8; }
.item.current { background: var(--mine); border-color: #9fd9d1; }
.item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-time { color: var(--muted); font-size: .8rem; }
.item-snip { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-item { grid-template-columns: 56px 1fr; align-items: center; }
.media-item img, .thumb { grid-row: span 2; width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #dce7ec; }
.media-item .item-snip { grid-column: 2; }
.empty { color: var(--muted); padding: 14px; }

.bubbles { list-style: none; margin: 0; padding: 14px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; background: var(--sand); }
.bubble { max-width: 72%; padding: 8px 12px; border-radius: 14px; background: var(--theirs); border: 1px solid var(--line); }
.bubble p { margin: 0 0 2px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.bubble time { font-size: .75rem; color: var(--muted); }
.bubble.mine { align-self: flex-end; background: var(--mine); border-color: #a9ddd6; }
.composer { padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.composer textarea { width: 100%; font: inherit; padding: 10px; border-radius: 10px; border: 1px solid #b9c7cf; resize: vertical; }
.composer-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.hint { color: var(--muted); font-size: .85rem; margin: 0 0 6px; }

.caption { margin: 0; padding: 12px 14px; white-space: pre-wrap; border-bottom: 1px solid var(--line); color: var(--ink); background: #fafcfd; }
.comments { list-style: none; margin: 0; padding: 10px 14px; overflow: auto; flex: 1; }
.comment { border-bottom: 1px solid var(--line); padding: 10px 0; }
.c-head { margin: 0; font-size: .9rem; }
.c-head time { color: var(--muted); font-size: .8rem; }
.c-text { margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.replies { list-style: none; margin: 4px 0 8px 18px; padding-left: 12px; border-left: 3px solid var(--line); }
.reply.mine .c-text { color: var(--teal-ink); }
.tag { background: var(--mine); color: var(--teal-ink); border-radius: 6px; padding: 0 6px; margin-left: 6px; font-size: .75rem; }
.composer.inline { border-top: 0; padding: 6px 0 0; }

.account { background: var(--card); border-radius: 14px; border: 1px solid var(--line); padding: 18px 22px; max-width: 760px; line-height: 1.6; }
.account h2 { margin-top: 0; color: var(--navy); }
.account dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.account dt { color: var(--muted); }
.account dd { margin: 0; font-weight: 600; }

.status-list { padding-left: 18px; line-height: 1.7; }

.foot { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; padding: 14px; font-size: .88rem; color: var(--muted); }

.doc { background: var(--card); max-width: 860px; margin: 0 auto; padding: 28px 32px; border-radius: 14px; line-height: 1.75; }
.doc h1 { color: var(--navy); margin-top: 0; }
.doc h2 { color: var(--navy); margin-top: 1.6em; font-size: 1.2rem; }
.doc .lang-sep { border: 0; border-top: 2px dashed var(--line); margin: 36px 0; }
.doc table { border-collapse: collapse; width: 100%; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; height: auto; }
  .col.list { max-height: 40vh; }
  .col.detail { min-height: 60vh; }
  .bubble { max-width: 88%; }
  main { padding: 12px 16px; }
  .doc { padding: 20px 16px; }
}
