/* =========================================================
   Executive Management · violet workspace theme (light)
   ========================================================= */
:root {
  color-scheme: light;
  --font: 'Inter Variable', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --bg: #f7f6fc;
  --surface: #ffffff;
  --surface-2: #f5f3fd;
  --surface-3: #ece8f9;
  --line: #ebe8f4;
  --line-strong: #dcd7ec;
  --ink: #17142c;
  --ink-2: #48455f;
  --muted: #6e6a86;   /* darker grey = easier to read */

  --accent: #6d3ce9;
  --accent-hover: #5f2fdc;
  --accent-deep: #5426cf;
  --accent-soft: #efe9fe;
  --accent-soft-2: #f6f2ff;
  --accent-grad: linear-gradient(135deg, #8d5cf7 0%, #6d3ce9 60%, #5b2ad6 100%);

  --done: #16a34a;      --done-soft: #e6f7ec;    --done-ink: #12773a;
  --forms: #4f46e5;     --forms-soft: #ebebff;   --forms-ink: #3730a3;
  --emails: #059669;    --emails-soft: #e2f6ee;  --emails-ink: #046c4e;
  --outliers: #ea580c;  --outliers-soft: #fff0e6; --outliers-ink: #b8430a;
  --note: #f59e0b;      --note-soft: #fff8e7;    --note-ink: #8a5a06;
  --notdone: #dc2626;   --notdone-soft: #fdecec; --notdone-ink: #a61b1b;
  --danger: #dc2626;    --danger-soft: #fdecec;

  --shadow-xs: 0 1px 2px rgba(23, 20, 44, .05);
  --shadow-sm: 0 1px 3px rgba(23, 20, 44, .06), 0 1px 2px rgba(23, 20, 44, .04);
  --shadow-md: 0 12px 32px -12px rgba(43, 25, 110, .22), 0 2px 6px rgba(23, 20, 44, .05);
  --shadow-lg: 0 28px 64px -16px rgba(43, 25, 110, .35);
  --focus: 0 0 0 3px rgba(109, 60, 233, .25);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3 { font-weight: 750; letter-spacing: -0.022em; margin: 0; line-height: 1.15; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[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; }
svg { flex: none; }
.backdrop { background: radial-gradient(900px 500px at 100% -10%, rgba(141, 92, 247, .10), transparent 60%), var(--bg); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px rgba(109, 60, 233, .8); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.07); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input {
  height: 44px; padding: 0 14px; border-radius: 12px; width: 100%;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
@media (pointer: coarse) { .input { font-size: 16px; } }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }

.alert { border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }

.logo {
  width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: var(--accent-grad); color: #fff; box-shadow: 0 8px 18px -8px rgba(109, 60, 233, .9), inset 0 1px 0 rgba(255,255,255,.25);
}
.logo svg { width: 24px; height: 24px; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; flex: none; display: grid; place-items: center; background: var(--accent-grad); color: #fff; font-weight: 800; font-size: 20px; box-shadow: 0 8px 18px -8px rgba(109, 60, 233, .9); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; font-weight: 650; font-size: 13px; color: #fff;
  background: var(--av, var(--accent));
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar .online { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--done); border: 2px solid #fff; }

/* ---------- dialogs, popovers, toasts ---------- */
dialog.modal {
  border: none; padding: 0; border-radius: 20px; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(23, 20, 44, .35); backdrop-filter: blur(3px); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-body h2 { font-size: 20px; }
.modal-body p { margin: 0; color: var(--ink-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.pop {
  position: fixed; z-index: 60; min-width: 220px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 6px; animation: pop-in .13s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pop-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pop-head strong { display: block; font-size: 14px; }
.pop-head span { color: var(--muted); font-size: 12.5px; }
.pop-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 4px; }
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none;
  padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 500;
}
.pop-item:hover { background: var(--surface-2); }
.pop-item svg { width: 18px; height: 18px; color: var(--muted); }
.pop-item .ic-tile { width: 28px; height: 28px; }
.pop-item .ic-tile svg { width: 16px; height: 16px; }
.pop-item.checked { color: var(--accent); font-weight: 600; }
.pop-item.checked::after { content: '✓'; margin-left: auto; font-weight: 700; }
.pop-sep { height: 1px; background: var(--line); margin: 6px 4px; }

.toast-wrap { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 14px; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-md); font-size: 14px; font-weight: 500; animation: toast-in .2s ease-out; }
.toast.error { background: var(--danger); }
.toast-action { pointer-events: auto; border: 0; background: rgba(255,255,255,.14); color: #cbb6ff; font-weight: 700; font-size: 13.5px; padding: 5px 12px; border-radius: 8px; }
.toast-action:hover { background: rgba(255,255,255,.24); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* icon tiles (sidebar, header, menus) */
.ic-tile { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--ink-2); }
.ic-tile svg { width: 18px; height: 18px; }
.t-feed { background: var(--accent-soft); color: var(--accent); }
.t-done { background: var(--done-soft); color: var(--done); }
.t-forms { background: var(--forms-soft); color: var(--forms); }
.t-emails { background: var(--emails-soft); color: var(--emails); }
.t-outliers { background: var(--outliers-soft); color: var(--outliers); }
.t-notdone { background: var(--notdone-soft); color: var(--notdone); }
.t-search { background: var(--surface-3); color: var(--ink-2); }

/* =========================================================
   Login
   ========================================================= */
.login-page { min-height: 100%; display: grid; place-items: center; padding: 28px 16px; }
.login-shell { width: 100%; max-width: 900px; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.login-art { position: relative; padding: 44px 40px; color: #fff; background: var(--accent-grad); display: flex; flex-direction: column; justify-content: space-between; min-height: 500px; overflow: hidden; }
.login-art::before, .login-art::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); }
.login-art::before { width: 360px; height: 360px; right: -130px; top: -110px; }
.login-art::after { width: 240px; height: 240px; left: -90px; bottom: -100px; }
.login-art h2 { font-size: 34px; line-height: 1.08; position: relative; z-index: 1; font-weight: 800; }
.login-art p { position: relative; z-index: 1; margin: 12px 0 0; opacity: .9; max-width: 320px; }
.art-cards { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.art-card { background: #fff; color: var(--ink); border-radius: 14px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; box-shadow: 0 12px 28px -12px rgba(0,0,0,.4); width: max-content; max-width: 100%; }
.art-card:nth-child(2) { margin-left: 36px; }
.art-card:nth-child(3) { margin-left: 14px; }
.login-form-wrap { padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-head h1 { font-size: 26px; }
.login-sub { color: var(--muted); margin: 0 0 26px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-foot { margin-top: 22px; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; max-width: 420px; }
  .login-art { min-height: 0; padding: 28px 24px; }
  .login-art h2 { font-size: 26px; }
  .art-cards { display: none; }
  .login-form-wrap { padding: 28px 24px 32px; }
}

/* =========================================================
   App shell
   ========================================================= */
.chat-page { overflow: hidden; overscroll-behavior: none; }
.app { position: fixed; inset: 0 0 auto 0; height: var(--app-h, 100dvh); display: grid; grid-template-columns: 292px minmax(0, 1fr); }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; min-height: 0; padding: 22px 18px 18px 22px; border-right: 1px solid var(--line); background: var(--surface); }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 20px; border-bottom: 1px solid var(--line); }
.side-brand h1 { font-size: 17px; line-height: 1.2; }
.presence { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--done); display: inline-block; }
.dot.off { background: var(--muted); }
.side-scroll { flex: 1; overflow-y: auto; min-height: 0; padding-top: 18px; }
.side-label { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 8px 10px; }
.side-group { display: flex; flex-direction: column; gap: 4px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; text-align: left;
  padding: 9px 10px; border-radius: 14px; color: var(--ink); font-weight: 550; font-size: 15px;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item .ic-tile { width: 32px; height: 32px; border-radius: 50%; }
.ws-item .ic-tile { border-radius: 10px; }
.nav-item .count { margin-left: auto; font-size: 12.5px; font-weight: 600; min-width: 26px; height: 24px; display: grid; place-items: center; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.nav-item.active { background: var(--accent-grad); color: #fff; box-shadow: 0 10px 22px -12px rgba(109, 60, 233, .95); }
.nav-item.active .ic-tile { color: #fff !important; background: rgba(255,255,255,.16) !important; }
.nav-item.active .count { background: rgba(255,255,255,.2); color: #fff; }
.nav-item[data-view="feed"] .ic-tile { color: var(--accent); }
.nav-item[data-view="done"] .ic-tile { color: var(--done); }
.nav-item[data-view="notdone"] .ic-tile { color: var(--notdone); }
.ws-item { border: 1px solid var(--line); background: var(--surface); padding: 8px 10px; box-shadow: var(--shadow-xs); }
.ws-item:hover { border-color: var(--line-strong); }
.ws-item.active { border-color: transparent; }
.side-group.ws { gap: 8px; }
.tip { border-radius: 16px; background: var(--accent-soft-2); border: 1px solid #e6dcfd; padding: 16px; font-size: 13.5px; color: var(--ink-2); }
.tip strong { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 15px; margin-bottom: 6px; }
.tip strong svg { width: 18px; height: 18px; }
.side-user { border-top: 1px solid var(--line); padding-top: 14px; }
.me-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: 14px; border: 0; background: none; text-align: left; }
.me-btn:hover { background: var(--surface-2); }
.me-btn .who { min-width: 0; flex: 1; }
.me-btn strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-btn span.role { font-size: 13px; color: var(--muted); }
.me-btn .chev { color: var(--ink-2); width: 18px; height: 18px; }

/* Main column */
.main { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 22px 24px 22px; gap: 18px; }
.topbar { flex: none; display: flex; align-items: center; gap: 16px; }
.search { position: relative; flex: 1; max-width: 640px; }
.search .lead { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); display: grid; color: var(--ink-2); pointer-events: none; }
.search .lead svg { width: 20px; height: 20px; }
.search input {
  width: 100%; height: 48px; border-radius: 14px; border: 1px solid transparent; background: var(--surface-3);
  padding: 0 44px 0 50px; font-size: 15px; transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.search input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: var(--focus); }
.search .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 9px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
.search .clear:hover { background: var(--surface-2); color: var(--ink); }
.search .clear svg { width: 16px; height: 16px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.bell { position: relative; width: 44px; height: 44px; border-radius: 12px; border: 0; background: none; color: var(--ink); display: grid; place-items: center; }
.bell:hover { background: var(--surface-3); }
.bell svg { width: 24px; height: 24px; }
.bell .ping { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; border: 2px solid var(--bg); }
.top-sep { width: 1px; height: 32px; background: var(--line-strong); }
.top-me { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px; border-radius: 999px; }
.top-me:hover { background: var(--surface-3); }
.top-me .avatar { width: 44px; height: 44px; font-size: 15px; }
.top-me svg { width: 18px; height: 18px; color: var(--ink-2); }

.board { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); overflow: hidden; position: relative; }
.board-head { flex: none; display: flex; align-items: center; gap: 18px; padding: 24px 24px 16px; }
.board-head .ic-tile { width: 58px; height: 58px; border-radius: 16px; background: var(--accent-grad); color: #fff; box-shadow: 0 10px 22px -12px rgba(109, 60, 233, .9); }
.board-head .ic-tile svg { width: 28px; height: 28px; }
.board-head .ic-tile.t-done { background: linear-gradient(135deg, #34d399, #16a34a); box-shadow: 0 10px 22px -12px rgba(22,163,74,.8); }
.board-head .ic-tile.t-forms { background: linear-gradient(135deg, #818cf8, #4f46e5); box-shadow: 0 10px 22px -12px rgba(79,70,229,.8); }
.board-head .ic-tile.t-emails { background: linear-gradient(135deg, #34d399, #059669); box-shadow: 0 10px 22px -12px rgba(5,150,105,.8); }
.board-head .ic-tile.t-outliers { background: linear-gradient(135deg, #fb923c, #ea580c); box-shadow: 0 10px 22px -12px rgba(234,88,12,.8); }
.board-head .ic-tile.t-notdone { background: linear-gradient(135deg, #f87171, #dc2626); }
.board-head .ic-tile.t-search { background: linear-gradient(135deg, #a1a1c0, #6b6889); box-shadow: none; }
.board-head h2 { font-size: 32px; font-weight: 800; }
.board-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }

.banner {
  flex: none; display: flex; align-items: center; gap: 10px; margin: 0 24px 16px; padding: 12px 16px;
  background: #fff8f0; color: var(--ink); font-size: 14.5px; border-radius: 14px; border: 1px solid #fbe4cf;
}
.banner svg { width: 20px; height: 20px; color: #c2620c; }
.banner .grow { flex: 1; }
.banner button.link { background: none; border: 0; color: var(--accent); font-weight: 650; padding: 0; }
.banner button.link:hover { text-decoration: underline; }
.banner .x { background: none; border: 0; color: var(--ink); width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.banner .x:hover { background: rgba(0,0,0,.05); }
.banner .x svg { width: 16px; height: 16px; color: inherit; }

.tabbar { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 22px;
  border: 0; border-bottom: 3px solid transparent; border-radius: 12px 12px 0 0; background: none;
  color: var(--ink); font-weight: 550; font-size: 16px;
}
.tab svg { width: 22px; height: 22px; }
.tab:hover { background: var(--surface-2); }
.tab.active { background: var(--accent-soft); color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.tab .count { font-size: 12px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.tab.active .count { background: rgba(109,60,233,.14); color: var(--accent); }
.tab[data-view="done"], .tab[data-view="notdone"] { display: none; }
.tools { margin-left: auto; display: flex; gap: 10px; padding-bottom: 10px; }
.tool-btn { height: 44px; min-width: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 550; font-size: 15px; color: var(--ink); position: relative; }
.tool-btn:hover { background: var(--surface-2); }
.tool-btn svg { width: 18px; height: 18px; }
.tool-btn .chev { width: 16px; height: 16px; color: var(--ink-2); }
.tool-btn.icon-only { padding: 0; width: 44px; }
.tool-btn .badge-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.feed { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; position: relative; }
.feed-inner { max-width: 920px; margin: 0 auto; padding: 8px 24px 20px; min-height: 100%; display: flex; flex-direction: column; }
.list { display: flex; flex-direction: column; }
.load-earlier { align-self: center; margin: 12px 0; }
.filter-note { align-self: center; margin: 10px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.filter-note button { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; }

.day-sep { align-self: center; margin: 18px 0 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; box-shadow: var(--shadow-xs); position: sticky; top: 8px; z-index: 3; }

/* ---------- messages ---------- */
.msg { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; max-width: 100%; }
.msg.cont { margin-top: 6px; }
.msg.mine { flex-direction: row-reverse; }
.msg > .avatar { margin-top: 22px; width: 34px; height: 34px; font-size: 12.5px; }
.msg.cont > .avatar { visibility: hidden; height: 0; }
.msg.mine > .avatar { display: none; }
.msg-col { display: flex; flex-direction: column; max-width: min(76%, 600px); min-width: 0; }
.msg.mine .msg-col { align-items: flex-end; }
.author { font-size: 13px; font-weight: 650; margin: 0 0 4px 4px; color: var(--ink-2); }
.msg.cont .author, .msg.mine .author { display: none; }

.bubble {
  position: relative; padding: 10px 14px 8px; border-radius: 18px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  overflow-wrap: anywhere; min-width: 100px;
}
.msg:not(.mine) .bubble { border-top-left-radius: 6px; background: #fbfaff; }
.msg.mine .bubble { background: var(--accent-grad); color: #fff; border-color: transparent; border-top-right-radius: 6px; box-shadow: 0 10px 22px -14px rgba(109, 60, 233, .9); }
.bubble .text { white-space: pre-wrap; font-size: 15px; }
.bubble .text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bubble.has-image { padding: 5px; }
.bubble.has-image .text { padding: 7px 9px 0; }
.bubble.has-image .meta { padding: 0 9px 3px; }
.img-btn { display: block; padding: 0; border: 0; background: var(--surface-3); border-radius: 14px; overflow: hidden; cursor: zoom-in; max-width: 100%; }
.msg:not(.mine) .img-btn { border-top-left-radius: 4px; }
.msg.mine .img-btn { border-top-right-radius: 4px; }
.img-btn img { display: block; width: 100%; height: auto; max-height: min(460px, 60vh); object-fit: cover; }
.meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; flex-wrap: wrap; }
.msg.mine .meta { color: rgba(255,255,255,.8); }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; padding: 2px 8px 2px 6px; border-radius: 999px; }
.chip svg { width: 12px; height: 12px; }
.chip-done { background: var(--done-soft); color: var(--done-ink); }
.chip-forms { background: var(--forms-soft); color: var(--forms-ink); }
.chip-emails { background: var(--emails-soft); color: var(--emails-ink); }
.chip-outliers, .chip-outlier { background: var(--outliers-soft); color: var(--outliers-ink); }
.chip-notdone { background: var(--notdone-soft); color: var(--notdone-ink); }
.msg.is-notdone .bubble { outline: 2px solid rgba(220,38,38,.35); outline-offset: 2px; }
.chip-feed { background: var(--accent-soft); color: var(--accent-deep); }
.msg.mine .chip { background: #fff; }

/* job number badge: "Email - 3" / "Form - 2" */
.job-tag {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px; padding: 4px 10px 4px 8px;
  border-radius: 8px; font-size: 12.5px; font-weight: 750; letter-spacing: .01em;
}
.job-tag svg { width: 14px; height: 14px; }
.job-tag-emails { background: var(--emails-soft); color: var(--emails-ink); }
.job-tag-forms { background: var(--forms-soft); color: var(--forms-ink); }
.msg.mine .job-tag { background: #fff; }
.bubble.has-image .job-tag { margin: 4px 0 6px 4px; }

.msg.is-done .bubble { outline: 2px solid rgba(22,163,74,.4); outline-offset: 2px; }

.actions { display: flex; gap: 4px; margin: 6px 2px 0; flex-wrap: wrap; opacity: 0; transition: opacity .15s; }
.msg.mine .actions { justify-content: flex-end; }
.msg:hover .actions, .msg:focus-within .actions, .msg.menu-open .actions { opacity: 1; }
@media (hover: none) { .actions { opacity: 1; } }
.act {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 12.5px; font-weight: 550; height: 30px; padding: 0 10px; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 5px; box-shadow: var(--shadow-xs);
}
.act svg { width: 15px; height: 15px; }
.act:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.act.on-done { background: var(--done-soft); color: var(--done-ink); border-color: #bfe6cc; }
.act.on-notdone { background: var(--notdone-soft); color: var(--notdone-ink); border-color: #f6caca; }
.act.on-outlier { background: var(--outliers-soft); color: var(--outliers-ink); border-color: #fbd5b8; }
.remark-form.reason { flex-direction: column; align-items: stretch; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px; box-shadow: var(--shadow-sm); }
.remark-form.reason label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.remark-form.reason .row { display: flex; gap: 6px; justify-content: flex-end; }
.act.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: #f6caca; }
.act .lbl-s { display: none; }

.remarks { margin-top: 8px; width: 100%; min-width: 260px; max-width: 480px; display: flex; flex-direction: column; gap: 6px; }
.remark { position: relative; background: var(--note-soft); border: 1px solid #fae8bd; border-left: 3px solid var(--note); border-radius: 6px 12px 12px 6px; padding: 8px 30px 8px 12px; font-size: 13.5px; text-align: left; }
.remark .r-head { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--note-ink); margin-bottom: 1px; }
.remark .r-head strong { color: #6b4504; font-size: 12.5px; }
.remark .r-body { white-space: pre-wrap; color: var(--ink); overflow-wrap: anywhere; }
.remark .r-del { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 6px; border: 0; background: none; color: #b48a3a; display: grid; place-items: center; opacity: 0; }
.remark:hover .r-del, .remark:focus-within .r-del { opacity: 1; }
@media (hover: none) { .remark .r-del { opacity: 1; } }
.remark .r-del:hover { background: rgba(220,38,38,.1); color: var(--danger); }
.remark .r-del svg { width: 14px; height: 14px; }
.remark-form { display: flex; gap: 6px; align-items: flex-end; }
.remark-form textarea { flex: 1; min-width: 0; resize: none; min-height: 40px; max-height: 140px; padding: 9px 12px; font-size: 14.5px; line-height: 1.4; border-radius: 10px; border: 1px solid #f3d590; background: #fffdf5; }
.remark-form textarea:focus { outline: none; border-color: var(--note); box-shadow: 0 0 0 3px rgba(245,158,11,.25); }
.remark-form .btn { height: 40px; }

.msg.enter { animation: msg-in .25s ease-out; }
@keyframes msg-in { from { opacity: .4; transform: translateY(6px); } }
.msg.flash .bubble { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 50% { box-shadow: 0 0 0 4px rgba(109,60,233,.45); } }

/* empty state */
.empty { margin: auto; text-align: center; padding: 40px 20px; max-width: 440px; color: var(--ink-2); }
.empty .illu { width: 240px; height: 170px; margin: 0 auto 10px; display: block; }
.empty h2 { font-size: 30px; font-weight: 800; color: var(--ink); margin-bottom: 10px; }
.empty p { margin: 0; font-size: 16px; line-height: 1.6; }

.jump { position: absolute; left: 50%; transform: translateX(-50%); z-index: 6; border: 0; background: var(--ink); color: #fff; border-radius: 999px; height: 38px; padding: 0 16px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 6px; }
.jump.at-bottom { bottom: calc(var(--composer-h, 0px) + 14px); }
.jump.at-top { top: calc(var(--feed-top, 200px) + 10px); }
.jump .badge { background: #a78bfa; color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; }
.jump svg { width: 16px; height: 16px; }

/* composer (admins) */
.composer { flex: none; padding: 12px 24px 20px; }
.composer-inner { max-width: 920px; margin: 0 auto; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface); padding: 8px; transition: border-color .15s, box-shadow .15s; }
.composer-inner:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.tray { display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 10px; border-bottom: 1px dashed var(--line-strong); margin-bottom: 8px; }
.att { flex: none; width: 150px; display: flex; flex-direction: column; gap: 6px; }
.att-thumb { position: relative; width: 150px; height: 104px; border-radius: 12px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-remove { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: rgba(23,20,44,.72); color: #fff; display: grid; place-items: center; font-size: 16px; line-height: 1; }
.att-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.2); }
.att-progress > i { display: block; height: 100%; width: 0; background: #a78bfa; transition: width .15s; }
.att-status { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(23,20,44,.35); color: #fff; font-size: 12px; font-weight: 600; text-align: center; padding: 8px; }
.att.error .att-status { background: rgba(185, 28, 28, .8); }
.att-caption { height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff; font-size: 13.5px; width: 100%; }
.att-caption:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.icon-btn { flex: none; width: 46px; height: 46px; border-radius: 13px; border: 0; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.send-btn { width: 58px; background: var(--accent-grad); color: #fff; box-shadow: 0 8px 18px -10px rgba(109,60,233,.9); }
.send-btn:hover:not(:disabled) { filter: brightness(1.07); background: var(--accent-grad); color: #fff; }
.send-btn:disabled { background: var(--surface-3); color: #b9b4cf; box-shadow: none; cursor: not-allowed; }
.textbox { flex: 1; min-width: 0; resize: none; max-height: 40vh; min-height: 46px; padding: 12px 6px; line-height: 1.4; border: 0; background: transparent; font-size: 15px; }
@media (pointer: coarse) { .textbox { font-size: 16px; } }
.textbox:focus, .textbox:focus-visible { outline: none; box-shadow: none; }
.hint { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 8px; }
.hint kbd { font-family: inherit; font-size: 11px; background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
@media (hover: none) and (pointer: coarse) { .hint { display: none; } }

.drop-overlay { position: absolute; inset: 10px; z-index: 30; display: grid; place-items: center; background: rgba(239, 233, 254, .9); border: 3px dashed var(--accent); border-radius: 20px; pointer-events: none; font-size: 22px; font-weight: 700; color: var(--accent); }

/* activity (bell) */
.activity { width: 380px; padding: 0; overflow: hidden; }
.activity .pop-head { padding: 14px 16px 12px; margin: 0; }
.activity .pop-head button { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 0; }
.act-list { max-height: min(420px, 60vh); overflow-y: auto; padding: 6px; }
.act-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 12px; font-size: 13.5px; color: var(--ink-2); }
.act-item:hover { background: var(--surface-2); }
.act-item .avatar { width: 32px; height: 32px; font-size: 12px; }
.act-item strong { color: var(--ink); font-weight: 650; }
.act-item time { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.act-item.unread { background: var(--accent-soft-2); }
.act-item.unread::after { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; margin-left: auto; }
.act-empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* filter popover */
.filter-pop { width: 260px; }
.seg { display: flex; gap: 4px; padding: 4px 8px 8px; }
.seg button { flex: 1; height: 34px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 550; color: var(--ink-2); }
.seg button.on { background: var(--accent-soft); border-color: #cdbbfb; color: var(--accent); font-weight: 650; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.filter-pop .check { padding: 6px 12px 10px; }

/* lightbox */
dialog.lightbox { border: 0; padding: 0; margin: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100dvh; background: rgba(15, 12, 30, .94); }
dialog.lightbox::backdrop { background: rgba(15, 12, 30, .94); }
.lightbox-inner { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 16px 20px; gap: 14px; }
.lightbox img { max-width: 100%; max-height: calc(100% - 70px); object-fit: contain; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .cap { color: #eeeaff; font-size: 15px; max-width: 720px; text-align: center; white-space: pre-wrap; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 14px; padding-top: max(14px, env(safe-area-inset-top)); flex-wrap: wrap; }
.lb-btn { height: 40px; min-width: 40px; padding: 0 14px; border-radius: 11px; border: 0; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font-size: 14px; font-weight: 600; }
.lb-btn:hover { background: rgba(255,255,255,.26); }
.lb-btn svg { width: 18px; height: 18px; }

/* ---------- compact header: keep the space for posts ---------- */
.main { padding: 14px 20px 16px; gap: 12px; }
.search input { height: 40px; border-radius: 12px; padding-left: 44px; font-size: 14.5px; }
.search .lead { left: 14px; }
.search .lead svg { width: 18px; height: 18px; }
.bell { width: 38px; height: 38px; border-radius: 10px; }
.bell svg { width: 21px; height: 21px; }
.bell .ping { top: 7px; right: 8px; }
.top-sep { height: 26px; }
.top-me .avatar { width: 36px; height: 36px; font-size: 13px; }
.board { border-radius: 18px; }
.board-head { padding: 12px 20px 10px; gap: 10px; }
.board-head > div:last-child { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.board-head .ic-tile { width: 32px; height: 32px; border-radius: 9px; box-shadow: none !important; align-self: center; }
.board-head .ic-tile svg { width: 17px; height: 17px; }
.board-head h2 { font-size: 20px; font-weight: 750; }
.board-head p { margin: 0; font-size: 13.5px; color: var(--muted); }
.banner { margin: 0 20px 10px; padding: 7px 12px; font-size: 13.5px; border-radius: 11px; }
.banner svg { width: 17px; height: 17px; }
.banner .x { width: 24px; height: 24px; }
.tabbar { padding: 4px 20px 0; gap: 10px; }
.tab { height: 40px; padding: 0 16px; font-size: 14.5px; gap: 8px; border-bottom-width: 2px; border-radius: 10px 10px 0 0; }
.tab svg { width: 18px; height: 18px; }
.tools { gap: 8px; padding-bottom: 5px; }
.tool-btn { height: 34px; min-width: 34px; padding: 0 12px; border-radius: 10px; font-size: 14px; gap: 8px; }
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn.icon-only { width: 34px; }
.tool-btn .badge-dot { top: 6px; right: 6px; }
.side-brand { padding: 0 6px 14px; }
.sidebar { padding-top: 16px; }

/* ---------- tablet / phone ---------- */
.m-only { display: none !important; }
@media (max-width: 1100px) {
  .app { grid-template-columns: 250px minmax(0, 1fr); }
  .tab { padding: 0 14px; font-size: 15px; }
  .tool-btn .lbl { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .m-only { display: grid !important; }
  .main { padding: 10px 10px 0; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; }
  .topbar { gap: 8px; }
  .topbar .logo { width: 40px; height: 40px; border-radius: 12px; }
  .search input { height: 42px; padding-left: 42px; border-radius: 12px; font-size: 16px; }
  .search .lead { left: 13px; }
  .search .lead svg { width: 18px; height: 18px; }
  .top-right { gap: 4px; }
  .top-sep, .top-me > span[data-icon] { display: none; }
  .top-me .avatar { width: 34px; height: 34px; font-size: 12.5px; }
  .bell { width: 36px; height: 36px; }
  .topbar .logo { width: 36px !important; height: 36px !important; border-radius: 10px; box-shadow: none; }
  .topbar .logo svg { width: 20px; height: 20px; }
  .search input { height: 38px; }
  .board { border-radius: 18px 18px 0 0; border-bottom: 0; }
  .board-head { padding: 10px 12px 8px; gap: 8px; }
  .board-head .ic-tile { width: 28px; height: 28px; border-radius: 8px; }
  .board-head .ic-tile svg { width: 15px; height: 15px; }
  .board-head h2 { font-size: 18px; }
  .board-head p { display: none; }
  .board:not(.searching) .board-head { display: none; } /* the active tab already names the section */
  .board:not(.searching) .banner { margin-top: 10px; }
  .banner { margin: 0 10px 8px; font-size: 12.5px; padding: 7px 10px; }
  .tabbar { padding: 6px 8px 0; gap: 6px; }
  .tab { height: 36px; padding: 0 10px; font-size: 13.5px; gap: 5px; }
  .tab svg { width: 16px; height: 16px; }
  .tab[data-view="done"], .tab[data-view="notdone"] { display: inline-flex; }
  .tools { gap: 6px; padding-bottom: 6px; }
  .tool-btn { height: 32px; min-width: 32px; border-radius: 9px; }
  .tool-btn.icon-only { width: 32px; }
  .tool-btn .chev { display: none; }
  .tool-btn { padding: 0 9px; }
  .feed-inner { padding: 4px 10px 14px; }
  .composer { padding: 8px 10px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .msg-col { max-width: 86%; }
  .act .lbl { display: none; }
  .act .lbl-s { display: inline; }
  .act { height: 32px; padding: 0 9px; gap: 4px; font-size: 12px; }
  .act.danger { width: 32px; padding: 0; justify-content: center; }
  .remarks { min-width: 0; }
  .att, .att-thumb { width: 128px; }
  .att-thumb { height: 90px; }
  .empty h2 { font-size: 24px; }
  .empty p { font-size: 15px; }
  .empty .illu { width: 190px; height: 135px; }
  .activity { width: min(380px, calc(100vw - 24px)); }
}
@media (max-width: 420px) {
  .board-head p { display: none; }
}

/* =========================================================
   Admin
   ========================================================= */
.admin-page { min-height: 100%; }
.admin-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px) saturate(1.3); border-bottom: 1px solid var(--line); }
.admin-top .brand { display: flex; align-items: center; gap: 12px; }
.admin-top h1 { font-size: 20px; }
.admin-top .sub { margin: 0; font-size: 13px; color: var(--muted); }
.admin-wrap { max-width: 1000px; margin: 0 auto; padding: 28px 16px 64px; display: flex; flex-direction: column; gap: 22px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h2 { font-size: 20px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .admin-top { padding: 12px 14px; } .admin-top .sub { display: none; } .card { padding: 18px; } }
.users { width: 100%; border-collapse: collapse; }
.users th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.users td { padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users tr:last-child td { border-bottom: 0; }
.u-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.u-cell strong { display: block; }
.u-cell span { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; font-size: 11px; font-weight: 650; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; }
.pill-admin { background: var(--accent-soft); color: var(--accent-deep); }
.pill-member { background: var(--surface-2); color: var(--ink-2); }
.pill-off { background: var(--danger-soft); color: var(--danger); }
.pill-temp { background: var(--note-soft); color: var(--note-ink); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.users tr.inactive .u-cell { opacity: .55; }
@media (max-width: 720px) {
  .users thead { display: none; }
  .users, .users tbody, .users tr, .users td { display: block; width: 100%; }
  .users tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .users tr:last-child { border-bottom: 0; }
  .users td { border: 0; padding: 4px 0; }
  .users td[data-label]::before { content: attr(data-label) ': '; color: var(--muted); font-size: 12.5px; }
  .row-actions { justify-content: flex-start; padding-top: 8px; }
}
.cred-box { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--done-soft); color: var(--done-ink); font-size: 14px; border: 1px solid #c6ebd3; }
.cred-box code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; background: #fff; padding: 2px 7px; border-radius: 6px; color: var(--ink); }

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

/* =========================================================
   Smoothness & phone polish
   ========================================================= */
button, a, .tab, .nav-item, .act { touch-action: manipulation; }
.feed { scroll-behavior: auto; scrollbar-gutter: stable; }

/* gentle press feedback */
.act, .tab, .nav-item, .tool-btn, .icon-btn, .btn, .pop-item, .bell, .top-me { transition: transform .12s ease, background-color .15s, color .15s, border-color .15s, box-shadow .15s; }
.act:active, .tab:active, .tool-btn:active, .icon-btn:active, .pop-item:active, .bell:active, .top-me:active { transform: scale(.96); }
.nav-item:active { transform: scale(.985); }

/* hover colours only where a real mouse exists (no "stuck" hover after a tap) */
@media (hover: none) {
  .act:hover { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
  .act.on-done:hover { background: var(--done-soft); color: var(--done-ink); }
  .act.on-notdone:hover { background: var(--notdone-soft); color: var(--notdone-ink); }
  .act.on-outlier:hover { background: var(--outliers-soft); color: var(--outliers-ink); }
  .tab:hover { background: none; }
  .tab.active:hover { background: var(--accent-soft); }
  .nav-item:hover { background: none; }
}

/* images: shimmer placeholder, then fade in */
.img-btn { background: linear-gradient(100deg, var(--surface-3) 30%, var(--surface-2) 50%, var(--surface-3) 70%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
.img-btn.loaded { animation: none; background: var(--surface-3); }
.img-btn img { opacity: 0; transition: opacity .35s ease; }
.img-btn img.loaded { opacity: 1; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* switching sections: thin progress bar + soft fade-in */
.board::before { content: ''; position: absolute; left: 0; top: 0; height: 3px; width: 0; z-index: 8; background: var(--accent-grad); border-radius: 0 3px 3px 0; opacity: 0; transition: opacity .2s; }
.board.is-loading::before { opacity: 1; animation: loadbar 1.1s ease-in-out infinite; }
@keyframes loadbar { 0% { width: 0; left: 0; } 50% { width: 60%; left: 20%; } 100% { width: 0; left: 100%; } }
.board.is-loading .list { opacity: .45; transition: opacity .15s; }
.list.fade-in { animation: list-in .28s ease-out; }
@keyframes list-in { from { opacity: 0; transform: translateY(6px); } }

/* bottom sheets (phone menus) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(23, 20, 44, .35); opacity: 0; transition: opacity .22s ease; }
.sheet-backdrop.show { opacity: 1; }
.pop.sheet {
  left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100% !important; max-width: none; min-width: 0;
  max-height: 82vh; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 22px 22px 0 0; border-bottom: 0; padding: 6px 12px calc(14px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .85, .25, 1); animation: none;
}
.pop.sheet.show { transform: none; }
.pop.sheet::before { content: ''; display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 6px auto 10px; }
.pop.sheet .pop-item { padding: 14px 12px; font-size: 16px; border-radius: 12px; }
.pop.sheet .pop-label { font-size: 12px; padding: 4px 12px 6px; }
.pop.sheet .seg button { height: 42px; font-size: 15px; }
.pop.sheet .check { font-size: 15px; padding: 10px 12px; }
.pop.sheet.activity { width: 100% !important; padding-left: 0; padding-right: 0; }
.pop.sheet.activity .act-list { max-height: 64vh; }
.pop.sheet.filter-pop { width: 100% !important; }

@media (max-width: 860px) {
  /* posts use the full width; one tidy row of equal buttons under each */
  .msg { gap: 8px; }
  .msg > .avatar { width: 28px; height: 28px; font-size: 11.5px; margin-top: 20px; }
  .msg-col { flex: 1; max-width: calc(100% - 36px); }
  .msg.mine .msg-col { max-width: 100%; }
  .msg-col > .bubble { max-width: 100%; }
  .msg:not(.mine) .msg-col { align-items: flex-start; }
  .actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; width: 100%; margin: 7px 0 0; opacity: 1; transform: none; }
  /* icon above label, like an app toolbar, so every label fits in full */
  .act { height: 48px; padding: 4px 2px; flex-direction: column; justify-content: center; border-radius: 12px; font-size: 11.5px; font-weight: 600; gap: 3px; min-width: 0; line-height: 1.1; }
  .act .lbl-s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .act.danger { width: auto; }
  .act svg { width: 18px; height: 18px; }
  .remarks { max-width: 100%; }
  .remark-form.reason textarea { font-size: 16px; }
  .bubble .text { font-size: 15.5px; line-height: 1.5; }
  .day-sep { top: 4px; }

  /* tabs: swipeable row with a soft edge so you can tell there's more */
  .tabs { scroll-snap-type: x proximity; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 18px; }
  .tab { scroll-snap-align: center; }

  /* toasts sit near the top, under the notch */
  .toast-wrap { top: calc(env(safe-area-inset-top) + 10px); width: calc(100vw - 24px); max-width: none; }
  .toast { justify-content: space-between; font-size: 13.5px; }

  .jump { height: 36px; font-size: 12.5px; }
  .empty { padding: 28px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .pop.sheet, .sheet-backdrop { transition: none; }
  .img-btn { animation: none; }
}

/* =========================================================
   Greeting card
   ========================================================= */
.greet {
  order: -1; position: relative; display: flex; gap: 14px; align-items: flex-start;
  margin: 12px 0 6px; padding: 16px 52px 16px 18px; border-radius: 18px;
  border: 1px solid #ebe3fb; box-shadow: var(--shadow-xs); animation: list-in .35s ease-out;
  background: linear-gradient(135deg, #f6f1ff, #fff7ee);
}
.greet-morning { background: linear-gradient(135deg, #fff6e2 0%, #f4eeff 100%); }
.greet-afternoon { background: linear-gradient(135deg, #eaf4ff 0%, #f4eeff 100%); }
.greet-evening { background: linear-gradient(135deg, #ffeee6 0%, #f2ecff 100%); }
.greet-night { background: linear-gradient(135deg, #eceeff 0%, #f6f0ff 100%); }
.greet-emoji { font-size: 32px; line-height: 1; flex: none; margin-top: 2px; }
.greet-body { min-width: 0; }
.greet h3 { font-size: 19px; font-weight: 750; margin: 0 0 4px; }
.greet-thought { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.greet-sum { margin: 8px 0 0; font-size: 13.5px; font-weight: 650; color: var(--accent-deep); }
.greet-x { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; color: var(--ink-2); display: grid; place-items: center; }
.greet-x:hover { background: rgba(0, 0, 0, .05); }
.greet-x svg { width: 18px; height: 18px; }

/* plain icon buttons used in the phone top bar */
.icon-plain { width: 44px; height: 44px; border: 0; background: none; border-radius: 12px; display: grid; place-items: center; color: var(--ink); flex: none; }
.icon-plain svg { width: 24px; height: 24px; }
.icon-plain:active { background: var(--surface-3); }
.drawer-close { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--ink); place-items: center; margin-left: auto; flex: none; }
.drawer-close svg { width: 18px; height: 18px; }

/* =========================================================
   Phone layout: simple and easy
   ========================================================= */
@media (max-width: 860px) {
  /* sidebar becomes a slide-in menu from the left */
  .sidebar {
    display: flex; position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
    width: min(86vw, 330px); padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
    border-right: 0; border-radius: 0 24px 24px 0; box-shadow: var(--shadow-lg);
    transform: translateX(-104%); transition: transform .3s cubic-bezier(.2, .85, .25, 1);
    will-change: transform;
  }
  .app.drawer-open .sidebar { transform: none; }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(23, 20, 44, .38); opacity: 0; transition: opacity .3s ease; }
  .app.drawer-open .drawer-backdrop { opacity: 1; }
  .sidebar .tip { display: none; }
  .side-brand { padding: 4px 4px 14px; }
  .side-brand h1 { font-size: 17px; }
  .side-scroll { padding-top: 14px; }
  .side-group { padding-bottom: 14px; margin-bottom: 14px; }
  .nav-item { min-height: 50px; font-size: 16px; padding: 10px 12px; }
  .ws-item { padding: 9px 12px; }
  .drawer-opts { display: block !important; }
  .drawer-opts .nav-item .count { min-width: 0; padding: 0 10px; }

  /* top bar: ☰  Section name  🔍 🔔 */
  .topbar { gap: 4px; min-height: 48px; }
  .m-title { display: block !important; flex: 1; min-width: 0; margin: 0 0 0 2px; font-size: 20px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search { display: none; }
  .topbar.search-open .search { display: block; flex: 1; }
  .topbar.search-open #menuBtn, .topbar.search-open .m-title, .topbar.search-open #searchOpen, .topbar.search-open .bell { display: none !important; }
  .top-me, .top-sep { display: none !important; }
  .top-right { gap: 2px; margin-left: 0; }
  .bell { width: 44px; height: 44px; }
  .bell svg { width: 24px; height: 24px; }
  .search input { height: 44px; font-size: 16px; }

  /* three big tabs that fit the width — no sideways scrolling */
  .tools { display: none; }
  .tabbar { padding: 6px 8px 0; }
  .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 4px; -webkit-mask-image: none; mask-image: none; padding-right: 0; scroll-snap-type: none; }
  .tab { justify-content: center; height: 46px; padding: 0 4px; font-size: 15px; gap: 6px; }
  .tab svg { width: 18px; height: 18px; }
  .tab .count { font-size: 12px; }

  /* posts use the full width (no repeated avatar circles) */
  .msg > .avatar { display: none; }
  .msg-col { max-width: 100%; }
  .author { margin-left: 2px; font-size: 13px; }
  .feed-inner { padding: 2px 12px 16px; }

  .greet { margin: 10px 0 4px; padding: 14px 48px 14px 14px; gap: 12px; }
  .greet-emoji { font-size: 28px; }
  .greet h3 { font-size: 18px; }
  .greet-thought { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .drawer-backdrop { transition: none !important; }
}
@media (max-width: 860px) {
  /* each post is a full-width card with its buttons lined up underneath */
  .msg-col { width: 100%; }
  .msg-col > .bubble { width: 100%; }
  .msg + .msg { margin-top: 14px; }
}

/* greeting: quote styling for the manager's daily wisdom */
.greet-thought.is-quote { font-size: 16px; line-height: 1.55; color: var(--ink); font-style: italic; }
.greet-cite { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.greet-try { margin: 10px 0 0; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(109, 60, 233, .15); font-size: 14px; line-height: 1.45; color: var(--ink); }
.greet-try strong { color: var(--accent-deep); }

/* notification invitation card */
.notify-card {
  order: -1; display: flex; align-items: center; gap: 12px; margin: 8px 0 4px; padding: 12px 14px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-xs);
}
.notify-ic { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.notify-ic svg { width: 22px; height: 22px; }
.notify-body { flex: 1; min-width: 0; }
.notify-body strong { display: block; font-size: 14.5px; }
.notify-body p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.notify-actions { display: flex; gap: 6px; flex: none; }
.ios-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink); line-height: 1.45; }
@media (max-width: 860px) {
  .notify-card { flex-wrap: wrap; }
  .notify-actions { width: 100%; }
  .notify-actions .btn { flex: 1; height: 42px; font-size: 14.5px; }
}
