/* ==========================================================================
   Architech Suite — platform layer on top of the shared design system
   (app.css is the same system used by Architech PM, unchanged)
   ========================================================================== */
:root { --rail-w: 76px; --side-w: 250px; }

/* ---------- launcher button, tenant + app chips ---------- */
.launch-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  color: var(--c-text-2); transition: all var(--t); flex-shrink: 0; }
.launch-btn:hover { background: var(--c-hover); color: var(--c-primary-hover); transform: scale(1.05); }
.t-avatar { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  color: #fff; font-size: 10px; font-weight: 800; flex-shrink: 0; }
.t-avatar.lg { width: 42px; height: 42px; border-radius: 11px; font-size: 14px; }
.app-chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px;
  border-radius: var(--r-pill); background: color-mix(in srgb, var(--ac) 12%, transparent);
  color: var(--ac); font-size: 12.5px; font-weight: 700; white-space: nowrap; }

/* ---------- rail carries each app's own colour ---------- */
.rail-item .ri-ico { display: grid; place-items: center; width: 34px; height: 30px; border-radius: 9px;
  transition: all var(--t); }
.rail-item.on { background: transparent; color: var(--ac, var(--c-primary-hover)); }
.rail-item.on .ri-ico { background: color-mix(in srgb, var(--ac, #3b82f6) 14%, transparent); }
.rail-item.on::before { background: var(--ac, var(--c-primary)); }
.rail-item:hover .ri-ico { background: var(--c-hover); }
.app-badge { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  color: #fff; flex-shrink: 0; }

/* ---------- launcher ---------- */
.launch-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.launch-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 16px; border: 1px solid var(--c-border); border-radius: var(--r-md); background: #fff;
  text-decoration: none; color: inherit; transition: all var(--t); text-align: left; }
.launch-tile:hover { border-color: color-mix(in srgb, var(--ac) 45%, transparent); box-shadow: var(--sh-md);
  transform: translateY(-3px); text-decoration: none; }
.launch-tile .lt-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ac) 13%, transparent); color: var(--ac); margin-bottom: 8px; }
.launch-tile .lt-name { font-size: 14px; font-weight: 750; letter-spacing: -.01em; }
.launch-tile .lt-tag { font-size: 11.5px; color: var(--c-text-3); line-height: 1.4; }
.launch-tile .lt-badge { position: absolute; top: 12px; right: 12px; min-width: 20px; height: 20px;
  padding: 0 6px; border-radius: var(--r-pill); background: var(--c-red); color: #fff; font-size: 10.5px;
  font-weight: 700; display: grid; place-items: center; }
.launch-tile.off { opacity: .74; border-style: dashed; }
.launch-tile.off:hover { opacity: 1; }
.launch-tile .lt-add { display: inline-flex; align-items: center; gap: 4px; margin-top: 9px;
  font-size: 11.5px; font-weight: 700; color: var(--ac); }
.mini-app { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; }

/* ---------- tenant switcher ---------- */
.tenant-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px;
  border: 1px solid var(--c-border); border-radius: var(--r-md); background: #fff; text-align: left;
  transition: all var(--t); }
.tenant-row:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-md); transform: translateY(-1px); }
.tenant-row.on { border-color: var(--c-primary); background: var(--c-primary-light); }

.cmdk-foot { display: flex; align-items: center; gap: 7px; padding: 9px 16px;
  border-top: 1px solid var(--c-border-light); background: var(--c-muted);
  font-size: 11.5px; font-weight: 600; color: var(--c-text-3); }
.notif-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 10px;
  text-decoration: none; color: inherit; transition: background var(--t); }
.notif-row:hover { background: var(--c-hover); text-decoration: none; }

/* ---------- multi-pane app layouts (mail, chat, drive) ---------- */
.pane { display: flex; height: calc(100vh - var(--topbar-h)); overflow: hidden; }
.pane-list { flex: 0 0 384px; border-right: 1px solid var(--c-border); display: flex; flex-direction: column;
  background: #fff; min-width: 0; }
.pane-list.narrow { flex-basis: 306px; }
.pane-head { padding: 13px 16px; border-bottom: 1px solid var(--c-border-light); display: flex;
  align-items: center; gap: 10px; flex-shrink: 0; }
.pane-scroll { flex: 1; overflow-y: auto; }
.pane-body { flex: 1; overflow-y: auto; background: var(--c-page); min-width: 0; }
.pane-empty { height: 100%; display: grid; place-items: center; text-align: center; padding: 40px; }

/* mail list rows */
.mrow { display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--c-border-light);
  cursor: pointer; transition: background var(--t); position: relative; }
.mrow:hover { background: var(--c-hover); }
.mrow.on { background: var(--c-primary-light); }
.mrow.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c-primary); }
.mrow.unread .m-from, .mrow.unread .m-sub { font-weight: 750; color: var(--c-text); }
.mrow .m-from { font-size: 13px; font-weight: 550; color: var(--c-text-2); }
.mrow .m-sub { font-size: 13px; font-weight: 500; margin-top: 2px; }
.mrow .m-pre { font-size: 12px; color: var(--c-text-3); margin-top: 3px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mrow .m-time { font-size: 11px; color: var(--c-text-3); white-space: nowrap; }
.mrow .m-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-primary); flex-shrink: 0; margin-top: 6px; }
.mrow .m-star { color: var(--c-text-3); }
.mrow .m-star.on { color: var(--c-amber); }
.label-dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

.reader { max-width: 880px; margin: 0 auto; padding: 26px 30px 60px; }
.reader-body { font-size: 14.5px; line-height: 1.75; white-space: pre-wrap; color: var(--c-text); }
.att { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--c-border);
  border-radius: 10px; background: #fff; font-size: 12.5px; font-weight: 600; transition: all var(--t); }
.att:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-sm); }

/* the cross-app context rail — the thing Zoho/M365 do not do */
.related { border: 1px solid var(--c-border); border-radius: var(--r-md); background: #fff; overflow: hidden; }
.related-head { padding: 11px 14px; border-bottom: 1px solid var(--c-border-light); font-size: 11px;
  font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--c-text-3);
  display: flex; align-items: center; gap: 7px; }
.related-item { display: flex; align-items: center; gap: 11px; padding: 11px 14px; width: 100%;
  border-bottom: 1px solid var(--c-border-light); text-align: left; transition: background var(--t); }
.related-item:last-child { border-bottom: 0; }
.related-item:hover { background: var(--c-hover); }

/* ---------- chat ---------- */
.chat-msg { display: flex; gap: 11px; padding: 8px 20px; transition: background var(--t); }
.chat-msg:hover { background: var(--c-hover); }
.chat-msg .cm-name { font-size: 13.5px; font-weight: 700; }
.chat-msg .cm-time { font-size: 11px; color: var(--c-text-3); }
.chat-msg .cm-text { font-size: 14px; line-height: 1.6; margin-top: 2px; }
.chat-msg .mention { background: var(--c-primary-light); color: var(--c-primary-hover); border-radius: 4px;
  padding: 0 4px; font-weight: 650; }
.reaction { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px;
  border: 1px solid var(--c-border); border-radius: var(--r-pill); background: #fff; font-size: 12px;
  font-weight: 600; color: var(--c-text-2); transition: all var(--t); }
.reaction:hover { border-color: var(--c-primary); }
.chat-composer { padding: 12px 20px 16px; border-top: 1px solid var(--c-border-light); background: #fff; }
.chat-input { display: flex; align-items: flex-end; gap: 10px; padding: 10px 12px; border: 1px solid var(--c-border);
  border-radius: var(--r-md); background: #fff; transition: all var(--t); }
.chat-input:focus-within { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-focus-ring); }
.chat-input textarea { flex: 1; border: 0; outline: 0; resize: none; font: inherit; font-size: 14px;
  line-height: 1.5; max-height: 120px; }
.av-wrap { position: relative; display: inline-flex; }
.presence { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #fff; position: absolute;
  right: -1px; bottom: -1px; }
.presence.online { background: var(--c-green); } .presence.busy { background: var(--c-red); }
.presence.away { background: var(--c-amber); } .presence.offline { background: #cbd5e1; }

/* ---------- calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--c-border);
  border-radius: var(--r-md); overflow: hidden; background: var(--c-border); gap: 1px; }
.cal-dow { background: var(--c-muted); padding: 9px; text-align: center; font-size: 11px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; color: var(--c-text-3); }
.cal-cell { background: #fff; min-height: 118px; padding: 7px 8px; transition: background var(--t); cursor: pointer; }
.cal-cell:hover { background: var(--c-hover); }
.cal-cell.other { background: var(--c-muted); }
.cal-cell.today { background: var(--c-primary-light); }
.cal-cell .cd { font-size: 12.5px; font-weight: 700; color: var(--c-text-2); margin-bottom: 5px; }
.cal-cell.today .cd span { background: var(--c-primary); color: #fff; border-radius: 50%; width: 22px;
  height: 22px; display: inline-grid; place-items: center; }
.cal-ev { display: block; width: 100%; text-align: left; font-size: 11px; font-weight: 650; padding: 3px 6px;
  border-radius: 5px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: all var(--t); }
.cal-ev:hover { filter: brightness(.95); }
.day-grid { display: grid; grid-template-columns: 58px 1fr; border: 1px solid var(--c-border);
  border-radius: var(--r-md); overflow: hidden; background: #fff; }
.day-hour { border-bottom: 1px solid var(--c-border-light); height: 54px; font-size: 11px; color: var(--c-text-3);
  padding: 4px 8px; text-align: right; font-weight: 600; }
.day-slot { border-bottom: 1px solid var(--c-border-light); border-left: 1px solid var(--c-border-light);
  height: 54px; position: relative; }
.day-ev { position: absolute; left: 6px; right: 6px; border-radius: 7px; padding: 5px 9px; overflow: hidden;
  font-size: 11.5px; cursor: pointer; transition: all var(--t); z-index: 1; }
.day-ev:hover { filter: brightness(.97); box-shadow: var(--sh-sm); z-index: 2; }

/* ---------- drive ---------- */
.drive-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); }
.dcard { border: 1px solid var(--c-border); border-radius: var(--r-md); background: #fff; overflow: hidden;
  cursor: pointer; transition: all var(--t); text-align: left; width: 100%; }
.dcard:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-md); transform: translateY(-2px); }
.dcard .dc-thumb { height: 106px; display: grid; place-items: center; background: var(--c-sunken);
  border-bottom: 1px solid var(--c-border-light); position: relative; }
.dcard .dc-body { padding: 11px 12px; }
.dcard .dc-name { font-size: 12.5px; font-weight: 650; line-height: 1.35; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 34px; }
.dcard .dc-meta { font-size: 11px; color: var(--c-text-3); margin-top: 5px; }
.dcard .dc-star { position: absolute; top: 8px; right: 8px; color: var(--c-amber); }
.dcard .dc-lock { position: absolute; top: 8px; left: 8px; color: var(--c-text-3); }
.ftype { width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.ftype.sm { width: 32px; height: 32px; border-radius: 9px; }
.dropzone { border: 2px dashed var(--c-border-hover); border-radius: var(--r-md); padding: 30px;
  text-align: center; color: var(--c-text-3); transition: all var(--t); background: var(--c-muted); }
.dropzone:hover { border-color: var(--c-primary); color: var(--c-primary-hover); background: var(--c-primary-light); }
.pick-list { max-height: 380px; overflow-y: auto; border: 1px solid var(--c-border); border-radius: var(--r); }
.pick-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 13px;
  border-bottom: 1px solid var(--c-border-light); text-align: left; transition: background var(--t); }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--c-hover); }
.pick-row.on { background: var(--c-primary-light); }

/* document viewer */
.viewer { background: #1e293b; border-radius: var(--r-md); overflow: hidden; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: #0f172a; color: #e2e8f0; }
.viewer-bar .vb-btn { color: #94a3b8; display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 7px; transition: all var(--t); }
.viewer-bar .vb-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.viewer-stage { padding: 26px; display: grid; place-items: center; min-height: 400px; background: #334155; }
.page-sheet { background: #fff; width: 100%; max-width: 520px; aspect-ratio: 1 / 1.414; border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4); padding: 34px 38px; overflow: hidden; }
.sk-line { height: 9px; border-radius: 3px; background: #e2e8f0; margin-bottom: 11px; }
.sheet-grid { display: grid; grid-template-columns: 34px repeat(5, 1fr); gap: 1px; background: #e2e8f0;
  border: 1px solid #e2e8f0; border-radius: 4px; overflow: hidden; }
.sheet-grid div { background: #fff; padding: 6px 8px; font-size: 10.5px; }
.sheet-grid .hd { background: #f1f5f9; font-weight: 700; color: #64748b; }

/* ---------- crm ---------- */
.deal-card { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r); padding: 12px;
  box-shadow: var(--sh-xs); cursor: pointer; transition: all var(--t); }
.deal-card:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-md); transform: translateY(-1px); }
.deal-card .dv { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }

/* ---------- shared bits ---------- */
.stat-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--c-border);
  border-radius: var(--r); background: #fff; transition: all var(--t); width: 100%; text-align: left; }
.stat-row:hover { border-color: var(--c-primary-softer); box-shadow: var(--sh-sm); }
.seg-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--c-sunken);
  border: 1px solid var(--c-border); border-radius: var(--r); }
.seg-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
  border-radius: 7px; font-size: 12.5px; font-weight: 650; color: var(--c-text-2); text-decoration: none; }
.seg-tabs a:hover { color: var(--c-text); text-decoration: none; }
.seg-tabs a.on { background: #fff; color: var(--c-primary-hover); box-shadow: var(--sh-xs); }
.hero { background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%); border: 1px solid #dbeafe;
  border-radius: var(--r-lg); padding: 24px 26px; }

@media (max-width: 1100px) {
  .pane { flex-direction: column; height: auto; }
  .pane-list { flex-basis: auto; max-height: 320px; border-right: 0; border-bottom: 1px solid var(--c-border); }
}

/* ---------- suite split: the rail groups, the launcher tabs ----------
   Twenty apps do not fit in one unbroken rail column, so the rail scrolls and
   each suite gets a labelled divider. The label is tiny on purpose — it is a
   signpost between groups, not a heading competing with the app names. */
.rail { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.rail::-webkit-scrollbar { width: 5px; }
.rail::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }
.rail::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); }
.rail-sec { display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 50px; margin: 9px 0 3px; flex-shrink: 0; }
.rail-sec:first-child { margin-top: 0; }
.rail-sec i { display: block; width: 26px; height: 1px; background: var(--c-border); }
.rail-sec span { font-size: 8.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--c-text-3); text-align: center; line-height: 1.25; }

.suite-tabs { margin-bottom: 0; }
.suite-tabs .tab.on { color: var(--ac); border-bottom-color: var(--ac); }
.suite-tabs .tab.on .n { background: color-mix(in srgb, var(--ac) 13%, transparent); color: var(--ac); }
.suite-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 12px 14px;
  border-radius: var(--r-md); background: color-mix(in srgb, var(--ac) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--ac) 20%, transparent);
  font-size: 12.5px; line-height: 1.55; color: var(--c-text-2); }
.suite-note > *:first-child { color: var(--ac); flex-shrink: 0; margin-top: 1px; }


/* ---------- narrow screens, every app ----------
   Two things break layouts at phone width in this codebase. A grid or flex
   child will not shrink below its own content unless told it may, so one long
   name pushes the whole page sideways; and the topbar is a single row that
   cannot wrap. Both are fixed here rather than per app. */
.g-2 > *, .g-3 > *, .g-4 > *, .g-5 > *, .g-2-1 > *, .g-1-2 > *, .g-3-2 > * { min-width: 0; }
.card-head > *, .phead > * { min-width: 0; }

@media (max-width: 720px) {
  /* the parts of the topbar that are decoration rather than navigation */
  .app-chip, .topbar-div { display: none; }
  .brand-name span { display: none; }
  .ctx-chip .lbl { display: none; }
  .ctx-chip .val { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .phead { flex-wrap: wrap; row-gap: 10px; }
  .phead-actions { flex-wrap: wrap; max-width: 100%; }
  .card-head { flex-wrap: wrap; row-gap: 4px; }
}
@media (max-width: 460px) {
  /* at this width the topbar keeps only what you cannot work without:
     the launcher, the workspace, notifications and you */
  #ai-btn, #help-btn { display: none; }
  .topbar { padding-left: 8px; padding-right: 8px; gap: 6px; }
}
@media (max-width: 560px) {
  .brand-name { display: none; }
  .ctx-chip .val { max-width: 74px; }
  .launch-grid { grid-template-columns: 1fr 1fr; }
}
