/* =========================================================
 * 解家办公 · 客户端样式（高级感 · 清晰界面）
 *   - 深浅自适应（跟随系统）
 *   - 移动端底部标签 / 桌面侧边标签
 *   - 玻璃质感导航 + 柔和阴影 + 精致排版
 * ======================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --txt: #171d2b;
  --dim: #7c8598;
  --line: #e7eaf1;
  --brand: #2c5cf2;
  --brand-2: #6f8dff;
  --gold: #c99a4b;
  --badge: #f04438;
  --bubble-me: linear-gradient(135deg, #2c5cf2, #4f7bff);
  --bubble-bg: #f0f2f8;
  --shadow: 0 8px 32px rgba(23, 29, 43, .08);
  --radius: 16px;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1322;
    --panel: #141b2e;
    --txt: #e9edf6;
    --dim: #7d889e;
    --line: #232c44;
    --bubble-bg: #1c2439;
    --shadow: 0 8px 32px rgba(0, 0, 0, .35);
  }
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--txt);
  overscroll-behavior: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; color: inherit; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- 布局骨架 ---------------- */

.app {
  display: grid;
  grid-template-areas: "main" "tabs";
  grid-template-rows: 1fr auto;
  height: 100dvh;
  max-width: 1180px;
  margin: 0 auto;
}

.main { grid-area: main; position: relative; overflow: hidden; display: flex; }
.view { display: none; flex: 1; flex-direction: column; min-height: 0; }
.view.active { display: flex; }

.tabs {
  grid-area: tabs;
  display: flex;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  z-index: 30;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 5px; border-radius: 14px; color: var(--dim);
  font-size: 11px; position: relative; transition: color .18s;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--brand); }
.tab.active svg { filter: drop-shadow(0 3px 10px rgba(44, 92, 242, .35)); }
.badge {
  position: absolute; top: 4px; right: calc(50% - 24px);
  background: var(--badge); color: #fff; border-radius: 999px;
  font-style: normal; font-size: 10px; min-width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  font-weight: 700;
}

/* ---------------- 通用栏 / 列表 ---------------- */

.bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(14px); z-index: 5;
}
.bar h1 { font-size: 20px; font-weight: 700; letter-spacing: .02em; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: var(--dim); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bubble-bg); color: var(--txt); }

.list, .scroll { flex: 1; overflow-y: auto; min-height: 0; }
.scroll { padding: 18px 18px 30px; }

.item {
  display: flex; align-items: center; gap: 13px; padding: 13px 18px;
  cursor: pointer; transition: background .15s;
}
.item:hover { background: color-mix(in srgb, var(--bubble-bg) 55%, transparent); }
.item .avatar {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; color: #fff;
}
.item .info { flex: 1; min-width: 0; }
.item .info .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.item .name { font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .time { font-size: 11.5px; color: var(--dim); flex-shrink: 0; }
.item .preview {
  font-size: 13px; color: var(--dim); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item .unread {
  background: var(--badge); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 19px; height: 19px; border-radius: 999px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
}
.item .online-dot { width: 8px; height: 8px; border-radius: 50%; background: #12b76a; position: absolute; right: 12px; bottom: 12px; border: 2px solid var(--panel); }

.divider-head {
  font-size: 12px; color: var(--dim); padding: 14px 18px 5px;
  display: flex; justify-content: space-between;
}

/* ---------------- 搜索框 ---------------- */

.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--bubble-bg); border-radius: 12px; padding: 8px 12px;
}
.search svg { width: 17px; height: 17px; color: var(--dim); flex-shrink: 0; }
.search input { flex: 1; border: none; outline: none; background: none; font-size: 14px; }
.search input::placeholder { color: var(--dim); }

/* ---------------- 工作台 ---------------- */

.sec-title { font-size: 13px; color: var(--dim); font-weight: 600; letter-spacing: .08em; margin: 8px 4px 12px; }
.sec-title em { font-style: normal; color: var(--brand); margin-left: 4px; }

.notices .notice {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 12px; cursor: pointer; transition: transform .15s;
}
.notices .notice:active { transform: scale(.985); }
.notice .n-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.notice .n-pin { font-size: 11px; color: var(--gold); border: 1px solid var(--gold); padding: 1px 8px; border-radius: 999px; }
.notice .n-level { font-size: 11px; padding: 1px 8px; border-radius: 999px; }
.notice .n-level.important { background: #fef3c7; color: #b45309; }
.notice .n-level.urgent { background: #fee4e2; color: #b42318; }
.notice .n-level.info { background: #e0eaff; color: #3538cd; }
.notice h4 { font-size: 15.5px; font-weight: 650; }
.notice .n-time { font-size: 11.5px; color: var(--dim); margin-left: auto; }
.notice .n-body { font-size: 13.5px; color: var(--dim); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notice .n-body b { color: var(--txt); }

.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.app-tile {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 8px 13px; text-align: center; text-decoration: none; color: var(--txt);
  transition: transform .15s; display: block;
}
.app-tile:hover { transform: translateY(-2px); }
.app-tile .a-ico { font-size: 30px; display: block; margin-bottom: 8px; }
.app-tile .a-name { font-size: 13.5px; font-weight: 600; }
.app-tile .a-desc { font-size: 11px; color: var(--dim); margin-top: 3px; }

/* ---------------- 我的 ---------------- */

.profile-card {
  background: linear-gradient(135deg, #22355e 0%, #2c5cf2 100%);
  border-radius: 22px; color: #fff; padding: 22px;
  display: flex; align-items: center; gap: 16px; margin-bottom: 18px;
  box-shadow: 0 14px 40px rgba(44, 92, 242, .35);
}
.profile-card .avatar { width: 62px; height: 62px; border-radius: 20px; font-size: 24px; font-weight: 800; }
.profile-card h2 { font-size: 19px; font-weight: 700; }
.profile-card .p-line { font-size: 12.5px; opacity: .85; margin-top: 4px; }

.menu-list { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; font-size: 15px; font-weight: 550; text-align: left;
  border-bottom: 1px solid var(--line); transition: background .15s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--bubble-bg); }
.mi-ico { font-size: 19px; }
.mi-sub { margin-left: auto; font-size: 12px; color: var(--dim); font-weight: 400; }
.ver { text-align: center; color: var(--dim); font-size: 11px; margin-top: 18px; letter-spacing: .06em; }

/* ---------------- 聊天面板 ---------------- */

.chat {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(14px);
}
.chat-title b { font-size: 16.5px; font-weight: 700; display: block; }
.chat-title span { font-size: 11.5px; color: var(--dim); }

.chat-body { flex: 1; overflow-y: auto; padding: 16px 14px 10px; }
.day-sep { text-align: center; margin: 10px 0 14px; }
.day-sep i {
  font-style: normal; font-size: 11px; color: var(--dim);
  background: var(--bubble-bg); padding: 3px 12px; border-radius: 999px;
}

.msg { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-start; }
.msg .avatar { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; flex-shrink: 0; }
.msg .bubble {
  max-width: min(72%, 560px); padding: 10px 14px; font-size: 14.5px; line-height: 1.6;
  border-radius: 4px 16px 16px 16px; background: var(--bubble-bg);
  word-break: break-word; white-space: pre-wrap;
}
.msg .sender { font-size: 11px; color: var(--dim); margin-bottom: 3px; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .bubble { background: var(--bubble-me); color: #fff; border-radius: 16px 4px 16px 16px; }
.msg .bubble img { max-width: 100%; max-height: 260px; border-radius: 10px; display: block; cursor: zoom-in; }
.msg .bubble .file-chip {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit;
  min-width: 160px; padding: 3px 0;
}
.msg.mine .file-chip { color: #fff; }
.file-chip .f-ico { font-size: 22px; }
.file-chip .f-name { font-size: 13.5px; font-weight: 550; word-break: break-all; }
.file-chip .f-size { font-size: 11px; opacity: .7; margin-top: 2px; }

.chat-input {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(14px);
}
.chat-input input#chat-text {
  flex: 1; background: var(--bubble-bg); border: none; outline: none;
  border-radius: 999px; padding: 11px 18px; font-size: 15px;
}
.chat-input .send {
  background: var(--bubble-me); color: #fff; border-radius: 999px;
  padding: 10px 20px; font-size: 14px; font-weight: 650;
  transition: transform .12s, opacity .15s;
}
.chat-input .send:active { transform: scale(.96); }
.chat-input .send[disabled] { opacity: .5; }

/* ---------------- 弹层 ---------------- */

.modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10, 14, 24, .45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--panel); border-radius: 22px; padding: 22px;
  width: 420px; max-width: 100%; max-height: 80dvh; display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .4);
}
.modal-card h3 { font-size: 17px; margin-bottom: 14px; }
.modal-card input#group-name {
  background: var(--bubble-bg); border: none; outline: none; border-radius: 12px;
  padding: 11px 14px; font-size: 14.5px; margin-bottom: 12px;
}
.pick-list { flex: 1; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.pick-item:hover { background: var(--bubble-bg); }
.pick-item .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.pick-item input { width: 17px; height: 17px; accent-color: var(--brand); margin-left: auto; }
.pick-item .sub { font-size: 11.5px; color: var(--dim); }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions button {
  flex: 1; padding: 12px; border-radius: 12px; font-size: 14.5px; font-weight: 600;
  background: var(--bubble-bg);
}
.modal-actions button.primary { background: var(--brand); color: #fff; }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(17, 24, 39, .92); color: #fff; font-size: 13.5px;
  padding: 11px 20px; border-radius: 999px; z-index: 99;
  animation: fade-in .2s; max-width: 86vw; text-align: center;
}
@keyframes fade-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---------------- 桌面端（>=920px） ---------------- */

@media (min-width: 920px) {
  .app {
    grid-template-areas: "tabs main";
    grid-template-columns: 76px 1fr;
    grid-template-rows: 1fr;
  }
  .tabs {
    flex-direction: column; gap: 6px; justify-content: flex-start;
    border-top: none; border-right: 1px solid var(--line);
    padding: 18px 10px; background: color-mix(in srgb, var(--panel) 85%, transparent);
  }
  .tab { flex: none; padding: 13px 0 10px; }
  .badge { right: calc(50% - 26px); top: 6px; }
  .chat { position: absolute; inset: 0 0 0 76px; border-left: 1px solid var(--line); }
  #chat-back svg { transform: rotate(180deg); }
  .bar { padding: 16px 22px; }
  .item { padding: 13px 22px; }
  .scroll { padding: 20px 24px 30px; }
}
