/* Companies, admin & platform consoles, sign-in pages, chat. Uses the tokens from app.css. */
.small { font-size: 12.5px; }
.break { word-break: break-all; white-space: normal; }
.company-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 4px; border-radius: 999px;
  background: var(--surface-2); margin-right: 6px; max-width: 260px; }
.company-chip .company-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-mark { width: 28px; height: 28px; border-radius: 8px; display: inline-grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--sheet), var(--doc)); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.company-mark.lg { width: 48px; height: 48px; border-radius: 13px; font-size: 18px; }
.auth-card .company-mark.lg { margin-bottom: 4px; }
.platform-title { flex: 1; display: flex; align-items: center; }
.usage { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 6px 0 2px; }
.usage > i { display: block; height: 100%; background: var(--sheet); border-radius: 3px; }
.usage.warn > i { background: var(--folder); }
.usage.danger > i { background: var(--danger); }
.page-inner.wide { max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 18px 0 18px; flex-wrap: wrap; }
.page-head .page-title { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats.compact { grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 8px; }
.stat { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface); min-width: 0; }
.stat-label { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 650; margin-top: 4px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats.compact .stat-value { font-size: 18px; }
.stat-sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush .table th:first-child, .panel.flush .table td:first-child { padding-left: 20px; }
.panel.flush .table th:last-child, .panel.flush .table td:last-child { padding-right: 16px; }
.panel.flush .empty { padding: 50px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 6px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.with-button { display: flex; align-items: center; gap: 4px; }
.with-button .input { flex: 1; }
.credentials { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.credentials > div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border);
  align-items: baseline; }
.credentials > div:first-child { border-top: 0; }
.credentials > div > span:first-child { color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.credentials code { font-family: var(--mono); font-size: 13px; }
.privacy-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 10px;
  background: var(--accent-weak); color: var(--text); font-size: 13px; }
.privacy-note .icon { color: var(--accent); margin-top: 1px; }
.privacy-note code { font-family: var(--mono); font-size: 12px; }
.address-preview { display: inline; color: var(--text); }
.danger-title { color: var(--danger); }
.btn.danger-outline { color: var(--danger); border-color: var(--danger); }
.btn.danger-outline:hover { background: var(--danger-weak); }
.side-panel.wide { width: 440px; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
  font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.nav-badge.mention { background: var(--danger); color: #fff; }
.nav-item .grow { flex: 1; }
.auth-stack { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.auth-stack .auth-card { max-width: none; }
.auth-card.subtle { padding: 18px 24px; box-shadow: none; }
.auth-card.subtle summary { cursor: pointer; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; list-style: none; }
.auth-card.subtle summary::-webkit-details-marker { display: none; }
.find-company { display: flex; flex-direction: column; gap: 14px; }
.address-input { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  overflow: hidden; }
.address-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--sel); }
.address-input .input { border: 0; box-shadow: none !important; text-align: right; padding-right: 2px; font-weight: 600; }
.address-input .suffix { padding: 0 12px 0 0; color: var(--text-2); white-space: nowrap; font-size: 14px; }
.icon-btn.xs { width: 24px; height: 24px; }
.icon-btn.xs svg.icon { width: 15px; height: 15px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }

/* platform console: the companies list (search, status, sortable columns, pages) — platform.js */
.list-search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; max-width: 420px; height: 38px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.list-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--sel); }
.list-search .icon { color: var(--text-3); flex: none; }
.list-search .input { border: 0; height: 36px; padding: 0; box-shadow: none !important; background: transparent; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
  font-size: 11.5px; display: inline-grid; place-items: center; }
.seg-btn.active .seg-count { background: var(--accent-weak); color: var(--accent); }
.th-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 0; font: inherit;
  color: inherit; font-weight: 600; cursor: pointer; }
.th-sort:hover, .th-sort.sorted { color: var(--text); }
.th-sort .sort-hint { opacity: 0; transition: opacity .12s; }
.th-sort:hover .sort-hint, .th-sort:focus-visible .sort-hint { opacity: .45; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 16px 12px 20px; border-top: 1px solid var(--border); }
.pager:empty { display: none; }
.pager .select { width: auto; height: 32px; }
.pager .grow { flex: 1; }
.list-empty { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 4px 20px 18px; }

/* the activity log (activity_view.js: platform console and company admin console) */
.activity-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.activity-filter { min-width: 150px; flex: 0 1 190px; }
.activity-filter.grow { flex: 1 1 220px; }
.activity-filter .input[type="date"] { min-width: 140px; }
.activity-tools { gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.activity-tools .grow, .activity-foot .grow { flex: 1; }
.activity-foot { gap: 10px; margin-top: 8px; }
.activity-status { margin: 0; }
.activity-meta { overflow-wrap: anywhere; }
time.when.exact { font-variant-numeric: tabular-nums; }

/* sub-menus (File → Download → …) */
.menu .menu.sub { position: fixed; z-index: 1001; }
.menu-item .sub-arrow { margin-left: auto; color: var(--text-3); display: inline-flex; padding-left: 12px; }
.menu-item.has-sub .shortcut { display: none; }

/* ---------------------------------------------------------------- chat */
.chat { flex: 1; min-height: 0; display: grid; grid-template-columns: 280px 1fr; }
.chat-side { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 10px 18px; }
.chat-side-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.input.sm { height: 34px; font-size: 13.5px; }
.chat-list { flex: 1; overflow-y: auto; padding: 0 8px 16px; }
.chat-section { display: flex; align-items: center; justify-content: space-between; padding: 14px 6px 4px 10px; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.chan { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--text-2); width: 100%;
  border: 0; background: transparent; cursor: pointer; font-size: 14px; text-align: left; }
.chan:hover { background: var(--surface-2); text-decoration: none; }
.chan.active { background: var(--accent-weak); color: var(--accent); }
.chan.unread { color: var(--text); font-weight: 700; }
.chan .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan.subtle { color: var(--text-3); font-size: 13.5px; }
.chan-ico { width: 20px; display: inline-grid; place-items: center; flex: none; color: var(--text-3); }
.chan.active .chan-ico { color: var(--accent); }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); min-height: 60px; }
.chat-title { font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-topic { color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-back { display: none; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 8px 0 12px; min-height: 0; }
.chat-intro { padding: 24px 24px 12px; }
.chat-intro h3 { margin: 10px 0 4px; font-size: 20px; }
.chat-intro p { margin: 0; }
.chat-intro-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; }
.chat-more { display: flex; justify-content: center; padding: 10px; }
.chat-day { display: flex; align-items: center; gap: 12px; margin: 14px 20px 6px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.msg { position: relative; display: flex; gap: 12px; padding: 6px 24px 4px 20px; }
.msg:hover { background: var(--surface-2); }
.msg.grouped { padding-top: 1px; padding-bottom: 1px; }
.msg-time-side { width: 26px; flex: none; color: transparent; font-size: 10.5px; text-align: right; padding-top: 4px; white-space: nowrap; }
.msg.grouped:hover .msg-time-side { color: var(--text-3); }
.msg-body { min-width: 0; flex: 1; }
.msg-meta { display: flex; align-items: center; gap: 8px; }
.msg-meta b { font-size: 14px; }
.badge.bot { height: 18px; font-size: 11px; gap: 3px; }
.msg-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); flex: 1; min-width: 0; }
.msg-text.deleted { color: var(--text-3); font-style: italic; }
.msg-text code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 4px; border-radius: 4px; }
.chat-code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 10px 12px; border-radius: 8px; margin: 4px 0;
  white-space: pre-wrap; }
.mention { background: var(--accent-weak); color: var(--accent); border-radius: 4px; padding: 0 2px; font-weight: 600; }
.mention.me { background: var(--warn-weak); color: var(--warn-text); }
.msg-actions { position: absolute; right: 16px; top: -10px; display: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-1); padding: 2px; }
.msg:hover .msg-actions:not(:empty) { display: flex; }
/* touch screens have no hover: tapping a message (tabindex=-1) focuses it and shows its actions */
@media (hover: none) { .msg:focus-within .msg-actions:not(:empty) { display: flex; } }
.msg:focus { outline: none; background: var(--surface-2); }
.chan.archived { color: var(--text-3); }
.chat-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 24px; text-align: center; }
.chat-composer-wrap { padding: 0 16px 14px; }
.chat-composer { position: relative; display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 6px 6px 6px 12px; background: var(--surface); }
.chat-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--sel); }
.chat-input { flex: 1; border: 0; outline: none; resize: none; background: transparent; font: inherit; font-size: 14px; line-height: 1.5;
  max-height: 200px; padding: 5px 0; color: var(--text); }
.chat-input.edit { width: 100%; border: 1px solid var(--accent); border-radius: 8px; padding: 6px 8px; background: var(--surface); }
.chat-composer .send { color: var(--accent); }
.chat-hint { padding: 6px 4px 0; }
.chat-hint code { font-family: var(--mono); font-size: 11.5px; }
.chat-join { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; border: 1px dashed var(--border-strong);
  border-radius: 12px; color: var(--text-2); }
.chat-composer .suggest { bottom: calc(100% + 4px); left: 8px; }

@media (max-width: 860px) {
  .company-chip .company-name { display: none; }
  .company-chip { padding-right: 4px; }
  .chat { grid-template-columns: 1fr; }
  .chat.has-channel .chat-side { display: none; }
  .chat:not(.has-channel) .chat-main { display: none; }
  .chat-back { display: inline-flex; }
  .chat-head { padding: 8px 10px; gap: 4px; }
  .msg { padding-left: 12px; padding-right: 12px; }
  .msg-actions { right: 8px; }
  .chat-composer-wrap { padding: 0 8px 10px; }
  .chat-hint { display: none; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .stats.compact { grid-template-columns: 1fr 1fr; }
  .credentials > div { grid-template-columns: 1fr; gap: 2px; }
}
