:root {
  --bg: #08110d;
  --surface: #0f1b16;
  --surface-raised: #15251d;
  --surface-soft: #1b3025;
  --line: #294238;
  --line-strong: #3b6552;
  --text: #f2f7f4;
  --muted: #9eb5a9;
  --primary: #62d394;
  --primary-strong: #3eb77a;
  --primary-ink: #06120c;
  --warning: #edc86f;
  --danger: #ef8185;
  --danger-bg: #422326;
  --shadow: 0 24px 70px rgb(0 0 0 / 38%);
  --radius: 14px;
  --sidebar: 178px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(900px 600px at 8% -10%, rgb(39 111 76 / 38%), transparent 60%),
    radial-gradient(800px 520px at 96% 5%, rgb(92 103 52 / 24%), transparent 58%),
    linear-gradient(135deg, #07100c, #0a1510 55%, #07110d);
  background-size: 120% 120%, 130% 130%, 100% 100%;
  animation: ambient-shift 16s ease-in-out infinite alternate;
}

@keyframes ambient-shift {
  from { background-position: 0% 0%, 100% 0%, 0 0; }
  to { background-position: 8% 6%, 92% 8%, 0 0; }
}

button, input, textarea, select { font: inherit; }
button, .button { min-height: 38px; }
button, .button, input, textarea, select { border: 1px solid var(--line); border-radius: 10px; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  color: var(--text);
  background: var(--surface-soft);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
button:hover, .button:hover { border-color: var(--line-strong); transform: translateY(-1px); }
button:disabled, .button.disabled { cursor: not-allowed; opacity: 0.5; transform: none; }
button:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible, .dropzone:focus-visible {
  outline: 3px solid rgb(98 211 148 / 28%);
  outline-offset: 2px;
  border-color: var(--primary);
}
input, textarea, select {
  width: 100%;
  min-height: 42px;
  padding: 0.62rem 0.72rem;
  color: var(--text);
  background: #09130f;
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: auto; accent-color: var(--primary); }
a { color: #89ddb1; }
code { overflow-wrap: anywhere; color: #c9ead8; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0.35rem; font-size: clamp(1.45rem, 2.2vw, 2rem); letter-spacing: -0.02em; }
h2 { margin: 1.2rem 0 0.65rem; font-size: 1.06rem; }
h3 { font-size: 0.98rem; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.wide { width: 100%; }
.primary { color: var(--primary-ink); font-weight: 750; background: var(--primary); border-color: var(--primary); }
.primary:hover { background: #77dda4; border-color: #77dda4; }
.secondary { background: #1c382a; border-color: #355c48; }
.ghost { background: transparent; }
.danger { color: #fff; background: var(--danger-bg); border-color: #7d4147; }
.danger:hover { background: #5b2d31; }
.danger-text { color: var(--danger) !important; }
.compact-btn { min-height: 32px; padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.eyebrow { margin-bottom: 0.35rem !important; color: var(--primary) !important; font-size: 0.72rem !important; font-weight: 800; letter-spacing: 0.13em; }

.brand-row { display: flex; align-items: center; gap: 0.75rem; }
.brand-icon { width: 48px; height: 48px; flex: 0 0 auto; border-radius: 13px; object-fit: cover; box-shadow: 0 10px 30px rgb(0 0 0 / 28%); }
.brand-row.compact { gap: 0.6rem; }
.compact .brand-icon { width: 38px; height: 38px; border-radius: 10px; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(440px, 540px);
  align-items: stretch;
}
.auth-intro { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 100vh; padding: clamp(3rem, 8vw, 8rem); overflow: hidden; }
.auth-brand, .auth-lead, .feature-list, .auth-live { position: relative; z-index: 1; }
.auth-brand h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.5rem); }
.auth-brand .brand-icon { width: 66px; height: 66px; border-radius: 18px; }
.auth-lead { max-width: 650px; margin: 2rem 0; color: #d1e4d9; font-size: clamp(1.1rem, 2vw, 1.45rem); line-height: 1.65; }
.feature-list { display: grid; gap: 0.7rem; max-width: 650px; }
.feature-list article { display: flex; justify-content: space-between; gap: 2rem; padding: 0.9rem 1rem; border: 1px solid rgb(75 118 95 / 46%); border-radius: 12px; background: rgb(12 27 20 / 62%); backdrop-filter: blur(12px); }
.feature-list span { color: var(--muted); text-align: right; }
.auth-live { display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 2rem; color: var(--muted); font-size: 0.85rem; }
.mobile-auth-brand { display: none; }
.auth-card { align-self: center; width: calc(100% - 2.5rem); max-height: calc(100vh - 2.5rem); margin: 1.25rem; padding: clamp(1.35rem, 3vw, 2.1rem); overflow-y: auto; border: 1px solid var(--line); border-radius: 24px; background: rgb(14 27 21 / 94%); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.auth-copy h2 { margin: 0 0 0.4rem; font-size: 1.45rem; }
.auth-copy p:last-child { margin-bottom: 0; color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin: 1.35rem 0; padding: 0.3rem; border: 1px solid var(--line); border-radius: 12px; background: #09140f; }
.tab { min-height: 36px; background: transparent; border-color: transparent; }
.tab.active { color: var(--text); background: #213b2d; border-color: #39634d; }
.stack { display: grid; gap: 0.62rem; }
.stack label:not(.check) { margin-top: 0.15rem; color: #dce9e2; font-size: 0.86rem; font-weight: 650; }
.field-hint { margin: -0.35rem 0 0.1rem; color: var(--muted); font-size: 0.76rem; }
.check { display: flex; align-items: flex-start; gap: 0.55rem; color: var(--muted); font-size: 0.86rem; }
.remember-row { align-items: center; margin: 0.35rem 0; }
.remember-row span { display: grid; gap: 0.12rem; }
.remember-row strong { color: var(--text); font-size: 0.86rem; }
.remember-row small { color: var(--muted); font-size: 0.72rem; }
.login-submit { min-height: 46px; margin-top: 0.25rem; }
.form-message { min-height: 1.35rem; margin: 0.8rem 0 0; color: var(--warning); font-size: 0.86rem; }
.form-message.error { color: var(--danger); }
.access-note { margin: 0.8rem 0 0; padding-top: 0.9rem; overflow-wrap: anywhere; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.79rem; line-height: 1.55; }

.app-shell { min-height: 100vh; background: rgb(5 13 10 / 32%); }
.topbar { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: var(--sidebar) minmax(280px, 700px) 1fr; align-items: center; gap: 1.25rem; min-height: 66px; padding: 0.68rem 1rem; border-bottom: 1px solid var(--line); background: rgb(8 17 13 / 92%); backdrop-filter: blur(16px); }
.top-brand strong { display: block; font-size: 0.9rem; }
.user-badge { display: block; max-width: 120px; overflow: hidden; color: var(--muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.global-search-wrap { position: relative; }
.global-search-wrap input { min-height: 42px; padding-right: 7.2rem; border-radius: 12px; background: #0b1712; }
.search-scope { position: absolute; top: 50%; right: 0.65rem; transform: translateY(-50%); padding: 0.22rem 0.45rem; border-radius: 6px; color: var(--muted); background: #17291f; font-size: 0.7rem; pointer-events: none; }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.7rem; }
.connection { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.76rem; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 3px rgb(237 200 111 / 11%); }
.connection.online .status-dot, .auth-live.online .status-dot { background: var(--primary); box-shadow: 0 0 0 3px rgb(98 211 148 / 12%); }
.connection.offline .status-dot, .auth-live.offline .status-dot { background: var(--danger); }
.account-menu { position: relative; }
.account-menu summary { display: flex; align-items: center; min-height: 38px; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; list-style: none; }
.account-menu summary::-webkit-details-marker, .row-menu summary::-webkit-details-marker { display: none; }
.menu-popover { position: absolute; top: calc(100% + 0.45rem); right: 0; z-index: 60; display: grid; min-width: 160px; padding: 0.35rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); box-shadow: var(--shadow); }
.menu-popover button { justify-content: flex-start; border: 0; background: transparent; }

.workspace { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); max-width: 1600px; margin: 0 auto; }
.side-nav { position: sticky; top: 66px; align-self: start; display: flex; flex-direction: column; gap: 0.28rem; min-height: calc(100vh - 66px); padding: 1rem 0.55rem; border-right: 1px solid rgb(41 66 56 / 50%); }
.nav-item { display: grid; justify-items: start; gap: 0.12rem; min-height: 52px; padding: 0.55rem 0.72rem; color: var(--muted); background: transparent; border-color: transparent; }
.nav-item span { font-size: 0.9rem; }
.unread-badge, .member-unread { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; color: #fff; background: #d84f59; font-style: normal; font-size: 0.66rem; font-weight: 800; line-height: 1; }
.nav-item small { color: #708b7e; font-size: 0.68rem; }
.nav-item.active { color: var(--text); background: #183027; border-color: #315444; }
.nav-item.active small { color: #98bcaa; }
.side-status { display: grid; gap: 0.15rem; margin-top: auto; padding: 0.7rem; border: 1px solid var(--line); border-radius: 11px; background: rgb(15 27 22 / 72%); }
.side-status span, .side-status small { color: var(--muted); font-size: 0.68rem; }
.side-status strong { font-size: 0.8rem; }
.content { min-width: 0; padding: clamp(1rem, 2vw, 1.65rem); }
.panel { min-width: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.section-heading h1 { margin-bottom: 0.28rem; }
.section-heading p { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.compact-heading { align-items: center; }
.notice, .admin-note { margin-bottom: 0.9rem; padding: 0.72rem 0.82rem; border: 1px solid #6d6039; border-radius: 10px; color: #ead9a8; background: #332e1e; font-size: 0.84rem; line-height: 1.55; }
.notice.soft, .admin-note { border-color: var(--line); color: var(--muted); background: #101d17; }
.danger-note { border-color: #744046; color: #f0b9bc; background: #301e20; }

.file-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.7rem; margin-bottom: 0.7rem; }
.path-row, .toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.button input[type="file"] { display: none; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem; min-width: 120px; color: var(--muted); }
.crumb { min-height: 30px; padding: 0.22rem 0.35rem; border-color: transparent; background: transparent; color: var(--muted); font-size: 0.8rem; }
.crumb.current { color: var(--text); cursor: default; }
.crumb-sep { color: #62796d; }
.load-state { min-width: 4.5rem; color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.load-state.busy::before { content: ""; display: inline-block; width: 0.48rem; height: 0.48rem; margin-right: 0.35rem; border: 2px solid #3d6652; border-top-color: var(--primary); border-radius: 50%; animation: loading-spin 700ms linear infinite; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
.dropzone { margin-bottom: 0.75rem; padding: 0.7rem 1rem; border: 1px dashed var(--line-strong); border-radius: 11px; text-align: center; color: var(--muted); background: rgb(15 27 22 / 55%); font-size: 0.8rem; transition: border-color 150ms ease, background 150ms ease; }
.dropzone.dragover { border-color: var(--primary); color: var(--text); background: #173527; }
.upload-progress { margin-bottom: 0.75rem; padding: 0.65rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); font-size: 0.8rem; }
.progress-track { width: 100%; height: 6px; margin-top: 0.45rem; border: 0; border-radius: 999px; color: var(--primary); background: #07100c; }
.progress-track::-webkit-progress-bar { border-radius: 999px; background: #07100c; }
.progress-track::-webkit-progress-value { border-radius: 999px; background: var(--primary); }

.table-wrap { overflow: visible; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.file-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.file-table th, .file-table td { height: 54px; padding: 0.58rem 0.72rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.file-table th { height: 42px; color: var(--muted); background: #0d1813; font-size: 0.73rem; font-weight: 700; letter-spacing: 0.025em; }
.file-table th:first-child { width: 38%; }
.file-table tr:last-child td { border-bottom: 0; }
.file-table tbody tr:hover { background: #14271e; }
.file-table tbody[aria-busy="true"] { opacity: 0.62; }
.file-primary { min-width: 0; }
.file-name-wrap { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.file-ext { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid #3d6652; border-radius: 9px; color: #bde8d1; background: #193426; font-size: 0.63rem; font-weight: 800; text-transform: uppercase; }
.file-name { min-width: 0; min-height: auto; padding: 0; overflow: hidden; border: 0; color: var(--text); background: transparent; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { color: #91e2b7; transform: none; }
.file-name-static { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-kind, .file-updated, .file-size { color: var(--muted); font-size: 0.8rem; }
.file-size { white-space: nowrap; }
.actions-col { width: 138px; }
.row-action-cell { overflow: visible; }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.35rem; }
.row-actions > button { min-height: 32px; padding: 0.3rem 0.55rem; font-size: 0.76rem; }
.row-menu { position: relative; }
.row-menu summary { display: inline-flex; align-items: center; min-height: 32px; padding: 0.3rem 0.55rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 0.76rem; list-style: none; }
.row-menu .menu-popover { top: calc(100% + 0.3rem); min-width: 148px; }
.row-menu[open] { z-index: 20; }
.governance-menu summary { border-color: #5f7040; color: #f4dfa4; background: #2c2b1b; }
.empty-row { height: auto !important; padding: 2.2rem 1rem !important; color: var(--muted); text-align: center !important; }

.search-results { display: grid; gap: 0.55rem; }
.search-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.8rem 0.9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.search-result strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-meta { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.25rem; color: var(--muted); font-size: 0.76rem; }
.scope-pill { padding: 0.12rem 0.4rem; border: 1px solid var(--line); border-radius: 999px; color: #b8dfca; background: #173026; }

.messages-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 620px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.member-pane { min-width: 0; padding: 0.75rem; border-right: 1px solid var(--line); background: #0c1712; }
.member-pane > input { margin-bottom: 0.65rem; }
.member-list { display: grid; gap: 0.35rem; max-height: 550px; overflow: auto; }
.member-item { position: relative; display: grid; justify-items: start; gap: 0.1rem; width: 100%; min-height: 52px; padding: 0.55rem 2.2rem 0.55rem 0.65rem; background: transparent; border-color: transparent; text-align: left; }
.member-unread { position: absolute; top: 50%; right: 0.55rem; transform: translateY(-50%); }
.member-item strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.member-item small { color: var(--muted); font-size: 0.7rem; }
.member-item.active { background: #1a3428; border-color: #37604b; }
.member-item.self { cursor: default; opacity: 0.65; }
.chat-pane { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 620px; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 72px; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); }
.chat-header h2 { margin: 0 0 0.15rem; }
.chat-header p { margin: 0; font-size: 0.76rem; }
.chat-header-actions { display: flex; gap: 0.35rem; }
.chat-history { display: flex; flex-direction: column; gap: 0.55rem; min-height: 0; padding: 0.9rem; overflow-y: auto; background: #09130f; }
.message-bubble { position: relative; align-self: flex-start; width: min(78%, 680px); padding: 0.65rem 0.72rem; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; background: #14241c; }
.message-bubble.mine { align-self: flex-end; border-color: #39634d; border-radius: 12px 12px 4px 12px; background: #1b392a; }
/* Right padding keeps the timestamp clear of the corner delete button. */
.message-meta { display: flex; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.3rem; padding-right: 1.35rem; color: var(--muted); font-size: 0.68rem; }
.message-text { margin: 0; color: #e4eee8; font-size: 0.85rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-recalled { margin: 0; color: var(--muted); font-size: 0.78rem; font-style: italic; }
.message-actions { display: flex; justify-content: flex-end; align-items: center; min-height: 8px; margin-top: 0.28rem; }
.message-recall { min-height: 26px; padding: 0.18rem 0.42rem; color: var(--muted); font-size: 0.68rem; }
.message-recall:hover { color: var(--text); }
.attachment-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.55rem; margin-top: 0.55rem; padding: 0.55rem; border: 1px solid var(--line); border-radius: 9px; background: #0d1a14; }
.attachment-card strong, .attachment-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-card small { margin-top: 0.12rem; color: var(--muted); font-size: 0.7rem; }
.attachment-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.25rem; }
.attachment-actions button { min-height: 30px; padding: 0.25rem 0.48rem; font-size: 0.72rem; }
/* Corner affordance instead of a repeated text label under every bubble. */
.message-delete { position: absolute; top: 0.18rem; right: 0.3rem; display: grid; place-items: center; width: 20px; min-width: 20px; height: 20px; min-height: 20px; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 0.9rem; line-height: 1; opacity: 0; transition: opacity 120ms ease, color 120ms ease; }
.message-bubble:hover .message-delete, .message-delete:focus-visible { opacity: 1; }
.message-delete:hover { color: var(--danger); background: rgba(0, 0, 0, 0.28); transform: none; }
/* Touch pointers never hover, so keep it faintly visible there. */
@media (hover: none) {
  .message-delete { opacity: 0.55; }
}
.chat-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.55rem; padding: 0.75rem; border-top: 1px solid var(--line); }
.chat-attachment-toolbar { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.chat-attachment-toolbar button { min-width: 0; }
.chat-attachment-toolbar span { margin-left: auto; font-size: 0.72rem; }
.chat-dropzone { grid-column: 1 / -1; padding: 0.45rem 0.65rem; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted); background: #0b1712; text-align: center; font-size: 0.72rem; transition: 150ms ease; }
.chat-dropzone.dragover, .chat-dropzone.busy { border-color: var(--primary); color: var(--text); background: #173527; }
.chat-composer textarea { resize: vertical; }
.chat-composer button { min-width: 86px; }
.file-picker-modal { width: min(620px, calc(100% - 1.5rem)); }
.file-picker-list { display: grid; gap: 0.4rem; min-height: 160px; max-height: min(480px, 55vh); overflow: auto; }
.file-picker-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.65rem; align-items: center; width: 100%; padding: 0.65rem 0.7rem; text-align: left; }
.file-picker-item .file-ext { width: 30px; height: 30px; }
.file-picker-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-picker-item small { color: var(--muted); }
.file-picker-folder-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.4rem; align-items: center; }
.file-picker-folder-row > .secondary { white-space: nowrap; }

.help-heading { align-items: center; }
.security-state { padding: 0.42rem 0.68rem; border: 1px solid #2c684c; border-radius: 999px; color: #aee5c5; background: #10251b; font-size: 0.76rem; white-space: nowrap; }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.wide-card { grid-column: 1 / -1; }
.info-card, .card-row { padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.info-card h2 { margin: 0; font-size: 1rem; }
.info-card p, .info-card li { color: var(--muted); font-size: 0.82rem; line-height: 1.6; }
.info-card ol { padding-left: 1.25rem; }
.card-kicker { margin: 0 0 0.18rem; color: var(--primary) !important; font-size: 0.7rem !important; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.quickstart-card { padding: 1.15rem; border-color: var(--line-strong); background: var(--surface-soft); }
.recommend-badge, .risk-badge { padding: 0.35rem 0.58rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.recommend-badge, .low-risk { color: #092016; background: var(--primary); }
.quickstart-list { counter-reset: quickstep; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin: 0.85rem 0; padding: 0 !important; list-style: none; }
.quickstart-list li { counter-increment: quickstep; min-height: 92px; padding: 0.72rem; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: #0b1712; }
.quickstart-list li::before { content: counter(quickstep); display: grid; place-items: center; width: 24px; height: 24px; margin-bottom: 0.45rem; border-radius: 50%; color: #092016; background: var(--primary); font-size: 0.72rem; font-weight: 800; }
.quickstart-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.quickstart-actions a { margin-left: auto; color: var(--primary); font-size: 0.78rem; font-weight: 650; overflow-wrap: anywhere; }
.card-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.card-heading p { margin: 0.18rem 0 0; }
.decision-card { border-color: #315d48; }
.mode-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.55rem; margin-top: 0.85rem; }
.mode-guide-item { display: grid; gap: 0.26rem; padding: 0.72rem; border: 1px solid var(--line); border-radius: 10px; background: #0b1712; }
.mode-guide-item strong { font-size: 0.82rem; }
.mode-guide-item span { color: #c5ddd1; font-size: 0.74rem; }
.mode-guide-item small { color: var(--muted); font-size: 0.69rem; line-height: 1.45; }
.mode-guide-item.recommended { border-color: #3f8a64; background: #10271c; }
.mode-guide-item.higher-risk { border-color: #705f2f; }
.decision-note { margin: 0.7rem 0 0 !important; padding: 0.62rem 0.72rem; border-left: 3px solid #d6ac4f; color: #decf9f !important; background: #211d12; }
.switch { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--text); white-space: nowrap; }
.sync-settings { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.5fr); gap: 0.9rem; }
.sync-settings fieldset { display: grid; gap: 0.45rem; margin: 0; padding: 0.7rem; border: 1px solid var(--line); border-radius: 11px; }
.sync-settings legend { padding: 0 0.35rem; color: var(--muted); font-size: 0.8rem; }
.mode-option { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.55rem; border-radius: 9px; color: var(--muted); }
.mode-option:has(input:checked) { color: var(--text); background: #183127; }
.mode-option span { display: grid; gap: 0.12rem; }
.mode-option strong { font-size: 0.84rem; }
.mode-option small { color: var(--muted); font-size: 0.73rem; line-height: 1.4; }
.sync-options { display: grid; align-content: start; gap: 0.55rem; }
.sync-options > label:not(.check) { color: var(--muted); font-size: 0.8rem; }
.sync-folder-settings { grid-column: 1 / -1; display: grid; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 11px; background: #0c1712; }
.sync-folder-settings > label:not(.check) { color: var(--muted); font-size: 0.8rem; }
.sync-folder-settings small { color: var(--muted); line-height: 1.5; }
.sync-folder-row { display: flex; align-items: center; gap: 0.55rem; }
.sync-folder-row code { flex: 1; min-width: 0; padding: 0.55rem; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; color: #c7dfd2; background: #07100c; text-overflow: ellipsis; white-space: nowrap; }
.setup-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.sync-settings .card-actions { grid-column: 1 / -1; }
.release-list { display: grid; gap: 0.45rem; }
.release-row { display: grid; grid-template-columns: minmax(140px, 0.65fr) minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; padding: 0.65rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: #0c1712; }
.release-row small { color: var(--muted); }
.access-list { display: grid; gap: 0; margin: 0.65rem 0 0.7rem; }
.access-list > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 0.65rem; padding: 0.62rem 0; border-top: 1px solid var(--line); }
.access-list dt { color: var(--muted); font-size: 0.74rem; }
.access-list dd { display: grid; gap: 0.18rem; margin: 0; min-width: 0; }
.access-list a, .access-list code { color: #c9f2dc; overflow-wrap: anywhere; }
.access-list small { color: var(--muted); font-size: 0.68rem; }
.subtle-link { color: var(--primary); font-size: 0.78rem; }
.safety-checklist { display: grid; gap: 0.58rem; margin: 0.7rem 0 0; padding: 0 !important; list-style: none; }
.safety-checklist li { position: relative; padding-left: 1.35rem; color: #d2e5da; }
.safety-checklist li::before { content: ""; position: absolute; left: 0; top: 0.5rem; width: 7px; height: 7px; border: 2px solid var(--primary); border-radius: 50%; }
.faq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.7rem; }
.faq-grid details { padding: 0.68rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: #0b1712; }
.faq-grid summary { cursor: pointer; color: #d9ece2; font-size: 0.8rem; font-weight: 650; }
.faq-grid details[open] { border-color: #356c50; }
.faq-grid p { margin: 0.55rem 0 0; }
.boundary-card p { margin: 0.58rem 0 0; }
.boundary-card strong { color: #d8eee2; }
.card-list { display: grid; gap: 0.55rem; margin-bottom: 1.35rem; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.card-meta { margin-top: 0.28rem; color: var(--muted); font-size: 0.76rem; overflow-wrap: anywhere; }
.card-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.storage-status { padding: 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--surface); font-size: 0.74rem; }
.storage-status.warning { border-color: #8a6d2f; color: #ffe29a; background: #352d18; }

.modal { width: 480px; max-width: calc(100vw - 1.5rem); max-height: calc(100vh - 1.5rem); padding: 1.1rem; overflow: auto; border: 1px solid var(--line-strong); border-radius: 16px; color: var(--text); background: var(--surface-raised); box-shadow: var(--shadow); }
.modal::backdrop { background: rgb(0 0 0 / 66%); backdrop-filter: blur(4px); }
.modal h2 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.update-modal { width: 540px; }
.update-notes { padding: 0.8rem 0.9rem; border: 1px solid var(--line); border-radius: 11px; color: #dcebe3; background: #0b1712; font-size: 0.84rem; line-height: 1.65; white-space: pre-wrap; }
.modal fieldset { display: grid; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 10px; }
.modal legend { padding: 0 0.3rem; color: var(--muted); font-size: 0.8rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.45rem; margin-top: 0.5rem; }
.preview-modal { width: min(1100px, calc(100% - 1.5rem)); height: min(780px, calc(100vh - 1.5rem)); padding: 0; overflow: hidden; }
.markdown-editor-modal { width: min(980px, calc(100% - 1.5rem)); padding: 0; }
.markdown-editor-modal form { gap: 0; }
.markdown-editor-modal textarea { min-height: min(62vh, 620px); margin: 0 1rem; resize: vertical; border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.55; tab-size: 2; }
.markdown-editor-modal .dialog-actions { padding: 0.8rem 1rem 1rem; }
.preview-header { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.preview-header h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-header p { margin-bottom: 0; }
.preview-body { height: calc(100% - 90px); padding: 1rem; overflow: auto; background: #09130f; }
.preview-body img { display: block; max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; }
.preview-body iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }
.preview-text { margin: 0; color: #d9e8df; font: 0.84rem/1.6 Consolas, "SFMono-Regular", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.markdown-preview { max-width: 860px; margin: 0 auto; color: #dcebe3; line-height: 1.7; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 { margin-top: 1.2em; }
.markdown-preview pre { overflow: auto; padding: 0.8rem; border: 1px solid var(--line); border-radius: 9px; background: #07100c; }
.preview-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.preview-table { min-width: 600px; border-collapse: collapse; }
.preview-table td { padding: 0.45rem 0.55rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #dce9e2; font-size: 0.78rem; white-space: pre-wrap; }
.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: grid; gap: 0.45rem; width: min(380px, calc(100% - 2rem)); }
.toast { padding: 0.75rem 0.9rem; border: 1px solid var(--line-strong); border-radius: 11px; color: var(--text); background: #182b22; box-shadow: var(--shadow); font-size: 0.84rem; }
.toast.error { border-color: #82444a; background: #3b2326; }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; place-items: center; padding: 1rem; }
  .auth-intro { display: none; }
  .auth-card { width: min(520px, 100%); max-height: none; margin: 0; }
  .mobile-auth-brand { display: flex; margin-bottom: 1.2rem; }
  .mobile-auth-brand h1 { margin: 0; font-size: 1.45rem; }
  .mobile-auth-brand p { margin: 0; color: var(--muted); font-size: 0.82rem; }
  .topbar { grid-template-columns: var(--sidebar) minmax(250px, 1fr) auto; gap: 0.7rem; }
  .connection { display: none; }
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; padding: 0.55rem 0.7rem; }
  .top-brand { display: none; }
  .global-search-wrap { grid-column: 1; }
  .top-actions { grid-column: 2; }
  .workspace { grid-template-columns: 1fr; }
  .side-nav { position: fixed; inset: auto 0 0; top: auto; z-index: 40; display: grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(82px, 1fr); min-height: 0; padding: 0.4rem max(0.4rem, env(safe-area-inset-right)) calc(0.4rem + env(safe-area-inset-bottom)) max(0.4rem, env(safe-area-inset-left)); overflow-x: auto; border-top: 1px solid var(--line); border-right: 0; background: rgb(8 17 13 / 96%); backdrop-filter: blur(16px); }
  .side-nav { scrollbar-width: none; overscroll-behavior-x: contain; }
  .side-nav::-webkit-scrollbar { display: none; }
  .nav-item { justify-items: center; min-height: 48px; padding: 0.35rem 0.2rem; }
  .nav-item small { display: none; }
  .side-status { display: none; }
  .content { padding: 1rem 0.7rem calc(5.2rem + env(safe-area-inset-bottom)); }
  .help-grid, .sync-settings { grid-template-columns: 1fr; }
  .quickstart-list, .mode-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sync-settings .card-actions { grid-column: 1; }
  .file-table { min-width: 0; table-layout: auto; }
  .file-table thead { display: none; }
  .file-table tbody { display: grid; gap: 0.5rem; padding: 0.5rem; }
  .file-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; padding: 0.7rem; border: 1px solid var(--line); border-radius: 11px; background: #101e18; }
  .file-table td { height: auto; padding: 0; border: 0; }
  .file-table .file-primary { grid-column: 1; grid-row: 1; }
  .file-table .row-action-cell { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .file-table .file-kind, .file-table .file-updated, .file-table .file-size { grid-column: 1; }
  .file-table .file-kind, .file-table .file-size { display: inline; }
  .row-actions { justify-content: flex-end; }
  .row-actions > button { display: none; }
  .file-table tbody tr:hover { background: #14271e; }
  .file-ext { width: 32px; height: 32px; }
  .dropzone { display: none; }
  .search-result { grid-template-columns: 1fr; }
  .release-row { grid-template-columns: 1fr auto; }
  .release-row small { grid-column: 1 / -1; }
  .card-row { align-items: flex-start; flex-direction: column; }
  .messages-layout { grid-template-columns: 1fr; min-height: 660px; }
  .member-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .member-list { display: flex; max-height: none; overflow-x: auto; }
  .member-item { flex: 0 0 150px; }
  .chat-pane { min-height: 500px; }
  .message-bubble { width: 92%; }
}

@media (max-width: 520px) {
  .auth-shell { padding: 0; place-items: stretch; }
  .auth-card { min-height: 100vh; width: 100%; padding: 1.1rem; border: 0; border-radius: 0; }
  .auth-tabs { grid-template-columns: 1fr; }
  .global-search-wrap input { padding-right: 0.7rem; }
  .search-scope { display: none; }
  .account-menu summary { min-width: 42px; overflow: hidden; font-size: 0; }
  .account-menu summary::after { content: "账户"; font-size: 0.78rem; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .file-controls { align-items: stretch; }
  .path-row { width: 100%; }
  .toolbar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .toolbar-actions > * { min-width: 0; padding-inline: 0.35rem; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .dialog-actions > * { min-width: 0; white-space: normal; }
  .preview-modal { width: 100%; height: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .preview-header { padding: 0.75rem; }
  .preview-body { padding: 0.65rem; }
  .chat-header { align-items: flex-start; flex-direction: column; }
  .chat-header-actions { width: 100%; }
  .chat-header-actions button { flex: 1; }
  .attachment-card { grid-template-columns: 1fr; }
  .attachment-actions { justify-content: flex-start; }
  .chat-attachment-toolbar span { width: 100%; margin-left: 0; }
  .file-picker-folder-row { grid-template-columns: 1fr; }
  .sync-folder-row { align-items: stretch; flex-direction: column; }
  .setup-choice-grid { grid-template-columns: 1fr; }
  .quickstart-list, .mode-guide, .faq-grid { grid-template-columns: 1fr; }
  .quickstart-actions { align-items: stretch; flex-direction: column; }
  .quickstart-actions > * { width: 100%; margin-left: 0; text-align: center; }
  .access-list > div { grid-template-columns: 1fr; gap: 0.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
