/* WP50 dashboard screens. Tokens only (tokens.css); shared components live in ui.css. */

/* header: greeting, branch and date, integrity and actions */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-6); }
main.cb-main .dash-title, .dash-title { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; color: var(--text); }
.dash-greeting { margin: var(--sp-1) 0 var(--sp-3); font-size: var(--fs-md); color: var(--text-secondary); }
.dash-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.dash-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface);
  color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
}
.dash-chip .icon { width: 14px; height: 14px; color: var(--text-muted); }
.dash-chip-sep { width: 1px; height: 12px; background: var(--border-strong); }
.dash-actions { display: flex; align-items: center; gap: var(--sp-2); }
.dash-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: var(--r-pill); background: var(--surface-sunken); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 550; text-decoration: none; white-space: nowrap;
}
.dash-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.dash-pill.is-ok { background: var(--success-subtle); border-color: transparent; color: var(--success); }
.dash-pill.is-ok .dot { background: var(--success); }
.dash-pill.is-fail { background: var(--danger-subtle); border-color: transparent; color: var(--danger); }
.dash-pill.is-fail .dot { background: var(--danger); }

/* widget grid: 4 columns; a widget spans 1 (small), 2 (medium) or 4 (wide); dense packing fills the gaps */
.widget-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: row dense; gap: var(--sp-4); align-items: stretch; }
.widget-1 { grid-column: span 1; }
.widget-2 { grid-column: span 2; }
.widget-4 { grid-column: 1 / -1; }
.widget {
  display: flex; flex-direction: column; min-width: 0; padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--surface);
}
.widget-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
main.cb-main .widget-head h2, .widget-head h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.widget-more { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.widget-more .icon { width: 12px; height: 12px; }
.widget-more:hover, .widget-more:focus-visible { color: var(--accent-text); }
.widget-body { position: relative; display: grid; gap: 2px; margin-bottom: var(--sp-2); }
.widget-foot { margin-top: auto; padding-top: var(--sp-2); border-top: 1px solid var(--border-subtle); font-size: var(--fs-xs); color: var(--text-muted); }
.widget-count {
  position: absolute; top: calc(-1 * var(--sp-2) - 22px); right: 0; min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--accent-subtle); color: var(--accent-text); font-size: var(--fs-xs); font-weight: 650; text-align: center; line-height: 20px;
}
.widget-head:has(.widget-more) + .widget-body .widget-count { display: none; }
.widget-figure { display: grid; gap: 2px; margin: 0 0 var(--sp-2); padding: 0 var(--sp-2); }
.widget-figure .num { justify-self: start; text-align: left; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); }
.widget-figure span:last-child { font-size: var(--fs-xs); color: var(--text-muted); }
.widget-total { display: flex; justify-content: space-between; margin-top: var(--sp-1); padding: 7px var(--sp-2) 0; border-top: 1px solid var(--border-subtle); font-size: var(--fs-sm); font-weight: 600; }
.widget-empty { display: flex; align-items: center; gap: var(--sp-2); margin: 0; padding: var(--sp-2); color: var(--text-muted); font-size: var(--fs-sm); }
.widget-empty .icon { width: 16px; height: 16px; flex: none; color: var(--text-faint); }
.widget-empty.is-good .icon { color: var(--success); }
.widget-empty.is-error { color: var(--danger); }
.widget-link {
  justify-self: start; margin: var(--sp-1) var(--sp-2) 0; padding: 0; border: 0; background: none; cursor: pointer;
  font: 500 var(--fs-sm) / 1.4 var(--font-ui); color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px;
}
.is-negative { color: var(--danger); }

/* loading: a quiet skeleton shaped like rows; the shimmer stops under reduced motion */
.skeleton { display: grid; gap: 10px; padding: var(--sp-2); }
.skeleton-line { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-sunken) 0%, var(--surface-hover) 50%, var(--surface-sunken) 100%); background-size: 200% 100%; animation: shimmer 1.4s var(--ease-in-out) infinite; }
.skeleton-line:nth-child(2) { width: 82%; }
.skeleton-line:nth-child(3) { width: 64%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton-line { animation: none; } }
.widget { animation: widget-in var(--dur-2) var(--ease-out); }
@keyframes widget-in { from { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .widget { animation: none; } }

/* announcements: a banner, not a card */
.widget[data-widget="announcements"] { padding: 0; border-color: transparent; background: none; }
.widget[data-widget="announcements"] .widget-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.announcement {
  display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-3) 10px var(--sp-4);
  border: 1px solid transparent; border-radius: var(--r-panel); background: var(--accent-subtle); color: var(--accent-text);
}
.announcement + .announcement { margin-top: var(--sp-2); }
.announcement > .icon { width: 18px; height: 18px; flex: none; }
.announcement-text { display: flex; flex-wrap: wrap; gap: 2px var(--sp-2); flex: 1; min-width: 0; }
.announcement-text strong { font-weight: 600; }
.announcement-text span { color: var(--text-secondary); }

/* the launcher and quick actions sit flat inside their widget */
.widget[data-widget="all-screens"] .launcher-search { margin-bottom: var(--sp-4); }
.health-integrity { margin: 0 0 var(--sp-2); padding: 0 var(--sp-2); }

/* customize sheet */
.dash-customize { width: min(440px, calc(100vw - 32px)); }
.customize-form { padding: 0 var(--sp-6) var(--sp-5); }
.customize-hint { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); }
.customize-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-ctrl); }
.customize-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 4px 4px 4px var(--sp-3); }
.customize-row + .customize-row { border-top: 1px solid var(--border-subtle); }
.customize-row label { display: flex; align-items: center; gap: var(--sp-2); flex: 1; min-height: 32px; cursor: pointer; }
.customize-move { display: flex; gap: 2px; }
.customize-move .icon-btn { width: 28px; height: 28px; }
.customize-actions { display: flex; justify-content: space-between; margin-top: var(--sp-4); }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.stat-card {
  display: grid; gap: 2px; padding: var(--sp-4); min-height: 104px;
  border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--surface);
  color: var(--text); text-decoration: none;
  transition: border-color var(--dur-1) var(--ease-out), transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-low); transform: translateY(-1px); }
.stat-card:focus-visible { border-color: var(--accent); border-radius: var(--r-panel); }
.stat-label { font-size: var(--fs-sm); font-weight: 550; color: var(--text-muted); }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.stat-foot { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; font-size: var(--fs-xs); color: var(--text-muted); }
.stat-foot .icon { width: 12px; height: 12px; opacity: 0; transform: translateX(-3px); transition: opacity var(--dur-1) var(--ease-out), transform var(--dur-2) var(--ease-out); }
.stat-card:hover .stat-foot .icon, .stat-card:focus-visible .stat-foot .icon { opacity: 1; transform: none; }
.dash-empty {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5) var(--sp-4);
  border: 1px dashed var(--border-strong); border-radius: var(--r-panel); color: var(--text-muted);
}
.dash-empty p { margin: 0; }
.dash-empty .icon { width: 20px; height: 20px; color: var(--text-faint); }

/* rows: one line per item, the whole row is the link */
.waiting-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 7px var(--sp-2); border-radius: var(--r-ctrl); color: var(--text); text-decoration: none;
  transition: background var(--dur-1) var(--ease-out);
}
.waiting-row:hover { background: var(--surface-hover); }
.row-main { display: grid; min-width: 0; }
.row-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: var(--fs-xs); color: var(--text-muted); }
.row-value { font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.waiting-row > .icon { width: 14px; height: 14px; flex: none; color: var(--text-faint); }
.waiting-row:hover > .icon, .waiting-row:focus-visible > .icon { color: var(--accent-text); }
.waiting-row.is-overdue .row-meta, .waiting-row.is-overdue .row-value, .waiting-row.is-overdue .row-title { color: var(--danger); }
.waiting-row.is-warning .row-title { color: var(--warning); }
.waiting-row.is-unread .row-title::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 6px 2px 0; border-radius: 50%; background: var(--accent); vertical-align: middle; }

/* quick actions */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--sp-2); }
.quick-action {
  display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--surface);
  color: var(--text); text-decoration: none; font-weight: 550;
  transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.quick-action:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.quick-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent-subtle); color: var(--accent-text); flex: none; }
.quick-icon .icon { width: 18px; height: 18px; }
.quick-text { display: grid; line-height: 1.25; min-width: 0; }
.quick-verb { font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted); }

/* launcher: every screen the user may open, grouped by area, filterable */
.launcher-search { position: relative; display: block; width: min(280px, 100%); margin: 0; }
.launcher-search .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }
.launcher-search input {
  width: 100%; height: 32px; padding: 0 var(--sp-3) 0 30px;
  font: 450 var(--fs-body) / 1 var(--font-ui); color: var(--text);
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-ctrl);
  transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.launcher-search input:hover { border-color: var(--border-strong); }
.launcher-search input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: var(--focus-ring); }
.launcher { columns: 5 180px; column-gap: var(--sp-6); }
.launcher-group { break-inside: avoid; margin-bottom: var(--sp-4); }
.launcher-group[hidden], .launcher-group li[hidden] { display: none; }
.launcher-group h3 { margin: 0 0 var(--sp-1); padding: 0 var(--sp-2); font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.launcher-group ul { list-style: none; margin: 0; padding: 0; }
.launcher-group a {
  display: block; padding: 4px var(--sp-2); border-radius: 5px;
  color: var(--text-secondary); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.launcher-group a:hover { background: var(--surface-hover); color: var(--text); }
.launcher-group a:focus-visible { color: var(--text); }
.launcher-empty { margin: 0; padding: var(--sp-2); color: var(--text-muted); }

/* company line */
.dash-company { display: flex; flex-wrap: wrap; gap: 4px var(--sp-4); margin-top: var(--sp-6); font-size: var(--fs-sm); color: var(--text-muted); }
.dash-company-name { font-weight: 600; color: var(--text-secondary); }

/* bell and its slide-over panel (topbar, every page) */
.bell-btn { position: relative; }
/* the count sits on the bell's top-right corner, clear of the glyph (16px icon centred in a 32px button: glyph is 8..24) */
.bell-count {
  position: absolute; top: -3px; left: 21px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill);
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface-chrome);
}
.bell-btn:has(.bell-count:not([hidden])) { margin-right: 6px; }   /* room for the count before the avatar */
/* phones: a dot, so the bell stays readable at a glance */
@media (max-width: 600px) {
  .bell-count { top: 4px; left: 21px; min-width: 0; width: 8px; height: 8px; padding: 0; font-size: 0; }
  .bell-btn:has(.bell-count:not([hidden])) { margin-right: 0; }
}
.bell-count[hidden] { display: none; }
dialog.notif-panel {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(420px, 100vw); height: 100dvh; max-height: none;
  border-radius: 0; border-width: 0 0 0 1px; display: none; flex-direction: column;
}
dialog.notif-panel[open] { display: flex; animation: notif-in var(--dur-3) var(--ease-out); }
@keyframes notif-in { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.notif-panel[open] { animation: none; } }
#notif-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.notif-tabs { display: flex; gap: var(--sp-1); padding: 0 var(--sp-4) var(--sp-2) var(--sp-6); border-bottom: 1px solid var(--border); }
.notif-tab {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: var(--r-ctrl);
  background: none; color: var(--text-secondary); font: 500 var(--fs-sm) / 1 var(--font-ui); cursor: pointer;
}
.notif-tab:hover { background: var(--surface-hover); color: var(--text); }
.notif-tab[aria-selected="true"] { background: var(--surface-selected); color: var(--text); font-weight: 600; }
.notif-tab-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--accent-subtle); color: var(--accent-text); font-size: 11px; font-weight: 650; line-height: 18px; }
.notif-list { flex: 1; overflow-y: auto; padding: var(--sp-2) var(--sp-3); }
.notif-item {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) 8px; gap: var(--sp-3); align-items: start;
  padding: 10px var(--sp-3); border-radius: var(--r-ctrl); color: var(--text); text-decoration: none;
}
.notif-item:hover { background: var(--surface-hover); }
.notif-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--surface-sunken); color: var(--text-muted); }
.notif-icon .icon { width: 16px; height: 16px; }
.notif-icon.kind-work { background: var(--accent-subtle); color: var(--accent-text); }
.notif-icon.kind-setup { background: var(--warning-subtle); color: var(--warning); }
.notif-text { display: grid; gap: 2px; min-width: 0; }
.notif-title { font-weight: 550; }
.notif-item:not(.is-unread) .notif-title { font-weight: 450; color: var(--text-secondary); }
.notif-body { font-size: var(--fs-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { font-size: var(--fs-xs); color: var(--text-muted); }
.notif-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.notif-foot { display: flex; justify-content: flex-end; padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--border); }

@media (max-width: 1100px) {
  .widget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .widget-2 { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .widget-grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .widget-1 { grid-column: 1 / -1; }
  .dash-title { font-size: var(--fs-2xl); }
  .dash-actions { width: 100%; flex-wrap: wrap; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 92px; padding: var(--sp-3); }
  .stat-value { font-size: 24px; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .launcher-search { width: 100%; }
  .launcher { columns: 2 140px; column-gap: var(--sp-3); }
}
