/* Medha Hub styles.

   Every colour token (light and dark) lives in theme.css — the single source
   of truth for every Medha application. It is linked before this file in the
   HTML, so this stylesheet only ever references var(--token). */

:root[data-theme="dark"] body {
  /* Black ground, with cards lifting off it at --surface. */
  background: var(--canvas);
}
:root[data-theme="dark"] .primary-button:hover,
:root[data-theme="dark"] .modal-confirm:hover,
:root[data-theme="dark"] .reply-send:hover {
  background: var(--accent-deep);
}
:root[data-theme="dark"] .ai-summary-actions button { color: var(--rose-700); }
:root[data-theme="dark"] .ai-summary-actions button:hover { background: var(--rose-100); }
:root[data-theme="dark"] .priority-very-high { background: var(--border); color: var(--rose-300); }
:root[data-theme="dark"] .priority-high { background: var(--border); color: var(--rose-300); }
:root[data-theme="dark"] .priority-medium { background: var(--warning-bg); color: var(--tint-orange-fg); }
* { box-sizing: border-box; }

/* Smooth, modern theme switch: fade colors instead of snapping when
   data-theme flips, without animating layout-affecting properties. */
body,
.apps-topbar,
.card,
.app-tile,
.app-tile-icon,
.header-menu-panel,
.modal-card,
.primary-button,
.secondary-button,
input,
textarea,
select {
  transition: background-color var(--motion-base) var(--ease),
    color var(--motion-base) var(--ease),
    border-color var(--motion-base) var(--ease),
    box-shadow var(--motion-base) var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  body,
  .apps-topbar,
  .card,
  .app-tile,
  .app-tile-icon,
  .header-menu-panel,
  .modal-card,
  .primary-button,
  .secondary-button,
  input,
  textarea,
  select {
    transition: none;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  /* Ground, not card: body used to paint --surface (pure white), so white
     cards had nothing to lift off and the light theme read as one flat sheet. */
  background: var(--canvas);
}
button, input, select { font: inherit; }

html, body, .shell { height: 100%; }
.shell { min-height: 100vh; }
html, body { max-width: 100%; overflow-x: hidden; }
img { max-width: 100%; }

/* Ambient starfield canvas - fixed behind every view, drawn by starfield.js.
   Negative z-index keeps it under normal-flow content without needing to
   touch every panel's own stacking; the views above it trade solid fills
   for translucent ones so the stars actually show through. */
#starfield-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  pointer-events: none;
}
:root[data-theme-collection="halloween"] #starfield-bg { display:none; }
:root[data-theme-collection="thanksgiving"] #starfield-bg { display:none; }

/* Login / access screen */
#login-view.card {
  background: linear-gradient(to bottom right, color-mix(in srgb, var(--rose-50) 88%, transparent), color-mix(in srgb, var(--surface) 90%, transparent));
  align-items: center;
  justify-content: center;
}
.card {
  width: 100%;
  min-height: 100vh;
  display: flex;
  padding: 40px 20px;
  text-align: center;
}
.card-inner { width: min(100%, 400px); }
.wordmark { display: block; width: 202px; height: auto; margin: 0 auto 24px; }

.access-card {
  background: var(--surface);
  border: 1px solid var(--rose-200);
  border-radius: var(--radius-modal);
  padding: 32px;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--slate-900) 8%, transparent), 0 1px 2px color-mix(in srgb, var(--slate-900) 6%, transparent);
}

.apps-card {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  /* Transparent in both themes so the fixed starfield canvas below is what
     the applications sit on. */
  background: transparent;
}
.apps-body {
  flex: 1;
  padding: 32px clamp(20px, 5vw, 56px);
}
.apps-inner { width: 100%; margin: 0; animation: fade-in 0.4s ease; }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.card h2 { margin: 0 0 8px; font-size: 24px; font-weight: 700; color: var(--text); }
.subtext { margin: 0 0 28px; color: var(--text-secondary); line-height: 1.5; font-size: 14px; }

form { text-align: left; }
label { display: block; margin: 0 0 4px; font-size: 14px; font-weight: 500; color: var(--slate-700); }
.label-row { margin-top: 16px; }

input, select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-control);
  outline: none;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
input::placeholder { color: var(--slate-400); }
input:focus, select:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--rose-500);
}
.input-wrap { position: relative; }
.icon-button {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--slate-400);
  cursor: pointer;
}
.icon-button:hover { background: var(--slate-100); color: var(--slate-500); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.message { min-height: 18px; margin: 8px 2px 4px; color: var(--rose-600); font-size: 12px; }

.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  height: auto;
  padding: 12px 24px;
  border: 0;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  transition: background-color 0.15s, transform 0.1s;
}
.primary-button { color: white; background: var(--rose-600); }
.primary-button:hover { background: var(--brand-solid-deep); }
.primary-button:active { transform: scale(0.97); }
.primary-button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
form > .primary-button { width: 100%; margin-top: 6px; }

.secure-note { margin: 20px 0 0; text-align: center; color: var(--slate-400); font-size: 12px; }

.secondary-button {
  padding: 8px 16px;
  font-size: 14px;
  border: 1px solid var(--rose-300);
  color: var(--rose-700);
  background: var(--surface);
}
.secondary-button:hover { background: var(--rose-50); }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  flex: none;
  line-height: 0;
}
.icon-btn-svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Spin the refresh glyph while a sync is in flight. */
.icon-btn.is-busy .icon-btn-svg { animation: icon-btn-spin 0.9s linear infinite; }
@keyframes icon-btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .icon-btn.is-busy .icon-btn-svg { animation: none; } }

/* Header geometry and typography are shared across themes. */
.apps-topbar, .mailbox-topbar { font-family: Arial, Helvetica, sans-serif; }

/* Dashboard topbar (persistent app chrome - uses the exact Clockin menu color) */
.apps-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px clamp(16px, 5vw, 56px);
  background: var(--header-background);
  color: white;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 121;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.brand-logo-tile {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 8px;
  border-radius: var(--radius-card);
  background: white;
  flex-shrink: 0;
}
.brand-logo-tile img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; overflow: hidden; }
.brand-top { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.brand-sub { font-size: 11px; color: var(--rose-300); letter-spacing: 0.16em; text-transform: uppercase; }

.topbar-right { position: relative; display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }
.user-chip { display: none !important; }
.user-chip-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  max-width: 210px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-role { display: none !important; }
.notifications-button,
.header-menu-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rose-700);
  border-radius: 999px;
  color: white;
  background: transparent;
  cursor: pointer;
}
.notifications-button:hover,
.header-menu-button:hover,
.notifications-button.has-unread {
  background: var(--brand-solid-deep);
}
.notifications-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notifications-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--rose-900);
  border-radius: 999px;
  color: white;
  background: var(--amber-500);
  font-size: 10px;
  font-weight: 900;
  line-height: 14px;
  text-align: center;
}
.header-menu { position: relative; flex: none; order: -1; }
.header-menu-button {
  gap: 0;
  padding: 0;
  border-color: color-mix(in srgb, var(--glow) 22%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--glow) 8%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--glow) 12%, transparent), 0 6px 16px color-mix(in srgb, var(--slate-900) 14%, transparent);
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.header-menu-button:hover,
.header-menu-button[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--glow) 38%, transparent);
  background: color-mix(in srgb, var(--glow) 16%, transparent);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--glow) 18%, transparent), 0 9px 22px color-mix(in srgb, var(--slate-900) 20%, transparent);
}
.header-menu-button span {
  position: absolute;
  left: 50%;
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translateX(-50%);
  transition: transform .18s ease, opacity .14s ease, top .18s ease, width .18s ease;
}
.header-menu-button span:nth-child(1) { top: 12px; width: 15px; }
.header-menu-button span:nth-child(2) { top: 17px; width: 19px; }
.header-menu-button span:nth-child(3) { top: 22px; width: 13px; }
.header-menu-button[aria-expanded="true"] span:nth-child(1) { top: 17px; width: 18px; transform: translateX(-50%) rotate(45deg); }
.header-menu-button[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: translateX(-50%) scaleX(.35); }
.header-menu-button[aria-expanded="true"] span:nth-child(3) { top: 17px; width: 18px; transform: translateX(-50%) rotate(-45deg); }
.header-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  display: grid;
  min-width: 230px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 45px color-mix(in srgb, var(--slate-900) 22%, transparent);
}
.header-menu-panel[hidden] { display: none; }
.header-menu-user {
  display: grid;
  gap: 3px;
  margin: 0 0 6px;
  padding: 11px 12px 12px;
  border-bottom: 1px solid var(--border);
}
.header-menu-user-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.header-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.header-menu-item:hover { background: var(--rose-50); color: var(--rose-700); }
.header-menu-icon svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.user-chip-role {
  margin-top: 3px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.role-badge--admin { color:var(--rose-800); background:var(--rose-100); }
.role-badge--hr { color:var(--info-fg); background:var(--info-bg); }
.role-badge--employee, .role-badge--full_time { color:var(--success-fg); background:var(--success-bg); }
.role-badge--manager { color:var(--tint-violet-fg); background:var(--tint-violet-bg); }
.role-badge--part_time { background: var(--violet-100); color: var(--violet-700); }
.role-badge--contract { background: var(--amber-100); color: var(--amber-700); }
.role-badge--temporary { background: var(--amber-100); color: var(--amber-700); }
.role-badge--intern { background: var(--teal-100); color: var(--teal-700); }
.role-badge--custom { color:var(--role-color); background:var(--role-bg); }
/* No dark rule needed: the tint tokens the badge points at flip themselves. */

.topbar-right .secondary-button {
  background: transparent;
  border-color: var(--rose-700);
  color: white;
}
.topbar-right .secondary-button:hover { background: var(--brand-solid-deep); }

/* Theme toggle - visible sun/moon icon button in the persistent header,
   present on both the Hub topbar and the Mail Box topbar (theme.md #17).
   Icons crossfade + rotate on top of each other instead of snapping via
   display:none, so flipping the theme feels like one deliberate motion. */
.mailbox-calendar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--rose-700);
  border-radius: 50%;
  background: transparent;
  color: white;
  cursor: pointer;
  transition: background-color var(--motion-fast, 0.15s) var(--ease, ease), transform var(--motion-fast, 0.15s) var(--ease, ease);
}
.mailbox-calendar-button:hover { background: var(--brand-solid-deep); transform: scale(1.06); }
.mailbox-calendar-button:active { transform: scale(0.92); }
.mailbox-calendar-button:focus-visible { outline: 2px solid var(--surface); outline-offset: 2px; }
.mailbox-calendar-button:disabled { opacity: .6; cursor: not-allowed; }
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--rose-700);
  border-radius: 50%;
  background: transparent;
  color: white;
  cursor: pointer;
  transition: background-color var(--motion-fast, 0.15s) var(--ease, ease), transform var(--motion-fast, 0.15s) var(--ease, ease), border-color var(--motion-fast, 0.15s) var(--ease, ease);
}
.theme-toggle:hover { background: var(--brand-solid-deep); transform: scale(1.06); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle:focus-visible { outline: 2px solid var(--surface); outline-offset: 2px; }
.theme-toggle svg {
  position: absolute;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity var(--motion-base, 0.24s) var(--ease, ease), transform var(--motion-base, 0.24s) var(--ease, ease);
}
.theme-toggle-icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle-icon-moon,
.header-menu-icon .theme-toggle-icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.4); }
:root[data-theme="dark"] .theme-toggle-icon-sun { opacity: 0; transform: rotate(90deg) scale(0.4); }
:root[data-theme="dark"] .theme-toggle-icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }
@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .theme-toggle svg { transition: none; }
}

@media (max-width: 480px) {
  .apps-topbar { gap: 8px; padding: 10px 14px; }
  .brand-text { display: none; }
  .brand-logo-tile { width: 40px; height: 40px; padding: 7px; border-radius: 12px; }
  .topbar-right { gap: 7px; margin-left: auto; }
  .user-chip-name { max-width: 180px; font-size: 14px; }
  .install-help-button,
  .notifications-button,
  .header-menu-button { width: 34px; height: 34px; }
  .header-menu-panel {
    left: 0;
    min-width: min(230px, calc(100vw - 28px));
  }
}

/* Chat remains a familiar utility control in every collection. Halloween may
   decorate the workspace, but it must never restyle or obscure the original
   chat launcher beside AI summaries or the chat panel controls. */
:root[data-theme-collection="halloween"] .side-dock-btn[data-dock-target="chat-panel"] {
  border-color: var(--rose-200);
  background: var(--surface);
  color: var(--brand-solid);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--slate-900) 7%, transparent);
}
:root[data-theme-collection="halloween"] .side-dock-btn[data-dock-target="chat-panel"]:hover,
:root[data-theme-collection="halloween"] .side-dock-btn[data-dock-target="chat-panel"][aria-expanded="true"] {
  border-color: var(--rose-700);
  background: var(--rose-50);
  color: var(--brand-solid);
}
:root[data-theme-collection="halloween"] .side-dock-btn[data-dock-target="chat-panel"] .side-dock-svg {
  display: block;
  stroke: currentColor;
  fill: none;
}

.apps-card h2 { text-align: left; }
.apps-card .subtext { text-align: left; margin-bottom: 0; }
.apps-section-header { margin-bottom: 24px; }

.create-user-btn {
  display: flex;
  width: fit-content;
  padding: 8px 16px;
  font-size: 14px;
  margin: 0 auto 24px 0;
}

/* Single column. The old `7fr 3fr` split reserved ~30% of the row for a side
   column that no longer lays anything out - Your Emails and Recent Tasks are
   floating overlays now (see .apps-side-col below) - so that space was dead
   and the app tiles stopped short of the right edge. */
.apps-main-row { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 24px; }
.apps-main-col { min-width: 0; grid-column: 1; }
/* Your Emails, Recent Tasks and Notifications are stacked together in
   their own flex column so each one's height is purely a function of its
   own collapsed/expanded state, independent of the (much taller) app-tiles
   column beside it. */
/* The side column no longer lays anything out - both panels are floating
   overlays opened from the heading-row icons. It stays in the DOM purely as
   their container so all existing render logic keeps working. */
.apps-side-col { display: contents; }
#notifications-card { display: none !important; }

/* ---------- floating panels (all screen sizes) ---------- */
/* app.js mounts these nodes directly under body, alongside the scrim.
   Do not nest them in the animated/isolation-based application background:
   a child z-index cannot escape its ancestor to receive clicks above it. */
/* Grows out of the icon that opened it. The handler sets --anchor-x/-y from
   the button's position; the panel is right-aligned to that point and scales
   from its top-right corner. Phone overrides to a bottom sheet below. */
#email-digest-panel,
#chat-panel,
#activities-card,
#mail-panel {
  position: fixed;
  z-index: 90;
  top: var(--anchor-y, 96px);
  left: auto;
  right: var(--anchor-right, 24px);
  width: min(720px, calc(100vw - 32px));
  max-height: min(74vh, 680px);
  margin: 0;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  box-shadow: 0 24px 60px color-mix(in srgb, var(--slate-900) 26%, transparent);
  transform-origin: top right;
  transform: scale(0.9) translateY(-6px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.16s ease, visibility 0.2s;
}
#email-digest-panel.drawer-open,
#chat-panel.drawer-open,
#activities-card.drawer-open,
#mail-panel.drawer-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
}
/* The list scrolls inside the card; its own cap would double-clip it. */
#email-digest-panel #email-digest-list,
#chat-panel #chat-panel-list,
#activities-card #activities-list,
#mail-panel #mail-list {
  max-height: none;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Floating panels are always open, so their lists must show regardless of
   the saved expand/collapse state the caret used to control. */
#email-digest-panel #email-digest-list { display: block; }
#chat-panel #chat-panel-list { display: flex; flex-direction: column; }

/* Chat previews use their own row system. Without these rules the semantic
   spans collapse into one run of text inside the floating panel. */
#chat-panel { overflow:hidden; border:1px solid var(--border); background:var(--surface); }
.chat-panel-header { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:16px 18px; border-bottom:1px solid var(--border); background:color-mix(in srgb,var(--surface-raised) 88%,transparent); }
.chat-panel-header h2 { margin:0; font-size:16px; }.chat-panel-header p { margin:3px 0 0; color:var(--text-secondary); font-size:12px; }
.chat-panel-actions { display:flex; gap:8px; flex:none; }
.chat-panel-list { padding:8px; gap:4px; background:var(--surface); }
.chat-row { width:100%; display:grid; grid-template-columns:44px minmax(0,1fr) auto; align-items:center; gap:11px; min-height:64px; padding:9px 10px; border:0; border-radius:12px; color:var(--text); background:transparent; text-align:left; font:inherit; cursor:pointer; }
.chat-row:hover,.chat-row:focus-visible { outline:0; background:var(--brand-soft-bg); }
.chat-row--unread { background:color-mix(in srgb,var(--brand-soft-bg) 65%,transparent); }
.chat-row-avatar { position:relative; display:grid; place-items:center; width:42px; height:42px; border-radius:14px; color:#fff; background:linear-gradient(135deg,var(--brand-solid),var(--brand-solid-deep)); font-size:12px; font-weight:850; letter-spacing:.03em; }
.chat-row-online { position:absolute; right:-1px; bottom:-1px; width:11px; height:11px; border:2px solid var(--surface); border-radius:50%; background:#22c55e; }
.chat-row-copy { display:grid; gap:3px; min-width:0; }.chat-row-top { display:flex; align-items:center; justify-content:space-between; gap:8px; min-width:0; }.chat-row-top strong { overflow:hidden; font-size:13px; text-overflow:ellipsis; white-space:nowrap; }.chat-row-top time { flex:none; color:var(--text-muted); font-size:11px; }.chat-row-preview { overflow:hidden; color:var(--text-secondary); font-size:12px; text-overflow:ellipsis; white-space:nowrap; }.chat-row-unread { display:grid; place-items:center; min-width:20px; height:20px; padding:0 5px; border-radius:999px; color:#fff; background:var(--brand-solid); font-size:10px; font-weight:850; }
:root[data-theme-collection="halloween"] #chat-panel { border-color:color-mix(in srgb,var(--brand-solid) 40%,var(--border)); box-shadow:0 24px 60px rgba(43,0,7,.4); }

/* Conversation overlay: token-based rather than collection-specific, so it
   stays readable in Original, Halloween, and later theme collections. */
.chat-thread[hidden] { display:none; }
.chat-thread { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; padding:20px; }
.chat-thread-scrim { position:absolute; inset:0; background:color-mix(in srgb,var(--scrim,#170b10) 62%,transparent); backdrop-filter:blur(4px); }
.chat-thread-card { position:relative; z-index:1; display:grid; grid-template-rows:auto minmax(0,1fr) auto; width:min(920px,100%); height:min(760px,calc(100dvh - 40px)); overflow:hidden; border:1px solid var(--border-strong); border-radius:20px; background:var(--surface); color:var(--text); box-shadow:0 28px 80px color-mix(in srgb,var(--text) 32%,transparent); }
.chat-thread-head { display:flex; align-items:center; gap:11px; min-width:0; padding:13px 16px; border-bottom:1px solid var(--border); background:var(--surface-raised); }
.chat-thread-avatar { display:grid; flex:none; place-items:center; width:38px; height:38px; border-radius:12px; color:var(--text-on-brand,#fff); background:linear-gradient(135deg,var(--brand-solid),var(--brand-solid-deep)); font-size:11px; font-weight:850; }
.chat-thread-who { display:grid; min-width:0; gap:2px; flex:1; }.chat-thread-who strong,.chat-thread-who small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.chat-thread-who strong { font-size:14px; }.chat-thread-who small { color:var(--text-secondary); font-size:11px; }
.chat-thread-open,.chat-thread-close { display:grid; flex:none; place-items:center; width:34px; height:34px; border:1px solid var(--border); border-radius:10px; color:var(--text-secondary); background:var(--surface); cursor:pointer; }.chat-thread-open:hover,.chat-thread-close:hover { color:var(--text-on-brand,#fff); border-color:var(--brand-solid); background:var(--brand-solid); }.chat-thread-open svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }.chat-thread-close { font-size:22px; line-height:1; }
.chat-thread-body { position:relative; min-height:0; background:var(--surface-sunken); }.chat-thread-frame { display:block; width:100%; height:100%; border:0; opacity:0; transition:opacity .16s ease; }.chat-thread-frame.is-ready { opacity:1; }
.chat-thread-loading { position:absolute; inset:0; z-index:1; display:grid; place-content:center; justify-items:center; gap:7px; color:var(--text-secondary); text-align:center; }.chat-thread-loading strong { color:var(--text); }.chat-thread-loading small { font-size:12px; }.chat-thread-error { min-height:0; margin:0; padding:0 16px 12px; color:var(--danger-fg); font-size:12px; }.chat-thread-grip { display:none; }
body.chat-thread-open { overflow:hidden; }
@media (max-width:599px) { .chat-thread { padding:0; align-items:end; }.chat-thread-card { width:100%; height:min(88dvh,760px); border-radius:20px 20px 0 0; }.chat-thread-grip { display:block; position:absolute; top:6px; left:50%; width:36px; height:4px; border-radius:999px; background:var(--border-strong); transform:translateX(-50%); }.chat-thread-head { padding-top:16px; } }
#activities-card #activities-list { display: grid; }
#mail-panel #mail-list { display: block; }

@media (max-width: 599px) {
  /* Phone: dock to the bottom edge as a sheet instead of a centred card. */
  #email-digest-panel,
  #chat-panel,
#chat-panel,
  #activities-card,
  #mail-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 82vh;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 34px color-mix(in srgb, var(--slate-900) 22%, transparent);
    transform: translateY(102%);
    transform-origin: center bottom;
    opacity: 1;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.3s;
  }
  #email-digest-panel.drawer-open,
  #chat-panel.drawer-open,
#chat-panel.drawer-open,
  #activities-card.drawer-open,
  #mail-panel.drawer-open { transform: translateY(0); }
  /* Grab handle, so the sheet reads as swipe-dismissable. */
  #email-digest-panel.drawer-open::before,
  #chat-panel.drawer-open::before,
  #activities-card.drawer-open::before,
  #mail-panel.drawer-open::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--slate-200);
  }
  /* Header is the swipe grip - must not select text while dragging. */
  #email-digest-panel .email-digest-header,
  #chat-panel .chat-panel-header,
  #activities-card .activities-card-header,
  #mail-panel .mail-panel-header {
    padding-top: 18px;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }
  /* Track the finger 1:1 while dragging. */
  #email-digest-panel.drawer-dragging,
  #chat-panel.drawer-dragging,
  #activities-card.drawer-dragging,
  #mail-panel.drawer-dragging { transition: none; }
}

.email-digest-panel { margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: 0 8px 24px color-mix(in srgb, var(--slate-900) 8%, transparent); overflow: hidden; }
.email-digest-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.email-digest-header h2 { margin: 0; font-size: 16px; }
.email-digest-header .secondary-button { flex: none; padding: 7px 12px; }
.email-digest-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.email-digest-list { max-height: 460px; overflow-y: auto; }
.email-digest-empty { margin: 0; padding: 26px; text-align: center; color: var(--slate-400); font-size: 13px; }
.email-digest-row { border-bottom: 1px solid var(--slate-100); }
.email-digest-row:last-child { border-bottom: 0; }
.email-digest-row.unread { background: var(--slate-50); }
.email-digest-open { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 12px 18px; border: 0; background: none; text-align: left; cursor: pointer; -webkit-user-select: text; user-select: text; }
.email-digest-open:hover { background: var(--slate-50); }
.email-digest-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.email-digest-subject { font-size: 14px; font-weight: 700; color: var(--slate-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-digest-meta { color: var(--slate-500); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-digest-body { margin-top: 2px; color: var(--slate-600); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.email-digest-summary { margin-top: 3px; color: var(--slate-700); font-size: 13.5px; line-height: 1.5; font-weight: 500; }
/* A row the AI could not summarize shows a body excerpt. It is marked so an
   excerpt is never mistaken for a summary. */
.email-digest-summary.is-excerpt { color: var(--slate-500); font-style: italic; font-weight: 400; }
.email-digest-excerpt-note { display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 999px; background: var(--warning-bg); color: var(--warning-fg); font-size: 10px; font-weight: 700; }
.email-digest-facts { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.digest-fact { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; line-height: 1.4; }
.digest-fact-label { flex: none; color: var(--slate-500); font-weight: 700; }
.digest-fact-label::after { content: ""; }
.digest-fact-value { color: var(--slate-800); font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.email-digest-caret { flex: none; margin-top: 2px; color: var(--slate-400); font-size: 12px; transition: transform 0.15s; }
.email-digest-row.expanded .email-digest-caret { transform: rotate(90deg); }
.email-digest-detail { display: none; padding: 0 18px 14px 46px; }
.email-digest-row.expanded .email-digest-detail { display: block; }
.email-digest-detail strong { display: block; color: var(--slate-500); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.email-digest-detail p { margin: 5px 0 0; color: var(--slate-700); font-size: 13px; line-height: 1.5; }
.email-digest-priority { flex: none; margin-top: 1px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
.priority-very-high { background: var(--rose-200); color: var(--rose-900); }
.priority-high { background: var(--rose-100); color: var(--rose-800); }
.priority-medium { background: var(--rose-50); color: var(--rose-700); }
.priority-low { background: var(--slate-100); color: var(--slate-600); }
.priority-very-low { background: var(--slate-100); color: var(--slate-400); }
.priority-none { background: var(--slate-100); color: var(--slate-400); }
/* Phone digest rows. The previous rule here targeted .email-digest-row-head,
   a class the markup does not use, so the subject kept `white-space: nowrap`
   and long subjects widened the list instead of wrapping. */
@media (max-width: 640px) {
  .email-digest-open { gap: 8px; padding: 12px 14px; }
  .email-digest-subject,
  .email-digest-meta {
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .email-digest-subject { font-size: 13px; line-height: 1.35; -webkit-line-clamp: 3; }
  .email-digest-meta { font-size: 11.5px; -webkit-line-clamp: 2; }
  .email-digest-summary { font-size: 12.5px; line-height: 1.45; }
  .digest-fact { font-size: 11.5px; }
  .email-digest-priority { font-size: 10px; padding: 2px 7px; }
  /* Detail block is indented to line up under the text on desktop; on a phone
     that indent alone eats a quarter of the screen. */
  .email-digest-detail { padding: 0 14px 12px; }
  .email-digest-detail p { font-size: 12.5px; }
  .ai-summary-warehouse-actions { gap: 6px; }
  .ai-summary-warehouse-btn { flex: 1 1 auto; padding: 8px 10px; font-size: 11.5px; }
}

.activities-card {
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--slate-900) 16%, transparent), 0 4px 10px color-mix(in srgb, var(--slate-900) 6%, transparent);
}
.activities-card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.activities-card-header h2 { margin: 0; font-size: 16px; }
.activities-card-header p { margin: 4px 0 0; color: var(--slate-500); font-size: 12px; }
.activities-card-header .secondary-button { flex: none; padding: 7px 12px; }
.activities-card-actions { display:flex; align-items:center; gap:8px; }
.activities-card:not(.expanded) { min-height:0; }
.activities-list, .notifications-list { display:none; }
.activities-card.expanded .activities-list { display:grid; }
.notifications-card.expanded .notifications-list { display:grid; }
.activities-card.expanded .panel-toggle-caret { transform:rotate(90deg); }
.activities-list { gap:8px; max-height:650px; overflow-y:auto; padding:10px; background:var(--slate-50); }
.notifications-list { gap:8px; max-height:650px; overflow-y:auto; padding:10px; background:var(--slate-50); }
.notifications-card { display:none !important; }
.notifications-modal { padding: clamp(12px, 3vw, 32px); }
.notifications-modal-card {
  width: min(620px, 96vw);
  max-height: min(760px, 88dvh);
  overflow: hidden;
}
.notifications-modal-header {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
}
.notifications-modal-list {
  display:grid !important;
  max-height: min(620px, 70dvh);
  overflow-y:auto;
  border-top: 1px solid var(--border);
}
.notification-row { display:flex; align-items:center; gap:12px; padding:10px; border:1px solid var(--rose-100); border-radius:10px; color:inherit; background:var(--surface); text-decoration:none; }
.notification-row--unread { border-color:var(--amber-300); background:linear-gradient(135deg,var(--amber-100),var(--surface)); box-shadow:inset 3px 0 0 var(--amber-500); }
.notification-row:hover { border-color:var(--rose-300); box-shadow:0 3px 10px color-mix(in srgb, var(--slate-900) 8%, transparent); }
.notification-row img { width:48px; height:48px; flex:none; object-fit:contain; border-radius:8px; background:var(--surface); }
.notification-copy { display:grid; gap:3px; min-width:0; flex:1; text-align:left; }
.notification-copy strong { overflow:hidden; color:var(--slate-900); font-size:13px; text-overflow:ellipsis; white-space:nowrap; }
.notification-copy span,.notification-copy small { color:var(--slate-500); font-size:11.5px; line-height:1.3; }
.notification-arrow { flex:none; color:var(--rose-700); font-weight:700; }
.notification-kind { flex:none; min-width:66px; padding:3px 8px; border-radius:999px; font-size:10px; font-weight:800; text-align:center; text-transform:uppercase; }
.notification-kind--event { color:var(--violet-700); background:var(--violet-100); }
.notification-kind--shipment { color:var(--blue-700); background:var(--blue-100); }
.notification-kind--entry { color:var(--emerald-700); background:var(--emerald-100); }
.notification-kind--task { color:var(--rose-700); background:var(--rose-100); }
.notification-kind--file { color:var(--blue-700); background:var(--blue-100); }
.notification-kind--exhibition { color:var(--violet-700); background:var(--violet-100); }
.notification-load-more { width:100%; padding:10px; border:1px solid var(--rose-200); border-radius:9px; color:var(--rose-700); background:var(--surface); font-weight:700; }
.notification-load-more:hover { background:var(--rose-50); }
@media (max-width: 900px) {
  .apps-main-row { display: flex; flex-direction: column; }
  .apps-main-col { width: 100%; }
}
.activity-row { display:flex; flex-direction:column; overflow:hidden; border:1px solid var(--rose-100); border-radius:10px; background:linear-gradient(135deg,var(--surface),var(--rose-50)); box-shadow:0 1px 3px color-mix(in srgb, var(--slate-900) 6%, transparent); transition:transform .15s,box-shadow .15s,border-color .15s; }
.activity-row:hover { transform:translateY(-1px); border-color:var(--rose-200); box-shadow:0 5px 14px color-mix(in srgb, var(--slate-900) 10%, transparent); }
.activity-row-main { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:13px 18px; }
.activity-row-title { display:block; width:100%; color:var(--slate-900); font-size:14px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
.activity-row-left { display:grid; gap:6px; min-width:0; flex:1; text-align:left; }
.activity-row-assignees { display:block; overflow:hidden; color:var(--slate-600); font-size:12px; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
.activity-row-badges { display:grid; justify-items:end; gap:6px; flex:none; }
.activity-badge { padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
.activity-row-footer { display:flex; align-items:center; justify-content:flex-end; gap:8px 16px; min-width:0; padding:8px 18px; background:var(--slate-100); text-align:right; }
.activity-row-footer .activity-row-meta + .activity-row-meta { padding-left:16px; border-left:1px solid var(--slate-300); }
.activity-row-meta { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: var(--slate-500); font-size: 12px; }
.activity-row-meta-icon { flex: none; font-size: 12px; line-height: 1; }
.activity-row-meta-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row-meta--completed { color: var(--emerald-700); font-weight: 600; }
.activity-category--event { background: var(--violet-100); color: var(--violet-700); }
.activity-category--finance { background: var(--emerald-100); color: var(--emerald-700); }
.activity-category--hr-admin { background: var(--rose-100); color: var(--rose-700); }
.activity-category--repair { background: var(--amber-100); color: var(--amber-700); }
.activity-category--record-update { background: var(--blue-100); color: var(--blue-700); }
.activity-category--other { background: var(--slate-100); color: var(--slate-700); }
.activity-status--completed { background: var(--emerald-100); color: var(--emerald-700); }
.activity-status--in-progress { background: var(--blue-100); color: var(--blue-700); }
.activity-status--routine { background: var(--teal-100); color: var(--teal-700); }
.activity-status--pending { background: var(--amber-100); color: var(--amber-700); }
.activities-empty { margin: 0; padding: 28px; color: var(--slate-400); text-align: center; font-size: 13px; }
@media (max-width: 640px) {
  .activity-row-main { width:100%; }
  .activity-row-title { flex: none; width: 100%; white-space: normal; text-align: left; }
  .activity-row-footer { width:100%; flex-wrap:wrap; }
}

.mail-panel { margin: 24px 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: 0 1px 3px color-mix(in srgb, var(--slate-900) 8%, transparent); }
.mail-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.mail-panel-header h2 { margin: 0; font-size: 16px; }
.mail-panel-header p { margin: 4px 0 0; color: var(--slate-500); font-size: 12px; }
.mail-panel-header .secondary-button { flex: none; padding: 7px 12px; }
.mail-list { max-height: 340px; overflow-y: auto; }
/* Mail + Your Emails both start collapsed every load and remember the last
   expanded/collapsed state the user left them in (see MAIL_PANEL_EXPANDED_KEY /
   DIGEST_PANEL_EXPANDED_KEY in app.js). */
#mail-list, #email-digest-list { display: none; }
.mail-panel.expanded #mail-list, .email-digest-panel.expanded #email-digest-list { display: block; }
.panel-toggle { flex: none; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); cursor: pointer; transition: background 0.15s; }
.panel-toggle:hover { background: var(--slate-100); }
.panel-toggle-caret { display: flex; align-items: center; justify-content: center; transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1); }
.panel-toggle-svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mail-panel.expanded .panel-toggle-caret,
.email-digest-panel.expanded .panel-toggle-caret,
.activities-card.expanded .panel-toggle-caret,
.notifications-card.expanded .panel-toggle-caret { transform: rotate(90deg); }
.mail-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--slate-100); }
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: var(--slate-50); }
.mail-row[role="button"] { cursor: pointer; }
.mail-row[role="button"]:focus-visible { outline: 2px solid var(--rose-600); outline-offset: -2px; }
.mail-copy { min-width: 0; flex: 1; text-align: left; }
.mail-copy strong,.mail-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-copy strong { color: var(--slate-900); font-size: 14px; }
.mail-copy span,.mail-row time { margin-top: 3px; color: var(--slate-500); font-size: 12px; }
.mail-copy .mail-sender { margin-top: 0; color: var(--slate-700); font-size: 13px; font-weight: 700; }
.mail-copy .mail-preview { color: var(--slate-500); }
.mail-row time { flex: none; text-align: right; }
.mail-row-side { display: grid; justify-items: end; gap: 8px; flex: none; }
.mail-ai-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--rose-200); border-radius: 50%; color: white; background: linear-gradient(135deg,var(--rose-600),var(--rose-800)); box-shadow: 0 4px 12px color-mix(in srgb, var(--tint-pink-fg) 22%, transparent); cursor: pointer; transition: transform .15s,box-shadow .15s; }
.mail-ai-button:hover { transform: translateY(-1px); box-shadow: 0 7px 16px color-mix(in srgb, var(--tint-pink-fg) 30%, transparent); }
.mail-ai-button svg { width: 18px; height: 18px; fill: currentColor; }
.mail-ai-button.loading { animation: ai-pulse 1s infinite alternate; }
@keyframes ai-pulse { to { opacity:.55; transform:scale(.92); } }
.ai-summary-card { width:min(660px,calc(100vw - 28px)); max-height:90vh; overflow:auto; padding:0; border:1px solid var(--rose-100); background:linear-gradient(160deg,var(--surface) 65%,var(--rose-50)); }
.ai-summary-header { display:flex; align-items:flex-start; gap:12px; padding:20px 22px; border-bottom:1px solid var(--rose-100); }
.ai-summary-brand { display:flex; align-items:flex-start; gap:12px; min-width:0; flex:1 1 auto; }
.ai-summary-brand > div { min-width:0; }
.ai-summary-logo { display:grid; place-items:center; width:42px; height:42px; flex:none; border-radius:50%; color:white; background:linear-gradient(135deg,var(--rose-500),var(--rose-800)); box-shadow:0 6px 16px color-mix(in srgb, var(--tint-pink-fg) 25%, transparent); font-size:12px; font-weight:900; letter-spacing:.04em; }
.ai-summary-eyebrow { margin:0 0 3px; color:var(--rose-700); font-size:10px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }
.ai-summary-header h2 { width:100%; max-width:100%; white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; word-break:break-word; line-height:1.25; }
.ai-summary-header .mail-thread-close { flex:none; }
.ai-summary-meta { display:grid; gap:8px; margin:18px 22px 0; padding:14px 16px; border:1px solid var(--slate-200); border-radius:12px; background: var(--surface); }
.ai-summary-meta div { display:grid; grid-template-columns:58px 1fr; gap:8px; font-size:12px; line-height:1.45; }
.ai-summary-meta strong { color:var(--slate-500); }
.ai-summary-meta span { color:var(--slate-800); overflow-wrap:anywhere; }
.ai-summary-content { margin:16px 22px; padding:18px; border-radius:12px; color:var(--slate-800); background:var(--rose-50); line-height:1.6; }
.ai-summary-list { margin:0; padding-left:20px; }
.ai-summary-list li+li { margin-top:8px; }
.ai-summary-numbered { display:grid; gap:10px; padding:0; list-style:none; counter-reset:summary-point; }
.ai-summary-numbered li { position:relative; min-height:34px; padding:7px 8px 7px 46px; counter-increment:summary-point; }
.ai-summary-numbered li::before { content:counter(summary-point); position:absolute; left:0; top:3px; width:32px; height:32px; display:grid; place-items:center; border-radius:10px; color:var(--surface); background:linear-gradient(135deg,var(--rose-600),var(--rose-800)); font-size:12px; font-weight:900; box-shadow:0 4px 10px color-mix(in srgb, var(--tint-pink-fg) 20%, transparent); }
.ai-summary-action { margin-top:16px; padding:14px 16px; border:1px solid var(--rose-200); border-radius:12px; background:var(--surface); box-shadow:0 5px 16px color-mix(in srgb, var(--slate-900) 6%, transparent); }
.ai-summary-action span { display:block; margin-bottom:5px; color:var(--rose-700); font-size:10px; font-weight:900; letter-spacing:.07em; text-transform:uppercase; }
.ai-summary-action p { margin:0; color:var(--slate-800); font-size:13px; font-weight:650; line-height:1.55; }
.ai-summary-text,.ai-summary-loading,.ai-summary-error { margin:0; }
.ai-summary-error { color:var(--rose-700); }
.ai-summary-actions { display:flex; flex-wrap:wrap; gap:8px; padding:0 22px 18px; }
.ai-summary-actions button { padding:9px 14px; border:1px solid var(--rose-200); border-radius:999px; color:var(--rose-800); background: var(--surface); cursor:pointer; font-size:13px; font-weight:700; }
.ai-summary-actions button:hover { color:white; background:var(--brand-solid-deep); }
.ai-summary-note { margin:0; padding:13px 22px; border-top:1px solid var(--rose-100); color:var(--slate-500); font-size:11px; }
/* The warehouse block inside a DIGEST ROW is a sub-section of that email,
   not a sibling of it. It is inset to line up with the email's text column
   (46px matches .email-digest-detail), carries a left rail so it reads as
   "belonging to" the summary above, and leaves a clear gap before the next
   email so the two never blur together. */
.email-digest-warehouse:not(:empty) {
  margin: 2px 18px 16px 46px;
  padding: 10px 12px 12px;
  border: 1px solid var(--slate-200);
  border-left: 3px solid var(--rose-200);
  border-radius: 10px;
  background: var(--slate-50);
}
/* Inside a digest row the divider above is redundant - the card edge already
   separates it - so only the standalone summary modal keeps the rule. */
.email-digest-warehouse .ai-summary-warehouse {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  gap: 9px;
}
.email-digest-warehouse .ai-summary-warehouse-part {
  background: var(--surface);
}
:root[data-theme="dark"] .email-digest-warehouse .ai-summary-warehouse-part {
  background: color-mix(in srgb, var(--glow) 4%, transparent);
}
@media (max-width: 640px) {
  /* The 46px indent is the priority pill's column, which collapses on a
     phone - keep the block aligned with the row's own padding instead. */
  .email-digest-warehouse:not(:empty) { margin: 2px 14px 14px; padding: 9px 10px 10px; }
}

/* Warehouse entries holding a part number named in a shipping email. */
.ai-summary-warehouse { margin-top:18px; padding-top:14px; border-top:1px solid var(--slate-200); display:grid; gap:12px; }
.ai-summary-warehouse-title { display:flex; align-items:center; gap:6px; margin:0; color:var(--slate-500); font-size:10.5px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.ai-summary-warehouse-title::before { content:"\1F4E6"; font-size:12px; letter-spacing:0; }
.ai-summary-warehouse-part { display:grid; gap:7px; padding:9px 11px; border:1px solid var(--slate-200); border-radius:10px; background:var(--surface); }
.ai-summary-warehouse-code { margin:0; color:var(--slate-800); font-size:12px; font-weight:700; overflow-wrap:anywhere; }
.ai-summary-warehouse-count { color:var(--slate-500); font-weight:600; white-space:nowrap; }
.ai-summary-warehouse-actions { display:flex; flex-wrap:wrap; gap:8px; }
.ai-summary-warehouse-btn { padding:7px 13px; border:1px solid var(--rose-200); border-radius:999px; background:var(--surface); color:var(--rose-800); font:inherit; font-size:12px; font-weight:700; cursor:pointer; }
.ai-summary-warehouse-btn:hover { background:var(--brand-solid-deep); color:var(--surface); border-color:var(--rose-700); }
.ai-summary-warehouse-btn--ship { border-color:var(--slate-200); color:var(--slate-800); }
.ai-summary-warehouse-btn--ship:hover { background:var(--slate-800); border-color:var(--slate-800); }
.ai-summary-warehouse-btn--schedule { border-color:var(--tint-indigo-bg); color:var(--tint-indigo-fg); }
.ai-summary-warehouse-btn--schedule:hover { background:var(--tint-indigo-fg); border-color:var(--tint-indigo-fg); color:var(--surface); }
/* Whether the warehouse already has this part on a shipment. Green reads as
   "handled"; amber as "still needs an action". */
.ai-summary-warehouse-status { margin:0; font-size:11.5px; font-weight:650; overflow-wrap:anywhere; }
.ai-summary-warehouse-status.is-dispatched { color:var(--success-fg); }
/* Solid pill stating the part is already on a shipment booked for this
   email. Green = shipped, indigo = scheduled. */
.ai-summary-warehouse-pill { justify-self:start; padding:4px 11px; border-radius:999px; font-size:11px; font-weight:800; letter-spacing:.03em; text-transform:uppercase; color:var(--surface); }
.ai-summary-warehouse-pill--shipped { background:var(--success-fg); }
.ai-summary-warehouse-pill--scheduled { background:var(--tint-indigo-fg); }
.ai-summary-warehouse-btn--view { border-color:var(--success-bg); color:var(--success-fg); font-weight:800; }
.ai-summary-warehouse-btn--view:hover { background:var(--success-fg); border-color:var(--success-fg); color:var(--surface); }

/* Dark theme for the warehouse footer. These controls were written with
   literal light-mode colours (#3730a3 indigo, #047857 green) and the rose
   ramp, which inverts between themes - on the dark surface the default
   button measured 1.07:1 and "Mark scheduled" 1.98:1, i.e. invisible. Each
   is restated here as a light foreground on the dark ground. */
:root[data-theme="dark"] .ai-summary-warehouse-btn {
  border-color: var(--brand-tint-strong); background: color-mix(in srgb, var(--glow) 4%, transparent); color: var(--rose-300);
}
:root[data-theme="dark"] .ai-summary-warehouse-btn:hover {
  background: var(--brand); border-color: var(--brand); color: var(--text-on-brand);
}
:root[data-theme="dark"] .ai-summary-warehouse-btn--ship {
  border-color: var(--border-strong); color: var(--text-soft);
}
:root[data-theme="dark"] .ai-summary-warehouse-btn--ship:hover {
  background: var(--text-soft); border-color: var(--text-soft); color: var(--surface);
}
:root[data-theme="dark"] .ai-summary-warehouse-btn--schedule {
  border-color: var(--border-strong); color: var(--tint-indigo-fg);
}
:root[data-theme="dark"] .ai-summary-warehouse-btn--schedule:hover {
  background: var(--ring-elapsed-2); border-color: var(--ring-elapsed-2); color: var(--text-on-brand);
}
:root[data-theme="dark"] .ai-summary-warehouse-btn--view {
  border-color: var(--tint-cyan-bg); color: var(--success-fg);
}
:root[data-theme="dark"] .ai-summary-warehouse-btn--view:hover {
  background: var(--emerald-500); border-color: var(--emerald-500); color: var(--text-on-brand);
}
:root[data-theme="dark"] .ai-summary-warehouse-status.is-dispatched { color: var(--success-fg); }
:root[data-theme="dark"] .ai-summary-warehouse-status.is-pending { color: var(--warning-fg); }
:root[data-theme="dark"] .ai-summary-warehouse-pill--shipped { background: var(--emerald-500); color: var(--tint-emerald-bg); }
:root[data-theme="dark"] .ai-summary-warehouse-pill--scheduled { background: var(--ring-elapsed-2); color: var(--surface-raised); }
.ai-summary-warehouse-status.is-pending { color:var(--warning-fg); }

/* Popup listing every warehouse entry that holds a part number. Sits above
   the AI summary modal (z-index 100), which stays open behind it. */
.warehouse-parts-overlay { z-index:120; }
.warehouse-parts-card { display:flex; flex-direction:column; width:min(560px,100%); max-height:min(76vh,640px); }
.warehouse-parts-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:20px 22px 12px; }
.warehouse-parts-subtitle { margin:4px 0 0; color:var(--slate-500); font-size:12px; overflow-wrap:anywhere; }
.warehouse-parts-list { display:grid; gap:8px; overflow-y:auto; padding:2px 22px 4px; }
.warehouse-parts-row { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; padding:10px 12px; border:1px solid var(--slate-200); border-radius:12px; background:var(--surface); color:var(--slate-800); font:inherit; text-align:left; cursor:pointer; }
.warehouse-parts-row:hover { border-color:var(--rose-200); background:var(--rose-50); }
.warehouse-parts-main { display:grid; gap:6px; min-width:0; }
.warehouse-parts-entry { font-size:13px; font-weight:700; overflow-wrap:anywhere; }
.warehouse-parts-badges { display:flex; flex-wrap:wrap; gap:5px; }
.warehouse-parts-badge { padding:2px 8px; border-radius:999px; background:var(--slate-100); color:var(--slate-600); font-size:10px; font-weight:700; letter-spacing:.03em; text-transform:uppercase; }
.warehouse-parts-badge--tag { background:var(--rose-50); color:var(--rose-800); }
.warehouse-parts-badge--status { background:var(--tint-cyan-bg); color:var(--tint-cyan-fg); }
.warehouse-parts-badge--ship { background:var(--tint-green-bg); color:var(--success-fg); text-transform:none; letter-spacing:0; }
/* Section headings inside the inventory popup. Sticky so the group a row
   belongs to stays visible while scrolling a long list. */
.warehouse-parts-section { position:sticky; top:0; z-index:1; margin:10px 0 2px; padding:6px 2px; background:var(--surface); color:var(--slate-500); font-size:10.5px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; }
.warehouse-parts-section:first-child { margin-top:0; }
.warehouse-parts-section--shipments { color:var(--success-fg); }
.warehouse-parts-section--spares { color:var(--tint-indigo-fg); }
.warehouse-parts-section--returns { color:var(--warning-fg); }
.warehouse-parts-qty { flex:none; color:var(--slate-500); font-size:11px; font-weight:700; }
.warehouse-parts-note { margin:0; padding:13px 22px; border-top:1px solid var(--rose-100); color:var(--slate-500); font-size:11px; }
:root[data-theme="dark"] .warehouse-parts-badge--status { background:var(--tint-cyan-bg); color:var(--tint-cyan-fg); }
:root[data-theme="dark"] .warehouse-parts-badge--ship { background:var(--tint-green-bg); color:var(--success-fg); }
:root[data-theme="dark"] .warehouse-parts-section--shipments { color:var(--success-fg); }
:root[data-theme="dark"] .warehouse-parts-section--spares { color:var(--tint-indigo-fg); }
:root[data-theme="dark"] .warehouse-parts-section--returns { color:var(--warning-fg); }
.mail-empty { margin: 0; padding: 28px; color: var(--slate-400); text-align: center; font-size: 13px; }
.mail-panel-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.mail-new-button { flex: none; padding: 7px 12px; font-size: 13px; }
.mail-row--unread { background: var(--rose-50); box-shadow: inset 3px 0 0 var(--rose-600); }
.mail-row--unread:hover { background: var(--rose-100); }
.mail-row--selected,
.mail-row--selected:hover { position: relative; background: linear-gradient(90deg,var(--rose-100),var(--surface)); box-shadow: inset 4px 0 0 var(--rose-700), inset 0 0 0 1px var(--rose-300); }
.mail-row--selected::after { content: "Open"; flex: none; align-self: center; padding: 3px 8px; border-radius: 999px; color: white; background: var(--brand-solid-deep); font-size: 9px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.mail-row--unread .mail-copy strong,
.mail-row--unread .mail-copy .mail-sender { color: var(--slate-900); font-weight: 800; }
.mail-thread-header-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.mail-thread-reply { flex: none; padding: 7px 12px; font-size: 13px; }
.mail-compose-card { width:min(1400px,94vw); height:min(900px,94dvh); max-height:none; display:flex; flex-direction:column; overflow:hidden; border-radius:18px; }
.mail-compose-card .modal-content { flex:1; min-height:0; overflow:hidden; }
#mailbox-compose-form { height:100%; min-height:0; display:flex; flex-direction:column; }
#mailbox-compose-form label { margin:12px 0 5px; color:var(--slate-500); font-size:11px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
#mailbox-compose-form > label:first-child { margin-top:0; }
#mailbox-compose-form input { padding:9px 11px; border:1px solid var(--slate-300); border-radius:9px; color:var(--text); background:var(--surface); font-size:13px; }
#mailbox-compose-form input:focus { outline:none; border-color:transparent; box-shadow:0 0 0 2px var(--rose-500); }
#mailbox-compose-form .compose-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
#mailbox-compose-form .compose-field { display:flex; flex-direction:column; }
#mailbox-compose-form > input { width:100%; }
#mailbox-compose-form .compose-editor-shell { flex:1; min-height:100px; display:flex; flex-direction:column; overflow:hidden; border:1px solid var(--slate-300); border-radius:12px; background:var(--surface); }
.compose-formatbar { display:flex; flex:none; flex-wrap:nowrap; align-items:center; gap:5px; padding:6px 8px; overflow:hidden; border-bottom:1px solid var(--slate-200); background:var(--slate-50); }
.compose-formatbar button,.compose-formatbar select { width:auto; min-width:0; height:30px; min-height:30px; padding:3px 8px; border:1px solid var(--slate-300); border-radius:7px; color:var(--text); background:var(--surface); cursor:pointer; font-size:11px; }
.compose-formatbar .compose-format-icon { width:30px; padding:0; font-size:13px; }
.compose-formatbar #mc-font { max-width:92px; }
.compose-formatbar #mc-font-size { max-width:76px; }
.compose-rich-body { flex:1; min-height:0; padding:16px; outline:none; overflow-y:auto; color:var(--text); font:14px/1.6 Arial,sans-serif; }
.compose-rich-body:empty::before { content:attr(data-placeholder); color:var(--slate-400); pointer-events:none; }
.compose-editor-shell:focus-within { border-color:transparent; box-shadow:0 0 0 2px var(--rose-500); }
.compose-attachment-tools { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:12px; }
.compose-attachment-note { color:var(--slate-500); font-size:11px; }
.compose-attachment-list { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.compose-file-chip { display:flex; align-items:center; gap:8px; max-width:260px; padding:7px 8px 7px 11px; border:1px solid var(--slate-200); border-radius:10px; background:var(--slate-50); font-size:11px; }
.compose-file-chip span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.compose-file-chip button { border:0; background:transparent; color:var(--rose-700); cursor:pointer; font-size:17px; }
.compose-schedule-label { margin-left:auto; color:var(--slate-500); font-size:11px; font-weight:700; text-transform:uppercase; }
.compose-schedule { min-height:38px; padding:7px 10px; border:1px solid var(--slate-300); border-radius:8px; color:var(--text); background:var(--surface); }
@media(max-width:640px){
  #mailbox-compose-modal { padding:8px; }
  .mail-compose-card { width:calc(100vw - 16px); height:calc(100dvh - 16px); border-radius:14px; }
  .mail-compose-card .modal-header,.mail-compose-card .modal-content,.mail-compose-card .modal-actions { padding:10px; }
  #mailbox-compose-form .compose-row { grid-template-columns:1fr; gap:0; }
  #mailbox-compose-form .compose-editor-shell { min-height:80px; }
  .mail-compose-card .modal-actions { flex-wrap:wrap; }
  .compose-schedule-label { margin-left:0; }
  .compose-schedule { flex:1; min-width:170px; }
}
@media(min-width:641px) and (max-height:720px){
  .mail-compose-card { height:96dvh; }
  .mail-compose-card .modal-header { padding-block:9px; }
  .mail-compose-card .modal-content { padding-block:9px; }
  #mailbox-compose-form label { margin-top:7px; }
}
.mail-compose-card .modal-header { padding: 14px 20px; }
.mail-compose-card .modal-content { padding: 16px 20px; }
.mail-compose-card .modal-actions { padding: 12px 20px; }
#mail-compose-form label { margin: 12px 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--slate-500); }
#mail-compose-form > label:first-of-type { margin-top: 0; }
#mail-compose-form input { padding: 8px 11px; font-size: 13px; }
#mail-compose-form .compose-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
#mail-compose-form .compose-row label { margin-top: 0; }
#compose-body { width: 100%; padding: 9px 11px; min-height: 118px; border: 1px solid var(--slate-300); border-radius: var(--radius-control); outline: none; color: var(--text); background: var(--surface); font-family: inherit; font-size: 13px; line-height: 1.55; resize: vertical; transition: box-shadow 0.15s, border-color 0.15s; }
#compose-body:focus { border-color: transparent; box-shadow: 0 0 0 2px var(--rose-500); }
.compose-forward-thread { display:grid; gap:8px; margin-top:14px; padding-top:14px; border-top:1px solid var(--slate-200); }
.compose-forward-heading { margin:0 0 2px; color:var(--rose-700); font-size:11px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.compose-forward-card { overflow:hidden; border:1px solid var(--slate-200); border-radius:10px; background:var(--slate-50); }
.compose-forward-card summary { display:grid; gap:2px; padding:10px 12px; cursor:pointer; list-style:none; }
.compose-forward-card summary::-webkit-details-marker { display:none; }
.compose-forward-card summary strong { color:var(--slate-800); font-size:12px; }
.compose-forward-card summary span,.compose-forward-recipients { color:var(--slate-500); font-size:10px; }
.compose-forward-recipients { padding:9px 12px; border-top:1px solid var(--slate-200); background: var(--surface); overflow-wrap:anywhere; }
.compose-forward-card pre { max-height:180px; overflow:auto; margin:0; padding:12px; border-top:1px solid var(--slate-100); color:var(--slate-700); background: var(--surface); font:12px/1.55 inherit; white-space:pre-wrap; overflow-wrap:anywhere; }

/* In-thread reply composer (chat-style): To/Cc/Bcc → Subject → Body */
.reply-composer { position: relative; flex: none; padding: 12px 16px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.reply-composer.hidden { display: none; }
.reply-subject { width: 100%; margin-top: 10px; padding: 7px 11px; border: 1px solid var(--slate-200); border-radius: 999px; outline: none; color: var(--text); background: var(--slate-50); font-size: 13px; font-weight: 600; }
.reply-subject:focus { border-color: transparent; box-shadow: 0 0 0 2px var(--rose-500); background: var(--surface); }
.reply-composer-close { position: absolute; top: 10px; right: 12px; z-index: 1; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--slate-600); background: var(--slate-100); cursor: pointer; font-size: 19px; line-height: 1; }
.reply-composer-close:hover { background: var(--rose-100); color: var(--rose-700); }
.reply-recipients { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-right: 34px; }
.reply-tag { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 4px 3px 8px; border: 1px solid var(--blue-100); border-radius: 999px; background: var(--blue-100); color: var(--blue-700); font-size: 12px; font-weight: 600; }
.reply-tag--cc { border-color: var(--amber-300); background: var(--amber-50); color: var(--amber-700); }
.reply-tag--bcc { border-color: var(--slate-200); background: var(--slate-100); color: var(--slate-600); }
.reply-tag-kind { font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; opacity: .75; }
.reply-tag-name { overflow-wrap:anywhere; white-space:normal; }
.reply-tag-remove { flex: none; width: 16px; height: 16px; display: grid; place-items: center; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--slate-900) 8%, transparent); color: inherit; cursor: pointer; font-size: 13px; line-height: 1; }
.reply-tag-remove:hover { background: color-mix(in srgb, var(--slate-900) 18%, transparent); }
.reply-add { display: inline-flex; align-items: center; gap: 4px; }
.reply-add-chip { padding: 3px 7px; border: 1px solid var(--slate-200); border-radius: 999px; background: var(--surface); color: var(--slate-500); cursor: pointer; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.reply-add-chip.active { border-color: var(--rose-300); background: var(--rose-50); color: var(--rose-700); }
.reply-add-input { min-width: 130px; flex: 1; padding: 5px 9px; border: 1px solid var(--slate-200); border-radius: 999px; outline: none; color: var(--text); background: var(--slate-50); font-size: 12px; }
.reply-add-input:focus { border-color: transparent; box-shadow: 0 0 0 2px var(--rose-500); background: var(--surface); }
.reply-chat { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.reply-chat-input { flex: 1; padding: 10px 14px; border: 1px solid var(--slate-300); border-radius: 18px; outline: none; resize: none; color: var(--text); background: var(--slate-50); font-family: inherit; font-size: 13px; line-height: 1.5; max-height: 200px; }
.reply-chat-input:focus { border-color: transparent; box-shadow: 0 0 0 2px var(--rose-500); background: var(--surface); }
.reply-send { flex: none; height: 40px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--rose-600); color: white; cursor: pointer; font-size: 14px; font-weight: 700; }
.reply-send:hover { background: var(--brand-solid-deep); }
.reply-send:disabled { opacity: .55; cursor: wait; }
.reply-status { min-height: 0; margin: 8px 2px 0; }
.reply-status:empty { display: none; }
@media (max-width: 640px) { .reply-add-input { min-width: 90px; } .reply-send { padding: 0 14px; } }

/* Recipient autocomplete dropdown (custom, replaces native datalist) */
.ac-menu { position: fixed; z-index: 3000; max-height: 244px; overflow-y: auto; padding: 4px; border: 1px solid var(--slate-200); border-radius: 10px; background: var(--surface); box-shadow: 0 14px 34px color-mix(in srgb, var(--slate-900) 18%, transparent); }
.ac-item { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.ac-item.active { background: var(--rose-50); }
.ac-name { font-size: 13px; font-weight: 600; color: var(--slate-800); }
.ac-email { font-size:12px; color:var(--slate-500); overflow-wrap:anywhere; white-space:normal; }

#zimbra-connect-form label { margin-top: 14px; }
#zimbra-connect-form label:first-of-type { margin-top: 0; }
.mail-privacy-note { margin: 12px 0 0; color: var(--slate-500); font-size: 12px; line-height: 1.5; }
@media (max-width: 640px) { .mail-login-button { max-width: 92px; white-space: normal; line-height: 1.1; } .mail-row time { text-align: left; } .mail-panel-header { flex-wrap: wrap; } .mail-panel-actions { width: 100%; } .mail-new-button { flex: 1; } .mail-thread-header-actions { gap: 6px; } .mail-thread-reply { padding: 6px 9px; }

  /* Phone mail rows.
     The row stays a ROW (date + AI button pinned right, text left) rather than
     switching to a column: as a column, .mail-copy's `flex:1` applied to the
     height instead of the width and its `min-width:0` no longer constrained
     anything, so the nowrap subject/preview pushed the row wider than the
     screen and the whole list scrolled sideways. */
  .mail-row { align-items: flex-start; gap: 10px; padding: 11px 14px; }
  .mail-row > .mail-copy { flex: 1 1 auto; min-width: 0; max-width: 100%; }
  /* Wrap to a second line instead of running off-screen; capped so one long
     subject cannot grow a row without limit. */
  .mail-copy strong, .mail-copy span {
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .mail-copy .mail-sender { -webkit-line-clamp: 1; }
  .mail-copy strong { font-size: 13px; line-height: 1.35; }
  .mail-copy .mail-sender { font-size: 12px; }
  .mail-copy .mail-preview { font-size: 11.5px; line-height: 1.4; }
  /* Date above the AI button, both right-aligned and never squeezed. */
  .mail-row-side { flex: none; justify-items: end; gap: 6px; max-width: 40%; }
  .mail-row time { font-size: 10.5px; line-height: 1.3; text-align: right; white-space: normal; }
  .mail-ai-button { width: 30px; height: 30px; }
  .mail-ai-button svg { width: 16px; height: 16px; }
}

/* Fills a consistent share of the viewport at every size (phone, tablet,
   desktop) using an explicit height, not max-height - so the day-grid's 1fr
   rows below always get the same proportion of real space to flex into,
   instead of the dialog shrinking to content and the grid falling back to
   one fixed row height that's right for desktop and wrong everywhere else. */
.mcal-overlay { padding: clamp(6px, 2vw, 24px); }
.mcal-dialog { display: flex; flex-direction: column; width: min(1360px, 98vw); height: min(900px, 94dvh); overflow: hidden; border-radius: 18px; background: var(--canvas, var(--surface)); box-shadow: 0 30px 90px color-mix(in srgb, var(--slate-900, #0f172a) 35%, transparent); }
/* .mcal-header combines with .modal-header (title + subtext), which has no
   layout of its own - without this the close button fell below the title
   block instead of sitting top-right beside it. */
.mcal-header { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.mcal-header .mail-thread-close { margin-top: 2px; }
.mcal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: clamp(10px, 2vw, 14px) clamp(14px, 3vw, 24px); border-bottom: 1px solid var(--border); flex: none; }
.mcal-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.mcal-add-button { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--brand-solid, var(--brand)); color: var(--text-on-brand, #fff); font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer; }
.mcal-add-button:hover { filter: brightness(1.08); }
.hcal-duration-row { display: flex; gap: 8px; }
.hcal-duration-row input[type="number"] { width: 90px; flex: none; }
.hcal-duration-row select { flex: 1; }
.hcal-checkbox-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-weight: 600; cursor: pointer; }
.hcal-checkbox-row input { width: auto; flex: none; }
#hcal-add-form .modal-content > label,
#hcal-add-form .modal-content > div { margin-top: 16px; }
#hcal-add-form .modal-content > label:first-child,
#hcal-add-form .modal-content > div:first-child { margin-top: 0; }
.secondary-button.compact { padding: 6px 14px; font-size: 13px; }
.mcal-nav { display: flex; align-items: center; gap: 10px; }
.mcal-nav h3 { margin: 0; min-width: 140px; text-align: center; font-size: clamp(14px, 2vw, 16px); font-weight: 700; }
.mcal-arrow { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 18px; cursor: pointer; }
.mcal-arrow:hover { border-color: var(--brand-solid, var(--brand)); }
.mcal-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.mcal-grid { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: clamp(8px, 2vw, 14px) clamp(10px, 2vw, 18px); overflow-y: auto; }
.mcal-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 6px; flex: none; }
.mcal-weekdays span { padding: 4px 0; color: var(--text-secondary); font-size: 11px; font-weight: 800; text-align: center; text-transform: uppercase; }
/* min-height:0 lets this grid shrink below its rows' natural size instead of
   overflowing the dialog - grid-auto-rows:1fr then shares out whatever
   height is actually left, on any screen, rather than assuming desktop's. */
.mcal-days { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(44px, 1fr); gap: clamp(3px, .6vw, 5px); }
.mcal-day { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: clamp(4px, 1vw, 7px) clamp(3px, 1vw, 6px); border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.mcal-day:hover { border-color: var(--brand-solid, var(--brand)); background: color-mix(in srgb, var(--brand-solid, var(--brand)) 6%, var(--surface)); }
.mcal-day.outside { opacity: .45; }
.mcal-day.today { border-color: var(--brand-solid, var(--brand)); background: color-mix(in srgb, var(--brand-solid, var(--brand)) 13%, var(--surface)); box-shadow: inset 0 0 0 1px var(--brand-solid, var(--brand)); }
.mcal-day.today .mcal-daynum { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--brand-solid, var(--brand)); color: var(--text-on-brand, #fff); }
.mcal-day.selected { border-color: var(--brand-solid, var(--brand)); background: color-mix(in srgb, var(--brand-solid, var(--brand)) 10%, var(--surface)); }
.mcal-daynum { font-size: clamp(10px, 1.6vw, 13px); font-weight: 700; }
.mcal-chips { display: flex; flex-direction: column; gap: 2px; width: 100%; overflow: hidden; }
.mcal-chip { display: block; padding: clamp(1px, .3vw, 2px) clamp(3px, .8vw, 6px); border-radius: 5px; background: color-mix(in srgb, var(--brand-solid, var(--brand)) 16%, transparent); color: var(--text); font-size: clamp(8px, 1.3vw, 11px); font-weight: 600; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcal-chip b { font-weight: 800; }
/* Canonical 4-tag colour scheme, shared with the public Holiday Calendar:
   Zimbra blue, Holiday cute yellow, Birthday red + cake, everything else grey. */
:root { --mcal-zimbra: #2563eb; --mcal-holiday: #f59e0b; --mcal-birthday: #dc2626; --mcal-other: #6b7280; }
:root[data-theme="dark"] { --mcal-zimbra: #60a5fa; --mcal-holiday: #fbbf24; --mcal-birthday: #f87171; --mcal-other: #9ca3af; }
.mcal-chip--zimbra { background: color-mix(in srgb, var(--mcal-zimbra) 16%, transparent); color: var(--mcal-zimbra); }
.mcal-chip--holiday { background: #fef3c7; color: #92400e; }
:root[data-theme="dark"] .mcal-chip--holiday { background: color-mix(in srgb, var(--mcal-holiday) 22%, transparent); color: var(--mcal-holiday); }
.mcal-chip--other { background: color-mix(in srgb, var(--mcal-other) 16%, transparent); color: var(--mcal-other); }
.mcal-chip--birthday { background: color-mix(in srgb, var(--mcal-birthday) 18%, transparent); color: var(--mcal-birthday); font-weight: 700; }
.mcal-agenda-time.mcal-chip--holiday, .mcal-agenda-time.mcal-chip--other, .mcal-agenda-time.mcal-chip--zimbra, .mcal-agenda-time.mcal-chip--birthday { padding: 2px 6px; border-radius: 5px; }
.mcal-more { font-size: 10.5px; color: var(--text-secondary); font-weight: 700; }

.mcal-filter-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 clamp(14px, 3vw, 24px) 10px; }
.mcal-tag-select { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.mcal-tag-select select { min-height: 34px; padding: 0 28px 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-weight: 700; }
.mcal-dot { width: 8px; height: 8px; border-radius: 50%; }
.mcal-dot--zimbra { background: var(--mcal-zimbra); }
.mcal-dot--holiday { background: var(--mcal-holiday); }
.mcal-dot--birthday { background: var(--mcal-birthday); }
.mcal-dot--other { background: var(--mcal-other); }

/* Multi-day events render as one spanning bar over the day grid, Google
   Calendar style, instead of a repeated chip on every covered day. */
.mcal-days-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.mcal-days-wrap .mcal-days { position: relative; height: 100%; }
.mcal-days-wrap.mcal-anim-out-left #mcal-days,.mcal-days-wrap.mcal-anim-out-left #mcal-span-layer { animation: mcal-slide-out-left .16s ease forwards; }
.mcal-days-wrap.mcal-anim-out-right #mcal-days,.mcal-days-wrap.mcal-anim-out-right #mcal-span-layer { animation: mcal-slide-out-right .16s ease forwards; }
.mcal-days-wrap.mcal-anim-in-left #mcal-days,.mcal-days-wrap.mcal-anim-in-left #mcal-span-layer { animation: mcal-slide-in-left .32s ease forwards; }
.mcal-days-wrap.mcal-anim-in-right #mcal-days,.mcal-days-wrap.mcal-anim-in-right #mcal-span-layer { animation: mcal-slide-in-right .32s ease forwards; }
@keyframes mcal-slide-out-left { to { transform: translateX(-26px); opacity: 0; } }
@keyframes mcal-slide-out-right { to { transform: translateX(26px); opacity: 0; } }
@keyframes mcal-slide-in-left { from { transform: translateX(-26px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes mcal-slide-in-right { from { transform: translateX(26px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mcal-days-wrap [class*="mcal-anim-"] #mcal-days, .mcal-days-wrap [class*="mcal-anim-"] #mcal-span-layer { animation: none; } }
.mcal-span-layer { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(44px, 1fr)); gap: clamp(3px, .6vw, 5px); pointer-events: none; }
.mcal-span-bar { pointer-events: auto; align-self: start; margin-top: 20px; display: flex; align-items: center; justify-content: center; min-width: 0; padding: 2px 6px; border-radius: 5px; font-size: clamp(8px, 1.2vw, 10.5px); font-weight: 700; text-align: center; overflow: hidden; cursor: pointer; }
.mcal-span-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcal-span-bar--zimbra { background: color-mix(in srgb, var(--mcal-zimbra) 70%, white); color: #fff; }
.mcal-span-bar--holiday { background: var(--mcal-holiday); color: #78350f; }
.mcal-span-bar--birthday { background: var(--mcal-birthday); color: #fff; }
.mcal-span-bar--other { background: var(--mcal-other); color: #fff; }
@media (max-width: 720px) { .mcal-filter-row { padding: 0 10px 8px; } }
.mcal-agenda { flex: none; width: clamp(220px, 26vw, 300px); padding: clamp(12px, 2vw, 18px); border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; animation: mcal-slide-in .18s ease; }
@keyframes mcal-slide-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
.mcal-agenda-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.mcal-agenda-head h4 { margin: 0; font-size: 14px; }
.mcal-agenda-close { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--surface-sunken, var(--surface)); color: var(--text-secondary); font-size: 16px; line-height: 1; cursor: pointer; }
.mcal-agenda-close:hover { background: color-mix(in srgb, var(--brand-solid, var(--brand)) 12%, var(--surface)); color: var(--text); }
.mcal-agenda-item { display: flex; gap: 8px; padding: 8px 4px; margin: 0 -4px; border-bottom: 1px solid var(--border); border-radius: 8px; font-size: 13px; cursor: pointer; transition: background .15s; }
.mcal-agenda-item:last-child { border-bottom: 0; }
.mcal-agenda-item:hover, .mcal-agenda-item:focus-visible { background: color-mix(in srgb, var(--brand-solid, var(--brand)) 6%, var(--surface)); outline: none; }
.mcal-chip { cursor: pointer; }
.mcal-chip:hover { filter: brightness(0.96); }

/* Event detail scorecard: same brand-coloured chrome as the month view,
   opened from either an agenda item or a chip in the grid. */
.hcal-event-dialog { display: flex; flex-direction: column; width: min(480px, 92vw); max-height: min(640px, 88dvh); overflow: hidden; border-radius: 20px; background: var(--canvas, var(--surface)); box-shadow: 0 30px 90px color-mix(in srgb, var(--slate-900, #0f172a) 35%, transparent); }
.hcal-event-body { flex: 1; min-height: 0; overflow-y: auto; padding: clamp(16px, 3vw, 24px); display: flex; flex-direction: column; gap: 14px; }
.hcal-event-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text); }
.hcal-event-row-icon { flex: none; font-size: 15px; line-height: 1.4; }
.hcal-event-attendees { display: flex; flex-wrap: wrap; gap: 6px; }
.hcal-event-attendee { padding: 3px 10px; border-radius: 999px; background: var(--surface-sunken, var(--surface)); border: 1px solid var(--border); font-size: 12px; font-weight: 600; }
.hcal-event-description { padding: 12px 14px; border-radius: 12px; background: var(--surface-sunken, var(--surface)); color: var(--text); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.hcal-event-description a { color: var(--brand-solid, var(--brand)); text-decoration: underline; text-underline-offset: 2px; }
.hcal-event-attachments h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.hcal-event-attachments { display: flex; flex-direction: column; gap: 6px; }
.hcal-event-attachment { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s; }
.hcal-event-attachment:hover { border-color: var(--brand-solid, var(--brand)); background: color-mix(in srgb, var(--brand-solid, var(--brand)) 6%, var(--surface)); }
.hcal-event-join { align-self: flex-start; text-decoration: none; }
.hcal-event-delete { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border: 1px solid var(--rose-200, #fecdd3); border-radius: 10px; background: var(--rose-50, #fff1f2); color: var(--rose-700, #be123c); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.hcal-event-delete:hover { background: var(--rose-100, #ffe4e6); }
.hcal-event-delete:disabled { opacity: .6; cursor: default; }
.hcal-event-locked { margin: 0; color: var(--text-secondary); font-size: 12.5px; }
.mcal-agenda-time { flex: none; width: 60px; color: var(--text-secondary); font-size: 11px; font-weight: 700; }
.mcal-agenda-loc { display: block; color: var(--text-secondary); font-size: 11.5px; }
.mcal-agenda-empty { color: var(--text-secondary); font-size: 13px; }
@media (max-width: 720px) {
  .mcal-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .mcal-body { flex-direction: column; }
  .mcal-agenda { width: 100%; border-left: 0; border-top: 1px solid var(--border); max-height: 38dvh; animation: none; }
  .mcal-days { grid-auto-rows: minmax(40px, 1fr); }
  .mcal-span-layer { grid-template-rows: repeat(6, minmax(40px, 1fr)); }
  .mcal-chip { font-size: 8.5px; }
  .mcal-day { border-radius: 8px; }
}
@media (max-height: 560px) and (min-width: 721px) {
  /* Short, wide windows (a laptop with little vertical room, a tablet in
     landscape with a software keyboard up) - the grid still needs to fit,
     so the agenda collapses to a slim strip rather than fighting it for height. */
  .mcal-agenda { width: clamp(180px, 22vw, 240px); padding: 10px; }
  .mcal-days { grid-auto-rows: minmax(34px, 1fr); }
  .mcal-span-layer { grid-template-rows: repeat(6, minmax(34px, 1fr)); }
}

.mail-thread-overlay { padding: clamp(12px, 3vw, 36px); }
.mail-thread-dialog { display: flex; flex-direction: column; width: min(1180px, 96vw); height: min(820px, 92vh); overflow: hidden; border-radius: 18px; background: var(--canvas); box-shadow: 0 30px 90px color-mix(in srgb, var(--slate-900) 35%, transparent); }
.mail-thread-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--border); background: var(--surface); text-align: left; }
.mail-thread-eyebrow { margin: 0 0 3px; color: var(--rose-700); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.mail-thread-header h2 { margin: 0; font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-thread-close { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; color: var(--slate-700); background: var(--slate-100); cursor: pointer; font-size: 25px; line-height: 1; }
.mail-thread-close:hover { background: var(--rose-100); color: var(--rose-700); }
.mail-thread-content { flex: 1; overflow-y: auto; padding: 24px; }
.mail-thread-loading,.mail-thread-error { margin: 50px auto; color: var(--slate-500); text-align: center; }
.mail-thread-error { color: var(--rose-700); }
.thread-message { max-width: 1080px; margin: 0 auto 16px; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 2px 8px color-mix(in srgb, var(--slate-900) 6%, transparent); text-align: left; }
.thread-message--current { width: 100%; border-top: 4px solid var(--rose-700); box-shadow: 0 8px 24px color-mix(in srgb, var(--slate-900) 10%, transparent); }
.thread-message--sub { width: calc(100% - 90px); max-width: 900px; margin-left: auto; border-left: 3px solid var(--rose-300); box-shadow: 0 1px 5px color-mix(in srgb, var(--slate-900) 5%, transparent); }
.thread-message--sub[data-depth="2"] { border-left-color: var(--amber-300); }
.thread-message--sub[data-depth="3"],.thread-message--sub[data-depth="4"] { border-left-color: var(--blue-300); }
.thread-message--sub > summary { position: relative; padding-left: 46px; cursor: pointer; list-style: none; }
.thread-message--sub > summary::-webkit-details-marker { display: none; }
.thread-message--sub > summary::before { content: "›"; position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--rose-700); font-size: 28px; font-weight: 500; transition: transform .18s ease; }
.thread-message--sub[open] > summary::before { transform: translateY(-50%) rotate(90deg); }
.thread-message--sub[open] > summary { border-bottom: 1px solid var(--slate-100); }
.thread-message-meta { padding: 14px 18px; border-bottom: 1px solid var(--slate-100); }
.thread-message-meta strong,.thread-message-meta span,.thread-message-meta time { display: block; }
.thread-message-meta strong { color: var(--slate-900); font-size: 14px; }
.thread-message-meta span,.thread-message-meta time { margin-top: 3px; color: var(--slate-500); font-size: 12px; }
.thread-message-meta .thread-message-date { width: fit-content; margin-top: 8px; color: var(--slate-600); font-weight: 700; text-align: left; }
.thread-recipient-line { display: flex; align-items: flex-start; gap: 7px; margin-top: 7px; }
.thread-recipient-label { flex: none; padding-top: 4px; color: var(--slate-600) !important; font-size: 11px !important; font-weight: 800; }
.thread-recipient-tags { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.thread-recipient-tag { margin: 0 !important; padding: 3px 8px; border: 1px solid var(--blue-100); border-radius: 999px; color: var(--blue-700) !important; background: var(--blue-100); font-size: 10px !important; font-weight: 700; white-space: nowrap; }
.thread-recipient-empty { margin: 0 !important; padding-top: 3px; color: var(--slate-400) !important; font-style: italic; }
.thread-message-meta .thread-message-label { width: fit-content; margin: 0 0 7px; padding: 3px 8px; border-radius: 999px; color: var(--rose-700); background: var(--rose-50); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.thread-message-body { margin: 0; padding: 20px 18px; color: var(--slate-800); font-family: inherit; font-size: 14px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.invite-card { margin: 16px 18px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); background: var(--surface); }
.invite-card-head { display: flex; align-items: flex-start; gap: 12px; }
.invite-card-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-tint, var(--rose-50)); font-size: 20px; }
.invite-card-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.invite-card-when { margin: 4px 0 0; color: var(--text); font-size: 13px; font-weight: 600; }
.invite-card-location { margin: 2px 0 0; color: var(--text-secondary); font-size: 13px; }
.invite-card-join { display: inline-flex; align-items: center; justify-content: center; margin-top: 14px; padding: 10px 18px; border-radius: 10px; background: var(--brand-solid, var(--brand, #ce0505)); color: var(--text-on-brand, #fff); font-size: 13px; font-weight: 700; text-decoration: none; }
.invite-card-join:hover { filter: brightness(1.08); }
.invite-card-people { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 4px; }
.invite-card-people p { margin: 0; color: var(--text-secondary); font-size: 12.5px; }
.invite-card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.invite-card-actions button { padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s; }
.invite-card-actions button:hover:not(:disabled) { border-color: var(--brand-solid, var(--brand, #ce0505)); color: var(--brand-solid, var(--brand, #ce0505)); }
.invite-card-actions button:disabled { opacity: .55; cursor: not-allowed; }
.invite-card-accept { background: var(--brand-tint, var(--rose-50)); }
.invite-card-status { margin: 10px 0 0; color: var(--text-secondary); font-size: 12px; }
/* Up to 5 attachments per row (wraps into a 2nd row past 5), shown before the body. */
.thread-message-html { width: 100%; border: 0; background: var(--surface); display: block; }
.thread-attachments { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 4px 18px 16px; }
.thread-attachment { display: flex; flex-direction: column; gap: 5px; padding: 10px 8px; border: 1px solid var(--slate-200); border-radius: 10px; background: var(--slate-50); text-align: center; min-width: 0; }
.thread-attachment-info { min-width: 0; text-align: center; }
.thread-attachment-info strong,.thread-attachment-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-attachment-info strong { color: var(--slate-800); font-size: 12px; }
.thread-attachment-info span { margin-top: 2px; color: var(--slate-500); font-size: 10px; }
.thread-attachment-download { flex: none; min-height: 34px; padding: 7px 11px; border: 1px solid var(--rose-700); border-radius: 9px; color: white; background: linear-gradient(135deg,var(--rose-700),var(--rose-800)); box-shadow: 0 3px 8px color-mix(in srgb, var(--tint-pink-fg) 18%, transparent); cursor: pointer; font-size: 11px; font-weight: 800; }
.thread-attachment-download:hover { border-color: var(--rose-900); background: linear-gradient(135deg,var(--rose-800),var(--rose-900)); transform: translateY(-1px); }
.thread-attachment-download:disabled { opacity: .6; cursor: wait; }
.thread-attachment-actions { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: auto; }
.thread-attachment-preview { min-height: 34px; padding: 7px 11px; border: 1px solid var(--slate-300); border-radius: 9px; color: var(--slate-700); background: var(--surface); box-shadow: 0 2px 6px color-mix(in srgb, var(--slate-900) 8%, transparent); cursor: pointer; font-size: 11px; font-weight: 800; }
.thread-attachment-preview:hover { border-color: var(--rose-300); color: var(--rose-700); background: var(--rose-50); }
@media (max-width: 640px) { .thread-attachments { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.attachment-preview-overlay { z-index: 130; padding: clamp(10px, 2vw, 24px); }
.attachment-preview-dialog { display: flex; flex-direction: column; width: min(1240px, 98vw); height: min(880px, 95vh); overflow: hidden; border-radius: 16px; background: var(--surface); box-shadow: 0 30px 100px color-mix(in srgb, var(--slate-900) 42%, transparent); }
.attachment-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 20px; border-bottom: 1px solid var(--border); text-align: left; }
.attachment-preview-header p { margin: 0 0 3px; color: var(--rose-700); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.attachment-preview-header h2 { max-width: 70vw; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
.attachment-preview-actions { display: flex; align-items: center; gap: 8px; }
.attachment-preview-content { flex: 1; overflow: auto; padding: 20px; background: var(--slate-50); }
.attachment-preview-loading,.attachment-preview-unsupported { margin: 60px auto; color: var(--slate-500); text-align: center; }
.attachment-preview-image { display: block; max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; border-radius: 8px; background: white; box-shadow: 0 3px 15px color-mix(in srgb, var(--slate-900) 12%, transparent); }
.attachment-preview-frame { width: 100%; height: 100%; min-height: 640px; border: 0; border-radius: 8px; background: white; }
.attachment-preview-text,.docx-preview { max-width: 900px; min-height: 80%; margin: 0 auto; padding: 40px; border-radius: 8px; color: var(--slate-800); background: white; box-shadow: 0 3px 15px color-mix(in srgb, var(--slate-900) 8%, transparent); font-family: inherit; font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; }
.xlsx-preview { border-collapse: collapse; min-width: 100%; background: white; font-size: 12px; }
.xlsx-preview td { min-width: 90px; max-width: 280px; padding: 7px 9px; border: 1px solid var(--slate-200); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pptx-preview { display: grid; gap: 18px; max-width: 960px; margin: auto; }
.pptx-slide { aspect-ratio: 16/9; padding: 7%; border-radius: 8px; color: var(--slate-900); background: white; box-shadow: 0 4px 18px color-mix(in srgb, var(--slate-900) 12%, transparent); text-align: left; font-size: clamp(14px,2vw,24px); overflow: auto; }
.pptx-slide-label { margin: 0 0 8px; color: var(--slate-500); font-size: 10px; font-weight: 800; text-transform: uppercase; }
@media (max-width: 640px) { .attachment-preview-overlay { padding: 0; } .attachment-preview-dialog { width: 100vw; height: 100dvh; border-radius: 0; } .attachment-preview-header { padding: 12px; } .attachment-preview-header h2 { max-width: 48vw; font-size: 15px; } .attachment-preview-content { padding: 10px; } .attachment-preview-text,.docx-preview { padding: 20px 16px; font-size: 13px; } .thread-attachment { align-items: flex-start; flex-direction: column; } .thread-attachment-actions { width: 100%; } .thread-attachment-actions button { flex: 1; } }
@media (max-width: 640px) { .mail-thread-overlay { padding: 0; } .mail-thread-dialog { width: 100vw; height: 100dvh; border-radius: 0; } .mail-thread-header { padding: 14px 16px; } .mail-thread-header h2 { max-width: 74vw; font-size: 17px; } .mail-thread-content { padding: 12px; } .thread-message--sub:not(.mail-thread-content .thread-message--sub) { width: calc(100% - 18px) !important; } .thread-message--sub > summary { padding-left: 40px; } .thread-message--sub > summary::before { left: 14px; } .thread-message-body { padding: 16px 14px; font-size: 13px; } }

/* Create-user modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 128;
  display: grid;
  place-items: center;
  padding: 16px;
  background: color-mix(in srgb, var(--scrim) 50%, transparent);
}
.modal-card {
  width: min(440px, 100%);
  max-height: min(90vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-modal);
  box-shadow: 0 20px 25px -5px color-mix(in srgb, var(--shadow-color) 10%, transparent), 0 8px 10px -6px color-mix(in srgb, var(--shadow-color) 10%, transparent);
}
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-content { padding: 24px; overflow-y: auto; text-align: left; }
.modal-title { margin: 0; font-size: 18px; font-weight: 600; color: var(--text); }
.modal-subtext { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
#create-user-form label { margin-top: 16px; }
#create-user-form label:first-of-type { margin-top: 0; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.modal-actions button { border: none; border-radius: var(--radius-control); padding: 10px 20px; font-weight: 600; font-size: 14px; cursor: pointer; }
.modal-cancel { background: var(--slate-100); color: var(--text); }
.modal-cancel:hover { background: var(--slate-200); }
.modal-confirm { background: var(--rose-600); color: white; }
.modal-confirm:hover { background: var(--brand-solid-deep); }
.modal-confirm:disabled { opacity: 0.5; cursor: not-allowed; }
.modal-card.mail-compose-card { width:min(1480px,96vw); height:min(920px,94dvh); max-width:none; max-height:none; }
.compose-mobile-send { display:none; position:relative; }
.compose-send-icon { width:42px; height:42px; display:grid; place-items:center; padding:0!important; border-radius:50%!important; color:var(--surface); background:var(--rose-600); }
.compose-send-icon svg { width:19px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.compose-send-menu { position:absolute; right:0; bottom:50px; z-index:5; width:150px; padding:5px; border:1px solid var(--slate-200); border-radius:11px; background:var(--surface); box-shadow:0 14px 35px color-mix(in srgb, var(--slate-900) 22%, transparent); }
.compose-send-menu button { width:100%; padding:9px 10px!important; border:0; border-radius:7px!important; color:var(--text); background:transparent; text-align:left; font-size:12px!important; }
.compose-send-menu button:hover { background:var(--rose-50); color:var(--rose-700); }
@media(max-width:640px){
  .modal-card.mail-compose-card { width:calc(100vw - 20px); height:calc(100dvh - 20px); }
  .mail-compose-card .modal-actions > #mailbox-compose-discard,
  .mail-compose-card .modal-actions > #mailbox-compose-draft,
  .mail-compose-card .modal-actions > .compose-schedule-label,
  .mail-compose-card .modal-actions > .compose-schedule,
  .mail-compose-card .modal-actions > #mailbox-compose-send { display:none; }
  .mail-compose-card .modal-actions { min-height:58px; align-items:center; justify-content:flex-end; flex-wrap:nowrap; }
  .compose-mobile-send { display:block; }
  .compose-scheduling .modal-actions > .compose-schedule { display:block; flex:1; min-width:0; }
}
.install-help-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--rose-700);
  background: var(--surface);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.install-help-button:hover { border-color: var(--rose-300); background: var(--rose-50); }
.install-help-card { width: min(520px, 100%); max-height: min(92vh, 760px); }
.install-help-content { display: grid; gap: 14px; min-height: 0; overscroll-behavior: contain; }
.install-help-section {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--slate-50);
}
.install-help-section h3 {
  margin: 0 0 8px;
  color: var(--rose-700);
  font-size: 15px;
}
.install-help-section ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
.install-help-section li + li { margin-top: 5px; }
.install-help-section strong { color: var(--text); }
.install-step-summary { margin: 0 0 10px; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.install-step-summary strong { color: var(--text); }
.install-video-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.install-video-btn:hover { border-color: var(--brand-solid, var(--brand)); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand-solid, var(--brand)) 14%, transparent); transform: translateY(-1px); }
.install-video-btn-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-solid, var(--brand));
  color: var(--text-on-brand, #fff);
  font-size: 13px;
}
.install-video-btn-copy { display: grid; gap: 1px; }
.install-video-btn-copy strong { font-size: 14px; }
.install-video-btn-copy small { color: var(--text-secondary); font-size: 12px; }

/* The install-steps clip plays inside an on-screen phone frame - a modern
   mockup, not a bare <video> floating in a dialog. */
.install-video-overlay { z-index: 140; padding: 16px; }
.install-video-dialog { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(360px, 94vw); }
.install-video-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.install-video-title { margin: 0; color: var(--text-on-brand, #fff); font-size: 15px; font-weight: 700; }
.install-video-close { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: color-mix(in srgb, #fff 16%, transparent); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.install-video-close:hover { background: color-mix(in srgb, #fff 26%, transparent); }
.phone-frame {
  position: relative;
  width: min(300px, 86vw);
  aspect-ratio: 9 / 19.5;
  padding: 14px;
  border-radius: 46px;
  background: linear-gradient(160deg, #1c1e24, #0b0c0f);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(255, 255, 255, .06);
}
.phone-notch { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 40%; height: 22px; border-radius: 0 0 14px 14px; background: #0b0c0f; z-index: 1; }
.phone-screen { display: block; width: 100%; height: 100%; border-radius: 34px; background: #000; object-fit: cover; }
@media (prefers-reduced-motion: reduce) { .install-video-btn { transition: none; } }
.install-action-section {
  display: grid;
  gap: 9px;
  background: linear-gradient(135deg, var(--rose-50), var(--surface));
}
.install-device-button {
  width: 100%;
  min-height: 44px;
}
.install-action-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}
.install-shots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.install-shot { margin: 0; }
.install-shot svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.install-shot figcaption {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.4;
  text-align: center;
}
.install-shot figcaption strong { color: var(--text); }
.ish-screen { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.ish-chrome { fill: var(--slate-50); }
.ish-sheet { fill: var(--slate-50); stroke: var(--border); stroke-width: 1; }
.ish-omnibox { fill: var(--surface); stroke: var(--border); stroke-width: 1; }
.ish-grip { fill: var(--border); }
.ish-body { fill: var(--border); opacity: 0.55; }
.ish-rule { stroke: var(--border); stroke-width: 1; }
.ish-url { fill: var(--text-secondary); font-size: 7px; text-anchor: middle; }
.ish-row { fill: var(--text-secondary); font-size: 7.5px; }
.ish-icon {
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.7;
}
.ish-icon-f { fill: var(--text-secondary); opacity: 0.7; }
.ish-icon-hot {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ish-dot-hot { r: 2; fill: var(--accent); }
.ish-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}
.ish-hotrow { fill: var(--accent); opacity: 0.12; }
.ish-row-hot { fill: var(--accent); font-weight: 700; }
.ish-target { animation: ish-pulse 2s ease-in-out infinite; transform-origin: center; }
@keyframes ish-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .ish-target { animation: none; }
}
@media (max-width: 360px) {
  .install-shots { grid-template-columns: 1fr; gap: 14px; justify-items: center; }
  .install-shot { max-width: 200px; }
}
.mail-choice-options { display: flex; flex-direction: column; gap: 10px; }
.mail-choice-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: 0.15s ease;
}
.mail-choice-option:hover { border-color: var(--rose-300); background: var(--rose-50); }
.mail-choice-option-name { font-weight: 600; font-size: 14px; color: var(--text); }
.mail-choice-option-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* App tiles */
/* Hide every tile until role-based visibility has been resolved, so a
   disabled tile is never shown — not even for a frame — to employees. */
.app-grid.tiles-pending .app-tile { display: none !important; }
.app-grid {
  /* Flex, so different rows can hold different numbers of tiles and EVERY row
     still ends flush with the edge. A plain grid gives every row the same
     column count, which leaves the last row short; here each tile's width is
     derived from how many tiles share its own row (--row-len, set in JS), so
     seven apps lay out as a full 4 + a full 3 rather than 5 + a ragged 2. */
  --tile-gap: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--tile-gap);
  align-items: stretch;
}
.app-grid > * {
  min-width: 0;
  /* grow only absorbs sub-pixel rounding inside a row, because the bases in a
     row already sum to 100%. The lone-tile case sets --row-grow: 0 so a single
     app keeps half a row instead of growing into a full-width banner. */
  flex: var(--row-grow, 1) 1 calc((100% - (var(--row-len, 3) - 1) * var(--tile-gap)) / var(--row-len, 3));
}

/* The heading row holds the title and (on phones) the panel launchers. */
.apps-section-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.apps-section-heading-text { min-width: 0; }
.apps-section-heading-text h2 { margin: 0; }

/* ---------- phone panel launchers + bottom sheets ---------- */
/* Launchers sit in the "Your applications" heading row on every screen size.
   On desktop the panels are also present in the side column, so these act as
   a quick jump; on a phone they are the only way in. */
.side-dock { position: relative; z-index: 95; display: flex; align-items: center; gap: 8px; flex: none; }
.side-dock.side-dock-empty { display: none; }
.side-dock-btn[hidden] { display: none; }
.side-dock-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  background: var(--surface);
  color: var(--slate-800);
  font: inherit;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--slate-900) 7%, transparent);
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.4, 0, 0.2, 1), background 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.side-dock-btn:hover { border-color: var(--rose-200); background: var(--rose-50); box-shadow: 0 4px 14px color-mix(in srgb, var(--slate-900) 10%, transparent); }
.side-dock-btn:active { transform: scale(0.92); }
.side-dock-btn[aria-expanded="true"] { border-color: var(--rose-700); background: var(--rose-50); }
.side-dock-svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.side-dock-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  padding: 1px 4px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--brand-solid-deep);
  color: var(--surface);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
}
.side-dock-count[hidden] { display: none; }
.panel-close:hover { background: var(--rose-100); color: var(--rose-800); }
/* Backdrop behind an open panel, on every screen size. */
.side-dock-scrim {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 85;
  /* Keep the live Hub palette exactly as it is while a dock popup is open.
     This remains an invisible click-catcher for closing the popup. */
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.side-dock-scrim.open { opacity: 1; pointer-events: auto; }
/* Brief tint on the panel a desktop launcher just opened, so the eye lands
   on what changed. Animates background only - no layout work. */
@keyframes panel-flash {
  0% { background: var(--rose-50); }
  100% { background: transparent; }
}
.panel-flash { animation: panel-flash 1s ease-out; }
@media (prefers-reduced-motion: reduce) { .panel-flash { animation: none; } }

@media (max-width: 599px) {
  /* Dimmed backdrop behind an open drawer. Fades rather than snapping. */

    /* Inside a drawer the panel is always showing its list - the caret toggle
     is redundant there. */
  #email-digest-panel.drawer-open #email-digest-list { display: block; }
  body.drawer-locked { overflow: hidden; }

  @media (prefers-reduced-motion: reduce) {
    #email-digest-panel,
  #chat-panel,
#chat-panel,
    #activities-card,
    .side-dock-scrim,
    .side-dock-btn { transition: none; }
  }
}

@media (max-width: 599px) {
  .apps-inner { display: flex; flex-direction: column; min-width: 0; }
  .create-user-btn { order: 0; }
  .apps-main-row { display: contents; }
  /* Your Emails, Recent Tasks and Notifications stack together (in that
     order) ahead of the app tiles, so mobile reads top to bottom as:
     Add User -> Your Emails -> Recent Tasks -> Notifications ->
     Your Applications -> Inbox. */
  .apps-main-col { order: 2; width: 100%; }
  .mail-panel { order: 3; width: 100%; margin: 0 0 18px; }
  .app-grid { --tile-gap: 10px; }
  .app-tile { min-height: 112px; padding: 12px; gap: 6px; overflow: hidden; }
  .app-tile-icon { width: 34px; height: 34px; flex: none; }
  .app-tile-icon svg { width: 17px; height: 17px; }
  .app-tile-name { width: 100%; padding-right: 14px; font-size: 12px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-tile-desc { width: 100%; font-size: 10px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-tile-arrow { top: 12px; right: 10px; font-size: 12px; opacity: 1; transform: none; }
  .apps-body { padding: 16px 12px 24px; }
  .apps-section-header { margin-bottom: 12px; }
  .apps-section-header h2 { font-size: 18px; white-space: nowrap; }
  .apps-section-header .subtext { font-size: 12px; white-space: nowrap; }
}

.app-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  /* Translucent glass so the starfield drifts visibly behind the grid. */
  background: color-mix(in srgb, var(--glow) 72%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  text-decoration: none;
  color: var(--text);
  /* Raised and glossy: a bright top edge, a soft wash of the app's own colour
     from above, then a two-part shadow - a tight contact shadow plus a wide
     ambient one. That pair is what makes a surface look lifted rather than
     just outlined. */
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--glow) 96%, transparent) 0%, color-mix(in srgb, var(--glow) 66%, transparent) 46%, color-mix(in srgb, var(--glow) 54%, transparent) 100%),
    radial-gradient(120% 82% at 50% -18%, color-mix(in srgb, var(--app, var(--tint-pink-fg)) 11%, transparent), transparent 72%),
    color-mix(in srgb, var(--glow) 62%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--glow) 95%, transparent),
    0 1px 2px color-mix(in srgb, var(--slate-900) 6%, transparent),
    0 8px 18px -10px color-mix(in srgb, var(--slate-900) 22%, transparent);
  transition: transform var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease),
    border-color var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease);
  animation: fade-in 0.4s ease both;
}
.app-tile[hidden] { display: none !important; }
.app-tile:nth-child(2) { animation-delay: 0.06s; }
.app-tile:nth-child(3) { animation-delay: 0.12s; }
.app-tile:nth-child(4) { animation-delay: 0.18s; }
.app-tile:hover {
  border-color: color-mix(in srgb, var(--app, var(--tint-pink-fg)) 42%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--glow) 95%, transparent),
    0 2px 4px color-mix(in srgb, var(--slate-900) 7%, transparent),
    0 18px 34px -16px color-mix(in srgb, var(--app, var(--tint-pink-fg)) 40%, color-mix(in srgb, var(--slate-900) 30%, transparent));
  transform: translateY(-4px);
}
.app-tile:active { transform: translateY(-1px) scale(0.985); box-shadow: var(--shadow-md); }
.app-tile:is(:hover, :focus-visible) .app-tile-arrow { opacity: 1; transform: translateX(0); }
.app-tile:is(:hover, :focus-visible) .app-tile-icon { transform: scale(1.08) rotate(-4deg); }
.app-tile:focus-visible { outline: 2px solid var(--rose-500); outline-offset: 3px; }
.app-tile-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  flex: none;
  background: var(--app-icon-bg, var(--rose-50));
  color: var(--app-icon-color, var(--rose-700));
  transition: transform 0.18s ease;
}
/* The chip is the one place with real gloss: a fixed highlight across the top
   third, plus a specular sweep that runs when the tile is hovered. */
.app-tile-icon { position: relative; overflow: hidden; isolation: isolate; }
.app-tile-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(163deg, color-mix(in srgb, var(--glow) 62%, transparent) 0%, color-mix(in srgb, var(--glow) 14%, transparent) 36%, color-mix(in srgb, var(--glow) 0%, transparent) 64%);
}
.app-tile-icon::before {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -55%;
  width: 42%;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--glow) 80%, transparent), transparent);
}
.app-tile:is(:hover, :focus-visible) .app-tile-icon::before { animation: app-chip-sheen 0.85s cubic-bezier(.3, .6, .3, 1); }
.app-tile-icon svg { position: relative; width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linejoin: round; stroke-linecap: round; }
.app-tile-name { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; text-align: center; }
.app-tile-desc { color: var(--text-secondary); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; text-align: center; }
.app-tile-arrow {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--rose-600);
  font-weight: 700;
  opacity: 0;
  transform: translateX(-4px);
  transition: 0.18s ease;
}

@media (max-width: 599px) {
  .app-tile { min-height: 112px; padding: 12px; gap: 6px; overflow: hidden; }
  .app-tile-icon { width: 42px; height: 42px; border-radius: 12px; flex: none; }
  .app-tile-icon svg { width: 28px; height: 28px; }
  .app-tile-name { width: 100%; padding-right: 0; font-size: 13px; line-height: 1.3; white-space: normal; overflow-wrap: normal; }
  .app-tile-desc { width: 100%; font-size: 11px; line-height: 1.4; white-space: normal; overflow-wrap: normal; }
  .app-tile-arrow { top: 12px; right: 10px; font-size: 12px; opacity: 1; transform: none; }
}

/* One hue per application, spaced around the wheel so no two tiles
   read alike. --app drives the icon, its chip and the tile's own tint. */
.app-tile[data-app="clockin"]        { --app: var(--info-fg); }
.app-tile[data-app="tasks"]          { --app: var(--tint-teal-fg); }
.app-tile[data-app="communications"] { --app: var(--tint-violet-fg); }
.app-tile[data-app="warehouse"]      { --app: var(--warning-fg); }
.app-tile[data-app="news_events"]    { --app: var(--tint-cyan-fg); }
.app-tile[data-app="files"]          { --app: var(--tint-lime-fg); }
.app-tile[data-app="mailbox"]        { --app: var(--brand-solid); }
.app-tile[data-app="users"]          { --app: var(--tint-indigo-fg); }
.app-tile[data-app="grants"]         { --app: var(--tint-fuchsia-fg); }

/* Light theme: the chip is tinted with the app's own colour and lit from the
   top-left, the same construction as the dark theme rather than a flat pastel
   block - that flatness was what made the light Hub look dated. */
/* Scoped to light only: an unscoped `color` here beat the dark theme's
   --app-icon-color and darkened every icon on black. */
:root:not([data-theme="dark"]) .app-tile-icon {
  background: var(--app-icon-bg, var(--rose-50));
  background: linear-gradient(150deg,
    color-mix(in srgb, var(--app) 26%, var(--text-on-brand)),
    color-mix(in srgb, var(--app) 9%, var(--text-on-brand)));
  color: color-mix(in srgb, var(--app) 72%, var(--surface));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--glow) 85%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--app) 24%, transparent);
}
:root:not([data-theme="dark"]) .app-tile:hover .app-tile-icon {
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--glow) 90%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--app) 42%, transparent),
    0 8px 18px -6px color-mix(in srgb, var(--app) 34%, transparent);
}

/* On black each tile carries a faint wash of its own colour, so the grid
   reads as nine distinct applications without shouting. */
:root[data-theme="dark"] .app-tile {
  /* Lightened, not raw: these hues are tuned for a white ground, and several
     of them (the Medha red most of all) fall below 3:1 straight onto black. */
  --app-icon-color: var(--app);
  --app-icon-color: color-mix(in srgb, var(--app) 58%, var(--text-on-brand));
  /* Same construction on black: a faint lit top edge, the app's colour
     washing down from above, then depth below. */
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--glow) 6%, transparent) 0%, color-mix(in srgb, var(--glow) 1%, transparent) 44%, color-mix(in srgb, var(--glow) 0%, transparent) 100%),
    radial-gradient(125% 92% at 50% -22%, color-mix(in srgb, var(--app) 18%, transparent), transparent 74%),
    color-mix(in srgb, var(--surface) 78%, transparent);
  border-color: color-mix(in srgb, var(--glow) 9%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--glow) 7%, transparent),
    0 2px 4px color-mix(in srgb, var(--scrim) 50%, transparent),
    0 14px 30px -14px color-mix(in srgb, var(--scrim) 85%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
:root[data-theme="dark"] .app-tile:hover {
  border-color: var(--app);
  border-color: color-mix(in srgb, var(--app) 58%, transparent);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--glow) 8%, transparent) 0%, color-mix(in srgb, var(--glow) 2%, transparent) 44%, color-mix(in srgb, var(--glow) 0%, transparent) 100%),
    radial-gradient(125% 92% at 50% -22%, color-mix(in srgb, var(--app) 30%, transparent), transparent 74%),
    color-mix(in srgb, var(--surface-raised) 85%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--glow) 10%, transparent),
    0 2px 6px color-mix(in srgb, var(--scrim) 55%, transparent),
    0 22px 44px -18px color-mix(in srgb, var(--app) 45%, color-mix(in srgb, var(--scrim) 90%, transparent));
}
:root[data-theme="dark"] .app-tile:focus-visible { outline-color: var(--app); }
:root[data-theme="dark"] .app-tile-arrow { color: var(--app); }
:root[data-theme="dark"] .app-tile-icon .icon-fill { fill-opacity: .24; }
:root[data-theme="dark"] .app-tile-icon {
  background: color-mix(in srgb, var(--glow) 6%, transparent);
  background: linear-gradient(152deg,
    color-mix(in srgb, var(--app) 32%, var(--surface)),
    color-mix(in srgb, var(--app) 8%, var(--surface)));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--glow) 16%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--app) 34%, transparent);
}
/* Gloss is subtler on black - a bright wash there looks like fog, not shine. */
:root[data-theme="dark"] .app-tile-icon::after {
  background: linear-gradient(163deg, color-mix(in srgb, var(--glow) 24%, transparent) 0%, color-mix(in srgb, var(--glow) 5%, transparent) 38%, color-mix(in srgb, var(--glow) 0%, transparent) 66%);
}
:root[data-theme="dark"] .app-tile-icon::before {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--glow) 40%, transparent), transparent);
}
:root[data-theme="dark"] .app-tile:hover .app-tile-icon {
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--glow) 22%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--app) 58%, transparent),
    0 10px 22px -8px color-mix(in srgb, var(--app) 40%, transparent);
}

.app-tile-icon .icon-fill { fill: currentColor; fill-opacity: .2; stroke: none; }
.app-tile-icon .icon-motion {
  animation: var(--icon-animation) var(--icon-duration, 4.2s) var(--icon-ease, cubic-bezier(.34, 1.4, .5, 1)) infinite;
}
.app-tile[data-app="clockin"] { --icon-animation: app-clock-tick; }
.app-tile[data-app="tasks"] { --icon-animation: app-check-draw; }
.app-tile[data-app="communications"] { --icon-animation: app-chat-dot; }
.app-tile[data-app="warehouse"] { --icon-animation: app-stock-lift; }
.app-tile[data-app="news_events"] { --icon-animation: app-news-lines; }
.app-tile[data-app="files"] { --icon-animation: app-file-upload; }
.app-tile[data-app="mailbox"] { --icon-animation: app-mail-flap; }
.app-tile[data-app="users"] { --icon-animation: app-people; }
.app-tile[data-app="grants"] { --icon-animation: app-funding; }
/* steps(), not linear: a real second hand jumps, it does not glide. */
.app-tile[data-app="clockin"] .icon-motion { transform-origin: 12px 12px; animation-duration: 24s; animation-timing-function: steps(24, end); }
.app-tile[data-app="tasks"] { --icon-duration: 5s; --icon-ease: ease-in-out; }
.app-tile[data-app="tasks"] .icon-motion { transform-origin: 12px 12.8px; }
.app-tile[data-app="news_events"] { --icon-duration: 5s; --icon-ease: ease-in-out; }
.app-tile[data-app="news_events"] .icon-motion { transform-origin: 6px 50%; }
.app-tile[data-app="files"] { --icon-duration: 4.6s; --icon-ease: cubic-bezier(.3, .7, .3, 1); }
.app-tile[data-app="communications"] { --icon-duration: 1.5s; --icon-ease: ease-in-out; }
.app-tile[data-app="warehouse"], .app-tile[data-app="grants"] { --icon-duration: 4.8s; }
.app-tile[data-app="mailbox"] { --icon-duration: 5.2s; --icon-ease: cubic-bezier(.5, 0, .3, 1); }
.app-tile-icon .chat-dot { fill: currentColor; stroke: none; }
.app-tile-icon .chat-dot:nth-of-type(2) { animation-delay: .18s; }
.app-tile-icon .chat-dot:nth-of-type(3) { animation-delay: .36s; }
.app-tile[data-app="mailbox"] .icon-motion { transform-origin: 12px 7.6px; }
.app-tile[data-app="users"] .icon-motion { transform-origin: 9.3px 20.5px; }
/* Motion that reads as the real thing: a clock that ticks in discrete steps,
   a crate that overshoots and settles, a typing indicator, a coin that drops
   and bounces. All slow and low-amplitude - this is a work tool, not a toy. */
@keyframes app-clock-tick { to { transform: rotate(360deg); } }
@keyframes app-check-draw {
  0%, 62%, 100% { transform: scale(1); }
  72% { transform: scale(1.2); }
  84% { transform: scale(.96); }
}
@keyframes app-chat-dot {
  0%, 60%, 100% { transform: translateY(0) scale(1); opacity: .55; }
  30% { transform: translateY(-2.4px) scale(1.15); opacity: 1; }
}
@keyframes app-stock-lift {
  0%, 12% { transform: translateY(0); }
  38% { transform: translateY(-3.4px); }
  52% { transform: translateY(.6px); }
  62% { transform: translateY(-.7px); }
  72%, 100% { transform: translateY(0); }
}
/* Floors at .62, not .25: at this stroke weight a line that shrinks away
   leaves the icon looking unfinished for part of every cycle. */
@keyframes app-news-lines {
  0%, 8% { transform: scaleX(.62); opacity: .55; }
  38%, 78% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(.62); opacity: .55; }
}
@keyframes app-file-upload {
  0%, 10% { transform: translateY(2.5px); opacity: 0; }
  30% { opacity: 1; }
  62% { transform: translateY(-3.5px); opacity: 1; }
  82%, 100% { transform: translateY(-5px); opacity: 0; }
}
@keyframes app-mail-flap {
  0%, 14% { transform: scaleY(1); }
  44%, 54% { transform: scaleY(.18); }
  78%, 100% { transform: scaleY(1); }
}
@keyframes app-people {
  0%, 60%, 100% { transform: translateY(0) rotate(0); opacity: 1; }
  22% { transform: translateY(-1.2px) rotate(-4deg); }
  40% { transform: translateY(0) rotate(2.5deg); }
}
@keyframes app-funding {
  0%, 8% { transform: translateY(-4px); opacity: 0; }
  26% { opacity: 1; }
  46% { transform: translateY(0); }
  56% { transform: translateY(-1.6px); }
  66% { transform: translateY(0); }
  88% { opacity: 1; }
  100% { transform: translateY(0); opacity: .55; }
}
/* A slow specular sweep across the icon chip - the "polish" pass. */
@keyframes app-chip-sheen {
  0% { transform: translateX(-120%) rotate(8deg); opacity: 0; }
  22% { opacity: .85; }
  100% { transform: translateX(160%) rotate(8deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .app-tile-icon::before { animation: none !important; opacity: 0 !important; }
  .app-tile, .app-tile-icon, .app-tile-icon *, .app-tile-arrow {
    animation: none !important;
    transition: none;
  }
  .app-tile:is(:hover, :active), .app-tile:is(:hover, :focus-visible) .app-tile-icon { transform: none; }
}

[hidden], .hidden { display: none !important; }

/* Mail Box app (/mail) */
.mailbox-gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--canvas) 92%, transparent); }
.modal-actions a.modal-cancel { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
/* Pinned to the viewport rather than min-height, so the mailbox never grows
   the page: the wheel over the list scrolls the LIST, and the reading pane
   scrolls itself only when its content actually overflows. Without this the
   whole document scrolled and the two panes moved together. */
.mailbox-app { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: color-mix(in srgb, var(--canvas) 92%, transparent); }
.mailbox-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px, 5vw, 40px); background: var(--header-background); color: white; }
.mailbox-topbar a.secondary-button { text-decoration: none; }
.mailbox-body { flex: 1; display: grid; grid-template-columns: 220px minmax(300px, 380px) 1fr; min-height: 0; }
.mailbox-sidebar { padding: 16px; border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.mailbox-compose { width: 100%; justify-content: center; margin-bottom: 16px; font-size: 14px; padding: 10px 16px; }
.mailbox-folders { display: flex; flex-direction: column; gap: 4px; }
.mailbox-folder { text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--slate-700); font-size: 14px; font-weight: 600; cursor: pointer; }
.mailbox-folder:hover { background: var(--slate-100); }
.mailbox-folder.active { background: var(--rose-50); color: var(--rose-700); }
.mailbox-list-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border); background: var(--surface); }
.mailbox-list-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.mailbox-list-header h2 { margin: 0; font-size: 16px; }
.mailbox-list-header .secondary-button { flex: none; padding: 6px 12px; }
.mailbox-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
/* Sits at the end of the message rows, so reaching the bottom of the list is
   what reveals it. */
.mailbox-load-more { display: block; width: calc(100% - 32px); margin: 12px 16px 16px; padding: 9px 12px; border: 1px solid var(--rose-300); border-radius: 8px; background: var(--surface); color: var(--rose-700); font-size: 12px; font-weight: 700; cursor: pointer; }
.mailbox-load-more:hover:not(:disabled) { background: var(--rose-50); }
.mailbox-load-more:disabled { opacity: .6; cursor: default; }
.mailbox-row { display: flex; flex-direction: column; gap: 2px; padding: 11px 16px; border-bottom: 1px solid var(--slate-100); cursor: pointer; text-align: left; }
.mailbox-row:hover { background: var(--slate-50); }
.mailbox-row:focus-visible { outline: 2px solid var(--rose-600); outline-offset: -2px; }
.mailbox-row--unread { background: var(--rose-50); box-shadow: inset 3px 0 0 var(--rose-600); }
.mailbox-row--selected,
.mailbox-row--selected:hover { position: relative; background: linear-gradient(90deg,var(--rose-100),var(--surface)); box-shadow: inset 4px 0 0 var(--rose-700), inset 0 0 0 1px var(--rose-300); }
.mailbox-row--selected::after { content: "Open"; position: absolute; top: 9px; right: 10px; padding: 3px 8px; border-radius: 999px; color: white; background: var(--brand-solid-deep); font-size: 9px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.mailbox-row--selected .mailbox-row-who,
.mailbox-row--selected .mailbox-row-subject { padding-right: 48px; }
.mailbox-row-who { font-size: 13px; font-weight: 700; color: var(--slate-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-row--unread .mailbox-row-who { font-weight: 800; }
.mailbox-row-subject { font-size: 13px; color: var(--slate-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-row-preview { font-size: 12px; color: var(--slate-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-row-date { font-size: 11px; color: var(--slate-400); }
.mail-star-button { display:grid; place-items:center; width:30px; height:30px; padding:0; border:0; border-radius:50%; color:var(--slate-300); background:transparent; cursor:pointer; font-size:22px; line-height:1; }
.mail-star-button:hover { color:var(--amber-300); background:var(--amber-100); }
.mail-star-button.active { color:var(--amber-500); text-shadow:0 1px 2px color-mix(in srgb, var(--warning-fg) 20%, transparent); }
.mail-star-button:disabled { opacity:.55; cursor:wait; }
.mailbox-empty { padding: 28px; color: var(--slate-400); text-align: center; font-size: 13px; }
.mailbox-reading { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.mailbox-reading-inner { padding: 20px; }
.mailbox-reading-empty { margin: 60px auto; color: var(--slate-400); text-align: center; }
.mailbox-message-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.mailbox-message-subject { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.mailbox-message-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: none; }
.mailbox-tool { padding: 7px 12px; border: 1px solid var(--rose-300); border-radius: 8px; color: var(--rose-700); background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 700; }
.mailbox-tool:hover { background: var(--rose-50); }
.mailbox-tool:disabled { opacity: .6; cursor: wait; }
.mailbox-tool--danger { border-color: var(--slate-300); color: var(--slate-600); }
.mailbox-tool--danger:hover { border-color: var(--rose-500); color: var(--rose-700); background: var(--rose-50); }
.mailbox-card { margin-bottom: 14px; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 1px 3px color-mix(in srgb, var(--slate-900) 6%, transparent); }
.mailbox-card--sub { border-left: 3px solid var(--rose-200); }
.mailbox-card-meta { padding: 12px 16px; border-bottom: 1px solid var(--slate-100); }
.mailbox-card-meta strong, .mailbox-card-meta span, .mailbox-card-meta time { display: block; }
.mailbox-card-meta strong { font-size: 14px; color: var(--slate-900); }
.mailbox-card-meta span { margin-top: 2px; font-size: 12px; color: var(--slate-500); overflow-wrap: anywhere; }
.mailbox-card-date { margin-top: 6px; font-size: 12px; color: var(--slate-600); font-weight: 700; }
.mailbox-card-body { margin: 0; padding: 16px; font-family: inherit; font-size: 14px; line-height: 1.6; color: var(--slate-800); white-space: pre-wrap; overflow-wrap: anywhere; }
.mailbox-attach-section { padding: 0 16px 12px; }
.mailbox-attach-heading { margin: 0 0 8px; color: var(--slate-500); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
/* auto-fill, not a fixed 5: the reading pane is a resizable column, and
   five fixed tracks overflowed it on a narrow window. */
/* auto-fill, not a fixed 5: the reading pane is a resizable column, and five
   fixed tracks overflowed it on a narrow window. max-width caps how wide the
   row may grow so a wide monitor gets readable cards, not 8 thin slivers. */
.attachments-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-width: 880px; }
.attachment-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; border: 1px solid var(--slate-200); border-radius: 10px; background: var(--slate-50); text-align: center; min-width: 0; }
.attachment-card-icon { width: 36px; height: 36px; display: grid; place-items: center; margin: 0 auto; border-radius: 8px; font-size: 10px; font-weight: 900; letter-spacing: .03em; }
.attachment-card-name { font-size: 11px; font-weight: 600; color: var(--slate-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-card-size { font-size: 10px; color: var(--slate-500); }
.attachment-card-actions { display: flex; gap: 4px; justify-content: center; margin-top: auto; }
.attachment-card-preview, .attachment-card-download { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; padding: 7px 10px; border: 1px solid var(--slate-300); border-radius: 9px; background: var(--surface); box-shadow: 0 2px 6px color-mix(in srgb, var(--slate-900) 8%, transparent); cursor: pointer; font-size: 10px; font-weight: 800; color: var(--slate-700); }
.attachment-card-download { border-color: var(--rose-700); color: white; background: linear-gradient(135deg,var(--rose-700),var(--rose-800)); }
.attachment-card-preview:hover, .attachment-card-download:hover { border-color: var(--rose-300); color: var(--rose-700); }
.attachment-card-download:disabled { opacity: .5; cursor: wait; }
.mailbox-attachments { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
.mailbox-attachment { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--slate-200); border-radius: 8px; background: var(--slate-50); font-size: 12px; color: var(--slate-700); }
@media (max-width: 900px) {
  /* Stacked on a phone the panes sit one above the other, so the page itself
     has to scroll again - pinning it here would trap the reading pane. */
  .mailbox-app { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  .mailbox-body { grid-template-columns: 1fr; }
  .mailbox-sidebar { display: flex; align-items: center; gap: 12px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .mailbox-compose { width: auto; margin: 0; flex: none; }
  .mailbox-folders { flex-direction: row; }
  .mailbox-list-col { border-right: 0; border-bottom: 1px solid var(--border); max-height: 42vh; }
  /* The headline already takes a full row of its own, so the actions do not
     need a separate column - stacking them wasted most of a phone screen. */
  .mailbox-message-toolbar { flex-direction: row; }
}

/* ── Mailbox on small screens ──────────────────────────────────────────────
   The reading pane, list and sidebar are one column below 900px; these rules
   cover what that alone did not: a top bar whose brand and buttons collided,
   tap targets under the 44px minimum, and nesting indents that ate the width
   a quoted email had left to show its text. */
@media (max-width: 900px) {
  /* Wrap rather than overlap - the theme toggle was sitting on the logo. */
  .mailbox-topbar { flex-wrap: wrap; row-gap: 8px; padding: 10px clamp(12px, 4vw, 24px); }
  .mailbox-topbar .brand { min-width: 0; }
  .mailbox-topbar .brand-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mailbox-topbar .topbar-right { gap: 8px; }
  /* Folders are the primary navigation on a phone; give them the row and let
     Compose sit beside them instead of consuming a row by itself. */
  .mailbox-sidebar { padding: 10px 12px; gap: 8px; }
  /* The folder strip scrolls sideways on its own instead of pushing the
     sidebar wider than the screen (Inbox/Sent/Drafts/Trash did not fit on a
     375px phone once Compose took its share of the row). */
  .mailbox-folders { gap: 6px; min-width: 0; overflow-x: auto; flex: 1 1 auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .mailbox-folders::-webkit-scrollbar { display: none; }
  .mailbox-folder { white-space: nowrap; flex: none; }
  .mailbox-compose { flex: none; }
}

/* Sized by INPUT, not width: a tablet is finger-driven at 1024px just as a
   phone is at 375px, so the 44px minimum keys off a coarse pointer rather
   than a breakpoint. A mouse keeps the compact buttons. */
@media (pointer: coarse) {
  .mailbox-tool,
  .attachment-card-preview,
  .attachment-card-download,
  .mailbox-folder,
  .mailbox-compose { min-height: 44px; padding-inline: 14px; font-size: 13px; }
  .attachment-card-actions { flex-wrap: wrap; gap: 6px; }
  .attachment-card-preview { flex: 1 1 auto; justify-content: center; }
  .attachment-card-download { flex: 0 0 44px; justify-content: center; }
  .mailbox-row { padding-block: 12px; }
  /* The per-row AI button sat at ~26px, too small to hit without also
     opening the message underneath it. */
  .mail-ai-button { width: 40px; height: 40px; }
}

@media (max-width: 640px) {
  .mailbox-message-actions { gap: 6px; }
  .mailbox-message-subject { font-size: 17px; }
  /* A depth-4 email had ~120px of indent on a 375px screen and almost no room
     left for its own text; the colour key and label still convey the level. */
  .thread-message--sub > summary { padding-left: 38px; }
  .thread-message--sub > summary::before { left: 12px; font-size: 24px; }
  .thread-message-meta { padding: 12px 14px; }
  .mailbox-reading-inner { padding: 12px; }
  .mailbox-attach-section { padding: 0 14px 12px; }
  .thread-message-footer { padding: 10px 14px; }
}
/* Hub Tools previews are visual only. This rule is intentionally CSS-level
   so the access overlay cannot flash while the Hub module is starting. */
html[data-hub-preview] #push-prompt{display:none!important}
html[data-hub-preview] #welcome-view.permissions-pending .apps-topbar,
html[data-hub-preview] #welcome-view.permissions-pending .apps-inner{visibility:visible}
.permissions-pending .apps-topbar,.permissions-pending .apps-inner{visibility:hidden}.push-required-backdrop{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:18px;background:var(--canvas,var(--slate-50))}.push-required-backdrop[hidden]{display:none}.push-required-dialog{width:min(380px,100%);padding:24px;border:1px solid var(--slate-200,var(--slate-200));border-radius:20px;background:var(--surface,var(--surface));color:var(--slate-900,var(--slate-900));text-align:center;box-shadow:0 22px 65px color-mix(in srgb, var(--slate-900) 22%, transparent)}.push-required-icon{display:grid;width:54px;height:54px;margin:0 auto 10px;place-items:center;border-radius:17px;background:var(--rose-100,var(--rose-100));color:var(--rose-700,var(--rose-700))}.push-required-icon svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.push-required-eyebrow{display:block;margin-bottom:5px;color:var(--rose-700,var(--rose-700));font-size:10px;font-weight:800;letter-spacing:.11em;text-transform:uppercase}.push-required-dialog h2{margin:0 0 8px;font-size:21px;letter-spacing:-.02em}.push-required-dialog p{margin:0;color:var(--slate-500,var(--slate-500));font-size:13px;line-height:1.5}.push-required-benefits{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;margin:14px 0 1px}.push-required-benefits span{padding:5px 8px;border:1px solid var(--rose-200,var(--rose-200));border-radius:999px;background:var(--rose-50,var(--rose-50));color:var(--rose-700,var(--rose-700));font-size:10px;font-weight:700}.push-required-dialog .push-required-status{min-height:20px;margin:11px 0 2px;color:var(--rose-700,var(--rose-700));font-size:.8rem}.push-required-dialog .primary-button{width:100%;min-height:42px;margin-top:8px;border-radius:11px;font-weight:750}:root[data-theme="dark"] .push-required-backdrop{background:var(--canvas,var(--canvas))}:root[data-theme="dark"] .push-required-dialog{border-color:var(--border);background:var(--surface,var(--surface));color:var(--text-on-brand);box-shadow:0 22px 65px color-mix(in srgb, var(--scrim) 55%, transparent)}:root[data-theme="dark"] .push-required-icon{background:var(--border);color:var(--rose-300)}:root[data-theme="dark"] .push-required-dialog p{color:var(--neutral-fg)}:root[data-theme="dark"] .push-required-benefits span{border-color:var(--rose-950);background:var(--brand-tint);color:var(--rose-300)}

/* ── Mailbox reading pane: threaded conversation ──────────────────────────
   The .thread-message-* rules above were written for the Hub's centered
   modal (fixed max-width, auto margins, width:calc(100% - 90px) indent).
   The mailbox reading pane is a narrow resizable column, so those width
   rules are re-stated here: indentation is margin-left set per depth in
   mail.js, and the card always fills whatever width is left. */
.mailbox-reading-inner .thread-message { max-width: none; margin: 0 0 14px; width: auto; }
.mailbox-reading-inner .thread-message--current,
.mail-thread-content .thread-message--current { border-top: 4px solid var(--rose-700); box-shadow: 0 6px 20px color-mix(in srgb, var(--slate-900) 10%, transparent); }

/* ── Scorecards: each quoted level is a smaller card joined to its parent ──
   --thread-step (1..5) is set per card in mail.js from the message depth.
   Indent, shrink and fade are all driven off that one number so the levels
   stay in step with each other. */
.mailbox-reading-inner .thread-message--sub,
.mail-thread-content .thread-message--sub {
  --thread-indent: calc(var(--thread-step, 1) * 26px);
  position: relative;
  width: auto;
  max-width: none;
  margin-left: var(--thread-indent);
  margin-right: 0;
  border-radius: 12px;
  /* Older = quieter, but never so faint it cannot be read. */
  background: color-mix(in srgb, var(--surface) 100%, var(--canvas) calc(var(--thread-step, 1) * 6%));
  box-shadow: 0 1px 4px color-mix(in srgb, var(--slate-900) 5%, transparent);
}

/* The connector: a short elbow from the parent card's left edge into this
   one, so a reply visibly hangs off the message it answers instead of
   floating as a separate card. Drawn with borders on a pseudo-element - no
   extra DOM, and it inherits the depth colour automatically. */
.mailbox-reading-inner .thread-message--sub::before,
.mail-thread-content .thread-message--sub::before {
  content: "";
  position: absolute;
  top: -15px;
  left: -14px;
  width: 14px;
  bottom: calc(100% - 26px);
  border-left: 2px solid var(--thread-line, var(--slate-300));
  border-bottom: 2px solid var(--thread-line, var(--slate-300));
  border-bottom-left-radius: 9px;
  pointer-events: none;
}

/* Depth colour key, shared by the left border and the connector elbow. */
.thread-message--sub[data-depth="1"] { --thread-line: var(--rose-300); }
.thread-message--sub[data-depth="2"] { --thread-line: var(--amber-300); }
.thread-message--sub[data-depth="3"] { --thread-line: var(--blue-300); }
.thread-message--sub[data-depth="4"] { --thread-line: var(--emerald-700); }
.thread-message--sub[data-depth="5"] { --thread-line: var(--violet-700); }
.mailbox-reading-inner .thread-message--sub,
.mail-thread-content .thread-message--sub { border-left: 3px solid var(--thread-line, var(--slate-300)); }

/* Phones: half the step. The nesting must stay visible, but a full 26px per
   level left a deep quote almost no width for its own text on a 390px screen.
   Declared after the base rule above - same specificity, so order decides. */
@media (max-width: 640px) {
  .mailbox-reading-inner .thread-message--sub,
  .mail-thread-content .thread-message--sub { --thread-indent: calc(var(--thread-step, 1) * 11px); }
  .mailbox-reading-inner .thread-message--sub::before,
  .mail-thread-content .thread-message--sub::before { left: -8px; width: 8px; }
}

/* Type scales down with the card so a level-4 quote reads as subordinate
   without becoming unreadable (13px floor). */
.mailbox-reading-inner .thread-message--sub .thread-message-from,
.mail-thread-content .thread-message--sub .thread-message-from { font-size: clamp(13px, calc(15px - var(--thread-step, 1) * 0.5px), 15px); }
.mailbox-reading-inner .thread-message--sub .thread-message-body,
.mailbox-reading-inner .thread-message--sub .thread-message-subject-line,
.mail-thread-content .thread-message--sub .thread-message-body,
.mail-thread-content .thread-message--sub .thread-message-subject-line { font-size: clamp(13px, calc(14.5px - var(--thread-step, 1) * 0.4px), 14px); }

/* Without min-width:0 the action buttons win the flex negotiation and
   squeeze the subject to a single character per line. */
.mailbox-message-headline { flex: 1 1 100%; min-width: 0; }
/* The action row wraps under the subject instead of competing with it for
   width - at a narrow reading pane the last button was cut off the edge. */
.mailbox-message-toolbar { flex-wrap: wrap; }
.mailbox-message-actions { flex: 1 1 auto; }
.mailbox-reading-inner { min-width: 0; }
.mailbox-thread-count { display: block; margin-top: 4px; color: var(--slate-500); font-size: 12px; font-weight: 600; }

/* Depth colour key, so nesting level is readable at a glance. */
.thread-message--sub[data-depth="2"] { border-left-color: var(--amber-300); }

.thread-message-from { overflow-wrap: anywhere; }
.thread-message-subject-line { margin-top: 6px; color: var(--slate-700) !important; font-weight: 600; overflow-wrap: anywhere; }
.mailbox-reading-inner .thread-message-html { min-height: 80px; }
/* Past the 2400px sizing cap the frame scrolls rather than clipping. */
.thread-message-html { overflow: auto; }

/* Per-message Reply / Reply all / Forward. */
.thread-message-footer { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px 14px; border-top: 1px solid var(--slate-100); background: var(--slate-50); }
.thread-message--sub .thread-message-footer { background: transparent; }

@media (max-width: 640px) {
  .thread-message-footer { padding: 10px 14px; }
  .thread-message-footer .mailbox-tool { flex: 1; }
}

/* ── Reveal-password control on the mail login form ── */
.password-field { position: relative; display: block; }
.password-field input { width: 100%; padding-right: 44px; }
.password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  display: grid; place-items: center; width: 34px; height: 34px;
  padding: 0; border: 0; border-radius: 8px;
  color: var(--slate-500); background: transparent; cursor: pointer;
}
.password-toggle:hover { color: var(--rose-700); background: var(--rose-50); }
.password-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
/* One icon at a time: eye = "click to show", crossed eye = "click to hide". */
.password-toggle .password-icon-hide { display: none; }
.password-toggle.is-visible .password-icon-show { display: none; }
.password-toggle.is-visible .password-icon-hide { display: block; }
@media (pointer: coarse) { .password-toggle { width: 44px; height: 44px; } .password-field input { padding-right: 52px; } }

/* ---------- inbox as a floating dock panel ---------- */
/* The panel header doubles as the swipe grip on phones and holds the actions;
   it must wrap rather than push the sheet wider than the screen. */
#mail-panel .mail-panel-header { flex-wrap: wrap; }
#mail-panel .mail-panel-actions { flex-wrap: wrap; }
/* The collapse caret is meaningless in a floating panel that is always open. */
#mail-panel #mail-panel-toggle { display: none; }

/* Nothing inside a mail row or a thread may force sideways scrolling: long
   addresses, unbroken URLs and pasted tokens all wrap instead. */
#mail-panel #mail-list,
.mail-thread-content { overscroll-behavior: contain; }
.mail-row, .mail-row * { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.thread-message, .thread-message * { min-width: 0; }
/* HTML emails carry their own wide tables/images - clip them to the dialog
   and let the offending block scroll inside itself, never the page. */
.thread-message-body img,
.mailbox-reading-inner img { max-width: 100%; height: auto; }
.thread-message-body table,
.mailbox-reading-inner table { display: block; max-width: 100%; overflow-x: auto; }
.thread-message-body pre,
.thread-message-body code { max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Subject/preview lines stay on one line only where there is room for it. */
.mail-thread-header h2 { overflow-wrap: anywhere; }

/* ============================================================
   APP TILES - one brand colour, bigger icons, label at the foot
   Every icon is the logo's red. Nine hues made the grid read as a sweet tray,
   and two shades of red made it look like two sets of tiles; one colour lets
   the icon shape alone carry the meaning and makes the grid scan as Medha at
   a glance. --brand-solid is deliberately the same value in both themes: the
   --rose-700/800/900 steps lighten in dark mode, which is what split the grid
   into two shades before.
   ============================================================ */
.app-tile[data-app="clockin"],
.app-tile[data-app="tasks"],
.app-tile[data-app="communications"],
.app-tile[data-app="warehouse"],
.app-tile[data-app="news_events"],
.app-tile[data-app="files"],
.app-tile[data-app="mailbox"],
.app-tile[data-app="grants"],
.app-tile[data-app="users"] { --app: var(--brand-solid); }

/* The icon leads and the label sits at the foot of the card. Tiles in a row
   stretch to the same height, so every label lines up on one baseline. */
.app-tile { justify-content: flex-start; }
.app-tile-name { margin-top: auto; }

.app-tile-icon { width: 76px; height: 76px; border-radius: 22px; }
.app-tile-icon svg { width: 44px; height: 44px; stroke-width: 2; }

@media (min-width: 900px) and (max-width: 1179px) {
  .app-tile-icon { width: 68px; height: 68px; border-radius: 20px; }
  .app-tile-icon svg { width: 40px; height: 40px; }
}
@media (min-width: 600px) and (max-width: 899px) {
  .app-tile-icon { width: 64px; height: 64px; border-radius: 19px; }
  .app-tile-icon svg { width: 37px; height: 37px; }
}
@media (max-width: 599px) {
  .app-tile { gap: 8px; padding: 12px 5px 10px; }
  .app-tile-icon { width: 56px; height: 56px; border-radius: 17px; }
  .app-tile-icon svg { width: 32px; height: 32px; stroke-width: 2.1; }
}
@media (max-width: 389px) {
  .app-tile-icon { width: 50px; height: 50px; border-radius: 15px; }
  .app-tile-icon svg { width: 28px; height: 28px; }
}

/* Solid brand-red chip, white glyph, in both themes. A tinted chip with a red
   line icon looked muted at a glance on black; a filled Medha-red tile with a
   white mark is the highest-contrast way to stay inside the one brand colour. */
.app-tile .app-tile-icon,
:root:not([data-theme="dark"]) .app-tile .app-tile-icon,
:root[data-theme="dark"] .app-tile .app-tile-icon {
  color: var(--text-on-brand);
  background: linear-gradient(150deg, color-mix(in srgb, var(--app) 82%, var(--rose-700)), var(--app) 55%, color-mix(in srgb, var(--app) 80%, var(--rose-100)));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--glow) 28%, transparent), 0 6px 16px -6px color-mix(in srgb, var(--app) 60%, transparent);
}
.app-tile .app-tile-icon .icon-fill { fill: var(--surface); fill-opacity: 0.2; }
:root[data-theme="dark"] .app-tile .app-tile-icon .icon-fill { fill-opacity: 0.2; }
.app-tile:hover .app-tile-icon,
:root[data-theme="dark"] .app-tile:hover .app-tile-icon,
:root:not([data-theme="dark"]) .app-tile:hover .app-tile-icon {
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--glow) 34%, transparent), 0 12px 26px -8px color-mix(in srgb, var(--app) 75%, transparent);
}
.app-tile .app-tile-icon::after { background: linear-gradient(163deg, color-mix(in srgb, var(--glow) 34%, transparent) 0%, color-mix(in srgb, var(--glow) 6%, transparent) 40%, color-mix(in srgb, var(--glow) 0%, transparent) 66%); }

/* Labels share one baseline: the description always reserves two lines, so a
   one-line description no longer drops its tile's name lower than its
   neighbours'. */
@media (min-width: 600px) {
  .app-tile-desc {
    min-height: 2.9em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
}

/* A single tile on its own phone/iPad row lays out sideways - icon then
   label - so a full-width row reads as a feature tile, not a stretched square. */
@media (max-width: 1024px) {
  .app-tile.app-tile--wide { flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; padding: 12px 16px; text-align: left; }
  .app-tile.app-tile--wide .app-tile-name { margin-top: 0; text-align: left; width: auto; min-height: 0; -webkit-line-clamp: 1; }
  .app-tile.app-tile--wide .app-tile-desc { display: block; text-align: left; min-height: 0; }
}

/* Phone and iPad: the full app name and its description are always shown.
   Earlier rules clamped the name to two lines with an ellipsis and hid the
   description entirely below 600px. */
@media (max-width: 1024px) {
  .app-grid .app-tile .app-tile-name {
    display: block; -webkit-line-clamp: unset; overflow: visible; text-overflow: clip;
    white-space: normal; overflow-wrap: break-word; min-height: 0; width: 100%;
    font-size: 13px; line-height: 1.25;
  }
  .app-grid .app-tile .app-tile-desc {
    display: block; -webkit-line-clamp: unset; overflow: visible; min-height: 0;
    white-space: normal; overflow-wrap: break-word; width: 100%;
    font-size: 11px; line-height: 1.35; color: var(--text-secondary);
  }
  .app-grid .app-tile { overflow: visible; height: auto; }
  .app-grid .app-tile.app-tile--wide .app-tile-name,
  .app-grid .app-tile.app-tile--wide .app-tile-desc { width: auto; }
}
@media (max-width: 389px) {
  .app-grid .app-tile .app-tile-name { font-size: 12px; }
  .app-grid .app-tile .app-tile-desc { font-size: 10.5px; }
}
@media (max-width: 1024px) {
  .app-grid .app-tile.app-tile--wide {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto;
    column-gap: 14px; row-gap: 2px; align-content: center; align-items: center;
  }
  .app-grid .app-tile.app-tile--wide .app-tile-icon { grid-row: 1 / 3; }
  .app-grid .app-tile.app-tile--wide .app-tile-name { grid-column: 2; align-self: end; }
  .app-grid .app-tile.app-tile--wide .app-tile-desc { grid-column: 2; align-self: start; }
  .app-grid .app-tile.app-tile--wide .app-tile-arrow { display: none; }
}

/* Phones never show the application description - name only. iPad and
   larger keep it. Placed last so no earlier phone rule can bring it back. */
@media (max-width: 599px) {
  .app-grid .app-tile .app-tile-desc,
  .app-grid .app-tile.app-tile--wide .app-tile-desc { display: none !important; }
  .app-grid .app-tile.app-tile--wide .app-tile-name { grid-row: 1 / 3; align-self: center; }
}

/* ── Hub announcement banner ──────────────────────────────────────────────
   A persistent notice from Medha Users, live until its end time.

   It is fixed to the top rather than inserted into the flow, so it cannot be
   pushed off screen by a scrolled panel. Everything else is moved down
   instead: app.js measures the banner and sets --hub-banner-height, and the
   padding below consumes it. Nothing is overlapped or clipped, and the space
   collapses the moment the banner goes. */
.hub-banner {
  position: fixed;
  inset: var(--hub-topbar-height, 72px) 0 auto 0;
  z-index: 120;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px clamp(12px, 3vw, 22px);
  background: linear-gradient(135deg, #fff9e9 0%, #fff0c5 55%, #ffe2ad 100%);
  color: #3e2106;
  border-bottom: 1px solid #e7ae4f;
  box-shadow: 0 10px 28px rgba(89, 49, 5, .18);
  /* Slides down on first paint and, because it animates its own transform,
     the reserved space below never jumps. */
  animation: hub-banner-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#holiday-banner.holiday-banner { inset: calc(var(--hub-topbar-height, 72px) + var(--hub-announcement-height, 0px)) 0 auto 0; z-index: 119; background: linear-gradient(135deg, #e8fbf8 0%, #d2f4ed 56%, #b5e9db 100%); color: #073d36; border-bottom-color: #59b6a5; }
.holiday-banner .hub-banner-icon { background: rgba(255,255,255,.68); color: #08766a; animation: none; }
.holiday-banner .hub-banner-link { display: inline-block; margin-top: 5px; color: inherit; font-size: .78rem; font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.holiday-fab { position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 125; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px 0 11px; border: 1px solid color-mix(in srgb, var(--text-on-brand, #fff) 28%, var(--brand, #ce0505)); border-radius: 999px; color: var(--text-on-brand, #fff); background: linear-gradient(135deg, var(--brand-hover, #a80404), var(--brand-solid, #ce0505)); box-shadow: 0 8px 20px color-mix(in srgb, var(--brand, #ce0505) 30%, transparent), var(--shadow-md, 0 3px 9px rgba(0,0,0,.16)); font-size: 12px; font-weight: 800; letter-spacing: -.01em; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease; }
.holiday-fab svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.holiday-fab:hover { transform: translateY(-3px); filter: brightness(1.07); box-shadow: 0 16px 34px color-mix(in srgb, var(--brand, #ce0505) 42%, transparent), var(--shadow-lg, 0 4px 10px rgba(0,0,0,.18)); }
.holiday-fab:focus-visible { outline: 3px solid #f0c674; outline-offset: 4px; }
.hub-banner[hidden] { display: none; }
@keyframes hub-banner-in {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.hub-banner-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--glow) 60%, transparent);
  font-size: 17px;
  /* A slow pulse reads as "still live" without demanding attention. */
  animation: hub-banner-pulse 2.6s ease-in-out infinite;
}
@keyframes hub-banner-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warning-fg) 35%, transparent); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--warning-fg) 0%, transparent); }
}
/* min-width:0 lets title and body wrap inside the fixed banner on every
   screen size. */
.hub-banner-copy { min-width: 0; flex: 1 1 auto; }
.hub-banner-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.hub-banner-body {
  margin: 2px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.hub-banner-meta {
  margin: 7px 0 0;
  text-align: right;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.72;
}
.hub-banner-image {
  display: block;
  margin-top: 9px;
  max-height: 150px;
  max-width: 100%;
  border-radius: 10px;
  object-fit: cover;
}
/* The page moves down by exactly the banner's height. */
body.has-hub-banner { padding-top: 0; }
body.has-hub-banner .apps-body { padding-top: calc(32px + var(--hub-banner-height, 0px)); }
body.has-hub-banner .shell { scroll-margin-top: var(--hub-banner-height, 0px); }

:root[data-theme="dark"] .hub-banner {
  background: linear-gradient(135deg, #fff8e5 0%, #ffe8b5 55%, #ffd48b 100%);
  color: #321500;
  border-bottom-color: #ffbd58;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .48);
}
:root[data-theme="dark"] .hub-banner-icon { background: rgba(255,255,255,.62); }
:root[data-theme="dark"] #holiday-banner.holiday-banner { background: linear-gradient(135deg, #e6faf5 0%, #c8f0e5 56%, #a8e2d2 100%); color: #073d36; }

@media (prefers-reduced-motion: reduce) {
  .hub-banner { animation: none; }
  .hub-banner-icon { animation: none; }
}

@media (max-width: 480px) {
  :root { --hub-topbar-height: 60px; }
  body.has-hub-banner .apps-body { padding-top: calc(20px + var(--hub-banner-height, 0px)); }
  .holiday-fab { right: max(14px, env(safe-area-inset-right, 0px)); bottom: max(14px, env(safe-area-inset-bottom, 0px)); min-height: 36px; padding: 0 12px 0 10px; font-size: 11px; }
}

/* ============================================================
   CRT SWITCH — the light/dark change
   The page is the picture on an old television. theme-flip.js writes
   --crt-inset and --crt-scale every frame; the page is clipped to them, so
   what collapses is the live Hub, not a copy of it. The surround is the
   canvas of the theme being switched on, which is why going dark closes
   into black.
   ============================================================ */
.crt-switch {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  background: var(--crt-surround, #000);
  /* The tube's own glow, strongest where the picture is collapsing. */
  box-shadow: inset 0 0 180px 40px color-mix(in srgb, var(--crt-surround, #000) 70%, transparent);
}
/* The bright scan line the picture flattens into. */
.crt-switch__line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-50%) scaleX(0);
  opacity: 0;
  background: linear-gradient(to right,
    transparent,
    color-mix(in srgb, var(--crt-glow, #fff) 92%, transparent) 18%,
    var(--crt-glow, #fff) 50%,
    color-mix(in srgb, var(--crt-glow, #fff) 92%, transparent) 82%,
    transparent);
  filter: blur(.4px);
}
/* The point it snaps to when the set goes off. */
.crt-switch__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  opacity: 0;
  background: var(--crt-glow, #fff);
  box-shadow: 0 0 18px 6px color-mix(in srgb, var(--crt-glow, #fff) 65%, transparent);
}
/* Going off: the line burns across as the picture flattens, then the dot
   holds for an instant and dies. */
.is-crt-off .crt-switch__line { animation: crt-line-off 520ms cubic-bezier(.5, 0, .2, 1) forwards; }
.is-crt-off .crt-switch__dot { animation: crt-dot-off 640ms cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes crt-line-off {
  0% { opacity: 0; transform: translateY(-50%) scaleX(0); }
  62% { opacity: .9; transform: translateY(-50%) scaleX(1); }
  100% { opacity: 1; transform: translateY(-50%) scaleX(.06); }
}
@keyframes crt-dot-off {
  0%, 58% { opacity: 0; transform: scale(.2); }
  74% { opacity: 1; transform: scale(1.6); }
  100% { opacity: 0; transform: scale(.1); }
}
/* Coming back on: the dot blooms, the line opens, and the picture follows. */
.is-crt-on .crt-switch__line { animation: crt-line-on 420ms cubic-bezier(.2, .8, .3, 1) forwards; }
.is-crt-on .crt-switch__dot { animation: crt-dot-on 260ms ease-out forwards; }
@keyframes crt-line-on {
  0% { opacity: 1; transform: translateY(-50%) scaleX(.08); }
  45% { opacity: .95; transform: translateY(-50%) scaleX(1); }
  100% { opacity: 0; transform: translateY(-50%) scaleX(1); }
}
@keyframes crt-dot-on {
  0% { opacity: 1; transform: scale(1.4); }
  100% { opacity: 0; transform: scale(.2); }
}
/* The picture itself. */
html.is-crt-switching {
  overflow: hidden;
  background: var(--crt-surround, #000);
}
html.is-crt-switching body {
  clip-path: inset(var(--crt-inset, 0% 0%));
  transform: scale(var(--crt-scale, 1));
  transform-origin: 50% 50%;
  will-change: clip-path, transform;
}
/* The set warming up: header and tiles arrive a moment apart, the way a
   picture fills in rather than appearing all at once. */
html.is-crt-on .apps-topbar,
html.is-crt-on .hub-header { animation: crt-element-in 420ms cubic-bezier(.2, .8, .3, 1) both; }
html.is-crt-on .app-tile { animation: crt-element-in 460ms cubic-bezier(.2, .8, .3, 1) both; }
html.is-crt-on .app-tile:nth-child(2) { animation-delay: 40ms; }
html.is-crt-on .app-tile:nth-child(3) { animation-delay: 80ms; }
html.is-crt-on .app-tile:nth-child(4) { animation-delay: 120ms; }
html.is-crt-on .app-tile:nth-child(5) { animation-delay: 160ms; }
html.is-crt-on .app-tile:nth-child(6) { animation-delay: 200ms; }
html.is-crt-on .app-tile:nth-child(7) { animation-delay: 240ms; }
html.is-crt-on .app-tile:nth-child(8) { animation-delay: 280ms; }
html.is-crt-on .app-tile:nth-child(9) { animation-delay: 320ms; }
@keyframes crt-element-in {
  from { opacity: 0; transform: translateY(6px) scale(.985); filter: brightness(1.6); }
  to { opacity: 1; transform: none; filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  /* theme-flip.js swaps straight over and never builds the set. */
  .crt-switch { display: none; }
  html.is-crt-on .apps-topbar,
  html.is-crt-on .hub-header,
  html.is-crt-on .app-tile { animation: none; }
}

/* Paperclip beside the reply box: the dashboard reply can carry attachments too. */
.reply-attach { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--slate-300); border-radius: 999px; background: var(--surface); color: var(--rose-700); cursor: pointer; }
.reply-attach:hover { border-color: var(--rose-500); background: var(--rose-50); }
.reply-composer .compose-attachment-list:empty, .mail-compose-card .compose-attachment-list:empty { display: none; }
@media (pointer: coarse) { .reply-attach { width: 44px; height: 44px; } }
.compose-attach-button { display: inline-flex; align-items: center; gap: 6px; }
.compose-attach-button svg { flex: none; color: var(--rose-700); }

/* ── Mailbox on phones: list page ⇄ message page ──────────────────────────
   Replaces the old stacked layout (list squeezed into 42vh with the message
   below it). The app is pinned to the screen again; the list owns the full
   height and scrolls itself, and an opened thread slides in over it as its
   own page (mail.js toggles .is-reading and adds a history entry so the back
   gesture returns to the list). Desktop keeps the three panes. */
.mailbox-reading-bar { display: none; }
.mailbox-row-avatar { display: none; }
@media (max-width: 900px) {
  .mailbox-app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  /* one slim row: logo + title, then theme toggle and Hub */
  .mailbox-topbar { flex-wrap: nowrap; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
  .mailbox-topbar .brand-sub, .mailbox-topbar .user-chip-name { display: none; }
  .mailbox-topbar .brand { flex: 1 1 auto; min-width: 0; gap: 10px; }
  .mailbox-topbar .brand-text { display: block; flex: 1 1 auto; min-width: 0; }
  .mailbox-topbar .brand-top { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mailbox-topbar .topbar-right { flex: none; }
  .mailbox-topbar .secondary-button { padding: 7px 12px; font-size: 12px; white-space: nowrap; }
  .mailbox-body { position: relative; display: flex; flex-direction: column; overflow: hidden; }

  /* folder chips: one scrollable row */
  .mailbox-sidebar { flex: none; padding: 8px 12px; border-bottom: 1px solid var(--border); }
  .mailbox-folder { padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; }
  .mailbox-folder.active { border-color: var(--rose-300); }

  /* compose: floating action button on the list page */
  .mailbox-compose { position: fixed; z-index: 6; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: auto; min-height: 52px; margin: 0; padding: 0 22px; border-radius: 999px; font-size: 15px; font-weight: 700;
    box-shadow: 0 10px 28px color-mix(in srgb, var(--rose-700) 35%, transparent), 0 2px 6px color-mix(in srgb, var(--slate-900) 18%, transparent); }
  .mailbox-app.is-reading .mailbox-compose { opacity: 0; pointer-events: none; transform: scale(.9); }
  .mailbox-compose { transition: opacity .2s, transform .2s; }

  /* the list takes the whole remaining screen */
  .mailbox-list-col { flex: 1; min-height: 0; max-height: none; border: 0; }
  .mailbox-list-header { padding: 10px 16px; }
  .mailbox-list-header h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
  .mailbox-list { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } /* room under the FAB */

  /* rows: avatar · sender + date · subject · two-line preview */
  .mailbox-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "av who side" "av subj side" "av prev prev";
    column-gap: 12px; row-gap: 1px; align-items: start; padding: 12px 14px 12px 12px; }
  .mailbox-row-avatar { grid-area: av; display: grid; place-items: center; width: 40px; height: 40px; margin-top: 2px; border-radius: 50%;
    background: var(--rose-100); color: var(--rose-700); font-size: 16px; font-weight: 800; }
  .mailbox-row--unread .mailbox-row-avatar { background: var(--rose-600); color: #fff; }
  .mailbox-row-who { grid-area: who; font-size: 15px; }
  .mailbox-row-subject { grid-area: subj; font-size: 14px; }
  .mailbox-row--unread .mailbox-row-subject { font-weight: 700; }
  .mailbox-row-preview { grid-area: prev; font-size: 13px; line-height: 1.4; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .mailbox-row-side { grid-area: side; display: flex; align-items: center; gap: 2px; }
  .mailbox-row-date { font-size: 12px; white-space: nowrap; margin-right: 2px; }
  .mailbox-row .mail-star-button { width: 32px; height: 32px; font-size: 20px; }
  .mailbox-row .mail-ai-button { width: 32px; height: 32px; }
  .mailbox-row .mail-ai-button svg { width: 15px; height: 15px; }
  .mailbox-row--selected::after { display: none; }
  .mailbox-row--selected .mailbox-row-who, .mailbox-row--selected .mailbox-row-subject { padding-right: 0; }
  .mailbox-row--unread { box-shadow: inset 3px 0 0 var(--rose-600); }

  /* message page: slides in over the list */
  .mailbox-reading { position: absolute; inset: 0; z-index: 5; background: var(--canvas, var(--surface)); overflow-y: auto; -webkit-overflow-scrolling: touch;
    transform: translateX(100%); visibility: hidden; transition: transform .34s cubic-bezier(.2,.8,.2,1), visibility 0s linear .34s; }
  .mailbox-app.is-reading .mailbox-reading { transform: none; visibility: visible; transition: transform .34s cubic-bezier(.2,.8,.2,1), visibility 0s; }
  .mailbox-app.is-reading .mailbox-list-col { transform: translateX(-18%); }
  .mailbox-list-col { transition: transform .34s cubic-bezier(.2,.8,.2,1); }
  .mailbox-reading-bar { display: flex; position: sticky; top: 0; z-index: 3; align-items: center; min-height: 52px; padding: 4px 8px;
    background: color-mix(in srgb, var(--surface) 90%, transparent); border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); }
  .mailbox-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 14px 0 4px; border: 0; border-radius: 12px;
    background: transparent; color: var(--rose-700); font-size: 16px; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mailbox-back:active { background: var(--rose-50); }
  .mailbox-reading-inner { padding: 14px 12px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .mailbox-message-toolbar { flex-direction: column; gap: 10px; }
  .mailbox-message-subject { font-size: 20px; line-height: 1.25; }
  /* actions: one swipeable row instead of a wrapped block */
  .mailbox-message-actions { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .mailbox-message-actions::-webkit-scrollbar { display: none; }
  .mailbox-tool { flex: none; border-radius: 999px; padding-inline: 16px; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .mailbox-reading, .mailbox-list-col, .mailbox-compose { transition: none; }
}

/* ── Floating announcement banner (2026-10-30) ───────────────────────────
   A floating card under the header instead of a full-width strip: theme
   surface colours (light/dark), a bold amber→brand accent and a pulsing
   megaphone badge so it is clearly noticeable. The page still moves down by
   the measured height plus the float gaps. */
.hub-banner {
  inset: calc(var(--hub-topbar-height, 72px) + 12px) 0 auto 0;
  width: min(820px, calc(100% - 24px));
  margin: 0 auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px 14px 22px;
  border: 1px solid color-mix(in srgb, var(--warning-fg, #b45309) 35%, var(--border, #e5e7eb));
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface, #fff) 92%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  color: var(--text, #111827);
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .28), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  overflow: hidden;
  animation: hub-banner-float-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hub-banner::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, #f59e0b, var(--brand-solid, #ce0505));
}
@keyframes hub-banner-float-in {
  from { transform: translateY(-14px) scale(.98); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.hub-banner-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f59e0b, var(--brand-solid, #ce0505));
  color: #fff;
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand-solid, #ce0505) 55%, transparent);
}
.hub-banner-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hub-banner-title { font-size: 1rem; color: var(--text, #111827); }
.hub-banner-body { margin-top: 3px; font-size: 0.9rem; color: var(--text-secondary, #374151); }
.hub-banner-meta { margin-top: 8px; text-align: left; color: var(--text-muted, #6b7280); opacity: 1; }
.hub-banner-image { max-height: 170px; border-radius: 12px; }
#holiday-banner.holiday-banner {
  inset: calc(var(--hub-topbar-height, 72px) + 12px + var(--hub-announcement-height, 0px)) 0 auto 0;
  background: color-mix(in srgb, var(--surface, #fff) 92%, transparent);
  color: var(--text, #111827);
  border-color: color-mix(in srgb, #14b8a6 40%, var(--border, #e5e7eb));
}
#holiday-banner.holiday-banner::before { background: linear-gradient(180deg, #2dd4bf, #0d9488); }
.holiday-banner .hub-banner-icon { background: linear-gradient(135deg, #2dd4bf, #0d9488); color: #fff; }
:root[data-theme="dark"] .hub-banner,
:root[data-theme="dark"] #holiday-banner.holiday-banner {
  background: color-mix(in srgb, var(--surface, #18181b) 90%, transparent);
  color: var(--text, #f4f4f5);
  border-color: color-mix(in srgb, #f59e0b 45%, transparent);
  box-shadow: 0 18px 48px -10px rgba(0, 0, 0, .65), 0 0 0 1px rgba(245, 158, 11, .12);
}
:root[data-theme="dark"] #holiday-banner.holiday-banner { border-color: color-mix(in srgb, #2dd4bf 40%, transparent); }
:root[data-theme="dark"] .hub-banner-icon { background: linear-gradient(135deg, #f59e0b, var(--brand-solid, #ce0505)); }
:root[data-theme="dark"] .holiday-banner .hub-banner-icon { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
body.has-hub-banner .apps-body { padding-top: calc(44px + var(--hub-banner-height, 0px)); }
@media (prefers-reduced-motion: reduce) { .hub-banner { animation: none; } }
@media (max-width: 480px) {
  .hub-banner { inset: calc(var(--hub-topbar-height, 60px) + 8px) 0 auto 0; width: calc(100% - 16px); padding: 12px 14px 12px 18px; gap: 12px; border-radius: 16px; }
  .hub-banner-icon { width: 36px; height: 36px; border-radius: 12px; }
  body.has-hub-banner .apps-body { padding-top: calc(28px + var(--hub-banner-height, 0px)); }
}

/* ── Theme switch: dusk & dawn (replaces the CRT effect, 2026-10-30) ─────
   theme-flip.js runs a View Transition. The new page is revealed through a
   feathered mask that sweeps down (dusk, going dark) or up (dawn, going
   light), while a moon or sun crosses the sky above it with a soft wash. */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.sky-switching::view-transition-new(root) {
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 58%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 58%, transparent 100%);
  -webkit-mask-size: 100% 260%;
  mask-size: 100% 260%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: sky-dusk-fall 1.15s cubic-bezier(.65, 0, .35, 1) both;
}
.sky-dawn::view-transition-new(root) {
  -webkit-mask-image: linear-gradient(to top, #000 0%, #000 42%, transparent 58%, transparent 100%);
  mask-image: linear-gradient(to top, #000 0%, #000 42%, transparent 58%, transparent 100%);
  animation-name: sky-dawn-rise;
}
@keyframes sky-dusk-fall { from { -webkit-mask-position: 0 100%; mask-position: 0 100%; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes sky-dawn-rise { from { -webkit-mask-position: 0 0; mask-position: 0 0; } to { -webkit-mask-position: 0 100%; mask-position: 0 100%; } }

.sky-wash, .sky-orb { position: fixed; pointer-events: none; z-index: 2147483000; }
.sky-wash { inset: 0; view-transition-name: sky-wash; }
.sky-wash.is-dusk { background: linear-gradient(180deg, rgba(255, 138, 76, .32), rgba(124, 58, 237, .18) 55%, rgba(15, 23, 42, 0)); }
.sky-wash.is-dawn { background: radial-gradient(120% 80% at 18% 100%, rgba(255, 196, 92, .42), rgba(255, 236, 179, .16) 45%, rgba(255, 255, 255, 0) 70%); }
::view-transition-old(sky-wash) { display: none; }
::view-transition-new(sky-wash) { animation: sky-wash 1.15s ease-out both; }
@keyframes sky-wash { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

.sky-orb { left: 0; top: 0; width: 92px; height: 92px; border-radius: 50%; view-transition-name: sky-orb; }
.sky-orb.is-sun { background: radial-gradient(circle at 40% 38%, #fff7d1, #ffd36b 42%, #ff9d2e 70%); box-shadow: 0 0 60px 22px rgba(255, 186, 73, .55), 0 0 140px 60px rgba(255, 214, 120, .28); }
.sky-orb.is-moon { background: radial-gradient(circle at 36% 34%, #ffffff, #e7ecf5 55%, #c6cfdf 80%); box-shadow: inset -16px -10px 0 0 rgba(148, 163, 184, .55), 0 0 46px 14px rgba(203, 213, 245, .45), 0 0 120px 40px rgba(147, 165, 255, .22); }
::view-transition-old(sky-orb) { display: none; }
::view-transition-new(sky-orb) { animation: sky-orb-arc 1.15s cubic-bezier(.4, 0, .2, 1) both; }
@keyframes sky-orb-arc {
  0%   { transform: translate(8vw, 88vh) scale(.7); opacity: 0; }
  20%  { opacity: 1; }
  55%  { transform: translate(46vw, 16vh) scale(1); opacity: 1; }
  100% { transform: translate(84vw, 34vh) scale(.85); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Event-only banner: violet accent instead of the holiday teal. */
#holiday-banner.holiday-banner.is-event { border-color: color-mix(in srgb, #8b5cf6 40%, var(--border, #e5e7eb)); }
#holiday-banner.holiday-banner.is-event::before { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
:root[data-theme="dark"] #holiday-banner.holiday-banner.is-event { border-color: color-mix(in srgb, #a78bfa 40%, transparent); }

/* Birthday banner: amber/cake accent, only shown on the day itself. */
#holiday-banner.holiday-banner.is-birthday { border-color: color-mix(in srgb, #f59e0b 45%, var(--border, #e5e7eb)); }
#holiday-banner.holiday-banner.is-birthday::before { background: linear-gradient(180deg, #fbbf24, #f59e0b); }
:root[data-theme="dark"] #holiday-banner.holiday-banner.is-birthday { border-color: color-mix(in srgb, #fbbf24 45%, transparent); }

/* Apps layout switcher and embedded app dashboard */
.hub-layout-picker{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 14px;color:var(--text-secondary);font-size:12px;font-weight:600}
.hub-layout-picker>div{display:flex;gap:4px;padding:3px;border:1px solid var(--border);border-radius:11px;background:var(--surface-sunken)}
.hub-layout-picker button{display:grid;place-items:center;width:34px;height:32px;padding:0;border:0;border-radius:8px;color:var(--text-secondary);background:transparent;cursor:pointer}
.hub-layout-picker button[aria-pressed=true]{background:var(--surface);color:var(--brand);box-shadow:0 1px 5px #0002}
.hub-layout-picker svg,.hub-widget-open svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.7}
.hub-layout-picker button:focus-visible,.hub-widget-open:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
.hub-widgets[hidden]{display:none!important}.hub-widgets{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:16px;align-items:start;width:100%;margin:0 0 24px}
.hub-widget{min-width:0;overflow:hidden;border:1px solid var(--border);border-radius:20px;background:var(--surface);box-shadow:0 8px 26px color-mix(in srgb,var(--text) 7%,transparent)}
.hub-widget-header{display:flex;align-items:center;gap:12px;padding:15px 16px;border-bottom:1px solid var(--border)}
.hub-widget-icon{display:grid;place-items:center;width:38px;height:38px;flex:none;border-radius:12px;background:var(--brand-soft-bg);color:var(--brand)}
.hub-widget-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.5}.hub-widget-icon .icon-fill{fill:none}
.hub-widget-title{min-width:0;flex:1}.hub-widget-title strong{display:block;font-size:15px;color:var(--text)}.hub-widget-title span{display:block;margin-top:2px;font-size:12px;color:var(--text-secondary)}
.hub-widget-open{display:grid;place-items:center;flex:none;width:36px;height:36px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text-secondary);cursor:pointer}.hub-widget-open:hover{color:var(--brand);background:var(--surface-hover)}
.hub-widget iframe{display:block;width:100%;height:390px;border:0;background:var(--surface-sunken)}
.hub-widget-fallback{min-height:125px;display:flex;align-items:center;padding:20px;color:var(--text-secondary);font-size:13px;line-height:1.5}

/* Dashboard scorecards: bounded summaries, never internally scrolling. */
.hub-widgets{gap:18px;grid-template-columns:repeat(auto-fit,minmax(min(100%,310px),1fr));align-items:stretch}
.hub-widget{display:flex;flex-direction:column;min-width:0;border-radius:22px;background:var(--surface);box-shadow:0 8px 30px color-mix(in srgb,var(--text) 6%,transparent)}
.hub-widget-header{padding:20px 20px 14px;border:0}
.hub-widget-icon{width:42px;height:42px;border-radius:14px;background:var(--brand-soft-bg);color:var(--brand)}
.hub-widget-title strong{font-size:16px;letter-spacing:-.025em}.hub-widget-title span{font-size:12px;line-height:1.35}
.hub-widget-body{display:flex;flex:1;flex-direction:column;gap:16px;min-height:178px;padding:0 20px 20px}
.hub-widget-rows{display:flex;flex-direction:column;gap:6px;min-width:0}
.hub-widget-row{display:flex;align-items:center;gap:10px;width:100%;min-width:0;min-height:38px;padding:8px 10px;text-align:left;border:0;border-radius:11px;color:var(--text);background:var(--surface-sunken);font:inherit}
button.hub-widget-row{cursor:pointer}button.hub-widget-row:hover{background:var(--brand-soft-bg)}
.hub-widget-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--brand);box-shadow:0 0 0 4px color-mix(in srgb,var(--brand) 12%,transparent)}
.hub-widget-row-copy{display:block;min-width:0;flex:1}.hub-widget-row-copy strong,.hub-widget-row-copy small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hub-widget-row-copy strong{font-size:12px;font-weight:650}.hub-widget-row-copy small{margin-top:2px;color:var(--text-secondary);font-size:11px}
.hub-widget-action{align-self:flex-start;margin-top:auto;padding:8px 13px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);font-family:inherit;font-size:12px;font-weight:600;cursor:pointer}.hub-widget-action:hover{background:var(--brand-soft-bg);color:var(--brand)}
.hub-widget-body iframe{width:100%;height:330px;border:0;border-radius:14px;overflow:hidden;background:var(--surface-sunken)}
.hub-widget-workspace{width:min(1100px,calc(100% - 32px));height:min(850px,calc(100% - 32px));max-width:none;max-height:none;padding:0;border:1px solid var(--border);border-radius:20px;background:var(--surface);color:var(--text);box-shadow:0 24px 80px #0006;overflow:hidden}
.hub-widget-workspace[open]{display:flex;flex-direction:column}.hub-widget-workspace::backdrop{background:color-mix(in srgb,var(--text) 55%,transparent)}
.hub-widget-workspace-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 18px;border-bottom:1px solid var(--border)}.hub-widget-workspace-bar button{border:1px solid var(--border);border-radius:9px;padding:8px 14px;background:var(--surface);color:var(--text);cursor:pointer}.hub-widget-workspace iframe{flex:1;width:100%;min-height:0;border:0;background:var(--surface)}
@media(max-width:600px){.hub-widgets{gap:12px}.hub-widget-header{padding:16px 16px 12px}.hub-widget-body{padding:0 16px 16px}.hub-widget-workspace{width:calc(100% - 16px);height:calc(100% - 16px)}}
.hub-widgets{align-items:start}
.hub-widget-action{font:inherit;font-size:12px;font-weight:600}

/* Varied card sizes keep interactive views legible without card scrolling. */
.hub-widgets{grid-template-columns:repeat(12,minmax(0,1fr));align-items:start}
.hub-widget{grid-column:span 4}
.hub-widget[data-app="clockin"]{grid-column:span 3}
.hub-widget[data-app="tasks"]{grid-column:span 5}
.hub-widget[data-app="grants"]{grid-column:span 8}
.hub-widget-header{padding:16px 18px 8px;align-items:center}
.hub-widget-title{flex:0 1 auto;min-width:0;padding:7px 12px;border:1px solid var(--border);border-radius:999px;background:var(--surface-sunken);box-shadow:0 3px 10px color-mix(in srgb,var(--text) 6%,transparent)}
.hub-widget-title strong{font-size:12px;line-height:1.2;white-space:nowrap}
.hub-widget-open{margin-left:auto;border:0;background:var(--surface-sunken);border-radius:50%;width:34px;height:34px}
.hub-widget-body{padding:8px 18px 18px}
.hub-widget[data-app="clockin"] .hub-widget-body{min-height:0}
.hub-widget[data-app="tasks"] .hub-widget-body{min-height:0}
.hub-widget[data-app="tasks"] iframe{height:250px;background:var(--surface)}
.hub-widget[data-app="grants"] .hub-widget-body{padding:4px 16px 16px;min-height:0}
.hub-grants-map{position:relative;display:grid;place-items:center;min-width:0;overflow:hidden;border-radius:16px;background:var(--surface-sunken)}
.hub-grants-map svg{width:100%;height:auto;max-height:390px;padding:14px 16px 30px}
.hub-grants-map path{fill:color-mix(in srgb,var(--text) 9%,var(--surface));stroke:var(--surface);stroke-width:1.4;cursor:pointer;transition:fill .15s}
.hub-grants-map path[data-level="1"]{fill:color-mix(in srgb,var(--brand) 24%,var(--surface))}.hub-grants-map path[data-level="2"]{fill:color-mix(in srgb,var(--brand) 52%,var(--surface))}.hub-grants-map path[data-level="3"]{fill:var(--brand)}
.hub-grants-map path:hover,.hub-grants-map path:focus-visible,.hub-grants-map path.is-selected{fill:var(--brand);stroke:var(--text);stroke-width:2;outline:none}
.hub-grants-map-status{position:absolute;bottom:8px;left:12px;max-width:calc(100% - 24px);padding:5px 9px;border-radius:9px;background:var(--surface);color:var(--text-secondary);font-size:11px;line-height:1.3}
@media(max-width:1050px){.hub-widget,.hub-widget[data-app="clockin"],.hub-widget[data-app="tasks"]{grid-column:span 6}.hub-widget[data-app="grants"]{grid-column:span 12}}
@media(max-width:650px){.hub-widget,.hub-widget[data-app="clockin"],.hub-widget[data-app="tasks"],.hub-widget[data-app="grants"]{grid-column:1 / -1}.hub-grants-map svg{padding:12px 8px 32px}}
.hub-widget[data-app="warehouse"]{grid-column:span 8}
.hub-widget[data-app="warehouse"] .hub-widget-body{min-height:0}
.hub-widget[data-app="warehouse"] iframe{height:230px;background:var(--surface)}
@media(max-width:1050px){.hub-widget[data-app="warehouse"]{grid-column:span 12}}
@media(max-width:650px){.hub-widget[data-app="warehouse"]{grid-column:1 / -1}.hub-widget[data-app="warehouse"] iframe{height:390px}}
.hub-widget-profile{display:flex;align-items:center;gap:14px;padding:8px 2px}
.hub-widget-avatar{position:relative;display:grid;place-items:center;width:70px;height:70px;flex:none;overflow:hidden;border-radius:50%;background:var(--surface-sunken);border:1px solid var(--border);color:var(--text-secondary)}
.hub-widget-avatar svg{width:32px;height:32px;fill:none;stroke:currentColor;stroke-width:1.5}.hub-widget-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:var(--surface)}
.hub-widget-profile-info{display:grid;justify-items:start;gap:5px;min-width:0}.hub-widget-profile-info strong{font-size:14px}.hub-widget-profile-status{font-size:11px;color:var(--text-secondary)}
.hub-widget-photo-button{border:1px dashed var(--border);border-radius:9px;padding:7px 10px;background:var(--surface-sunken);color:var(--text);font:inherit;font-size:12px;font-weight:600;cursor:pointer}.hub-widget-photo-button:disabled{opacity:.6;cursor:wait}
.hub-map-label{font:700 12px Geist,system-ui,sans-serif;fill:var(--text);paint-order:stroke;stroke:var(--surface);stroke-width:2.5px;stroke-linejoin:round;pointer-events:none}.hub-map-leader{stroke:var(--text-secondary);stroke-width:1;pointer-events:none}

/* Compact, content-sized widget tiles with floating controls. */
@media(min-width:651px){.hub-widgets.masonry-ready{grid-auto-rows:8px;grid-auto-flow:row dense;align-items:start}}
@media(max-width:650px){.hub-widgets.masonry-ready .hub-widget{grid-row-end:auto!important}}
.hub-widget{border-radius:22px;background:linear-gradient(155deg,var(--surface),color-mix(in srgb,var(--surface) 94%,var(--brand-soft-bg)));box-shadow:0 7px 24px color-mix(in srgb,var(--text) 7%,transparent)}
.hub-widget-header{padding:14px 14px 4px}
.hub-widget-title{padding:7px 11px;background:color-mix(in srgb,var(--surface) 84%,var(--brand-soft-bg));box-shadow:0 4px 12px color-mix(in srgb,var(--text) 8%,transparent)}
.hub-widget-open{width:34px;height:34px;background:var(--surface-sunken);box-shadow:0 3px 9px color-mix(in srgb,var(--text) 7%,transparent)}
.hub-widget-body{min-height:0;padding:7px 14px 14px;gap:11px}
.hub-widget-rows{gap:6px}
.hub-widget-row{min-height:46px;padding:8px 10px;background:color-mix(in srgb,var(--surface-sunken) 90%,var(--brand-soft-bg));border:1px solid color-mix(in srgb,var(--border) 65%,transparent)}
.hub-widget-dot{display:grid;place-items:center;width:28px;height:28px;border-radius:9px;background:var(--brand-soft-bg);color:var(--brand);box-shadow:none}
.hub-widget-dot svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.hub-widget-dot svg .icon-fill{fill:none}
.hub-widget-action{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:34px;margin-top:0;padding:7px 12px;border:1px solid color-mix(in srgb,var(--brand) 20%,var(--border));border-radius:999px;background:var(--brand-soft-bg);color:var(--brand);font-size:11px;font-weight:700;box-shadow:0 3px 10px color-mix(in srgb,var(--brand) 8%,transparent)}
.hub-widget-action svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.hub-widget-action:hover{background:var(--brand);color:var(--text-on-brand)}
.hub-widget-action:focus-visible,.hub-widget-row:focus-visible,.hub-widget-photo-button:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
.hub-widget[data-app="grants"] .hub-widget-body{padding:5px 14px 14px}
.hub-widget[data-app="clockin"] iframe,.hub-widget[data-app="tasks"] iframe,.hub-widget[data-app="warehouse"] iframe{border:1px solid var(--border)}

/* Keep cards on a consistent column rhythm across the workspace. */
.hub-widgets{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.hub-widget,.hub-widget[data-app="clockin"],.hub-widget[data-app="tasks"]{grid-column:span 1}
.hub-widget[data-app="grants"],.hub-widget[data-app="warehouse"]{grid-column:span 2}
.hub-widget{border-radius:18px;box-shadow:0 4px 18px color-mix(in srgb,var(--text) 6%,transparent)}
.hub-widget-header{padding:16px 16px 8px}
.hub-widget-title{padding:7px 12px;box-shadow:none}
.hub-widget-title strong{font-size:13px;letter-spacing:0}
.hub-widget-open{width:36px;height:36px;box-shadow:none}
.hub-widget-body{padding:8px 16px 16px;gap:12px}
.hub-widget-row{min-height:50px;padding:9px 10px}
.hub-widget-row-copy strong{font-size:13px}.hub-widget-row-copy small{font-size:12px}
.hub-widget-action{min-height:36px;padding:8px 13px;font-size:12px;box-shadow:none}
@media(max-width:1050px){.hub-widgets{grid-template-columns:repeat(2,minmax(0,1fr))}.hub-widget,.hub-widget[data-app="clockin"],.hub-widget[data-app="tasks"]{grid-column:span 1}.hub-widget[data-app="grants"],.hub-widget[data-app="warehouse"]{grid-column:span 2}}
@media(max-width:650px){.hub-widgets{grid-template-columns:minmax(0,1fr)}.hub-widget,.hub-widget[data-app="clockin"],.hub-widget[data-app="tasks"],.hub-widget[data-app="grants"],.hub-widget[data-app="warehouse"]{grid-column:1/-1}}

/* Floating controls surround a separate data-only scorecard. */
.hub-widget{overflow:visible;border:0;border-radius:0;background:transparent;box-shadow:none}
.hub-widget-header{padding:0 2px 8px;gap:8px}
.hub-widget-title{background:var(--surface);border:1px solid var(--border);box-shadow:0 3px 12px color-mix(in srgb,var(--text) 9%,transparent)}
.hub-widget-open{background:var(--surface);border:1px solid var(--border);box-shadow:0 3px 12px color-mix(in srgb,var(--text) 9%,transparent)}
.hub-widget-body,.hub-widget[data-app="grants"] .hub-widget-body{padding:0;gap:8px;min-height:0}
.hub-widget-data{min-width:0;overflow:hidden;border:1px solid var(--border);border-radius:18px;background:var(--surface);box-shadow:0 5px 20px color-mix(in srgb,var(--text) 7%,transparent)}
.hub-widget-data>.hub-widget-rows{padding:10px}
.hub-widget-data>.hub-widget-profile{padding:16px}
.hub-widget-data>.hub-grants-map{border-radius:17px}
.hub-widget-data>iframe,.hub-widget[data-app="clockin"] .hub-widget-data>iframe,.hub-widget[data-app="tasks"] .hub-widget-data>iframe,.hub-widget[data-app="warehouse"] .hub-widget-data>iframe{display:block;border:0;border-radius:0}
.hub-widget-action{align-self:flex-start;margin:0 2px;background:var(--surface);border-color:var(--border);box-shadow:0 3px 12px color-mix(in srgb,var(--text) 9%,transparent)}

/* Hub workspace: app activity on the left, people and conversations on the right. */
.hub-widgets,.hub-widgets.masonry-ready{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,3fr);grid-auto-rows:auto;gap:20px;align-items:start}
.hub-widgets.no-side{grid-template-columns:minmax(0,1fr)}
.hub-widgets-main,.hub-widgets-side{display:flex;flex-direction:column;gap:20px;min-width:0}
.hub-widgets-primary,.hub-widgets-extra{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start;min-width:0}
.hub-widgets-primary>.hub-widget:only-child,.hub-widgets-extra>.hub-widget:only-child{grid-column:1/-1!important}
.hub-widgets .hub-widget{grid-column:auto!important;grid-row:auto!important;min-width:0}
@media(max-width:800px){.hub-widgets,.hub-widgets.masonry-ready{grid-template-columns:minmax(0,1fr)}.hub-widgets-main,.hub-widgets-side{gap:16px}.hub-widgets-primary,.hub-widgets-extra{gap:16px}}
@media(max-width:520px){.hub-widgets-primary,.hub-widgets-extra{grid-template-columns:minmax(0,1fr)}}

/* A light outline groups each widget's floating controls and data card. */
.hub-widgets .hub-widget{box-sizing:border-box;padding:10px;border:1px solid color-mix(in srgb,var(--text) 18%,transparent);border-radius:20px;background:transparent;box-shadow:none}
@media(max-width:520px){.hub-widgets .hub-widget{padding:8px;border-radius:18px}}

/* Floating glass tray for the Hub's panel shortcuts. */
#side-dock:not(.side-dock-empty){gap:5px;padding:5px;border:1px solid color-mix(in srgb,var(--text) 12%,transparent);border-radius:18px;background:linear-gradient(145deg,color-mix(in srgb,var(--surface) 78%,transparent),color-mix(in srgb,var(--surface-sunken) 54%,transparent));box-shadow:inset 0 1px 0 color-mix(in srgb,var(--surface) 90%,transparent),0 8px 24px color-mix(in srgb,var(--text) 12%,transparent),0 2px 6px color-mix(in srgb,var(--text) 6%,transparent);-webkit-backdrop-filter:blur(18px) saturate(1.4);backdrop-filter:blur(18px) saturate(1.4)}
#side-dock .side-dock-btn,#side-dock #floating-week-btn{width:38px;height:38px;border:1px solid color-mix(in srgb,var(--text) 10%,transparent);border-radius:12px;color:var(--text);background:linear-gradient(155deg,color-mix(in srgb,var(--surface) 96%,transparent),color-mix(in srgb,var(--surface-sunken) 74%,transparent));box-shadow:inset 0 1px 0 color-mix(in srgb,var(--surface) 90%,transparent),0 3px 9px color-mix(in srgb,var(--text) 9%,transparent);transition:transform .16s ease,background .16s ease,border-color .16s ease,box-shadow .16s ease}
#side-dock .side-dock-btn:hover,#side-dock #floating-week-btn:hover{transform:translateY(-2px);color:var(--brand);border-color:color-mix(in srgb,var(--brand) 35%,var(--border));background:linear-gradient(155deg,var(--surface),var(--brand-soft-bg));box-shadow:inset 0 1px 0 var(--surface),0 6px 14px color-mix(in srgb,var(--brand) 16%,transparent)}
#side-dock .side-dock-btn[aria-expanded="true"],#side-dock #floating-week-btn[aria-expanded="true"]{color:var(--brand);border-color:color-mix(in srgb,var(--brand) 45%,var(--border));background:var(--brand-soft-bg);box-shadow:inset 0 1px 0 color-mix(in srgb,var(--surface) 80%,transparent),0 0 0 2px color-mix(in srgb,var(--brand) 12%,transparent)}
#side-dock .side-dock-btn:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
@media(max-width:600px){#side-dock:not(.side-dock-empty){gap:3px;padding:4px;border-radius:16px}#side-dock .side-dock-btn,#side-dock #floating-week-btn{width:34px;height:34px;border-radius:10px}}
@media(max-width:360px){.apps-section-heading-row{flex-wrap:wrap}#side-dock{margin-left:auto}}
@media(prefers-reduced-motion:reduce){#side-dock .side-dock-btn,#side-dock #floating-week-btn{transition:none}}

/* =========================================================================
   Widgets v2: raised, glossy cards. One card per widget (header + data),
   per-app accent, top sheen, cursor glare, staggered entrance.
   Supersedes the stacked widget rules above.
   ========================================================================= */
.hub-widget{--acc:var(--brand);--acc2:var(--rose-400)}
.hub-widget[data-app="clockin"]{--acc:#ef2a20;--acc2:#ff8a6b}
.hub-widget[data-app="tasks"]{--acc:#7c3aed;--acc2:#c084fc}
.hub-widget[data-app="warehouse"]{--acc:#d97706;--acc2:#fbbf24}
.hub-widget[data-app="grants"]{--acc:#059669;--acc2:#34d399}
.hub-widget[data-app="news_events"]{--acc:#2563eb;--acc2:#60a5fa}
.hub-widget[data-app="users"]{--acc:#0891b2;--acc2:#22d3ee}
.hub-widget[data-app="communications"]{--acc:#4f46e5;--acc2:#818cf8}
.hub-widget[data-app="mailbox"]{--acc:#0284c7;--acc2:#38bdf8}
.hub-widget[data-app="files"]{--acc:#475569;--acc2:#94a3b8}
.hub-widgets{--w-surface:linear-gradient(160deg,color-mix(in srgb,var(--surface) 100%,#fff 0%),color-mix(in srgb,var(--surface) 92%,var(--surface-sunken)));--w-edge:color-mix(in srgb,var(--text) 9%,transparent);--w-shadow:0 1px 1px color-mix(in srgb,var(--text) 4%,transparent),0 10px 24px -10px color-mix(in srgb,var(--text) 22%,transparent),0 28px 60px -32px color-mix(in srgb,var(--text) 30%,transparent);--w-hi:rgba(255,255,255,.9);--w-well:color-mix(in srgb,var(--surface-sunken) 80%,var(--surface))}
:root[data-theme="dark"] .hub-widgets{--w-surface:linear-gradient(160deg,#1b1c22,#121318);--w-edge:rgba(255,255,255,.08);--w-shadow:0 1px 0 rgba(255,255,255,.04) inset,0 18px 40px -18px rgba(0,0,0,.85),0 40px 80px -40px rgba(0,0,0,.9);--w-hi:rgba(255,255,255,.07);--w-well:rgba(255,255,255,.035)}
.hub-widgets .hub-widget{position:relative;isolation:isolate;display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--w-edge);border-radius:24px;background:var(--w-surface);box-shadow:inset 0 1px 0 var(--w-hi),var(--w-shadow);overflow:hidden;animation:hw-in .6s cubic-bezier(.22,1,.36,1) both;animation-delay:calc(var(--i,0) * 55ms);transition:transform .35s cubic-bezier(.22,1,.36,1),box-shadow .35s,border-color .35s}
/* gloss: soft top highlight + accent aura + cursor glare */
.hub-widgets .hub-widget::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(120% 60% at 50% -10%,color-mix(in srgb,#fff 55%,transparent),transparent 55%),radial-gradient(60% 50% at 100% 0%,color-mix(in srgb,var(--acc) 14%,transparent),transparent 70%);opacity:.9}
:root[data-theme="dark"] .hub-widgets .hub-widget::before{background:radial-gradient(120% 60% at 50% -10%,rgba(255,255,255,.07),transparent 55%),radial-gradient(60% 50% at 100% 0%,color-mix(in srgb,var(--acc) 22%,transparent),transparent 70%)}
.hub-widgets .hub-widget::after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(420px circle at var(--gx,50%) var(--gy,-40%),color-mix(in srgb,var(--acc) 10%,transparent),transparent 45%);opacity:0;transition:opacity .3s}
@media(hover:hover){.hub-widgets .hub-widget:hover{transform:translateY(-3px);border-color:color-mix(in srgb,var(--acc) 30%,var(--w-edge));box-shadow:inset 0 1px 0 var(--w-hi),0 2px 2px color-mix(in srgb,var(--text) 5%,transparent),0 18px 34px -14px color-mix(in srgb,var(--acc) 30%,transparent),0 36px 70px -36px color-mix(in srgb,var(--text) 40%,transparent)}.hub-widgets .hub-widget:hover::after{opacity:1}}
@keyframes hw-in{from{opacity:0;transform:translateY(14px) scale(.985)}}
/* header */
.hub-widgets .hub-widget-header{padding:0;gap:10px}
.hub-widgets .hub-widget-title{display:flex;align-items:center;gap:10px;padding:0;border:0;background:none;box-shadow:none}
.hub-widgets .hub-widget-title strong{font-size:14px;font-weight:650;letter-spacing:-.015em}
.hub-widget-badge{display:grid;place-items:center;flex:none;width:34px;height:34px;border-radius:11px;color:#fff;background:linear-gradient(145deg,var(--acc2),var(--acc));box-shadow:inset 0 1px 0 rgba(255,255,255,.45),inset 0 -6px 12px rgba(0,0,0,.12),0 6px 14px -6px color-mix(in srgb,var(--acc) 70%,transparent)}
.hub-widget-badge svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.hub-widget-badge svg .icon-fill{fill:none}
.hub-widgets .hub-widget-open{width:32px;height:32px;border:1px solid var(--w-edge);border-radius:50%;background:color-mix(in srgb,var(--surface) 70%,transparent);color:var(--text-secondary);box-shadow:inset 0 1px 0 var(--w-hi);transition:transform .25s cubic-bezier(.34,1.4,.5,1),color .2s,background .2s,border-color .2s}
.hub-widgets .hub-widget-open:hover{transform:rotate(-12deg) scale(1.08);color:#fff;background:var(--acc);border-color:transparent}
.hub-widgets .hub-widget-open svg{width:15px;height:15px}
/* data well */
.hub-widgets .hub-widget-body{padding:0;gap:10px}
.hub-widgets .hub-widget-data{border:1px solid var(--w-edge);border-radius:18px;background:var(--w-well);box-shadow:inset 0 1px 2px color-mix(in srgb,var(--text) 6%,transparent)}
.hub-widgets .hub-widget-data>.hub-widget-rows{padding:6px;gap:4px}
/* rows */
.hub-widgets .hub-widget-row{min-height:52px;padding:8px 10px;gap:12px;border:1px solid transparent;border-radius:14px;background:transparent;transition:background .2s,transform .25s cubic-bezier(.22,1,.36,1),border-color .2s}
.hub-widgets button.hub-widget-row:hover{background:var(--surface);border-color:var(--w-edge);transform:translateX(3px);box-shadow:0 6px 16px -10px color-mix(in srgb,var(--text) 35%,transparent)}
.hub-widgets .hub-widget-dot{width:34px;height:34px;border-radius:11px;color:var(--acc);background:color-mix(in srgb,var(--acc) 12%,transparent)}
.hub-widgets .hub-widget-dot.is-avatar{--h:220;border-radius:50%;color:#fff;font-size:12px;font-weight:700;letter-spacing:.02em;background:linear-gradient(145deg,hsl(var(--h) 70% 62%),hsl(calc(var(--h) + 30) 65% 45%));box-shadow:inset 0 1px 0 rgba(255,255,255,.35)}
.hub-widgets .hub-widget-row-copy strong{font-size:13px;font-weight:600}.hub-widgets .hub-widget-row-copy small{margin-top:2px;font-size:11.5px;color:var(--text-secondary)}
.hub-widgets .hub-widget-row.is-unread .hub-widget-row-copy strong{font-weight:700}
.hub-widget-count{flex:none;min-width:22px;height:22px;padding:0 7px;border-radius:999px;display:grid;place-items:center;font-size:11px;font-weight:700;color:#fff;background:linear-gradient(145deg,var(--acc2),var(--acc));box-shadow:0 4px 10px -4px var(--acc);animation:hw-pop .5s cubic-bezier(.34,1.6,.5,1) both}
@keyframes hw-pop{from{transform:scale(.4);opacity:0}}
/* embedded mini-apps sit in the well */
.hub-widgets .hub-widget-data>iframe{background:transparent}
/* profile */
.hub-widgets .hub-widget-avatar{width:76px;height:76px;border:0;padding:3px;background:conic-gradient(from 210deg,var(--acc),var(--acc2),var(--acc));box-shadow:0 10px 22px -10px var(--acc)}
.hub-widgets .hub-widget-avatar::after{content:"";position:absolute;inset:3px;border-radius:50%;background:var(--surface);z-index:0}
.hub-widgets .hub-widget-avatar svg,.hub-widgets .hub-widget-avatar img{position:relative;z-index:1}.hub-widgets .hub-widget-avatar img{inset:3px;width:calc(100% - 6px);height:calc(100% - 6px);border-radius:50%}
.hub-widgets .hub-widget-profile-info strong{font-size:16px;letter-spacing:-.02em}
.hub-widgets .hub-widget-photo-button{border:1px solid var(--w-edge);border-radius:999px;background:var(--surface);box-shadow:inset 0 1px 0 var(--w-hi)}
/* footer action */
.hub-widgets .hub-widget-action{align-self:flex-start;margin:0;min-height:34px;padding:7px 14px;border:1px solid color-mix(in srgb,var(--acc) 25%,var(--w-edge));border-radius:999px;background:color-mix(in srgb,var(--acc) 8%,var(--surface));color:var(--text);box-shadow:inset 0 1px 0 var(--w-hi);transition:background .2s,color .2s,transform .2s}
.hub-widgets .hub-widget-action:hover{background:linear-gradient(145deg,var(--acc2),var(--acc));color:#fff;border-color:transparent}
.hub-widgets .hub-widget-action:hover svg{transform:translateX(3px)}.hub-widgets .hub-widget-action svg{transition:transform .2s}
.hub-widgets .hub-grants-map path[data-level="1"]{fill:color-mix(in srgb,var(--acc) 26%,var(--surface))}.hub-widgets .hub-grants-map path[data-level="2"]{fill:color-mix(in srgb,var(--acc) 55%,var(--surface))}.hub-widgets .hub-grants-map path[data-level="3"],.hub-widgets .hub-grants-map path:hover,.hub-widgets .hub-grants-map path.is-selected{fill:var(--acc)}
.hub-widgets .hub-grants-map{background:transparent}
/* layout: desktop 7/3, tablet main full + side as 2-col, phone single column */
.hub-widgets,.hub-widgets.masonry-ready{gap:18px}
.hub-widgets-main,.hub-widgets-side,.hub-widgets-primary,.hub-widgets-extra{gap:18px}
@media(max-width:1100px){.hub-widgets,.hub-widgets.masonry-ready{grid-template-columns:minmax(0,1fr)}.hub-widgets-side{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}}
@media(max-width:640px){.hub-widgets-primary,.hub-widgets-extra,.hub-widgets-side{grid-template-columns:minmax(0,1fr)}.hub-widgets,.hub-widgets-main,.hub-widgets-side,.hub-widgets-primary,.hub-widgets-extra{gap:14px}.hub-widgets .hub-widget{padding:12px;border-radius:22px}}
@media(prefers-reduced-motion:reduce){.hub-widgets .hub-widget,.hub-widget-count{animation:none}.hub-widgets .hub-widget,.hub-widgets .hub-widget-row,.hub-widgets .hub-widget-open{transition:none}}

/* ---------- Widgets v2: ClockIn + Tasks share one height ---------- */
.hub-widgets-primary{align-items:stretch}
.hub-widgets-primary>.hub-widget{height:100%}
.hub-widgets-primary .hub-widget-body{flex:1;display:flex;flex-direction:column}
.hub-widgets-primary .hub-widget-data{flex:1;display:flex}
.hub-widgets .hub-widget[data-app="clockin"] .hub-widget-data>iframe,.hub-widgets .hub-widget[data-app="tasks"] .hub-widget-data>iframe{flex:1;height:auto;min-height:360px}
@media(max-width:640px){.hub-widgets .hub-widget[data-app="clockin"] .hub-widget-data>iframe,.hub-widgets .hub-widget[data-app="tasks"] .hub-widget-data>iframe{min-height:340px}}

/* ---------- Space: live unread total on the header ---------- */
.hub-widget-unread{display:grid;place-items:center;min-width:22px;height:22px;margin-left:2px;padding:0 7px;border-radius:999px;font-size:11px;font-weight:700;color:#fff;background:linear-gradient(145deg,#ff6b5e,#ef2a20);box-shadow:0 0 0 3px color-mix(in srgb,#ef2a20 18%,transparent);animation:hw-pop .45s cubic-bezier(.34,1.6,.5,1) both,hw-ping 2s ease-out .5s infinite}
.hub-widget-unread[hidden]{display:none}
@keyframes hw-ping{0%{box-shadow:0 0 0 0 color-mix(in srgb,#ef2a20 45%,transparent)}70%,100%{box-shadow:0 0 0 9px transparent}}

/* ---------- Mailbox: blinking line on new/unread mail ---------- */
.hub-widgets .hub-widget-row.is-new,.hub-page-row.is-new{position:relative}
.hub-widgets .hub-widget-row.is-new::before,.hub-page-row.is-new::before{content:"";position:absolute;left:2px;top:22%;bottom:22%;width:3px;border-radius:3px;background:var(--acc,#0284c7);box-shadow:0 0 10px var(--acc,#0284c7);animation:hw-blink 1.2s ease-in-out infinite}
.hub-widgets .hub-widget-row.is-new .hub-widget-row-copy strong,.hub-page-row.is-new .hub-widget-row-copy strong{font-weight:700}
@keyframes hw-blink{50%{opacity:.15}}

/* ---------- Grants explorer: map + side list ---------- */
.hub-grants{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(220px,1fr);gap:12px;padding:10px;min-height:300px}
.hub-grants .hub-grants-map{border-radius:14px}
.hub-grants .hub-grants-map svg{padding:10px 8px 30px;max-height:360px}
.hub-grants-side{display:flex;flex-direction:column;gap:8px;min-width:0;max-height:360px;overflow:auto;padding:4px 4px 4px 0;scrollbar-width:thin}
.hub-grants.is-page{grid-template-columns:minmax(0,1.5fr) minmax(300px,1fr);height:100%;min-height:0;padding:0}
.hub-grants.is-page .hub-grants-map svg{max-height:none}
.hub-grants.is-page .hub-grants-side{max-height:none;height:100%}
.hub-grants-head{display:flex;align-items:flex-start;gap:8px;padding:2px 2px 4px}.hub-grants-head strong{display:block;font-size:14px;line-height:1.3}.hub-grants-head small{display:block;margin-top:2px;font-size:11.5px;color:var(--text-secondary)}
.hub-grants-back{display:grid;place-items:center;flex:none;width:28px;height:28px;border:1px solid var(--w-edge,var(--border));border-radius:50%;background:var(--surface);color:var(--text);cursor:pointer}.hub-grants-back svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}
.hub-grants-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.hub-grants-stat{padding:10px 12px;border-radius:14px;border:1px solid var(--w-edge,var(--border));background:linear-gradient(160deg,var(--surface),color-mix(in srgb,var(--surface) 90%,var(--surface-sunken)));box-shadow:inset 0 1px 0 var(--w-hi,#fff)}
.hub-grants-stat b{display:block;font-size:22px;font-weight:700;letter-spacing:-.03em;color:var(--acc,#059669)}.hub-grants-stat span{font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-secondary)}
.hub-grants-tag{align-self:flex-start;padding:3px 10px;border-radius:999px;font-size:11px;font-weight:700;background:color-mix(in srgb,var(--text) 8%,transparent)}.hub-grants-tag.is-open{color:#047857;background:rgba(16,185,129,.14)}.hub-grants-tag.is-closed{color:#b91c1c;background:rgba(239,68,68,.12)}
.hub-grants-facts{display:grid;gap:8px;margin:0}.hub-grants-facts dt{font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-secondary)}.hub-grants-facts dd{margin:2px 0 0;font-size:13px;line-height:1.45}
.hub-grants-orgs{display:flex;flex-wrap:wrap;gap:6px;padding:10px;border-radius:14px;background:color-mix(in srgb,var(--text) 4%,transparent)}.hub-grants-orgs h4{flex-basis:100%;margin:0 0 2px;font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-secondary)}.hub-grants-orgs small{flex-basis:100%;font-size:12px;color:var(--text-secondary)}
.hub-grants-org{padding:5px 10px;border-radius:999px;border:1px solid var(--w-edge,var(--border));background:var(--surface);font-size:12px;font-weight:600}
[data-tone="open"] .hub-widget-row-copy strong::before{content:"";display:inline-block;width:7px;height:7px;margin-right:6px;border-radius:50%;background:#10b981;vertical-align:middle}
@media(max-width:760px){.hub-grants,.hub-grants.is-page{grid-template-columns:minmax(0,1fr)}.hub-grants-side,.hub-grants.is-page .hub-grants-side{max-height:none;height:auto}}

/* ---------- "Use in Hub" page sheet ---------- */
.hub-page{width:min(1180px,calc(100% - 32px));height:min(860px,calc(100% - 32px));max-width:none;max-height:none;padding:0;border:1px solid color-mix(in srgb,var(--text) 10%,transparent);border-radius:28px;color:var(--text);background:linear-gradient(170deg,var(--surface),color-mix(in srgb,var(--surface) 94%,var(--surface-sunken)));box-shadow:inset 0 1px 0 rgba(255,255,255,.7),0 40px 100px -30px rgba(0,0,0,.55);overflow:hidden}
.hub-page[open]{display:flex;flex-direction:column;animation:hp-in .45s cubic-bezier(.22,1,.36,1)}
.hub-page::backdrop{background:color-mix(in srgb,#05060a 45%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
@keyframes hp-in{from{opacity:0;transform:translateY(18px) scale(.98)}}
.hub-page{--acc:var(--brand);--acc2:var(--rose-400)}.hub-page[data-app="warehouse"]{--acc:#d97706;--acc2:#fbbf24}.hub-page[data-app="grants"]{--acc:#059669;--acc2:#34d399}.hub-page[data-app="news_events"]{--acc:#2563eb;--acc2:#60a5fa}.hub-page[data-app="communications"]{--acc:#4f46e5;--acc2:#818cf8}.hub-page[data-app="mailbox"]{--acc:#0284c7;--acc2:#38bdf8}.hub-page[data-app="files"]{--acc:#475569;--acc2:#94a3b8}
.hub-page-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid color-mix(in srgb,var(--text) 8%,transparent)}
.hub-page-head h2{margin:0;font-size:18px;letter-spacing:-.02em}
.hub-page-actions{display:flex;gap:8px;margin-left:auto}
.hub-page-btn{display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:0 14px;border:1px solid color-mix(in srgb,var(--text) 12%,transparent);border-radius:999px;background:var(--surface);color:var(--text);font-family:inherit;font-size:12.5px;font-weight:600;text-decoration:none;cursor:pointer;box-shadow:inset 0 1px 0 rgba(255,255,255,.6);transition:background .2s,color .2s,transform .2s}
.hub-page-btn:hover{background:linear-gradient(145deg,var(--acc2),var(--acc));color:#fff;border-color:transparent}
.hub-page-close{width:36px;padding:0;justify-content:center}.hub-page-close svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}
.hub-page-body{flex:1;min-height:0;overflow:auto;padding:18px 20px}
.hub-page[data-app="grants"] .hub-page-body,.hub-page[data-app="warehouse"] .hub-page-body{padding:14px}
.hub-page-frame{display:block;width:100%;height:100%;min-height:520px;border:0;border-radius:18px;background:transparent}
.hub-page-list{display:grid;gap:6px}
.hub-page-row{display:flex;align-items:center;gap:12px;width:100%;min-height:56px;padding:10px 14px;border:1px solid color-mix(in srgb,var(--text) 7%,transparent);border-radius:16px;background:var(--surface);color:var(--text);text-align:left;font:inherit;animation:hw-in .4s cubic-bezier(.22,1,.36,1) both;animation-delay:calc(var(--i,0) * 30ms);transition:transform .25s cubic-bezier(.22,1,.36,1),box-shadow .25s,border-color .2s}
button.hub-page-row{cursor:pointer}button.hub-page-row:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--acc) 35%,transparent);box-shadow:0 10px 22px -14px color-mix(in srgb,var(--acc) 60%,transparent)}
.hub-page-row .hub-widget-dot.is-avatar{--h:220;display:grid;place-items:center;flex:none;width:36px;height:36px;border-radius:50%;color:#fff;font-size:12px;font-weight:700;background:linear-gradient(145deg,hsl(var(--h) 70% 62%),hsl(calc(var(--h) + 30) 65% 45%))}
.hub-page-row .hub-widget-row-copy strong{font-size:13.5px}.hub-page-row .hub-widget-row-copy small{display:block;margin-top:2px;font-size:12px;color:var(--text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hub-page-meta{flex:none;margin-left:auto;padding:3px 9px;border-radius:999px;font-size:11.5px;font-weight:700;color:var(--acc);background:color-mix(in srgb,var(--acc) 12%,transparent)}
.hub-page-empty{margin:0;padding:24px;text-align:center;color:var(--text-secondary)}
:root[data-theme="dark"] .hub-page{background:linear-gradient(170deg,#191a20,#101116);box-shadow:inset 0 1px 0 rgba(255,255,255,.05),0 40px 100px -30px #000}
:root[data-theme="dark"] .hub-page-row,:root[data-theme="dark"] .hub-page-btn{background:rgba(255,255,255,.04)}
@media(max-width:640px){.hub-page{width:100%;height:100%;max-height:100dvh;border-radius:0;border:0}.hub-page-head{padding:12px 14px}.hub-page-body{padding:12px}.hub-page-btn{padding:0 11px}}
@media(prefers-reduced-motion:reduce){.hub-page[open],.hub-page-row,.hub-widget-unread,.hub-widgets .hub-widget-row.is-new::before,.hub-page-row.is-new::before{animation:none}}
.hub-page .hub-grants-map path[data-level="1"]{fill:color-mix(in srgb,var(--acc) 26%,var(--surface))}.hub-page .hub-grants-map path[data-level="2"]{fill:color-mix(in srgb,var(--acc) 55%,var(--surface))}.hub-page .hub-grants-map path[data-level="3"],.hub-page .hub-grants-map path:hover,.hub-page .hub-grants-map path.is-selected{fill:var(--acc)}
/* Profile photo: centred inside the accent ring (img must stay absolutely positioned). */
.hub-widgets .hub-widget-avatar{position:relative;overflow:hidden}
.hub-widgets .hub-widget-avatar img{position:absolute;inset:3px;z-index:1;width:auto;height:auto;border-radius:50%;object-fit:cover}
.hub-widgets .hub-widget-avatar svg{position:relative;z-index:1;color:var(--acc)}
.hub-widgets .hub-widget-profile{align-items:center;gap:16px}
.hub-widgets .hub-widget-profile-info{align-content:center}
/* Older ".hub-widget-title span{display:block}" must not reach the badge or the unread pill. */
.hub-widgets .hub-widget-title .hub-widget-badge{display:grid;place-items:center;margin:0;font-size:0}
.hub-widgets .hub-widget-title .hub-widget-unread{display:grid;margin:0 0 0 2px;font-size:11px;color:#fff}
.hub-widgets .hub-widget-title .hub-widget-unread[hidden]{display:none}
.hub-widget-badge svg{display:block;margin:auto}
.hub-widget-badge svg,.hub-widgets .hub-widget-dot svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.hub-widget-badge svg{width:19px;height:19px}
.hub-widgets .hub-widget-dot svg{width:17px;height:17px}
.hub-widgets .hub-widget-title .hub-widget-badge{color:#fff}
/* Grants widget: full map until a state is picked, then the list slides in. */
.hub-grants:not(.is-page){grid-template-columns:minmax(0,1fr) minmax(0,0fr);gap:0;transition:grid-template-columns .55s cubic-bezier(.22,1,.36,1),gap .55s cubic-bezier(.22,1,.36,1)}
.hub-grants:not(.is-page) .hub-grants-side{opacity:0;transform:translateX(24px);visibility:hidden;transition:opacity .3s ease,transform .5s cubic-bezier(.22,1,.36,1),visibility 0s linear .5s}
.hub-grants.is-split:not(.is-page){grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:12px}
.hub-grants.is-split:not(.is-page) .hub-grants-side{opacity:1;transform:none;visibility:visible;transition:opacity .35s ease .15s,transform .5s cubic-bezier(.22,1,.36,1) .1s,visibility 0s}
.hub-grants:not(.is-page) .hub-grants-map svg{transition:max-height .55s cubic-bezier(.22,1,.36,1)}
.hub-grants:not(.is-page):not(.is-split) .hub-grants-map svg{max-height:430px}
@media(max-width:760px){.hub-grants.is-split:not(.is-page){grid-template-columns:minmax(0,1fr);gap:12px}.hub-grants:not(.is-page):not(.is-split) .hub-grants-side{display:none}}
@media(prefers-reduced-motion:reduce){.hub-grants,.hub-grants .hub-grants-side,.hub-grants .hub-grants-map svg{transition:none!important}}
.hub-grants-side .hub-page-row .hub-widget-row-copy strong{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;white-space:normal;overflow:hidden;line-height:1.3}
.hub-grants-side .hub-page-row .hub-widget-row-copy small{white-space:nowrap}
.hub-grants-side .hub-page-row{min-height:0;padding:10px 12px;align-items:flex-start}
.hub-widgets .hub-widget-avatar>img{position:absolute!important;top:3px!important;left:3px!important;right:auto!important;bottom:auto!important;width:calc(100% - 6px)!important;height:calc(100% - 6px)!important;border-radius:50%;object-fit:cover}

/* ===== Loader + in-Hub View popups (ClockIn, Tasks, Profile) ===== */
.hub-loader{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;min-height:96px;padding:16px;color:var(--text-secondary);font-size:12px;font-weight:600;letter-spacing:.02em}
.hub-loader-ring{position:relative;width:28px;height:28px;border-radius:50%;background:conic-gradient(from 0deg,transparent 0 25%,var(--acc,var(--brand)) 70%,var(--acc2,var(--brand)) 100%);-webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 3.5px),#000 calc(100% - 3px));mask:radial-gradient(farthest-side,transparent calc(100% - 3.5px),#000 calc(100% - 3px));animation:hl-spin .9s linear infinite}
.hub-loader-text{animation:hl-fade 1.6s ease-in-out infinite}
.hub-loader.is-overlay{position:absolute;inset:0;z-index:5;min-height:0;border-radius:inherit;background:color-mix(in srgb,var(--surface) 88%,transparent);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px)}
.hub-widget-data,.hub-page-body{position:relative}
@keyframes hl-spin{to{transform:rotate(1turn)}}@keyframes hl-fade{50%{opacity:.45}}
.hub-page[data-app="clockin"]{--acc:#ef2a20;--acc2:#ff8a6b}.hub-page[data-app="tasks"]{--acc:#7c3aed;--acc2:#c084fc}.hub-page[data-app="users"]{--acc:#0891b2;--acc2:#22d3ee}
.hub-page[data-app="clockin"],.hub-page[data-app="tasks"],.hub-page[data-app="users"]{width:min(860px,calc(100% - 32px));height:fit-content;max-height:min(860px,calc(100% - 32px))}

.hv{display:grid;gap:16px;animation:hp-in .4s cubic-bezier(.22,1,.36,1)}
.hv-card{padding:18px;border-radius:22px;border:1px solid color-mix(in srgb,var(--text) 8%,transparent);background:linear-gradient(165deg,var(--surface),color-mix(in srgb,var(--surface) 92%,var(--surface-sunken)));box-shadow:inset 0 1px 0 rgba(255,255,255,.55),0 14px 30px -22px color-mix(in srgb,var(--text) 50%,transparent)}
:root[data-theme="dark"] .hv-card{background:rgba(255,255,255,.035);box-shadow:inset 0 1px 0 rgba(255,255,255,.05)}
.hv-card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.hv h3{margin:0;font-size:15px;font-weight:700;letter-spacing:-.01em}
.hv-eyebrow{margin:0 0 10px;font-size:11px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--text-secondary)}
.hv-muted{margin:0;color:var(--text-secondary);font-size:12px;font-weight:500}
.hv-error{margin:0;padding:12px 14px;border-radius:14px;background:color-mix(in srgb,#ef4444 10%,transparent);color:color-mix(in srgb,#ef4444 80%,var(--text));font-size:13px}
.hv-empty{margin:0;padding:22px 8px;text-align:center;color:var(--text-secondary);font-size:13px}
.hv-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:34px;padding:0 14px;border:1px solid color-mix(in srgb,var(--text) 12%,transparent);border-radius:999px;background:var(--surface);color:var(--text);font-family:inherit;font-size:12.5px;font-weight:600;line-height:1;white-space:nowrap;cursor:pointer;transition:transform .2s cubic-bezier(.34,1.4,.5,1),background .2s,box-shadow .2s}
.hv-btn svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.hv-btn:hover{transform:translateY(-1px)}.hv-btn:active{transform:scale(.96)}
.hv-btn.is-accent{border-color:transparent;color:#fff;background:linear-gradient(145deg,var(--acc2),var(--acc));box-shadow:inset 0 1px 0 rgba(255,255,255,.3),0 8px 18px -10px var(--acc)}
.hv-btn:disabled{opacity:.6;cursor:default;transform:none}
.hv-icon-btn{width:36px;min-height:36px;padding:0}.hv-icon-btn svg{width:18px;height:18px}

/* ClockIn view */
.hv-clock{grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start}
.hv-clock-main{display:grid;gap:16px;justify-items:stretch}
.hv-flip{display:flex;gap:8px;perspective:600px}
.hv-flip-unit{flex:1 1 0;display:grid;justify-items:center;gap:6px;min-width:0}
.hv-flip-unit small{font-size:9.5px;font-weight:700;letter-spacing:.16em;text-transform:uppercase;color:var(--text-secondary)}
.hv-flip-card{position:relative;width:100%;aspect-ratio:1/1.05;border-radius:16px;background:linear-gradient(180deg,#24262d 0%,#1a1c21 49.6%,#14151a 50.4%,#0e0f13 100%);box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 12px 24px -12px rgba(0,0,0,.6);transform-style:preserve-3d}
.hv-flip-card::after{content:"";position:absolute;left:0;right:0;top:50%;height:2px;margin-top:-1px;background:rgba(0,0,0,.6);z-index:3}
.hv-flip-face,.hv-flip-leaf{position:absolute;inset:0;display:grid;place-items:center;border-radius:inherit;font-family:inherit;font-size:clamp(32px,6vw,52px);font-weight:700;line-height:1;letter-spacing:-.03em;color:#f4f4f6;font-variant-numeric:tabular-nums}
.hv-flip-leaf{z-index:4;background:linear-gradient(180deg,#2a2c33 0%,#1d1f24 49.6%,#16171c 50.4%,#101115 100%);transform-origin:50% 0;backface-visibility:hidden;animation:hv-flip .55s cubic-bezier(.35,0,.55,1) forwards}
.hv-flip-card[data-unit="s"] .hv-flip-face,.hv-flip-card[data-unit="s"] .hv-flip-leaf{color:#ff8a7a}
@keyframes hv-flip{0%{transform:rotateX(0)}70%{opacity:1}100%{transform:rotateX(92deg);opacity:.35;filter:brightness(1.5)}}
.hv-punch-row{display:flex;align-items:center;gap:16px;padding:12px;border-radius:18px;background:color-mix(in srgb,var(--text) 4%,transparent)}
.hv-punch-ring{flex:none;padding:5px;border-radius:50%;background:conic-gradient(var(--acc) var(--p,0deg),color-mix(in srgb,var(--text) 10%,transparent) 0);transition:background .4s}
.hv-punch{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:78px;height:78px;border:0;border-radius:50%;color:#fff;font-family:inherit;font-size:11.5px;font-weight:700;line-height:1;white-space:nowrap;cursor:pointer;background:linear-gradient(145deg,#ff5a4d,#c40d05);box-shadow:inset 0 1px 0 rgba(255,255,255,.3),inset 0 -8px 14px rgba(0,0,0,.18),0 10px 22px -8px rgba(206,5,5,.6);transition:transform .2s cubic-bezier(.34,1.4,.5,1)}
.hv-punch svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.hv-punch:hover:not(:disabled){transform:scale(1.05)}.hv-punch:active:not(:disabled){transform:scale(.94)}.hv-punch:disabled{opacity:.75;cursor:progress}
.hv-clock[data-in="true"] .hv-punch{background:linear-gradient(145deg,#3a3d46,#17181d)}
.hv-session{display:grid;gap:4px;min-width:0}
.hv-pill{justify-self:start;padding:4px 10px;border-radius:999px;font-size:11px;font-weight:700;color:var(--text-secondary);background:color-mix(in srgb,var(--text) 7%,transparent)}
.hv-clock[data-in="true"] .hv-pill{color:#fff;background:linear-gradient(145deg,#ff6b5e,#ef2a20)}
.hv-timer{font-size:24px;font-weight:700;line-height:1.15;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.hv-clock:not([data-in="true"]) .hv-timer{font-size:14px;font-weight:600;color:var(--text-secondary)}
.hv-status{min-height:1em;color:var(--text-secondary);font-size:12px}
.hv-days{display:grid;gap:10px}
.hv-day{padding:12px 14px;border-radius:16px;background:color-mix(in srgb,var(--text) 3.5%,transparent);animation:hw-in .45s cubic-bezier(.22,1,.36,1) both;animation-delay:calc(var(--i)*60ms)}
.hv-day>header{display:flex;align-items:baseline;gap:8px;margin-bottom:6px}
.hv-day>header strong{font-size:13.5px}.hv-day>header small{color:var(--text-secondary);font-size:12px}
.hv-day-total{margin-left:auto;font-size:12.5px;font-weight:700;font-variant-numeric:tabular-nums}
.hv-entry{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;padding:6px 0;font-size:13px;font-variant-numeric:tabular-nums}
.hv-entry+.hv-entry{border-top:1px solid color-mix(in srgb,var(--text) 6%,transparent)}
.hv-entry small{color:var(--text-secondary);font-size:11.5px}
.hv-entry-dot{width:8px;height:8px;border-radius:50%;background:#10b981}
.hv-entry.is-live .hv-entry-dot{background:var(--acc);box-shadow:0 0 0 0 var(--acc);animation:hv-pulse 1.6s infinite}
.hv-entry.is-pending .hv-entry-dot{background:#f59e0b}
@keyframes hv-pulse{70%{box-shadow:0 0 0 7px transparent}}
.hv-tag{justify-self:end;padding:3px 9px;border-radius:999px;font-size:10.5px!important;font-weight:700;white-space:nowrap;color:#b45309!important;background:color-mix(in srgb,#f59e0b 15%,transparent)}
.hv-form{display:grid;gap:12px;margin-bottom:12px;padding:14px;border-radius:16px;border:1px solid color-mix(in srgb,var(--acc) 22%,transparent);background:color-mix(in srgb,var(--acc) 5%,var(--surface));animation:hw-in .3s cubic-bezier(.22,1,.36,1)}
.hv-form[hidden],.hv-notes[hidden],.hv-task-list[hidden]{display:none}
.hv-form label{display:grid;gap:5px;font-size:12px;font-weight:600;color:var(--text-secondary)}
.hv-form input,.hv-form textarea{width:100%;min-width:0;max-width:100%;min-height:38px;padding:8px 11px;border:1px solid color-mix(in srgb,var(--text) 14%,transparent);border-radius:11px;background:var(--surface);color:var(--text);font-family:inherit;font-size:13.5px;font-weight:500;line-height:1.4;box-sizing:border-box;resize:vertical}
.hv-form input:focus,.hv-form textarea:focus{outline:2px solid color-mix(in srgb,var(--acc) 45%,transparent);outline-offset:1px}
.hv-fields{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) minmax(0,1fr);gap:10px}
.hv-form,.hv-form label{min-width:0;grid-template-columns:minmax(0,1fr)}.hv-form .hv-muted{display:inline;font-size:11.5px}
.hv-form-actions{display:flex;justify-content:flex-end;gap:8px}
.hv-form-msg{margin:0;font-size:12px;color:var(--text-secondary)}.hv-form-msg:empty{display:none}
.hv-note{margin:0;font-size:12px;color:#b45309}

/* Tasks view */
.hv-tasks-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px}
.hv-tasks-head .hv-eyebrow{margin-bottom:4px}.hv-tasks-head h3{font-size:19px}
.hv-tools{display:flex;gap:8px}
.hv-progress{height:8px;border-radius:999px;background:color-mix(in srgb,var(--text) 8%,transparent);overflow:hidden}
.hv-progress span{display:block;height:100%;width:0;border-radius:inherit;background:linear-gradient(90deg,var(--acc),var(--acc2));transition:width .6s cubic-bezier(.22,1,.36,1)}
.hv-task-list{display:grid;gap:8px}
.hv-task{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:12px;padding:11px 14px;border-radius:16px;border:1px solid color-mix(in srgb,var(--text) 7%,transparent);background:var(--surface);animation:hw-in .4s cubic-bezier(.22,1,.36,1) both;animation-delay:calc(var(--i)*35ms);transition:opacity .3s,background .3s}
.hv-task.is-overdue{border-color:color-mix(in srgb,#ef4444 30%,transparent)}
.hv-task.is-done{opacity:.6}.hv-task.is-done strong{text-decoration:line-through;text-decoration-color:color-mix(in srgb,var(--text) 40%,transparent)}
.hv-check{display:grid;place-items:center;width:26px;height:26px;padding:0;border-radius:50%;border:2px solid color-mix(in srgb,var(--acc) 45%,transparent);background:transparent;color:transparent;cursor:pointer;transition:background .25s,color .25s,transform .25s cubic-bezier(.34,1.4,.5,1)}
.hv-check svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.hv-check:hover:not(:disabled){transform:scale(1.1);color:color-mix(in srgb,var(--acc) 60%,transparent)}
.hv-task.is-done .hv-check{border-color:transparent;color:#fff;background:linear-gradient(145deg,var(--acc2),var(--acc))}
.hv-check:disabled{cursor:default;opacity:.5}
.hv-task-copy{display:grid;gap:2px;min-width:0}
.hv-task-copy strong{font-size:13.5px;font-weight:600;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.hv-task-copy small{font-size:11.5px;color:var(--text-secondary)}.hv-task.is-overdue .hv-task-copy small{color:#dc2626}
.hv-task .hv-tag{color:var(--text-secondary)!important;background:color-mix(in srgb,var(--text) 6%,transparent)}
.hv-task .hv-tag.is-progress{color:#2563eb!important;background:color-mix(in srgb,#2563eb 12%,transparent)}
.hv-task .hv-tag.is-done{color:#059669!important;background:color-mix(in srgb,#10b981 14%,transparent)}
.hv-task .hv-tag.is-routine{color:var(--acc)!important;background:color-mix(in srgb,var(--acc) 12%,transparent)}
.hv-notes{display:grid;gap:12px;animation:hw-in .35s cubic-bezier(.22,1,.36,1)}
.hv-notes .hv-card-head{margin:0}
.hv-note-list{display:grid;gap:8px}
.hv-note-item{padding:12px 14px;border-radius:14px;border-left:3px solid var(--acc);background:color-mix(in srgb,var(--text) 3.5%,transparent)}
.hv-note-item p{margin:0 0 6px;font-size:13.5px;line-height:1.5;white-space:pre-wrap}.hv-note-item small{color:var(--text-secondary);font-size:11.5px}

/* Profile view */
.hv-profile{justify-items:center;text-align:center;padding:18px 0 8px}
.hv-profile .hub-widget-avatar.is-large{width:132px!important;height:132px!important}
.hv-profile h3{font-size:20px}

@media(max-width:760px){.hv-clock{grid-template-columns:minmax(0,1fr)}.hv-fields{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.hv-fields label:first-child{grid-column:1/-1}}
@media(max-width:640px){.hub-page[data-app="clockin"],.hub-page[data-app="tasks"],.hub-page[data-app="users"]{width:100%;height:100%;max-height:100dvh}.hv-tasks-head{align-items:flex-start;flex-direction:column}.hv-card{padding:14px}.hv-task{padding:10px 12px}}
@media(prefers-reduced-motion:reduce){.hub-loader-ring{animation-duration:2.5s}.hv,.hv-day,.hv-task,.hv-form,.hv-notes,.hv-flip-leaf,.hv-entry.is-live .hv-entry-dot{animation:none}}
.hub-page[data-app="users"]{width:min(520px,calc(100% - 32px))}

/* ===== First paint: widget placeholders + per-card loading veil ===== */
html.hub-layout-widgets .app-grid{display:none!important}
html.hub-layout-widgets #hub-widgets.hub-widgets[hidden]{display:grid!important}
.hub-widgets .hub-widget.is-skeleton{min-height:var(--sk-h,220px)}
.hub-widget.is-skeleton .hub-widget-badge{background:linear-gradient(145deg,var(--acc2),var(--acc));opacity:.85}
.hub-sk-line{display:block;width:96px;height:11px;border-radius:999px;background:linear-gradient(90deg,color-mix(in srgb,var(--text) 8%,transparent) 0%,color-mix(in srgb,var(--text) 15%,transparent) 50%,color-mix(in srgb,var(--text) 8%,transparent) 100%) 0 0/200% 100%;animation:hv-shim 1.4s ease-in-out infinite}
.hub-widget.is-skeleton .hub-widget-body{position:relative;flex:1;min-height:0}
.hub-widget.is-loading .hub-widget-body{position:relative;min-height:170px}
.hub-widget.is-loading .hub-widget-body>:not(.hub-widget-veil){visibility:hidden}
.hub-widget-veil{position:absolute;inset:0;z-index:6;display:grid;place-items:center;border-radius:18px;overflow:hidden;background:linear-gradient(160deg,color-mix(in srgb,var(--acc,var(--brand)) 5%,transparent),color-mix(in srgb,var(--text) 2.5%,transparent))}
.hub-widget-veil::before{content:"";position:absolute;inset:0;background:linear-gradient(105deg,transparent 30%,color-mix(in srgb,#fff 32%,transparent) 50%,transparent 70%) -150% 0/60% 100% no-repeat;animation:hv-sweep 1.8s cubic-bezier(.4,0,.2,1) infinite}
:root[data-theme="dark"] .hub-widget-veil::before{background-image:linear-gradient(105deg,transparent 30%,rgba(255,255,255,.06) 50%,transparent 70%)}
.hub-veil-orb{position:relative;display:grid;place-items:center;width:64px;height:64px;border-radius:50%;background:radial-gradient(circle at 32% 26%,rgba(255,255,255,.95),rgba(255,255,255,.35) 38%,transparent 62%),linear-gradient(150deg,color-mix(in srgb,var(--acc,var(--brand)) 14%,var(--surface)),var(--surface));box-shadow:inset 0 1px 0 rgba(255,255,255,.9),inset 0 -6px 12px color-mix(in srgb,var(--acc,var(--brand)) 12%,transparent),0 12px 26px -12px color-mix(in srgb,var(--acc,var(--brand)) 70%,transparent),0 0 0 1px color-mix(in srgb,var(--text) 6%,transparent);animation:hv-breathe 2.4s ease-in-out infinite}
:root[data-theme="dark"] .hub-veil-orb{background:radial-gradient(circle at 32% 26%,rgba(255,255,255,.22),transparent 55%),linear-gradient(150deg,color-mix(in srgb,var(--acc,var(--brand)) 26%,#1b1d22),#121317);box-shadow:inset 0 1px 0 rgba(255,255,255,.14),0 12px 26px -12px color-mix(in srgb,var(--acc,var(--brand)) 80%,transparent),0 0 0 1px rgba(255,255,255,.06)}
.hub-veil-orb .hub-loader-ring{width:34px;height:34px}
@keyframes hv-sweep{to{background-position:250% 0}}@keyframes hv-shim{to{background-position:-200% 0}}@keyframes hv-breathe{50%{transform:scale(1.06)}}
/* Real cards replace the placeholders in place: no second entrance animation. */
.hub-widgets.is-live .hub-widget{animation:none}
@media(prefers-reduced-motion:reduce){.hub-widget-veil::before,.hub-sk-line,.hub-veil-orb{animation:none}}

/* View popups: sections, tabs, search, people picker */
.hub-page[data-app="communications"],.hub-page[data-app="files"]{width:min(860px,calc(100% - 32px));height:min(780px,calc(100% - 32px))}
.hv-section{display:grid;gap:8px}.hv-section+.hv-section{margin-top:10px}
.hv-section>h4{display:flex;align-items:center;gap:8px;margin:0;font-size:11.5px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--text-secondary)}
.hv-section>h4 span{padding:2px 8px;border-radius:999px;font-size:10.5px;letter-spacing:0;color:var(--acc);background:color-mix(in srgb,var(--acc) 12%,transparent)}
.hv-seg{display:inline-flex;justify-self:start;gap:4px;padding:4px;border-radius:999px;background:color-mix(in srgb,var(--text) 6%,transparent)}
.hv-seg label{display:block!important;cursor:pointer}.hv-seg input{position:absolute;opacity:0;pointer-events:none}
.hv-seg span{display:block;padding:7px 14px;border-radius:999px;font-size:12px;font-weight:600;color:var(--text-secondary);transition:background .2s,color .2s}
.hv-seg input:checked+span{background:var(--surface);color:var(--text);box-shadow:0 2px 8px color-mix(in srgb,var(--text) 12%,transparent)}
.hv-seg input:focus-visible+span{outline:2px solid var(--acc)}
.hv-tabs{display:inline-flex;justify-self:start;gap:4px;padding:4px;border-radius:999px;background:color-mix(in srgb,var(--text) 6%,transparent)}
.hv-tabs button{padding:8px 16px;border:0;border-radius:999px;background:transparent;color:var(--text-secondary);font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer;transition:background .2s,color .2s}
.hv-tabs button[aria-selected=true]{background:var(--surface);color:var(--text);box-shadow:0 2px 8px color-mix(in srgb,var(--text) 12%,transparent)}
.hv-search,.hv-picker input{width:100%;min-height:40px;padding:8px 14px;border:1px solid color-mix(in srgb,var(--text) 12%,transparent);border-radius:12px;background:var(--surface);color:var(--text);font-family:inherit;font-size:13.5px;box-sizing:border-box}
.hv-search:focus,.hv-picker input:focus{outline:2px solid color-mix(in srgb,var(--acc) 45%,transparent);outline-offset:1px}
.hv-search[hidden],.hv-picker[hidden],.hub-page-list[hidden]{display:none}
.hv-picker{margin:0}.hv-picker .hv-card-head{margin:0}
.hv-people{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:6px;max-height:min(46vh,420px);overflow:auto;padding:2px}
.hv-person{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid color-mix(in srgb,var(--text) 8%,transparent);border-radius:14px;background:var(--surface);color:var(--text);font-family:inherit;font-size:13px;font-weight:600;text-align:left;cursor:pointer;transition:border-color .2s,background .2s,transform .2s}
.hv-person:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--acc) 35%,transparent)}
.hv-person>span:nth-child(2){flex:1;min-width:0;overflow-wrap:anywhere}
.hv-person.is-on{border-color:var(--acc);background:color-mix(in srgb,var(--acc) 8%,var(--surface))}
.hv-tick{width:18px;height:18px;border-radius:50%;border:2px solid color-mix(in srgb,var(--acc) 45%,transparent);flex:none}
.hv-person.is-on .hv-tick{border-color:var(--acc);background:radial-gradient(circle,var(--acc) 0 45%,transparent 50%)}
.hv-filetype{flex:none;display:grid;place-items:center;width:40px;height:40px;border-radius:12px;font-size:10px;font-weight:800;letter-spacing:.04em;color:#fff;background:linear-gradient(145deg,var(--acc2),var(--acc));box-shadow:inset 0 1px 0 rgba(255,255,255,.3)}

/* ===== Widgets v3: floating cards, compact header (title · View · globe), content first ===== */
.hub-widgets .hub-widget{gap:8px;padding:8px;border-radius:26px;box-shadow:inset 0 1px 0 var(--w-hi),0 1px 2px color-mix(in srgb,var(--text) 5%,transparent),0 18px 40px -22px color-mix(in srgb,var(--text) 38%,transparent),0 40px 70px -48px color-mix(in srgb,var(--acc) 45%,transparent)}
.hub-widgets.is-live .hub-widget:hover{transform:translateY(-4px);box-shadow:inset 0 1px 0 var(--w-hi),0 2px 4px color-mix(in srgb,var(--text) 6%,transparent),0 26px 52px -24px color-mix(in srgb,var(--text) 42%,transparent),0 48px 80px -50px color-mix(in srgb,var(--acc) 60%,transparent)}
.hub-widgets .hub-widget-header{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:30px;padding:0 2px 0 4px}
.hub-widgets .hub-widget-title{gap:8px;min-width:0}
.hub-widgets .hub-widget-title strong{font-size:13px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hub-widgets .hub-widget .hub-widget-title .hub-widget-badge{width:24px;height:24px;min-width:24px;border-radius:8px}
.hub-widgets .hub-widget .hub-widget-title .hub-widget-badge svg{width:13px;height:13px}
.hub-widget-tools{display:flex;align-items:center;gap:6px;flex:none}
.hub-widgets .hub-widget-tools .hub-widget-action{min-height:26px;height:26px;padding:0 10px 0 11px;gap:5px;font-size:11px;font-weight:650;letter-spacing:.01em;border-radius:999px;align-self:center;margin:0;box-shadow:inset 0 1px 0 var(--w-hi)}
.hub-widgets .hub-widget-tools .hub-widget-action svg{width:12px;height:12px}
.hub-widgets .hub-widget-tools .hub-widget-action:hover{color:#fff;background:linear-gradient(145deg,var(--acc2),var(--acc));border-color:transparent;transform:translateY(-1px)}
.hub-widgets .hub-widget-tools .hub-widget-open{width:26px;height:26px;display:grid;place-items:center;padding:0}
.hub-widgets .hub-widget-tools .hub-widget-open svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.hub-widgets .hub-widget-tools .hub-widget-open:hover{transform:rotate(18deg) scale(1.08)}
.hub-widgets .hub-widget-body{padding:0;gap:0;flex:1}
.hub-widgets .hub-widget-data{flex:1;border-radius:20px;background:var(--w-well);box-shadow:inset 0 1px 2px color-mix(in srgb,var(--text) 5%,transparent),0 1px 0 var(--w-hi)}
.hub-widgets .hub-widget-data>.hub-widget-rows{padding:8px;gap:6px}
.hub-widgets .hub-widget-row{padding:9px 10px;border-radius:14px}
.hub-widget-veil{border-radius:20px}
@media(max-width:640px){.hub-widgets .hub-widget{border-radius:22px}.hub-widgets .hub-widget-tools .hub-widget-action{padding:0 9px}}

/* Grants: state hover summary */
.hub-grants-tip{position:absolute;left:0;top:0;z-index:8;min-width:170px;max-width:240px;padding:10px 12px;border-radius:14px;border:1px solid color-mix(in srgb,var(--text) 10%,transparent);background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);box-shadow:0 16px 32px -14px rgba(0,0,0,.45);pointer-events:none;color:var(--text);font-size:11.5px;transition:transform .08s linear;animation:hw-in .18s ease-out}
.hub-grants-tip[hidden]{display:none}
.hub-grants-tip-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.hub-grants-tip-head strong{font-size:13px}.hub-grants-tip-head b{font-size:20px;font-weight:750;color:#059669;font-variant-numeric:tabular-nums}
.hub-grants-tip>small{display:block;margin-top:-2px;color:var(--text-secondary);font-size:10.5px}
.hub-grants-tip-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 10px;margin-top:8px;padding-top:8px;border-top:1px solid color-mix(in srgb,var(--text) 8%,transparent)}
.hub-grants-tip-grid span{display:flex;align-items:baseline;gap:5px;color:var(--text-secondary);white-space:nowrap}
.hub-grants-tip-grid b{color:var(--text);font-variant-numeric:tabular-nums}
.hub-grants-tip-grid .is-open b{color:#059669}.hub-grants-tip-grid .is-soon b{color:#2563eb}.hub-grants-tip-grid .is-awarded b{color:#7c3aed}.hub-grants-tip-grid .is-closed b{color:#94a3b8}.hub-grants-tip-grid .is-direct b{color:#d97706}
/* Tasks/ClockIn cards: room for ~7 task rows. */
.hub-widgets .hub-widget[data-app="clockin"] .hub-widget-data>iframe,.hub-widgets .hub-widget[data-app="tasks"] .hub-widget-data>iframe{min-height:410px}
@media(max-width:640px){.hub-widgets .hub-widget[data-app="clockin"] .hub-widget-data>iframe,.hub-widgets .hub-widget[data-app="tasks"] .hub-widget-data>iframe{min-height:400px}}
/* Space: blinking dot on avatars of chats with unread messages. */
.hub-widget-row.is-unread .hub-widget-dot,.hub-page-row.is-unread .hub-widget-dot{position:relative;overflow:visible}
.hub-unread-dot{flex:none;width:8px;height:8px;margin-right:-2px;border-radius:50%;background:#ef2a20;box-shadow:0 0 0 0 rgba(239,42,32,.55);animation:hub-unread-blink 1.4s ease-in-out infinite}
.hub-widget-row.is-unread .hub-widget-dot::after,.hub-page-row.is-unread .hub-widget-dot::after{display:none;content:"";position:absolute;top:-2px;right:-2px;width:10px;height:10px;border-radius:50%;background:#ef2a20;border:2px solid var(--surface);box-shadow:0 0 0 0 rgba(239,42,32,.55);animation:hub-unread-blink 1.4s ease-in-out infinite}
.hub-widget-row.is-unread strong,.hub-page-row.is-unread strong{font-weight:750}
@keyframes hub-unread-blink{0%,100%{opacity:1;box-shadow:0 0 0 0 rgba(239,42,32,.5)}50%{opacity:.35;box-shadow:0 0 0 5px rgba(239,42,32,0)}}
@media(prefers-reduced-motion:reduce){.hub-unread-dot,.hub-widget-row.is-unread .hub-widget-dot::after,.hub-page-row.is-unread .hub-widget-dot::after{animation:none}}
.hub-page[data-app="files"]{height:fit-content;min-height:min(420px,calc(100% - 32px));max-height:min(780px,calc(100% - 32px))}
/* Space / Mail rows: received time, small and right-aligned, above the unread count. */
.hub-row-side{display:flex;flex-direction:column;align-items:flex-end;justify-content:center;gap:4px;flex:none;margin-left:auto;padding-left:8px}
.hub-row-time{font-size:10.5px;font-weight:600;line-height:1;white-space:nowrap;color:var(--text-secondary);font-variant-numeric:tabular-nums}
.is-unread .hub-row-time,.is-new .hub-row-time{color:var(--acc,var(--brand))}
.hub-row-side .hub-widget-count{margin:0}
.hub-widget-row .hub-widget-row-copy,.hub-page-row .hub-widget-row-copy{min-width:0;flex:1}
.hub-widget-row .hub-widget-row-copy small,.hub-page-row .hub-widget-row-copy small{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.hub-unread-dot.is-off{visibility:hidden;animation:none}
/* Grants side list: every row fits the panel; titles and details wrap instead of running off the right edge. */
.hub-grants-side>*,.hub-grants-side .hub-page-list{min-width:0;max-width:100%}
.hub-grants-side .hub-page-row{width:100%;max-width:100%;box-sizing:border-box;min-width:0}
.hub-grants-side .hub-page-row .hub-widget-row-copy{flex:1;min-width:0;overflow:hidden}
.hub-grants-side .hub-page-row .hub-widget-row-copy strong{white-space:normal!important;overflow-wrap:anywhere;text-overflow:clip}
.hub-grants-side .hub-page-row .hub-widget-row-copy small{display:-webkit-box!important;-webkit-line-clamp:2;-webkit-box-orient:vertical;white-space:normal!important;overflow:hidden;overflow-wrap:anywhere;line-height:1.35;margin-top:3px}
.hub-grants-side .hub-page-row .hub-widget-row-copy strong,.hub-grants-side .hub-page-row .hub-widget-row-copy small{display:block!important;-webkit-line-clamp:unset;overflow:visible}
/* Files popup: preview / download */
.hv-file-actions{display:flex;gap:6px;flex:none;margin-left:6px}
.hv-file-actions .hv-icon-btn{width:32px;min-height:32px;height:32px}.hv-file-actions .hv-icon-btn svg{width:15px;height:15px}
.hv-file-actions .hv-icon-btn:hover{color:#fff;background:linear-gradient(145deg,var(--acc2),var(--acc));border-color:transparent}
.hv-preview{display:flex;flex-direction:column;gap:12px;min-height:min(62vh,600px)}.hv-preview[hidden],.hv-tabs[hidden]{display:none}
.hv-preview-bar{display:flex;align-items:center;gap:10px}.hv-preview-bar strong{flex:1;min-width:0;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hv-preview-stage{flex:1;display:grid;place-items:center;min-height:min(56vh,540px);border-radius:18px;overflow:hidden;border:1px solid color-mix(in srgb,var(--text) 8%,transparent);background:color-mix(in srgb,var(--text) 4%,var(--surface))}
.hv-preview-stage iframe{width:100%;height:100%;min-height:min(56vh,540px);border:0;background:#fff}
.hv-preview-stage img,.hv-preview-stage video{max-width:100%;max-height:min(56vh,540px);object-fit:contain}
.hv-preview-stage audio{width:min(420px,90%)}
.hv-more{justify-self:center}.hv-more[hidden]{display:none}
.hub-page[data-app="mailbox"]{width:min(860px,calc(100% - 32px));height:min(780px,calc(100% - 32px))}
.hub-page[data-app="files"]{max-height:min(860px,calc(100% - 32px))}
/* Loading veil: app name lights up letter by letter, glossy, then repeats; dots bounce below. */
.hub-widget-veil{align-content:center;justify-items:center;gap:12px}
.hub-veil-word{--step:.11s;display:flex;flex-wrap:wrap;justify-content:center;max-width:92%;font-size:clamp(17px,2.2vw,24px);font-weight:800;letter-spacing:.2em;line-height:1.15;text-align:center}
.hub-veil-word span{display:inline-block;color:color-mix(in srgb,var(--text) 16%,transparent);animation:hv-letter calc(var(--n) * var(--step) + 1.1s) ease-in-out infinite;animation-delay:calc(var(--i) * var(--step))}
@keyframes hv-letter{0%{color:color-mix(in srgb,var(--text) 16%,transparent);transform:none;text-shadow:none}
  12%{color:var(--acc,var(--brand));transform:translateY(-3px);text-shadow:0 0 14px color-mix(in srgb,var(--acc,var(--brand)) 55%,transparent),0 1px 0 rgba(255,255,255,.7)}
  30%,62%{color:color-mix(in srgb,var(--acc,var(--brand)) 85%,var(--text));transform:none;text-shadow:0 0 6px color-mix(in srgb,var(--acc,var(--brand)) 25%,transparent)}
  100%{color:color-mix(in srgb,var(--text) 16%,transparent);text-shadow:none}}
.hub-veil-dots{display:flex;gap:6px}
.hub-veil-dots i{width:7px;height:7px;border-radius:50%;background:linear-gradient(145deg,var(--acc2,var(--brand)),var(--acc,var(--brand)));box-shadow:0 3px 8px -2px var(--acc,var(--brand));animation:hv-dot 1.1s ease-in-out infinite}
.hub-veil-dots i:nth-child(2){animation-delay:.15s}.hub-veil-dots i:nth-child(3){animation-delay:.3s}
@keyframes hv-dot{0%,80%,100%{transform:translateY(0);opacity:.45}40%{transform:translateY(-6px);opacity:1}}
@media(prefers-reduced-motion:reduce){.hub-veil-word span,.hub-veil-dots i{animation:none;color:var(--acc,var(--brand))}}
/* Warehouse card: fixed two-row height (left out-of-stock panel + 2-row ring strip). */
.hub-widgets .hub-widget[data-app="warehouse"] .hub-widget-data>iframe{height:262px!important;min-height:262px}
/* Loader v2: solid app name; a colour band flows first → last letter while glowing dots travel under the lit letter. */
.hub-veil-word{--dur:calc(var(--n) * .16s + .5s);position:relative;display:inline-block;max-width:92%;padding-bottom:16px;font-size:clamp(18px,2.3vw,25px);font-weight:800;letter-spacing:.22em;line-height:1.15;text-align:center;white-space:nowrap;color:transparent;
  background:linear-gradient(90deg,var(--text) 0 40%,var(--acc2,var(--brand)) 46%,var(--acc,var(--brand)) 50%,var(--acc2,var(--brand)) 54%,var(--text) 60% 100%);background-size:200% 100%;background-position:100% 0;-webkit-background-clip:text;background-clip:text;
  filter:drop-shadow(0 1px 0 rgba(255,255,255,.6));animation:hv-flow var(--dur) cubic-bezier(.45,0,.55,1) infinite}
:root[data-theme="dark"] .hub-veil-word{filter:none}
@keyframes hv-flow{from{background-position:100% 0}to{background-position:0 0}}
.hub-veil-word .hub-veil-dots{position:absolute;left:0;bottom:0;display:flex;gap:4px;transform:translateX(-50%);animation:hv-travel var(--dur) cubic-bezier(.45,0,.55,1) infinite}
.hub-veil-word .hub-veil-dots i{width:6px;height:6px;border-radius:50%;background:var(--acc,var(--brand));box-shadow:0 0 6px var(--acc,var(--brand)),0 0 12px color-mix(in srgb,var(--acc,var(--brand)) 60%,transparent);animation:hv-blink .5s ease-in-out infinite alternate}
.hub-veil-word .hub-veil-dots i:nth-child(2){animation-delay:.17s}.hub-veil-word .hub-veil-dots i:nth-child(3){animation-delay:.34s}
@keyframes hv-travel{from{left:0}to{left:100%}}
@keyframes hv-blink{from{opacity:.35;transform:scale(.8)}to{opacity:1;transform:scale(1.15)}}
@media(prefers-reduced-motion:reduce){.hub-veil-word,.hub-veil-word .hub-veil-dots,.hub-veil-word .hub-veil-dots i{animation:none}.hub-veil-word{color:var(--text);background:none}.hub-veil-word .hub-veil-dots{left:50%}}
/* Loader v3: bigger solid name; a glossy colour wave fills the letters left → right and flows out, no dots. */
.hub-veil-dots{display:none!important}
.hub-veil-word{--dur:calc(var(--n) * .14s + .9s);padding:0;font-size:clamp(28px,3.6vw,44px);font-weight:900;letter-spacing:.14em;line-height:1.1;
  background:linear-gradient(100deg,color-mix(in srgb,var(--text) 82%,transparent) 0 30%,var(--acc2,var(--brand)) 40%,var(--acc,var(--brand)) 46%,color-mix(in srgb,var(--acc,var(--brand)) 55%,#fff) 50%,var(--acc,var(--brand)) 54%,var(--acc2,var(--brand)) 60%,color-mix(in srgb,var(--text) 82%,transparent) 70% 100%);
  background-size:250% 100%;background-position:100% 0;-webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 2px 10px color-mix(in srgb,var(--acc,var(--brand)) 22%,transparent));animation:hv-flow var(--dur) cubic-bezier(.6,0,.4,1) infinite}
:root[data-theme="dark"] .hub-veil-word{filter:drop-shadow(0 2px 14px color-mix(in srgb,var(--acc,var(--brand)) 35%,transparent))}
.hub-widgets-side .hub-veil-word{font-size:clamp(24px,2.6vw,34px)}
@media(prefers-reduced-motion:reduce){.hub-veil-word{animation:none;background:none;color:var(--acc,var(--brand))}}
/* Empty email (e.g. a forward with no message of its own). */
.thread-empty-note{display:grid;gap:4px;margin:4px 0;padding:14px 16px;border-radius:14px;border:1px dashed color-mix(in srgb,var(--text) 18%,transparent);background:color-mix(in srgb,var(--text) 3%,transparent)}
.thread-empty-note strong{font-size:13.5px}.thread-empty-note span{font-size:12.5px;color:var(--text-secondary)}
/* Loader v4: the colour band glides slowly left → right → left until content arrives; calm pulsing dots below. */
.hub-veil-word{--dur:calc(var(--n) * .22s + 1.6s);animation:hv-flow var(--dur) cubic-bezier(.65,0,.35,1) infinite alternate}
.hub-veil-pulse{display:flex;gap:7px;margin-top:2px}
.hub-veil-pulse i{width:7px;height:7px;border-radius:50%;background:var(--acc,var(--brand));box-shadow:0 0 0 0 color-mix(in srgb,var(--acc,var(--brand)) 45%,transparent);opacity:.3;animation:hv-pulse-dot 1.5s ease-in-out infinite}
.hub-veil-pulse i:nth-child(2){animation-delay:.25s}.hub-veil-pulse i:nth-child(3){animation-delay:.5s}
@keyframes hv-pulse-dot{0%,100%{opacity:.25;transform:scale(.85);box-shadow:0 0 0 0 transparent}40%{opacity:1;transform:scale(1.1);box-shadow:0 0 10px 1px color-mix(in srgb,var(--acc,var(--brand)) 55%,transparent)}}
@media(prefers-reduced-motion:reduce){.hub-veil-pulse i{animation:none;opacity:.7}}
/* No scrolling inside widgets: content is sized to fit; View shows everything. */
.hub-widgets .hub-widget-data,.hub-widgets .hub-widget-rows,.hub-widgets .hub-widget-body{overflow:hidden!important}
.hub-widgets .hub-grants:not(.is-page) .hub-grants-side{overflow:hidden!important;-webkit-mask-image:linear-gradient(180deg,#000 82%,transparent);mask-image:linear-gradient(180deg,#000 82%,transparent)}
.hub-veil-pulse,.hub-veil-dots{display:none!important}
/* Mailbox page (phone): per-sender colour avatars, never red (the unread dot is red). */
@media (max-width: 900px) {
  .mailbox-row-avatar, .mailbox-row--unread .mailbox-row-avatar { --h:205; color:#fff; background:linear-gradient(145deg,hsl(var(--h) 70% 60%),hsl(calc(var(--h) + 28) 65% 44%)); }
}
/* Profile photos inside any Hub avatar circle. */
.hub-widget-dot.is-avatar{position:relative}
.hub-av-photo{position:absolute;inset:0;width:100%;height:100%;border-radius:50%;object-fit:cover}
/* Tasks View: assignees, expandable details, settings and notes. */
.hv-task{grid-template-columns:auto minmax(0,1fr) auto auto auto}
.hv-task-copy.is-clickable{cursor:pointer}
.hv-assignees{display:flex;align-items:center}
.hv-av.hub-widget-dot.is-avatar{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;flex:none;color:#fff;font-size:9.5px;font-weight:800;background:linear-gradient(145deg,hsl(var(--h) 70% 60%),hsl(calc(var(--h) + 28) 65% 44%));box-shadow:0 0 0 2px var(--surface);overflow:hidden}
.hv-assignees .hv-av+.hv-av{margin-left:-7px}
.hv-av.is-more{display:grid;place-items:center;width:26px;height:26px;margin-left:-7px;border-radius:50%;font-size:9.5px;font-weight:800;color:var(--text-secondary);background:color-mix(in srgb,var(--text) 8%,var(--surface));box-shadow:0 0 0 2px var(--surface)}
.hv-expand{display:grid;place-items:center;width:30px;height:30px;padding:0;border:1px solid color-mix(in srgb,var(--text) 10%,transparent);border-radius:50%;background:var(--surface);color:var(--text-secondary);cursor:pointer;transition:transform .3s cubic-bezier(.22,1,.36,1),color .2s}
.hv-expand svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.hv-expand[aria-expanded=true]{transform:rotate(180deg);color:var(--acc)}
.hv-task-wrap{border-radius:18px;border:1px solid color-mix(in srgb,var(--acc) 28%,transparent);background:color-mix(in srgb,var(--acc) 4%,var(--surface));box-shadow:0 14px 30px -22px var(--acc);overflow:hidden}
.hv-task-wrap>.hv-task{border:0;border-radius:0;background:transparent;animation:none}
.hv-task-more{display:grid;gap:14px;padding:4px 16px 16px 52px;animation:hw-in .3s cubic-bezier(.22,1,.36,1)}
.hv-more-sec{display:grid;gap:8px}
.hv-more-sec h5{margin:0;font-size:10.5px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--text-secondary)}
.hv-chips{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.hv-chip{display:inline-flex;align-items:center;gap:7px;padding:3px 6px 3px 3px;border-radius:999px;font-size:12.5px;font-weight:600;background:var(--surface);border:1px solid color-mix(in srgb,var(--text) 9%,transparent)}
.hv-chip .hv-av{box-shadow:none}
.hv-chip-x{display:grid;place-items:center;width:20px;height:20px;padding:0;border:0;border-radius:50%;background:color-mix(in srgb,var(--text) 7%,transparent);color:var(--text-secondary);font-size:14px;line-height:1;cursor:pointer}.hv-chip-x:hover{background:#ef4444;color:#fff}
.hv-select{min-height:32px;padding:4px 10px;border:1px solid color-mix(in srgb,var(--text) 14%,transparent);border-radius:10px;background:var(--surface);color:var(--text);font-family:inherit;font-size:12.5px;font-weight:600}
.hv-select:disabled{opacity:.55}
.hv-desc{margin:0;font-size:13px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}.hv-desc.is-sup{padding:8px 10px;border-radius:10px;background:color-mix(in srgb,#f59e0b 10%,transparent)}
.hv-settings{display:flex;flex-wrap:wrap;gap:10px 16px}
.hv-setting{display:grid;gap:4px}.hv-setting>span{font-size:11px;font-weight:700;color:var(--text-secondary)}
.hv-toggle{display:inline-flex;align-items:center;gap:8px;min-height:32px;padding:0 12px 0 6px;border:1px solid color-mix(in srgb,var(--text) 14%,transparent);border-radius:999px;background:var(--surface);color:var(--text);font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer}
.hv-toggle i{position:relative;width:30px;height:18px;border-radius:999px;background:color-mix(in srgb,var(--text) 18%,transparent);transition:background .25s}
.hv-toggle i::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.3);transition:transform .25s cubic-bezier(.34,1.4,.5,1)}
.hv-toggle.is-on i{background:var(--acc)}.hv-toggle.is-on i::after{transform:translateX(12px)}
.hv-pill-sm{align-self:start;padding:4px 10px;border-radius:999px;font-size:11.5px;font-weight:700;color:var(--text-secondary);background:color-mix(in srgb,var(--text) 7%,transparent)}.hv-pill-sm.is-high{color:#dc2626;background:color-mix(in srgb,#ef4444 12%,transparent)}
.hv-notes-list{display:grid;gap:8px}
.hv-note-row{display:flex;gap:10px;align-items:flex-start}.hv-note-row>div{flex:1;min-width:0;padding:8px 12px;border-radius:4px 14px 14px 14px;background:var(--surface);border:1px solid color-mix(in srgb,var(--text) 7%,transparent)}
.hv-note-row p{margin:0 0 3px;font-size:13px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}.hv-note-row small{font-size:11px;color:var(--text-secondary)}
.hv-note-add{display:flex;gap:8px;align-items:flex-end}
.hv-note-add textarea{flex:1;min-height:40px;padding:8px 12px;border:1px solid color-mix(in srgb,var(--text) 14%,transparent);border-radius:12px;background:var(--surface);color:var(--text);font-family:inherit;font-size:13px;resize:vertical}
@media(max-width:640px){.hv-task{grid-template-columns:auto minmax(0,1fr) auto auto}.hv-task .hv-tag{display:none}.hv-task-more{padding:4px 12px 14px}}
/* "i" = install help (serif-style info glyph); "?" = widget tour. */
.hub-info-button{font-family:Georgia,"Times New Roman",serif;font-style:italic;font-weight:700}
/* Widget tour */
.hwt-layer{position:fixed;inset:0;z-index:2000}
.hwt-hole{position:fixed;border-radius:22px;box-shadow:0 0 0 9999px color-mix(in srgb,#05060a 58%,transparent),0 0 0 2px color-mix(in srgb,#fff 70%,transparent),0 0 30px 4px color-mix(in srgb,var(--brand) 35%,transparent);transition:top .45s cubic-bezier(.22,1,.36,1),left .45s cubic-bezier(.22,1,.36,1),width .45s cubic-bezier(.22,1,.36,1),height .45s cubic-bezier(.22,1,.36,1);pointer-events:none}
.hwt-card{position:fixed;display:grid;gap:10px;padding:16px 18px;border-radius:20px;color:var(--text);background:color-mix(in srgb,var(--surface) 94%,transparent);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border:1px solid color-mix(in srgb,var(--text) 10%,transparent);box-shadow:0 30px 60px -24px rgba(0,0,0,.55);transition:top .45s cubic-bezier(.22,1,.36,1),left .45s cubic-bezier(.22,1,.36,1)}
.hwt-card.is-in{animation:hwt-in .4s cubic-bezier(.22,1,.36,1)}
@keyframes hwt-in{from{opacity:0;transform:translateY(8px) scale(.98)}}
.hwt-head{display:flex;align-items:center;justify-content:space-between}
.hwt-count{font-size:10.5px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--brand)}
.hwt-x{display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;border-radius:50%;background:color-mix(in srgb,var(--text) 7%,transparent);color:var(--text);font-size:18px;line-height:1;cursor:pointer}
.hwt-card h3{margin:0;font-size:17px;font-weight:750;letter-spacing:-.01em}
.hwt-card p{margin:0;font-size:13.5px;line-height:1.55;color:var(--text-secondary)}
.hwt-bar{height:4px;border-radius:99px;background:color-mix(in srgb,var(--text) 9%,transparent);overflow:hidden}.hwt-bar i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--rose-400,#fb7185),var(--brand));transition:width .45s cubic-bezier(.22,1,.36,1)}
.hwt-actions{display:flex;align-items:center;gap:8px}.hwt-actions>span{flex:1}
.hwt-skip{padding:6px 4px;border:0;background:none;color:var(--text-secondary);font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer}
.hwt-btn{min-height:34px;padding:0 16px;border-radius:999px;border:1px solid color-mix(in srgb,var(--text) 14%,transparent);background:var(--surface);color:var(--text);font-family:inherit;font-size:12.5px;font-weight:650;cursor:pointer}
.hwt-btn:disabled{opacity:.4;cursor:default}
.hwt-btn.is-primary{border-color:transparent;color:#fff;background:linear-gradient(145deg,var(--rose-400,#fb7185),var(--brand));box-shadow:0 8px 18px -10px var(--brand)}
@media(prefers-reduced-motion:reduce){.hwt-hole,.hwt-card{transition:none}.hwt-card.is-in{animation:none}}
/* Mailbox: Junk approval + user folders */
.mailbox-tool--approve{color:#fff!important;border-color:transparent!important;background:linear-gradient(145deg,#34d399,#059669)!important}
.mailbox-folder{display:flex;align-items:center;justify-content:space-between;gap:8px}
.mailbox-folder--custom{font-size:.92em;opacity:.92}
.mailbox-folder-count{min-width:20px;padding:1px 7px;border-radius:999px;font-size:11px;font-weight:700;text-align:center;color:#fff;background:var(--brand)}
.hv-junk-actions{display:flex;gap:6px;flex:none;margin-left:6px}
.hv-junk-actions .hv-btn{min-height:30px;padding:0 12px;font-size:12px}
.hv-junk-actions .is-approve{color:#fff;border-color:transparent;background:linear-gradient(145deg,#34d399,#059669)}
.hv-junk-actions .is-deny{color:#dc2626;border-color:color-mix(in srgb,#ef4444 35%,transparent)}
/* Password fields: our eye button is always visible; hide Edge/IE's own reveal (it only appears while typing and overlaps ours). */
input[type="password"]::-ms-reveal,input[type="password"]::-ms-clear{display:none}
.input-wrap input[type="password"],.input-wrap input#password,.input-wrap input#zimbra-password{padding-right:44px}
.input-wrap .icon-button{z-index:2;display:grid;place-items:center;color:var(--text-secondary,var(--slate-500));opacity:1;visibility:visible}
.input-wrap .icon-button svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.input-wrap .icon-button:hover,.input-wrap .icon-button[aria-pressed="true"]{color:var(--brand)}
.password-field .password-toggle{z-index:2;visibility:visible;opacity:1}
/* Customise widgets */
.hub-customize-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px 12px;margin:-6px 0 12px}
.hub-customize-bar[hidden]{display:none}
.hub-customize-btn{display:inline-flex;align-items:center;gap:7px;min-height:32px;padding:0 14px 0 11px;border-radius:999px;border:1px solid color-mix(in srgb,var(--text) 12%,transparent);background:var(--surface);color:var(--text);font-family:inherit;font-size:12.5px;font-weight:650;cursor:pointer;box-shadow:0 6px 16px -12px color-mix(in srgb,var(--text) 50%,transparent);transition:transform .2s,background .2s}
.hub-customize-btn svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.hub-customize-btn:hover{transform:translateY(-1px)}
.hub-customize-btn.is-on{color:#fff;border-color:transparent;background:linear-gradient(145deg,var(--rose-400,#fb7185),var(--brand))}
.hub-customize-hint{font-size:12px;color:var(--text-secondary)}
.hub-customize-link{border:0;background:none;padding:4px;color:var(--text-secondary);font-family:inherit;font-size:12px;font-weight:600;text-decoration:underline;cursor:pointer}
.hub-customize-tray{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px}.hub-customize-tray small{font-size:11.5px;color:var(--text-secondary)}
.hub-customize-chip{padding:4px 10px;border-radius:999px;border:1px dashed color-mix(in srgb,var(--text) 25%,transparent);background:var(--surface);color:var(--text);font-family:inherit;font-size:12px;font-weight:600;cursor:pointer}.hub-customize-chip:hover{border-style:solid;border-color:var(--brand);color:var(--brand)}
.hub-widgets.is-editing .hub-widget{cursor:grab;outline:2px dashed color-mix(in srgb,var(--acc,var(--brand)) 45%,transparent);outline-offset:3px;animation:none}
.hub-widgets.is-editing .hub-widget:hover{transform:none}
.hub-widgets.is-editing .hub-widget-body,.hub-widgets.is-editing .hub-widget-tools{pointer-events:none}
.hub-widgets.is-editing .hub-widget-body{opacity:.75}
.hub-widget.is-dragging{opacity:.45;cursor:grabbing}
.hub-widget-hide{position:absolute;top:8px;right:8px;z-index:9;display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;border-radius:50%;background:#1f2937;color:#fff;font-size:17px;line-height:1;cursor:pointer;box-shadow:0 6px 14px -6px rgba(0,0,0,.5);transition:transform .2s,background .2s}
.hub-widget-hide:hover{background:#dc2626;transform:scale(1.08)}
@media(pointer:coarse){.hub-customize-hint::after{content:" (long-press on desktop browsers only)";display:none}}
/* Swipe rows (touch) */
.hv-swipe{position:relative;border-radius:16px;overflow:hidden}
.hv-swipe>:not(.hv-swipe-bg){position:relative;z-index:1;touch-action:pan-y}
.hv-swipe-bg{position:absolute;inset:0;display:flex;align-items:center;padding:0 18px;font-size:13px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:#fff;opacity:0;transition:opacity .15s}
.hv-swipe-bg.is-right{justify-content:flex-start}.hv-swipe-bg.is-left{justify-content:flex-end}
.hv-swipe[data-dir="right"] .hv-swipe-bg.is-right,.hv-swipe[data-dir="left"] .hv-swipe-bg.is-left{opacity:.75}
.hv-swipe.is-armed[data-dir="right"] .hv-swipe-bg.is-right,.hv-swipe.is-armed[data-dir="left"] .hv-swipe-bg.is-left{opacity:1}
.hv-swipe-bg.is-good{background:linear-gradient(90deg,#059669,#34d399)}.hv-swipe-bg.is-bad{background:linear-gradient(270deg,#dc2626,#f87171)}.hv-swipe-bg.is-info{background:linear-gradient(270deg,#2563eb,#60a5fa)}
/* Tour card: appears in place (no glide from the previous step). */
.hwt-card{transition:none}
/* Header: no notifications bell; calm, consistent glass outline icons for theme / help / install. */
#notifications-button{display:none!important}
.topbar-right .theme-toggle,.topbar-right .install-help-button{display:grid;place-items:center;width:38px;height:38px;padding:0;border-radius:12px;border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.1);color:#fff;font-size:0;box-shadow:inset 0 1px 0 rgba(255,255,255,.18);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);transition:background .25s,transform .25s cubic-bezier(.34,1.4,.5,1),border-color .25s}
.topbar-right .theme-toggle:hover,.topbar-right .install-help-button:hover{background:rgba(255,255,255,.2);border-color:rgba(255,255,255,.35);transform:translateY(-1px)}
.topbar-right .theme-toggle svg,.topbar-right .install-help-button svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.topbar-right .install-help-button[hidden]{display:none}
.hub-info-button{font-style:normal}
/* Embedded app cards (ClockIn, Tasks, Warehouse): transparent frames, so the card well behind them is the one background that switches theme. */
.hub-widgets .hub-widget[data-app] .hub-widget-data>iframe{background:transparent!important;color-scheme:inherit}
/* Users View: floating calendar button (opens the shared Medha Calendar). */
.hub-page[data-app="users"] .hub-page-body{position:relative;min-height:300px}
.hv-cal-fab{position:absolute;right:18px;bottom:18px;display:grid;place-items:center;width:50px;height:50px;padding:0;border:0;border-radius:50%;color:#fff;background:linear-gradient(145deg,var(--acc2,#22d3ee),var(--acc,#0891b2));box-shadow:inset 0 1px 0 rgba(255,255,255,.3),0 14px 28px -10px var(--acc,#0891b2);cursor:pointer;transition:transform .25s cubic-bezier(.34,1.4,.5,1)}
.hv-cal-fab:hover{transform:translateY(-3px) scale(1.05)}
.hv-cal-fab svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
/* Admin / HR team sections in View popups */
.hv-team{grid-column:1/-1;display:grid;gap:14px}
.hv-team .hv-card-head{margin:0}
.hv-team-tag{padding:3px 10px;border-radius:999px;font-size:10.5px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--acc);background:color-mix(in srgb,var(--acc) 12%,transparent)}
.hv-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}
.hv-kpi{--c:var(--acc);display:grid;align-content:start;gap:2px;padding:12px 14px;border-radius:16px;text-align:left;border:1px solid color-mix(in srgb,var(--text) 7%,transparent);background:var(--surface);color:var(--text);font-family:inherit;box-shadow:0 8px 18px -16px color-mix(in srgb,var(--text) 50%,transparent)}
button.hv-kpi{cursor:pointer;transition:transform .2s}button.hv-kpi:hover{transform:translateY(-2px)}
.hv-kpi b{font-size:24px;font-weight:800;line-height:1.05;letter-spacing:-.03em;color:var(--c);font-variant-numeric:tabular-nums}
.hv-kpi span{font-size:12px;font-weight:700}.hv-kpi small{font-size:11px;color:var(--text-secondary)}
.hv-kpi.is-good{--c:#059669}.hv-kpi.is-warn{--c:#d97706}.hv-kpi.is-alert{--c:#dc2626;border-color:color-mix(in srgb,#ef4444 30%,transparent);background:color-mix(in srgb,#ef4444 5%,var(--surface))}
.hv-kpi.is-ring{display:flex;align-items:center;gap:12px}.hv-kpi.is-ring>div{display:grid;gap:2px}
.hv-ring{--v:0;position:relative;display:grid;place-items:center;flex:none;width:52px;height:52px;border-radius:50%;background:conic-gradient(var(--acc) calc(var(--v)*1%),color-mix(in srgb,var(--text) 9%,transparent) 0)}
.hv-ring::before{content:"";position:absolute;inset:5px;border-radius:50%;background:var(--surface)}
.hv-ring b{position:relative;font-size:16px}
.hv-team-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:14px}
.hv-team-col{display:grid;align-content:start;gap:6px;padding:12px;border-radius:16px;background:color-mix(in srgb,var(--text) 3%,transparent)}
.hv-team h5,.hv-sub{margin:0;font-size:10.5px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--text-secondary)}
.hv-person-row{display:flex;align-items:center;gap:9px;padding:5px 2px;font-size:13px;font-weight:600}
.hv-person-row>span:nth-child(2){flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hv-person-row time,.hv-person-row>small{font-size:11.5px;color:var(--text-secondary);font-variant-numeric:tabular-nums}
.hv-person-row .hv-tag.is-late{color:#b45309!important;background:color-mix(in srgb,#f59e0b 15%,transparent)}.hv-person-row .hv-tag.is-ok{color:#059669!important;background:color-mix(in srgb,#10b981 13%,transparent)}
.hv-person-row.is-progress>span:nth-child(2){flex:0 1 160px}
.hv-mini-bar{flex:1;height:7px;border-radius:99px;background:color-mix(in srgb,var(--text) 9%,transparent);overflow:hidden}.hv-mini-bar i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--acc2),var(--acc))}
.hv-progress-list{display:grid;gap:2px}
.hv-bars{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;align-items:end;gap:8px;height:150px;padding-top:16px}
.hv-bar{position:relative;display:grid;grid-template-rows:auto 1fr auto;align-items:end;justify-items:center;height:100%;gap:4px}
.hv-bar i{display:block;width:100%;max-width:34px;height:var(--h);border-radius:8px 8px 4px 4px;background:color-mix(in srgb,var(--acc) 35%,transparent);animation:hv-bar-in .6s cubic-bezier(.22,1,.36,1) both;animation-delay:calc(var(--i)*40ms);transform-origin:bottom}
.hv-bar.is-now i{background:linear-gradient(180deg,var(--acc2),var(--acc))}
.hv-bar em{font-style:normal;font-size:10.5px;font-weight:700;color:var(--text-secondary);font-variant-numeric:tabular-nums}.hv-bar small{font-size:10.5px;color:var(--text-secondary)}
@keyframes hv-bar-in{from{transform:scaleY(.1);opacity:.4}}
.hv-notin{display:grid;gap:8px}
@media(max-width:760px){.hv-team-grid{grid-template-columns:minmax(0,1fr)}}
@media(prefers-reduced-motion:reduce){.hv-bar i{animation:none}}
/* ClockIn View: approvals + employee board (admin / HR) */
.hv-clock.is-admin{grid-template-columns:minmax(0,1fr)}
.hv-clock>[hidden]{display:none!important}
.hv-team-clock{margin-left:auto;margin-right:10px;font-size:15px;font-weight:800;letter-spacing:-.01em;font-variant-numeric:tabular-nums}
.hv-approvals{gap:10px}
.hv-appr{display:grid;gap:8px;padding:12px 14px;border-radius:16px;border:1px solid color-mix(in srgb,var(--text) 8%,transparent);background:var(--surface);transition:opacity .25s,transform .25s}
.hv-appr.is-gone{opacity:0;transform:translateX(16px)}
.hv-appr-top{display:flex;align-items:center;gap:9px;font-size:13.5px}.hv-appr-top strong{flex:1;min-width:0}.hv-appr-top small{font-size:11px;color:var(--text-secondary)}
.hv-appr .hv-tag.is-new{color:#2563eb!important;background:color-mix(in srgb,#2563eb 12%,transparent)}.hv-appr .hv-tag.is-change{color:#7c3aed!important;background:color-mix(in srgb,#7c3aed 12%,transparent)}
.hv-appr-times{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px}
.hv-appr-times span{display:grid;gap:2px;padding:8px 10px;border-radius:12px;font-size:12.5px;font-weight:600;font-variant-numeric:tabular-nums;background:color-mix(in srgb,var(--text) 4%,transparent)}
.hv-appr-times span.is-was{color:var(--text-secondary);text-decoration:line-through;text-decoration-color:color-mix(in srgb,var(--text) 30%,transparent)}
.hv-appr-times span.is-now{background:color-mix(in srgb,#10b981 9%,transparent)}
.hv-appr-times small{font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--text-secondary);text-decoration:none}
.hv-appr-note{margin:0;font-size:12.5px;color:var(--text-secondary);font-style:italic}
.hv-appr-actions{display:flex;justify-content:flex-end;gap:8px}
.hv-appr-actions .is-approve{color:#fff;border-color:transparent;background:linear-gradient(145deg,#34d399,#059669)}.hv-appr-actions .is-deny{color:#dc2626;border-color:color-mix(in srgb,#ef4444 35%,transparent)}
.hv-emp{display:grid;gap:4px}
.hv-emp-row{display:grid;grid-template-columns:auto minmax(110px,1fr) minmax(80px,2fr) auto auto auto;align-items:center;gap:10px;padding:6px 4px;font-size:13px}
.hv-emp-name{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hv-emp-row b{font-variant-numeric:tabular-nums}.hv-emp-row small{font-size:11.5px;color:var(--text-secondary)}
.hv-ontime{padding:3px 9px;border-radius:999px;font-size:11px;font-weight:700;white-space:nowrap}.hv-ontime.is-good{color:#059669;background:color-mix(in srgb,#10b981 13%,transparent)}.hv-ontime.is-warn{color:#b45309;background:color-mix(in srgb,#f59e0b 15%,transparent)}.hv-ontime.is-bad{color:#dc2626;background:color-mix(in srgb,#ef4444 12%,transparent)}
@media(max-width:640px){.hv-emp-row{grid-template-columns:auto minmax(0,1fr) auto auto}.hv-emp-row .hv-mini-bar,.hv-emp-row small{display:none}}
/* Safari: content-sized popups must size the body from its content (flex-basis 0 collapsed it to the header). */
.hub-page[data-app="clockin"] .hub-page-body,.hub-page[data-app="tasks"] .hub-page-body,.hub-page[data-app="users"] .hub-page-body,.hub-page[data-app="files"] .hub-page-body{flex:0 1 auto}

/* Official Apple "Download on the App Store" badge (install instructions). */
.install-store { margin-top: 14px; display: grid; gap: 8px; justify-items: start; }
.install-store .install-step-summary { margin: 0; }
.app-store-badge { display: inline-flex; border-radius: 10px; line-height: 0; }
.app-store-badge img { height: 50px; width: auto; display: block; }
.app-store-badge:focus-visible { outline: 2px solid var(--brand-solid, var(--brand)); outline-offset: 3px; }

/* Forgot password (login card). */
.label-row-split { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.text-link { border: 0; background: none; padding: 0; color: var(--rose-600); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.text-link:hover { text-decoration: underline; }
.text-link:disabled { opacity: .5; cursor: default; text-decoration: none; }
.reset-panel { text-align: left; }
.reset-panel form { display: grid; gap: 6px; }
.reset-panel .primary-button { width: 100%; margin-top: 12px; }
.reset-code { font-size: 22px !important; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }
.reset-resend, .reset-back { display: block; margin: 14px auto 0; }
.reset-banner { margin: 0 0 16px; padding: 10px 12px; border-radius: var(--radius-control); font-size: 13px; line-height: 1.45;
  background: color-mix(in srgb, var(--rose-600) 10%, transparent); color: var(--rose-600); border: 1px solid color-mix(in srgb, var(--rose-600) 30%, transparent); }
.reset-banner.is-success { background: color-mix(in srgb, #16a34a 10%, transparent); color: #15803d; border-color: color-mix(in srgb, #16a34a 30%, transparent); }
.login-banner { margin: 0 0 14px; }

/* Login: round "Get the app" buttons (App Store / Google Play). */
.login-apps { display:flex; align-items:center; justify-content:center; gap:12px; margin:18px 0 2px; }
.login-apps-label { font-size:13px; font-weight:600; color:var(--muted, #64748b); }
.login-app-icon { width:44px; height:44px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; border:1px solid var(--border, #e2e8f0); box-shadow:0 2px 8px rgba(15,23,42,.08); transition:transform .15s ease, box-shadow .15s ease; }
.login-app-icon:hover, .login-app-icon:focus-visible { transform:translateY(-1px); box-shadow:0 6px 16px rgba(15,23,42,.14); }
.login-app-icon svg { width:22px; height:22px; }
.login-app-ios { background:#000; border-color:#000; }
.login-app-android { background:#fff; }
.login-app-android svg { width:20px; height:20px; margin-left:3px; }

/* Email popup: header holds only Reply / Reply all / Forward / × (never cut
   off); the subject gets its own full-width row underneath and wraps. */
.mail-thread-header.mail-thread-header-actions-only { justify-content: flex-end; padding-top: 14px; padding-bottom: 14px; }
.mail-thread-header-actions-only .mail-thread-header-actions { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.mail-thread-subject-bar { padding: 16px 24px 4px; }
.mail-thread-subject-bar h2 { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 800; color: var(--text, #0f172a); white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .mail-thread-header.mail-thread-header-actions-only { padding: 10px 12px; }
  .mail-thread-header-actions-only .mail-thread-header-actions { gap: 6px; }
  .mail-thread-header-actions-only .mail-thread-reply { padding: 8px 12px; font-size: 14px; }
  .mail-thread-subject-bar { padding: 12px 16px 2px; }
  .mail-thread-subject-bar h2 { font-size: 18px; }
}
@media (max-width: 640px) {
  /* Phone: the email popup fills the screen exactly (no side offset or overflow). */
  .mail-thread-overlay { padding: 0 !important; justify-content: stretch; align-items: stretch; }
  .mail-thread-overlay .mail-thread-dialog { width: 100% !important; max-width: 100% !important; margin: 0 !important; box-sizing: border-box; }
  .mail-thread-header-actions-only .mail-thread-close { flex: none; }
}

/* Mobile header: '?' + App Store / Google Play icons; no mail entry. */
.topbar-right .store-link{display:none;text-decoration:none}
.topbar-right .store-link svg{fill:currentColor;stroke:none}
@media (max-width: 768px){
  .topbar-right .store-link{display:grid}
  .topbar-right #install-help-button:not([hidden]){display:grid}
  .apps-topbar #mail-login-button{display:none}
}
@media (display-mode: standalone){.topbar-right .store-link{display:none}}

/* Sign-in footer: get the phone app. */
.get-app{margin-top:22px;display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center}
.get-app>span{font-size:12px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--text-muted,#6b7280)}
.get-app-links{display:flex;flex-wrap:wrap;justify-content:center;gap:10px}
.get-app-links a{display:block;border-radius:10px;transition:transform .15s ease,box-shadow .15s ease}
.get-app-links a:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(0,0,0,.18)}
.get-app-links img{display:block;height:44px;width:auto}
@media (display-mode: standalone){.get-app{display:none}}
@media (max-width: 400px){
  .apps-topbar{gap:6px;padding:10px 10px}
  .topbar-right{gap:5px}
  .topbar-right .theme-toggle,.topbar-right .install-help-button,.topbar-right .notifications-button{width:32px;height:32px;border-radius:10px}
}

/* Holiday banner: month + date tag under the closed days. */
.hub-banner-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.hub-banner-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; letter-spacing: .01em; color: #b91c1c; background: rgba(220, 38, 38, .1); border: 1px solid rgba(220, 38, 38, .25); }
.is-event .hub-banner-tag { color: #1d4ed8; background: rgba(37, 99, 235, .1); border-color: rgba(37, 99, 235, .25); }
.is-birthday .hub-banner-tag { color: #a21caf; background: rgba(192, 38, 211, .1); border-color: rgba(192, 38, 211, .25); }
:root[data-theme="dark"] .hub-banner-tag { color: #fca5a5; background: rgba(248, 113, 113, .14); border-color: rgba(248, 113, 113, .3); }

/* Simple Hub clock: light, even-width numerals; blinking colon; spaced AM/PM */
.hv-simple-clock{display:flex;align-items:flex-end;line-height:.9;font-variant-numeric:tabular-nums;color:var(--text,#0f172a);
  font-family:"SF Pro Display",-apple-system,BlinkMacSystemFont,"Helvetica Neue",system-ui,sans-serif}
.hv-sc-num{font-size:clamp(50px,9vw,72px);font-weight:300;letter-spacing:-.035em}
.hv-sc-dots{font-size:clamp(46px,8.4vw,66px);font-weight:300;margin:0 .04em;transform:translateY(-.08em);animation:hv-sc-blink 1.2s ease-in-out infinite}
.hv-sc-ampm{margin:0 0 .5em .55em;font-size:13px;font-weight:600;letter-spacing:.2em;opacity:.5}
@keyframes hv-sc-blink{0%,100%{opacity:1}50%{opacity:.12}}
@media (prefers-reduced-motion:reduce){.hv-sc-dots{animation:none}}
