/* ============================================================================
   Office Suite workspace — combined sign-in + module launcher grid + the
   notifications bell. Built on top of the shared token system in styles.css
   (copied from the HRMS app, byte-identical base) so this stays visually
   consistent with both sub-apps.
   ============================================================================ */

.login-wrap.suite { background: linear-gradient(160deg, var(--color-bg) 0%, #eef1f8 100%); }
.login-card.suite { max-width: 400px; }
/* App "logo" badge — see ui.js's brandMark()/BRAND_MARK_SVG for what it is
   and why. Base look + icon centering lives in .brand-mark; this and .mark
   below are just the two size variants used on this page. */
.brand-mark { background: var(--color-primary); color: #fff; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.suite-mark { width: 44px; height: 44px; margin-bottom: 14px; }
.login-card.suite h1 { font-size: 19px; }
.suite-apps-hint { display: flex; gap: 8px; margin: 14px 0 4px; flex-wrap: wrap; }
.suite-apps-hint .chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 5px 10px; border-radius: 999px; background: var(--color-surface-alt);
  border: 1px solid var(--color-border); color: var(--color-text-muted);
}

.workspace-topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.workspace-topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; }
.workspace-topbar .brand .mark { width: 30px; height: 30px; border-radius: 8px; }
.workspace-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.workspace-user .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary-bg); color: var(--color-primary-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
/* rightWrap in buildTopbar() (app.js) — deliberately its own class rather
   than changing the global .flex utility, so this can wrap on narrow
   viewports without affecting the tight single-row layouts .flex is used
   for elsewhere. */
.topbar-right { flex-wrap: wrap; justify-content: flex-end; }
.workspace-body { max-width: 1180px; margin: 0 auto; padding: 28px; }
.workspace-hello { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.workspace-sub { color: var(--color-text-muted); font-size: 13.5px; margin: 0 0 28px; }

.suite-section { margin-bottom: 32px; }
.suite-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.suite-section-head .title-group { display: flex; align-items: center; gap: 10px; }
.suite-section-head .suite-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.suite-icon.hrms { background: var(--color-primary-bg); }
.suite-icon.po { background: var(--color-green-bg); }
.suite-icon.dclink { background: var(--color-orange-bg); }
.suite-section-head h2 { font-size: 15px; margin: 0; }
.suite-section-head .count { font-size: 12px; color: var(--color-text-muted); }
.suite-section-head .role-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 4px 10px; border-radius: 999px; }
.role-badge.hrms { background: var(--color-primary-bg); color: var(--color-primary-dark); }
.role-badge.po { background: var(--color-green-bg); color: var(--color-green); }
.role-badge.dclink { background: var(--color-orange-bg); color: var(--color-orange); }

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.module-card {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 16px; cursor: pointer; transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit;
}
.module-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--color-primary); text-decoration: none; }
.module-card .icon { width: 36px; height: 36px; border-radius: 9px; background: var(--color-surface-alt); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.module-card .label { font-weight: 700; font-size: 13.5px; }
.module-card .desc { font-size: 11.5px; color: var(--color-text-muted); line-height: 1.4; }
.module-card.restricted { opacity: 0.5; cursor: not-allowed; }
.module-card.restricted:hover { box-shadow: none; transform: none; border-color: var(--color-border); }
.module-card .top-row { display: flex; align-items: flex-start; justify-content: space-between; }
.module-card .lock { font-size: 11px; color: var(--color-text-muted); margin-left: auto; }

.no-access-panel { text-align: center; padding: 40px 20px; }

/* --- Company picker (step 1) --- */
.company-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.company-card .icon { background: var(--color-primary-bg); }

/* --- Suite picker (step 2) --- */
.suite-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: 700px; }
.suite-choice-card {
  position: relative; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg, 14px);
  padding: 28px 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  text-decoration: none; color: inherit; transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
}
.suite-choice-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--color-primary); text-decoration: none; }
.suite-choice-icon { font-size: 32px; }
.suite-choice-label { font-weight: 800; font-size: 17px; }
.suite-choice-desc { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.5; }
.suite-choice-card .role-badge { position: absolute; top: 20px; right: 20px; }

/* --- Topbar back link + admin action buttons --- */
.back-link {
  font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); text-decoration: none;
  padding: 6px 10px; border-radius: var(--radius-sm); background: var(--color-surface-alt); border: 1px solid var(--color-border);
}
.back-link:hover { color: var(--color-primary-dark); text-decoration: none; }
.topbar-admin-actions { display: flex; gap: 8px; }

/* --- Notifications bell --- */
.bell-wrap { position: relative; }
.bell-btn { position: relative; background: var(--color-surface); }
.bell-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: 999px; background: var(--color-red); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.bell-badge.due-soon { background: var(--color-orange); }
.bell-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: min(340px, calc(100vw - 32px)); max-height: 420px; overflow-y: auto;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); z-index: 50;
}
.bell-dropdown .bell-head { padding: 12px 14px; border-bottom: 1px solid var(--color-border); font-weight: 700; font-size: 13px; }
.bell-item { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; border-bottom: 1px solid var(--color-border); font-size: 12.5px; }
.bell-item:last-child { border-bottom: none; }
.bell-item .bell-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bell-item .bell-app-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--color-text-muted); }
.bell-empty { padding: 20px 14px; text-align: center; color: var(--color-text-muted); font-size: 12.5px; }

/* --- Grouped sidebar (used by both sub-apps) --- */
.sidebar-switch {
  margin: 8px 10px 4px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--color-surface-alt); border: 1px solid var(--color-border);
  font-size: 12px; font-weight: 600; color: var(--color-text-muted);
  display: flex; align-items: center; gap: 6px; text-decoration: none;
}
.sidebar-switch:hover { background: var(--color-primary-bg); color: var(--color-primary-dark); text-decoration: none; }
.sidebar-group { margin-bottom: 2px; }
.sidebar-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 12px 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--color-text-muted); cursor: pointer; user-select: none;
}
.sidebar-group-head .chev { transition: transform 0.15s; font-size: 9px; display: inline-block; }
.sidebar-group.collapsed .chev { transform: rotate(-90deg); }
.sidebar-group.collapsed .sidebar-group-items { display: none; }
.sidebar-group-items { padding-bottom: 4px; }
.sidebar-nav.grouped { padding: 6px; }

/* --- Small-phone safety net (~480px and below) --- */
@media (max-width: 480px) {
  .module-grid, .company-grid, .suite-choice-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 16px 10px; }
  .workspace-body { padding: 16px; }
  .workspace-topbar { padding: 10px 14px; }
  .workspace-user span:first-child { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* .bell-dropdown is positioned `right:0` relative to its own small
     .bell-wrap, which can land anywhere once .topbar-right wraps onto its
     own row — anchoring to the viewport edge instead keeps it on screen
     regardless of where that wrap ends up. */
  .bell-dropdown { position: fixed; top: 64px; right: 12px; left: 12px; width: auto; max-height: calc(100vh - 80px); }
}
