/* ==========================================================================
   AssistZen — component styles
   Uses ONLY the variables in tokens.css. Bootstrap 5 is loaded first and is
   used for the grid / utilities only; every visual it ships is overridden here.
   Mobile-first: base rules target phones; min-width media queries add layout.
   ========================================================================== */

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sd-font-body);
  font-size: var(--sd-fs-body);
  line-height: var(--sd-lh-normal);
  color: var(--sd-text);
  background: var(--sd-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4 {
  font-family: var(--sd-font-heading);
  color: var(--sd-text-heading);
  letter-spacing: var(--sd-ls-heading);
  margin: 0;
}
a { color: var(--sd-primary); text-decoration: none; }
/* links inside running text are underlined so they are not distinguished by colour alone (WCAG 1.4.1) */
p a, li > a:not([class]), .auth-foot a, .form-check-label a, .alert-sd a, .form-text a, .article-body a, .message-body a { text-decoration: underline; text-underline-offset: 2px; }
.link-text { color: var(--sd-primary); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--sd-primary-hover); text-decoration: underline; }
p { margin: 0 0 var(--sd-space-3); }
img { max-width: 100%; }
::selection { background: var(--sd-primary-soft); }
:focus-visible { outline: none; box-shadow: var(--sd-focus-ring); border-radius: var(--sd-radius-sm); }
.visually-hidden-focusable:not(:focus):not(:focus-within) { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; }
.skip-link { position: absolute; left: var(--sd-space-4); top: var(--sd-space-3); z-index: 2000; background: var(--sd-primary-strong); color: var(--sd-on-primary); padding: var(--sd-space-2) var(--sd-space-4); border-radius: var(--sd-radius-md); }
.text-muted, .muted { color: var(--sd-text-muted) !important; }
.text-subtle { color: var(--sd-text-subtle) !important; }
.text-heading { color: var(--sd-text-heading) !important; }
.text-secondary-sd { color: var(--sd-text-secondary) !important; }
.text-danger-sd { color: var(--sd-danger-text) !important; }
.text-success-sd { color: var(--sd-success-text) !important; }
.fw-semibold { font-weight: var(--sd-fw-semibold) !important; }
.small-sd { font-size: var(--sd-fs-small); }
.xs-sd { font-size: var(--sd-fs-xs); }
.nowrap { white-space: nowrap; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- icons */
.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }
.ic-sm { width: 16px; height: 16px; }
.ic-xs { width: 14px; height: 14px; }
.ic-lg { width: 26px; height: 26px; }
.ic-xl { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- tones */
.tone-blue   { --tone-bg: var(--sd-tone-blue-bg);   --tone-fg: var(--sd-tone-blue-fg);   --tone-text: var(--sd-tone-blue-text); }
.tone-orange { --tone-bg: var(--sd-tone-orange-bg); --tone-fg: var(--sd-tone-orange-fg); --tone-text: var(--sd-tone-orange-text); }
.tone-green  { --tone-bg: var(--sd-tone-green-bg);  --tone-fg: var(--sd-tone-green-fg);  --tone-text: var(--sd-tone-green-text); }
.tone-purple { --tone-bg: var(--sd-tone-purple-bg); --tone-fg: var(--sd-tone-purple-fg); --tone-text: var(--sd-tone-purple-text); }
.tone-red    { --tone-bg: var(--sd-tone-red-bg);    --tone-fg: var(--sd-tone-red-fg);    --tone-text: var(--sd-tone-red-text); }
.tone-teal   { --tone-bg: var(--sd-tone-teal-bg);   --tone-fg: var(--sd-tone-teal-fg);   --tone-text: var(--sd-tone-teal-text); }
.tone-sky    { --tone-bg: var(--sd-tone-sky-bg);    --tone-fg: var(--sd-tone-sky-fg);    --tone-text: var(--sd-tone-sky-text); }
.tone-navy   { --tone-bg: var(--sd-tone-navy-bg);   --tone-fg: var(--sd-tone-navy-fg);   --tone-text: var(--sd-tone-navy-text); }
.tone-gray   { --tone-bg: var(--sd-tone-gray-bg);   --tone-fg: var(--sd-tone-gray-fg);   --tone-text: var(--sd-tone-gray-text); }

.icon-tile {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: var(--sd-icon-tile); height: var(--sd-icon-tile); border-radius: var(--sd-radius-lg);
  background: var(--tone-bg, var(--sd-tone-blue-bg)); color: var(--tone-fg, var(--sd-tone-blue-fg));
}
.icon-tile .ic { width: 28px; height: 28px; stroke-width: 1.9; }
.icon-tile.sm { width: 38px; height: 38px; border-radius: var(--sd-radius-md); }
.icon-tile.sm .ic { width: 20px; height: 20px; }
.icon-tile.md { width: 46px; height: 46px; border-radius: var(--sd-radius-lg); }
.icon-tile.md .ic { width: 22px; height: 22px; }
.icon-tile.round { border-radius: var(--sd-radius-pill); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: var(--sd-avatar); height: var(--sd-avatar); border-radius: var(--sd-radius-pill);
  background: var(--tone-bg, var(--sd-tone-blue-bg)); color: var(--tone-text, var(--sd-tone-blue-text));
  font-family: var(--sd-font-heading); font-weight: var(--sd-fw-bold); font-size: .78rem; letter-spacing: .02em;
}
.avatar.sm { width: 28px; height: 28px; font-size: .68rem; }
.avatar.lg { width: var(--sd-avatar-lg); height: var(--sd-avatar-lg); font-size: .95rem; }
.avatar.xl { width: 84px; height: 84px; font-size: 1.6rem; }
.person { display: inline-flex; align-items: center; gap: var(--sd-space-2); min-width: 0; }
.person-name { color: var(--sd-text); font-weight: var(--sd-fw-medium); }

/* ---------------------------------------------------------------- badges, chips, dots */
.badge-sd {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 4px 12px; min-height: 26px; border-radius: var(--sd-radius-sm);
  font-size: var(--sd-fs-xs); font-weight: var(--sd-fw-medium); line-height: 1.2; white-space: nowrap;
  background: var(--tone-bg, var(--sd-tone-blue-bg)); color: var(--tone-text, var(--sd-tone-blue-text));
}
.badge-sd.lg { font-size: var(--sd-fs-small); padding: 5px 14px; min-height: 30px; }
.badge-sd.pill { border-radius: var(--sd-radius-pill); }
.count-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 24px; padding: 0 8px;
  border-radius: var(--sd-radius-sm); background: var(--sd-tone-gray-bg); color: var(--sd-text-secondary);
  font-size: var(--sd-fs-small); font-weight: var(--sd-fw-semibold);
}
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--dot, var(--sd-priority-low)); flex-shrink: 0; }
.dot.sm { width: 8px; height: 8px; }
.priority { display: inline-flex; align-items: center; gap: var(--sd-space-2); white-space: nowrap; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--sd-radius-md);
  background: var(--sd-tone-blue-bg); color: var(--sd-tone-blue-text); font-size: var(--sd-fs-small); font-weight: var(--sd-fw-medium);
}
.tag-chip button { border: 0; background: none; color: inherit; padding: 0; display: inline-flex; cursor: pointer; }
.tag-chip.add { background: var(--sd-bg-surface); border: 1px solid var(--sd-border-strong); color: var(--sd-text-secondary); cursor: pointer; }

.sla-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--sd-radius-pill);
  font-size: var(--sd-fs-xs); font-weight: var(--sd-fw-semibold); white-space: nowrap; line-height: 1.3;
  background: var(--tone-bg); color: var(--tone-text);
}
.sla-chip .ic { width: 13px; height: 13px; }
.sla-OnTrack { --tone-bg: var(--sd-tone-green-bg); --tone-text: var(--sd-tone-green-text); }
.sla-AtRisk { --tone-bg: var(--sd-tone-orange-bg); --tone-text: var(--sd-tone-orange-text); }
.sla-Breached { --tone-bg: var(--sd-tone-red-bg); --tone-text: var(--sd-tone-red-text); }
.sla-Paused { --tone-bg: var(--sd-tone-gray-bg); --tone-text: var(--sd-tone-gray-text); }
.sla-Met { --tone-bg: var(--sd-tone-green-bg); --tone-text: var(--sd-tone-green-text); }
.sla-None { --tone-bg: var(--sd-tone-gray-bg); --tone-text: var(--sd-tone-gray-text); }

.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sd-primary); display: inline-block; }
.unread-dot.read { background: var(--sd-border-strong); }
.trend-up { color: var(--sd-success-text); font-weight: var(--sd-fw-semibold); display: inline-flex; align-items: center; gap: 4px; font-size: var(--sd-fs-small); }
.trend-down { color: var(--sd-success-text); font-weight: var(--sd-fw-semibold); display: inline-flex; align-items: center; gap: 4px; font-size: var(--sd-fs-small); }
.trend-bad { color: var(--sd-danger-text); }

/* ---------------------------------------------------------------- buttons */
.btn {
  --bs-btn-focus-box-shadow: var(--sd-focus-ring);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sd-space-2);
  min-height: var(--sd-control-height); padding: 6px var(--sd-space-5); border-radius: var(--sd-radius-md);
  font-family: var(--sd-font-body); font-weight: var(--sd-fw-semibold); font-size: var(--sd-fs-body);
  border: 1px solid transparent; transition: background var(--sd-transition), border-color var(--sd-transition), color var(--sd-transition);
  text-decoration: none !important;
  /* labels wrap onto a second line when the space runs out instead of spilling past the button edge */
  white-space: normal; text-align: center; line-height: 1.25; max-width: 100%; min-width: 0;
}
.btn-lg { min-height: var(--sd-button-height); font-size: 1.0625rem; padding: 8px var(--sd-space-6); }
.btn-sm { min-height: var(--sd-control-height-sm); padding: 4px var(--sd-space-3); font-size: var(--sd-fs-small); }
.btn-primary-strong, .btn-primary-strong:visited { background: var(--sd-primary-strong); color: var(--sd-on-primary); box-shadow: var(--sd-shadow-button); }
.btn-primary-strong:hover, .btn-primary-strong:focus-visible { background: var(--sd-primary-strong-hover); color: var(--sd-on-primary); }
.btn-primary, .btn-primary:visited { background: var(--sd-primary); color: var(--sd-on-primary); border-color: var(--sd-primary); }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--sd-primary-hover); border-color: var(--sd-primary-hover); color: var(--sd-on-primary); }
.btn-primary:disabled, .btn-primary.disabled { background: var(--sd-primary); opacity: .45; color: var(--sd-on-primary); }
.btn-outline, .btn-outline:visited { background: var(--sd-bg-surface); color: var(--sd-text-heading); border-color: var(--sd-border-strong); }
.btn-outline:hover { background: var(--sd-bg-hover); color: var(--sd-text-heading); border-color: var(--sd-border-strong); }
.btn-outline-primary, .btn-outline-primary:visited { background: var(--sd-bg-surface); color: var(--sd-primary); border-color: var(--sd-primary); }
.btn-outline-primary:hover { background: var(--sd-primary-soft); color: var(--sd-primary-hover); border-color: var(--sd-primary); }
.btn-soft { background: var(--sd-primary-soft); color: var(--sd-primary); }
.btn-soft:hover { background: var(--sd-bg-selected); color: var(--sd-primary-hover); }
.btn-danger-sd { background: var(--sd-danger); color: #fff; }
.btn-danger-sd:hover { background: var(--sd-danger-text); color: #fff; }
.btn-ghost { background: transparent; color: var(--sd-text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
.btn-icon { width: var(--sd-control-height); padding: 0; flex-shrink: 0; }
.btn-icon.sm { width: 32px; min-height: 32px; }
.btn-link-sd { background: none; border: 0; padding: 0; color: var(--sd-primary); font-weight: var(--sd-fw-medium); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-link-sd:hover { color: var(--sd-primary-hover); text-decoration: underline; }
.kebab {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--sd-radius-md);
  background: none; border: 0; color: var(--sd-text-secondary); cursor: pointer;
}
.kebab:hover, .kebab[aria-expanded="true"] { background: var(--sd-bg-hover); color: var(--sd-text-heading); }

/* ---------------------------------------------------------------- forms */
.form-label, label.form-label { font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); font-size: .9rem; margin-bottom: 6px; }
.form-label .req { color: var(--sd-danger); margin-left: 2px; }
.form-label .opt { color: var(--sd-text-muted); font-weight: var(--sd-fw-regular); }
.form-text, .help-text { color: var(--sd-text-muted); font-size: var(--sd-fs-small); margin-top: 4px; }
.form-control, .form-select {
  min-height: var(--sd-control-height); border-radius: var(--sd-radius-md); border: 1px solid var(--sd-border-strong);
  background-color: var(--sd-bg-surface); color: var(--sd-text); font-size: var(--sd-fs-body); padding: 9px 14px;
  transition: border-color var(--sd-transition), box-shadow var(--sd-transition);
}
.form-control::placeholder { color: var(--sd-text-subtle); opacity: 1; }
.form-control:focus, .form-select:focus { border-color: var(--sd-border-focus); box-shadow: var(--sd-focus-ring); background-color: var(--sd-bg-surface); color: var(--sd-text); }
.form-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233B4C82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m6 9 6 6 6-6'/%3e%3c/svg%3e"); background-size: 16px 16px; background-position: right 14px center; padding-right: 40px; }
textarea.form-control { min-height: 110px; resize: vertical; }
.form-control.is-invalid, .form-select.is-invalid, .was-validated .form-control:invalid { border-color: var(--sd-danger); background-image: none; padding-right: 14px; }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(240, 56, 76, .2); }
.field-validation-error, .invalid-feedback { display: block; color: var(--sd-danger-text); font-size: var(--sd-fs-small); margin-top: 4px; }
.field-validation-valid { display: none; }
.validation-summary {
  border: 1px solid var(--sd-tone-red-bg); background: var(--sd-tone-red-bg); color: var(--sd-danger-text);
  border-radius: var(--sd-radius-md); padding: var(--sd-space-3) var(--sd-space-4); margin-bottom: var(--sd-space-4); font-size: var(--sd-fs-small);
}
.validation-summary ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--sd-text-secondary); pointer-events: none; }
.input-icon > .form-control, .input-icon > .form-select { padding-left: 50px; }
.input-icon > .adorn { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; display: inline-flex; align-items: center; justify-content: center; }
.input-icon > .adorn.avatar { width: 32px; height: 32px; font-size: .7rem; }
.input-icon > .adorn.dot { left: 16px; }
.input-icon > .adorn.icon-tile { width: 34px; height: 34px; border-radius: 50%; }
.input-icon > .adorn.icon-tile .ic { width: 18px; height: 18px; }
.input-icon.adorned > .form-select, .input-icon.adorned > .form-control { padding-left: 56px; }
.input-icon.adorned-sm > .form-select { padding-left: 40px; }
.input-icon .input-action { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.input-group-sd { display: flex; align-items: stretch; border: 1px solid var(--sd-border-strong); border-radius: var(--sd-radius-md); overflow: hidden; background: var(--sd-bg-surface); }
.input-group-sd .addon { display: flex; align-items: center; padding: 0 12px; background: var(--sd-bg-table-head); color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }
.input-group-sd .form-control { border: 0; border-radius: 0; min-width: 0; }
.input-group-sd:focus-within { border-color: var(--sd-border-focus); box-shadow: var(--sd-focus-ring); }
.form-check-input { width: 20px; height: 20px; border: 1.5px solid var(--sd-border-strong); border-radius: 5px; margin-top: 0; cursor: pointer; }
.form-check-input:checked { background-color: var(--sd-primary); border-color: var(--sd-primary); }
.form-check-input:focus { box-shadow: var(--sd-focus-ring); border-color: var(--sd-primary); }
.form-check-input[type="radio"] { border-radius: 50%; }
.form-check { display: flex; align-items: flex-start; gap: 10px; padding-left: 0; min-height: 24px; }
.form-check .form-check-input { float: none; margin-left: 0; flex-shrink: 0; }
.form-check-label { color: var(--sd-text); cursor: pointer; }
.form-check-label small { display: block; color: var(--sd-text-muted); font-size: var(--sd-fs-xs); }
.form-switch { padding-left: 0; }
.form-switch .form-check-input { width: 44px; height: 24px; border-radius: 999px; background-color: var(--sd-border-strong); border: 0;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e"); }
.form-switch .form-check-input:checked { background-color: var(--sd-primary); }
.char-count { position: absolute; right: 12px; bottom: 8px; font-size: var(--sd-fs-xs); color: var(--sd-text-subtle); }
.color-input { display: flex; align-items: center; gap: 10px; border: 1px solid var(--sd-border-strong); border-radius: var(--sd-radius-md); padding: 4px 12px; min-height: var(--sd-control-height); background: var(--sd-bg-surface); }
.color-input input[type="color"] { width: 26px; height: 26px; border: 0; border-radius: 50%; padding: 0; background: none; cursor: pointer; }
.color-input input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-input input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.color-input input[type="text"] { border: 0; outline: 0; width: 100%; font-weight: var(--sd-fw-medium); color: var(--sd-text); background: transparent; }

/* ---------------------------------------------------------------- app shell */
.app { min-height: 100vh; display: flex; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sd-sidebar-width); z-index: 1040;
  background: var(--sd-bg-sidebar); border-right: 1px solid var(--sd-border);
  display: flex; flex-direction: column; padding: 18px 12px 18px;
  transform: translateX(-100%); transition: transform .22s ease; visibility: hidden;
}
.sidebar.open { transform: none; visibility: visible; box-shadow: var(--sd-shadow-raised); }
.sidebar-backdrop { position: fixed; inset: 0; background: var(--sd-backdrop); z-index: 1035; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 20px; }
.sidebar-brand .brand-link { display: block; padding: 6px 4px; }
.sidebar-brand img { display: block; width: 200px; height: auto; }   /* artwork spans ~94% of the PNG → visible logo ≥ 180px (brand guideline) */
.sidebar-brand .brand-icon-dark { display: none; height: 44px; border-radius: 10px; }
[data-theme="dark"] .sidebar-brand .brand-logo.is-default { display: none; }
[data-theme="dark"] .sidebar-brand .brand-icon-dark { display: block; }
.sidebar-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 14px; border-radius: var(--sd-radius-md);
  color: var(--sd-nav-text); font-size: var(--sd-fs-nav); font-weight: var(--sd-fw-medium); text-decoration: none;
}
.sidebar-nav a .ic { width: 22px; height: 22px; stroke-width: 1.7; color: var(--sd-nav-text); }
.sidebar-nav a:hover { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
.sidebar-nav a.active { background: var(--sd-primary-strong); color: #fff; box-shadow: var(--sd-shadow-button); }
.sidebar-nav a.active .ic { color: #fff; }
.sidebar-nav .nav-section { margin: 14px 14px 2px; font-size: var(--sd-fs-xs); font-weight: var(--sd-fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--sd-text-subtle); }
.sidebar-nav { gap: 2px; }
.sidebar-nav a { height: 40px; }
.sidebar-nav .nav-badge { margin-left: auto; min-width: 22px; height: 20px; border-radius: 10px; background: var(--sd-notification-count); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
/* the menu scrolls between the logo and the help box when it is taller than the screen */
.sidebar > nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: 0 -6px; padding: 0 6px; }
.sidebar-brand, .sidebar-help { flex-shrink: 0; }
.sidebar-help {
  margin-top: 12px; background: var(--sd-bg-help); border-radius: var(--sd-radius-xl); padding: 18px 14px 14px;
}
.sidebar-help .help-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.sidebar-help .help-head .ic { width: 34px; height: 34px; color: var(--sd-primary-strong); stroke-width: 1.6; }
.sidebar-help strong { display: block; color: var(--sd-text-heading); font-size: .95rem; }
.sidebar-help span { color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }
.sidebar-help .btn { width: 100%; background: var(--sd-bg-surface); border: 1px solid var(--sd-tone-blue-bg); color: var(--sd-primary-strong); }
.sidebar-help .btn:hover { background: var(--sd-bg-surface); border-color: var(--sd-primary); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 0 var(--sd-content-pad-mobile); background: color-mix(in srgb, var(--sd-bg-page) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px); border-bottom: 1px solid var(--sd-border);
}
.topbar .menu-toggle { display: inline-flex; }
.topbar .brand-mobile img { height: 36px; width: auto; border-radius: 8px; }
.topbar-search { flex: 1; position: relative; max-width: 930px; display: none; }
.topbar-search .form-control { background: var(--sd-bg-search); border-color: transparent; height: 50px; border-radius: var(--sd-radius-lg); padding-left: 52px; font-size: .95rem; }
.topbar-search .form-control:focus { background: var(--sd-bg-surface); }
.topbar-search > .ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--sd-text-heading); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.bell { position: relative; width: 44px; height: 44px; border-radius: var(--sd-radius-md); border: 0; background: none; color: var(--sd-text-heading); display: inline-flex; align-items: center; justify-content: center; }
.bell:hover { background: var(--sd-bg-hover); }
.bell .ic { width: 24px; height: 24px; }
.bell .bell-dot { position: absolute; top: 8px; right: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--sd-notification-dot); border: 2px solid var(--sd-bg-page); }
.bell .bell-count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--sd-notification-count); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--sd-bg-page); }
.user-menu { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 6px 4px 4px; border-radius: var(--sd-radius-pill); color: var(--sd-text-heading); font-weight: var(--sd-fw-semibold); }
.user-menu:hover { background: var(--sd-bg-hover); }
.user-menu .avatar { width: 44px; height: 44px; font-size: .95rem; }
.user-menu .name { display: none; }
.topbar-divider { width: 1px; height: 36px; background: var(--sd-border); display: none; }

.content { padding: 20px var(--sd-content-pad-mobile) 40px; flex: 1; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-title { font-size: 1.75rem; font-weight: var(--sd-fw-extrabold); line-height: var(--sd-lh-tight); }
.page-subtitle { color: var(--sd-text-secondary); font-size: 1rem; margin: 8px 0 0; }
.page-header > :first-child { flex: 1 1 340px; min-width: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; min-width: 0; max-width: 100%; }
.page-actions > form { display: contents; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--sd-primary); font-weight: var(--sd-fw-medium); margin-bottom: 10px; }
.date-chip { display: inline-flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--sd-radius-lg); background: var(--sd-bg-surface); box-shadow: var(--sd-shadow-card); color: var(--sd-text-heading); font-weight: var(--sd-fw-medium); white-space: nowrap; }
.date-chip .ic { color: var(--sd-text-secondary); }

/* ---------------------------------------------------------------- layout helpers */
.grid-rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.row-gap { row-gap: 20px; }
.cols-2, .cols-3, .cols-4 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }

/* ---------------------------------------------------------------- cards */
.card-sd { background: var(--sd-bg-surface); border: 1px solid var(--sd-border); border-radius: var(--sd-radius-xl); box-shadow: var(--sd-shadow-card); }
.card-sd.p { padding: 18px; }
.card-sd.flush { overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 6px; }
.card-head > * { min-width: 0; }
.card-head > .d-flex { flex-wrap: wrap; }
.card-head.bordered { border-bottom: 1px solid var(--sd-divider); padding-bottom: 14px; }
.card-title { font-family: var(--sd-font-heading); font-size: var(--sd-fs-h3); font-weight: var(--sd-fw-bold); color: var(--sd-text-heading); margin: 0; letter-spacing: -.01em; }
.card-sub { color: var(--sd-text-muted); font-size: var(--sd-fs-small); margin-top: 2px; }
.card-body-sd { padding: 12px 18px 18px; }
.view-all { font-weight: var(--sd-fw-medium); font-size: .92rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }

.stat-card { display: flex; align-items: center; gap: 18px; padding: 18px; position: relative; color: inherit; text-decoration: none !important; min-height: 100px; min-width: 0; }
.stat-card > div { min-width: 0; }
.stat-card:hover { box-shadow: var(--sd-shadow-raised); }
.stat-value { font-family: var(--sd-font-heading); font-size: var(--sd-fs-stat); font-weight: var(--sd-fw-extrabold); line-height: 1; color: var(--sd-text-heading); letter-spacing: -.02em; }
.stat-label { color: var(--sd-text-secondary); font-size: 1rem; margin-top: 6px; }
.stat-meta { color: var(--sd-text-secondary); font-size: var(--sd-fs-small); margin-top: 4px; }
.stat-card .chev { position: absolute; top: 16px; right: 16px; color: var(--sd-text-secondary); }
.stat-card.compact { gap: 12px; padding: 16px; }
.stat-card.compact .icon-tile { width: 48px; height: 48px; }
.stat-card.compact .icon-tile .ic { width: 24px; height: 24px; }
.stat-card.compact .stat-label { font-size: .9rem; }
.stat-bar { height: 7px; border-radius: 4px; background: var(--sd-chart-track); margin-top: 8px; overflow: hidden; max-width: 180px; }
.stat-bar span { display: block; height: 100%; border-radius: 4px; background: var(--tone-fg, var(--sd-primary)); }
.kpi-card { display: flex; gap: 14px; padding: 18px; min-width: 0; }
.kpi-card > div { min-width: 0; }
.kpi-card .kpi-label { overflow-wrap: anywhere; }
.kpi-card .kpi-label { color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }
.kpi-card .kpi-value { font-family: var(--sd-font-heading); font-weight: var(--sd-fw-extrabold); font-size: 1.6rem; color: var(--sd-text-heading); line-height: 1.15; }
.kpi-card .kpi-foot { color: var(--sd-text-muted); font-size: var(--sd-fs-xs); }

/* ---------------------------------------------------------------- list rows (rails) */
.list-rows { list-style: none; margin: 0; padding: 0; }
.list-rows > li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--sd-divider); }
.list-rows > li:last-child { border-bottom: 0; }
.list-rows a.row-link { display: flex; align-items: center; gap: 14px; width: 100%; color: inherit; text-decoration: none; }
.list-rows a.row-link:hover .row-title { color: var(--sd-primary); }
.row-title { color: var(--sd-text-heading); font-weight: var(--sd-fw-medium); line-height: 1.3; }
.row-sub { color: var(--sd-text-muted); font-size: var(--sd-fs-small); }
.row-time { color: var(--sd-text-subtle); font-size: var(--sd-fs-xs); white-space: nowrap; margin-left: auto; align-self: flex-start; }
.list-rows .chev { margin-left: auto; color: var(--sd-text-secondary); }

/* ---------------------------------------------------------------- tabs */
.tabs-sd { display: flex; gap: 6px; border-bottom: 1px solid var(--sd-border); overflow-x: auto; scrollbar-width: none; margin-bottom: 18px; }
.tabs-sd::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .tabs-sd, .settings-nav { flex-wrap: wrap; overflow: visible; } }
.tabs-sd a, .tabs-sd button {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 14px; border: 0; background: none; white-space: nowrap;
  color: var(--sd-text-secondary); font-weight: var(--sd-fw-medium); font-size: .98rem; border-bottom: 3px solid transparent; margin-bottom: -1px;
  text-decoration: none; cursor: pointer;
}
.tabs-sd a:hover, .tabs-sd button:hover { color: var(--sd-text-heading); }
.tabs-sd .active { color: var(--sd-primary); border-bottom-color: var(--sd-highlight); font-weight: var(--sd-fw-semibold); }
.tabs-sd .active .count-pill { background: var(--sd-primary-soft); color: var(--sd-tone-blue-text); }
.card-sd > .tabs-sd { padding: 0 14px; }

/* ---------------------------------------------------------------- filters */
.filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 14px; }
.filters .clear { white-space: nowrap; font-weight: var(--sd-fw-medium); }
.result-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -2px 0 14px; }
.result-count { font-size: 14px; color: var(--sd-text-secondary); }
.result-count strong { color: var(--sd-text-heading); font-size: 15px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; min-width: 0; }
.filter-chips .tag-chip { max-width: 100%; overflow-wrap: anywhere; text-decoration: none; }
.input-icon .search-hint { position: absolute; left: 0; top: calc(100% + 2px); font-size: 11px; color: var(--sd-text-muted); white-space: nowrap; pointer-events: none; }

/* ---------------------------------------------------------------- tables */
/* position: relative keeps absolutely positioned descendants (visually-hidden labels) inside the scroll box
   so a wide table can never widen the page itself */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; max-width: 100%; }
.table-wrap .truncate { contain: inline-size; }
.break-any { overflow-wrap: anywhere; }
.table-sd { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--sd-fs-table); color: var(--sd-text); }
.table-sd thead th {
  background: var(--sd-bg-table-head); color: var(--sd-text-heading); font-weight: var(--sd-fw-medium); font-size: var(--sd-fs-small);
  padding: 12px 10px; text-align: left; white-space: nowrap; border: 0;
}
.table-sd thead th:first-child { border-radius: var(--sd-radius-md) 0 0 var(--sd-radius-md); }
.table-sd thead th:last-child { border-radius: 0 var(--sd-radius-md) var(--sd-radius-md) 0; }
.table-sd thead th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.table-sd tbody td { padding: 13px 10px; border-bottom: 1px solid var(--sd-divider); vertical-align: middle; }
.table-sd tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 1199.98px) { .table-sd thead th { padding: 12px 8px; } .table-sd tbody td { padding: 13px 8px; } }
.table-sd tbody tr:hover td { background: var(--sd-bg-hover); }
.table-sd tbody tr.selected td { background: var(--sd-bg-selected); }
.table-sd .id-link { color: var(--sd-primary); font-weight: var(--sd-fw-medium); white-space: nowrap; }
.table-sd .when { white-space: nowrap; line-height: 1.35; }
.table-sd .when small { display: block; color: var(--sd-text-muted); font-size: inherit; }
.table-sd .cell-title { color: var(--sd-text-heading); font-weight: var(--sd-fw-semibold); }
.table-sd .cell-sub { color: var(--sd-text-muted); font-size: var(--sd-fs-xs); }
.table-sd .col-check { width: 44px; }
.table-sd .col-actions { width: 56px; text-align: right; }
.table-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 4px 2px; color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }
.progress-sd { display: flex; align-items: center; gap: 10px; min-width: 100px; }
.progress-sd .track { flex: 1; height: 7px; background: var(--sd-chart-track); border-radius: 4px; overflow: hidden; }
.progress-sd .track span { display: block; height: 100%; background: var(--sd-primary); border-radius: 4px; }

/* table → cards on phones */
@media (max-width: 767.98px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { background: var(--sd-bg-surface); border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); padding: 10px 12px; margin-bottom: 10px; position: relative; }
  .table-cards tbody td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table-cards tbody td::before { content: attr(data-label); color: var(--sd-text-muted); font-size: var(--sd-fs-xs); text-align: left; flex-shrink: 0; padding-top: 2px; }
  .table-cards tbody td[data-label=""]::before { display: none; }
  .table-cards tbody td.col-check { position: absolute; top: 10px; left: 12px; width: auto; }
  .table-cards tbody td.col-actions { position: absolute; top: 6px; right: 6px; width: auto; }
  .table-cards tbody td.card-primary { display: block; text-align: left; padding-left: 30px; padding-right: 36px; font-size: .95rem; }
  .table-cards tbody td.card-primary::before { display: none; }
  .table-cards tbody tr:hover td { background: none; }
  .table-cards tbody td:has(> .id-link) { justify-content: flex-start; padding-left: 30px; padding-right: 40px; }
  .table-cards tbody td:has(> .id-link)::before { display: none; }
  .table-cards tbody tr:not(:has(.col-check)) td:has(> .id-link) { padding-left: 0; }
}

/* ---------------------------------------------------------------- pagination */
.pager { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.pager a, .pager span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 8px; border-radius: var(--sd-radius-md);
  border: 1px solid var(--sd-border-strong); background: var(--sd-bg-surface); color: var(--sd-text-heading); font-weight: var(--sd-fw-medium);
  font-size: var(--sd-fs-small); text-decoration: none;
}
.pager a:hover { background: var(--sd-bg-hover); }
.pager .active { background: var(--sd-primary); border-color: var(--sd-primary); color: #fff; }
.pager .gap { border-color: transparent; background: none; }
.pager .disabled { opacity: .45; pointer-events: none; }

/* ---------------------------------------------------------------- dropdowns, modals, toasts */
.dropdown-menu { --bs-dropdown-zindex: 1030; border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); box-shadow: var(--sd-shadow-dropdown); padding: 6px; background: var(--sd-bg-surface); min-width: 220px; font-size: .92rem; }
.dropdown-item { border-radius: var(--sd-radius-md); padding: 9px 12px; color: var(--sd-text); display: flex; align-items: center; gap: 10px; white-space: normal; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
.dropdown-item.danger { color: var(--sd-danger-text); }
.dropdown-divider { border-color: var(--sd-divider); }
.dropdown-header { color: var(--sd-text-muted); font-size: var(--sd-fs-xs); text-transform: uppercase; letter-spacing: .06em; }
.modal-content { border: 0; border-radius: var(--sd-radius-2xl); box-shadow: var(--sd-shadow-raised); background: var(--sd-bg-surface); color: var(--sd-text); }
.modal-header { border-bottom: 1px solid var(--sd-divider); padding: 20px 22px; }
.modal-title { font-family: var(--sd-font-heading); font-weight: var(--sd-fw-bold); font-size: 1.15rem; color: var(--sd-text-heading); }
.modal-body { padding: 20px 22px; }
.modal-footer { border-top: 1px solid var(--sd-divider); padding: 14px 22px; gap: 10px; }
.modal-backdrop.show { opacity: 1; background: var(--sd-backdrop); }
.btn-close { width: 32px; height: 32px; border-radius: var(--sd-radius-md); opacity: .7; }
[data-theme="dark"] .btn-close { filter: invert(1); }
.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 1090; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast-sd { display: flex; gap: 12px; align-items: flex-start; background: var(--sd-bg-surface); border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); box-shadow: var(--sd-shadow-dropdown); padding: 14px; animation: toast-in .2s ease; }
.toast-sd .toast-title { font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); }
.toast-sd .toast-msg { color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }
.toast-sd .toast-close { margin-left: auto; border: 0; background: none; color: var(--sd-text-muted); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.alert-sd { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--sd-radius-lg); padding: 12px 16px; margin-bottom: 18px; background: var(--tone-bg); color: var(--tone-text); font-size: .92rem; }
.alert-sd .ic { margin-top: 2px; }

/* notification bell panel */
.bell-panel { width: min(400px, calc(100vw - 24px)); padding: 0; }
.bell-panel .bp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--sd-divider); }
.bell-panel .bp-list { max-height: 420px; overflow-y: auto; list-style: none; margin: 0; padding: 6px; }
.bell-panel .bp-list a { display: flex; gap: 12px; padding: 10px; border-radius: var(--sd-radius-md); color: inherit; text-decoration: none; }
.bell-panel .bp-list a:hover { background: var(--sd-bg-hover); }
.bell-panel .bp-foot { border-top: 1px solid var(--sd-divider); padding: 10px; text-align: center; }

/* ---------------------------------------------------------------- empty / loading */
.empty-state { text-align: center; padding: 40px 16px; color: var(--sd-text-muted); }
.empty-state .icon-tile { margin-bottom: 14px; }
.empty-state h3 { font-size: 1.05rem; margin-bottom: 6px; }
.skeleton { position: relative; overflow: hidden; background: var(--sd-chart-track); border-radius: var(--sd-radius-md); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.chart-box { position: relative; height: 230px; }
.chart-box.tall { height: 260px; }
.chart-box.loading::before { content: ""; position: absolute; inset: 8px; border-radius: var(--sd-radius-md); background: var(--sd-chart-track); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: var(--sd-fs-small); color: var(--sd-text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.donut-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: center; }
.donut-canvas { position: relative; width: 156px; height: 156px; margin: 0 auto; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center strong { font-family: var(--sd-font-heading); font-size: 1.6rem; font-weight: var(--sd-fw-extrabold); color: var(--sd-text-heading); line-height: 1; }
.donut-center span { color: var(--sd-text-secondary); font-size: var(--sd-fs-small); margin-top: 4px; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: .92rem; min-width: 0; }
.donut-legend li { display: flex; align-items: center; gap: 8px; }
.donut-legend .lg-name { color: var(--sd-text); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend .lg-val { color: var(--sd-text-heading); font-weight: var(--sd-fw-semibold); min-width: 26px; text-align: right; }
.donut-legend .lg-pct { color: var(--sd-text-secondary); min-width: 38px; text-align: right; }
.card-body-sd:has(> .donut-wrap) { container-type: inline-size; }
@container (max-width: 420px) {
  .donut-wrap { grid-template-columns: 128px minmax(0, 1fr) !important; gap: 12px; }
  .donut-canvas { width: 128px; height: 128px; }
  .donut-center strong { font-size: 1.3rem; }
  .donut-legend .lg-pct { display: none; }
}
@container (max-width: 270px) { .donut-wrap { grid-template-columns: minmax(0, 1fr) !important; } }
.hbar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: var(--sd-fs-small); }
.hbar-list li { display: grid; grid-template-columns: minmax(80px, 150px) minmax(0, 1fr) 46px 40px; gap: 12px; align-items: center; }
.hbar-list .hb-name { color: var(--sd-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-list .hb-track { height: 9px; border-radius: 5px; background: var(--sd-chart-track); overflow: hidden; }
.hbar-list .hb-track span { display: block; height: 100%; border-radius: 5px; }
.hbar-list .hb-val { color: var(--sd-text-heading); text-align: right; font-weight: var(--sd-fw-medium); }
.hbar-list .hb-pct { color: var(--sd-text-secondary); text-align: right; }

/* ---------------------------------------------------------------- quick actions */
.qa-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.qa-tile { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--sd-border-strong); border-radius: var(--sd-radius-lg); background: var(--sd-bg-surface); color: var(--sd-text); font-weight: var(--sd-fw-medium); text-decoration: none !important; cursor: pointer; min-height: 54px; }
.qa-tile:hover { background: var(--sd-bg-hover); border-color: var(--sd-primary); color: var(--sd-text-heading); }
.qa-tile .ic { color: var(--sd-text-secondary); width: 22px; height: 22px; }
.qa-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.qa-list a, .qa-list button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px; border: 1px solid var(--sd-border-strong); border-radius: var(--sd-radius-md); background: var(--sd-bg-surface); color: var(--sd-text); font-weight: var(--sd-fw-medium); text-decoration: none !important; text-align: left; cursor: pointer; min-height: 46px; }
.qa-list a:hover, .qa-list button:hover { background: var(--sd-bg-hover); border-color: var(--sd-primary); }
.qa-list .ic { color: var(--sd-text-secondary); }
.qa-list .chev { margin-left: auto; color: var(--sd-text-heading); }

/* ---------------------------------------------------------------- definition list (ticket information) */
.info-list { display: grid; grid-template-columns: 110px minmax(0, 1fr); row-gap: 16px; column-gap: 12px; margin: 0; font-size: .93rem; }
.info-list dt { color: var(--sd-text-secondary); font-weight: var(--sd-fw-regular); align-self: center; }
.info-list dd { margin: 0; color: var(--sd-text); align-self: center; min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- conversation */
.message-card { display: flex; gap: 16px; padding: 18px; border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); background: var(--sd-bg-surface); }
.message-card.internal { background: color-mix(in srgb, var(--sd-tone-orange-bg) 28%, var(--sd-bg-surface)); border-color: color-mix(in srgb, var(--sd-tone-orange-bg) 80%, var(--sd-border)); }
.message-card .avatar { width: 44px; height: 44px; font-size: .95rem; }
.message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.message-meta .author { font-weight: var(--sd-fw-bold); color: var(--sd-text-heading); }
.message-meta time { color: var(--sd-text-muted); font-size: var(--sd-fs-small); }
.message-body { color: var(--sd-text); line-height: 1.65; overflow-wrap: anywhere; }
.message-body p { margin-bottom: 8px; }
.message-body img { max-width: 100%; border-radius: var(--sd-radius-md); }
.attachment-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; margin-right: 12px; color: var(--sd-primary); font-size: var(--sd-fs-small); }
.attachment-chip .size { color: var(--sd-text-secondary); }
.attachment-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attachment-thumb { display: block; width: 160px; max-width: 45%; height: 100px; border: 1px solid var(--sd-border); border-radius: 8px; overflow: hidden; background: var(--sd-bg-page); }
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.attachment-thumb:hover { border-color: var(--sd-primary); }
.composer { display: flex; align-items: flex-end; gap: 12px; }
.composer-box { flex: 1; border: 1px solid var(--sd-border-strong); border-radius: var(--sd-radius-lg); background: var(--sd-bg-surface); display: flex; align-items: flex-end; padding: 6px 8px 6px 14px; min-width: 0; }
.composer-box:focus-within { border-color: var(--sd-border-focus); box-shadow: var(--sd-focus-ring); }
.composer-box textarea { flex: 1; border: 0; outline: none; resize: none; min-height: 40px; max-height: 220px; padding: 9px 0; background: transparent; color: var(--sd-text); font: inherit; }
.composer-box .tool { border: 0; background: none; color: var(--sd-text-secondary); width: 36px; height: 36px; border-radius: var(--sd-radius-md); display: inline-flex; align-items: center; justify-content: center; }
.composer-box .tool:hover { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
/* staff e-mail composer (Tickets/_EmailComposer.cshtml) and the ticket toolbar */
.ticket-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; padding: 10px 12px; background: var(--sd-bg-surface); border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); box-shadow: var(--sd-shadow-card); }
/* "Back to Tickets" + the toolbar stay in view under the top bar (64px; 76px from 768px up) while the ticket scrolls */
.ticket-head.is-sticky { position: sticky; top: 64px; z-index: 1010; margin-top: -10px; padding-top: 10px; background: var(--sd-bg-page); }
.ticket-toolbar .btn { gap: 6px; }
.ticket-toolbar .is-starred { color: var(--sd-priority-medium); border-color: var(--sd-priority-medium); }
.ticket-toolbar .is-starred .ic { fill: currentColor; }
.email-composer { margin-top: 12px; background: var(--sd-bg-surface); border: 1px solid var(--sd-border-strong); border-radius: var(--sd-radius-lg); box-shadow: var(--sd-shadow-card); scroll-margin-top: 90px; }
.email-composer:focus-within { border-color: var(--sd-border-focus); }
.email-composer[data-mode="note"] { background: color-mix(in srgb, var(--sd-tone-orange-bg) 22%, var(--sd-bg-surface)); }
.ec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--sd-border); }
.ec-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ec-tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid transparent; border-radius: var(--sd-radius-md); background: none; color: var(--sd-text-secondary); font-size: var(--sd-fs-small); font-weight: var(--sd-fw-semibold); }
.ec-tab:hover { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
.ec-tab.active { background: var(--sd-primary-soft); color: var(--sd-primary); border-color: color-mix(in srgb, var(--sd-primary) 30%, transparent); }
.email-composer .tool { border: 0; background: none; color: var(--sd-text-secondary); width: 34px; height: 34px; border-radius: var(--sd-radius-md); display: inline-flex; align-items: center; justify-content: center; }
.email-composer .tool:hover, .email-composer .tool[aria-pressed="true"] { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
.ec-fields { border-bottom: 1px solid var(--sd-border); }
.ec-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 14px; min-height: 44px; }
.ec-row + .ec-row { border-top: 1px dashed var(--sd-divider, var(--sd-border)); }
.ec-label { font-size: var(--sd-fs-small); color: var(--sd-text-muted); }
.ec-value { font-size: var(--sd-fs-small); color: var(--sd-text-heading); overflow-wrap: anywhere; }
.ec-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; cursor: text; }
.ec-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 10px; border-radius: var(--sd-radius-pill); background: var(--sd-tone-gray-bg); color: var(--sd-text-heading); font-size: var(--sd-fs-small); overflow-wrap: anywhere; }
.ec-chip button { border: 0; background: none; color: var(--sd-text-muted); width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.ec-chip button:hover { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
.ec-chip.is-invalid { background: var(--sd-tone-red-bg, #fde8e8); color: var(--sd-danger-text); }
.ec-input { flex: 1 1 160px; min-width: 120px; border: 0; outline: 0; background: transparent; color: var(--sd-text); font-size: var(--sd-fs-small); padding: 4px 0; }
.ec-row-actions { display: inline-flex; gap: 10px; }
.ec-note-hint { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 14px; font-size: var(--sd-fs-xs); color: var(--sd-tone-orange-text); border-bottom: 1px solid var(--sd-border); }
.ec-editor { padding: 0; }
.ec-editor .jodit-container:not(.jodit_inline) { border: 0; border-radius: 0; background: transparent; }
.ec-editor .jodit-toolbar__box:not(:empty) { border-bottom: 1px solid var(--sd-border); background: var(--sd-bg-table-head); }
.ec-editor .jodit-wysiwyg { padding: 14px 16px !important; font-family: var(--sd-font-body); font-size: var(--sd-fs-body); color: var(--sd-text); }
.ec-editor .jodit-wysiwyg img { max-width: 100%; height: auto; }
.ec-editor .jodit-workplace, .ec-editor .jodit-wysiwyg { background: transparent !important; color: var(--sd-text) !important; }
.ec-editor .jodit-toolbar__box:not(:empty) .jodit-toolbar-button__button, .ec-editor .jodit-toolbar-button__trigger { color: var(--sd-text-secondary); }
.ec-editor .jodit-toolbar-button__icon, .ec-editor .jodit-toolbar-button__trigger { color: var(--sd-text-secondary); }
.ec-editor .jodit-icon { fill: none; stroke: currentColor; }
.ec-editor .jodit-toolbar-button:hover:not([disabled]) .jodit-toolbar-button__button, .ec-editor .jodit-toolbar-button__button[aria-pressed="true"] { background: var(--sd-bg-hover); }
.ec-editor .jodit-toolbar-button_disabled .jodit-toolbar-button__icon { color: var(--sd-text-subtle); }
.ec-editor .jodit-ui-separator { border-color: var(--sd-border); }
.ec-editor .jodit-placeholder { color: var(--sd-text-muted); }
.ec-editor .jodit-status-bar { display: none; }
.ec-forward-files { margin: 0; padding: 8px 16px 0; font-size: var(--sd-fs-small); }
.ec-files { padding: 8px 14px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ec-files:empty { display: none; }
.ec-files .tag-chip button { border: 0; background: none; color: inherit; padding: 0; display: inline-flex; }
.ec-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--sd-border); }
.ec-tools, .ec-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ec-actions { gap: 8px; margin-left: auto; }
.ec-actions .btn-group .btn { gap: 6px; }
.ec-actions .dropdown-menu { min-width: 300px; }
.ec-actions .dropdown-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; white-space: nowrap; }
.ec-split { padding-left: 10px; padding-right: 10px; border-left: 1px solid color-mix(in srgb, var(--sd-on-primary, #fff) 35%, transparent); }
.email-composer.is-expanded { position: fixed; inset: 24px; z-index: 1060; margin: 0; display: flex; flex-direction: column; box-shadow: var(--sd-shadow-raised); }
.email-composer.is-expanded form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.email-composer.is-expanded .ec-editor { flex: 1 1 auto; min-height: 0; display: flex; }
.email-composer.is-expanded .ec-editor .jodit-container { flex: 1 1 auto; height: auto !important; display: flex; flex-direction: column; }
.email-composer.is-expanded .ec-editor .jodit-workplace { flex: 1 1 auto; height: auto !important; }
body.ec-expanded::after { content: ""; position: fixed; inset: 0; z-index: 1055; background: var(--sd-backdrop, rgba(15, 23, 42, .45)); }
.message-recipients { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; margin: -2px 0 8px; font-size: var(--sd-fs-xs); color: var(--sd-text-muted); }
.message-recipients dt { font-weight: var(--sd-fw-semibold); }
.message-recipients dd { margin: 0; overflow-wrap: anywhere; }
.message-body img { max-width: 100%; height: auto; }
@media (max-width: 575.98px) {
  .ec-row { grid-template-columns: 40px minmax(0, 1fr); }
  .ec-row-actions { grid-column: 2; justify-self: start; }
  .email-composer.is-expanded { inset: 0; border-radius: 0; }
  .ec-actions { width: 100%; justify-content: flex-end; }
}
.composer-mode { display: inline-flex; gap: 4px; padding: 4px; background: var(--sd-bg-table-head); border-radius: var(--sd-radius-md); margin-bottom: 10px; }
.composer-mode label { padding: 6px 12px; border-radius: var(--sd-radius-sm); font-size: var(--sd-fs-small); font-weight: var(--sd-fw-semibold); color: var(--sd-text-secondary); cursor: pointer; }
.composer-mode input { position: absolute; opacity: 0; pointer-events: none; }
.composer-mode input:checked + label { background: var(--sd-bg-surface); color: var(--sd-text-heading); box-shadow: var(--sd-shadow-card); }
.composer-mode input:focus-visible + label { box-shadow: var(--sd-focus-ring); }
.composer-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mention-menu { position: absolute; z-index: 1060; background: var(--sd-bg-surface); border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); box-shadow: var(--sd-shadow-dropdown); padding: 6px; min-width: 220px; max-height: 240px; overflow-y: auto; }
.mention-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px; border-radius: var(--sd-radius-md); color: var(--sd-text); text-align: left; }
.mention-menu button.active, .mention-menu button:hover { background: var(--sd-bg-hover); }
.emoji-menu { display: grid; grid-template-columns: repeat(8, 32px); gap: 2px; padding: 8px; }
.emoji-menu button { border: 0; background: none; font-size: 20px; width: 32px; height: 32px; border-radius: 6px; }
.emoji-menu button:hover { background: var(--sd-bg-hover); }

/* ---------------------------------------------------------------- uploads */
.upload-zone { border: 1.5px dashed var(--sd-border-strong); border-radius: var(--sd-radius-lg); padding: 22px 16px; display: flex; align-items: center; justify-content: center; gap: 16px; text-align: left; color: var(--sd-text); cursor: pointer; background: var(--sd-bg-surface); transition: border-color var(--sd-transition), background var(--sd-transition); }
.upload-zone:hover, .upload-zone.drag { border-color: var(--sd-primary); background: var(--sd-bg-hover); }
.upload-zone .ic { width: 34px; height: 34px; color: var(--sd-primary-strong); }
.upload-zone .sub { display: block; color: var(--sd-text-muted); font-size: var(--sd-fs-small); }
.file-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.file-card { display: flex; align-items: center; gap: 14px; border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); padding: 10px 14px; background: var(--sd-bg-surface); min-width: 0; }
.file-card .thumb { width: 60px; height: 44px; border-radius: var(--sd-radius-sm); object-fit: cover; background: var(--sd-bg-table-head); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.file-card .thumb.pdf { background: var(--sd-tone-red-bg); color: var(--sd-tone-red-fg); font-weight: 800; font-size: 11px; width: 40px; }
.file-card .meta { flex: 1; min-width: 0; }
.file-card .meta strong { display: block; color: var(--sd-text-heading); font-weight: var(--sd-fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .meta span { color: var(--sd-text-muted); font-size: var(--sd-fs-small); }
.file-card .remove { border: 0; background: none; color: var(--sd-text-secondary); width: 32px; height: 32px; border-radius: var(--sd-radius-md); }
.file-card .remove:hover { background: var(--sd-bg-hover); color: var(--sd-danger-text); }

/* ---------------------------------------------------------------- rich text (Quill) */
.editor { border: 1px solid var(--sd-border-strong); border-radius: var(--sd-radius-md); background: var(--sd-bg-surface); }
.editor:focus-within { border-color: var(--sd-border-focus); box-shadow: var(--sd-focus-ring); }
.editor .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--sd-border); padding: 10px 12px; font-family: var(--sd-font-body); }
.editor .ql-container.ql-snow { border: 0; font-family: var(--sd-font-body); font-size: var(--sd-fs-body); color: var(--sd-text); min-height: 110px; }
.editor .ql-editor { min-height: 110px; }
.editor .ql-editor.ql-blank::before { color: var(--sd-text-subtle); font-style: normal; left: 15px; }
.editor .ql-snow .ql-stroke { stroke: var(--sd-text-heading); }
.editor .ql-snow .ql-fill { fill: var(--sd-text-heading); }
.editor .ql-snow .ql-picker { color: var(--sd-text-heading); }
.editor .ql-snow.ql-toolbar button:hover .ql-stroke, .editor .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--sd-primary); }
.editor.is-invalid { border-color: var(--sd-danger); }

/* ---------------------------------------------------------------- right-rail helpers */
.tips-card { background: var(--sd-bg-help); border-color: transparent; }
.tips-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.tips-list li { display: flex; gap: 14px; align-items: flex-start; color: var(--sd-text); }
.tips-list .check { width: 22px; height: 22px; border-radius: 50%; background: var(--sd-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tips-list .check .ic { width: 14px; height: 14px; stroke-width: 3; }
.urgent-card { background: var(--sd-bg-urgent); border-color: transparent; }
.hint-card { background: var(--sd-bg-warning-soft); border-color: transparent; }

/* ---------------------------------------------------------------- numbered form sections */
.section-step { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 18px; border-bottom: 1px solid var(--sd-divider); }
.section-step:last-of-type { border-bottom: 0; }
.step-no { width: 40px; height: 40px; border-radius: 50%; background: var(--sd-tone-blue-bg); color: var(--sd-primary); font-family: var(--sd-font-heading); font-weight: var(--sd-fw-bold); display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.section-step h2, .section-step h3 { font-size: 1.05rem; font-weight: var(--sd-fw-bold); }
.section-step .section-sub { color: var(--sd-text-muted); font-size: var(--sd-fs-small); margin: 2px 0 12px; }
.mode-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--sd-border-strong); border-radius: var(--sd-radius-lg); background: var(--sd-bg-surface); cursor: pointer; text-align: left; width: 100%; color: inherit; }
.mode-card .ic { width: 30px; height: 30px; color: var(--sd-primary-strong); flex-shrink: 0; }
.mode-card > span { min-width: 0; }
.mode-card strong { display: block; font-family: var(--sd-font-heading); font-size: 1.05rem; color: var(--sd-text-heading); }
.mode-card span { color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }
.mode-card:has(input:checked) { border: 2px solid var(--sd-primary); box-shadow: var(--sd-focus-ring); }
.mode-card:has(input:focus-visible) { box-shadow: var(--sd-focus-ring); }
.mode-card.active { border: 2px solid var(--sd-primary); box-shadow: var(--sd-focus-ring); }
.perm-box { border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* ---------------------------------------------------------------- settings layout */
.settings-nav { list-style: none; margin: 0; padding: 10px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.settings-nav::-webkit-scrollbar { display: none; }
.settings-nav a { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: var(--sd-radius-md); color: var(--sd-text); font-weight: var(--sd-fw-medium); white-space: nowrap; text-decoration: none; }
.settings-nav a .ic { color: var(--sd-text-secondary); width: 22px; height: 22px; }
.settings-nav a:hover { background: var(--sd-bg-hover); }
.settings-nav a.active { background: var(--sd-primary-soft); color: var(--sd-primary); }
.settings-nav a.active .ic { color: var(--sd-primary); }
.settings-nav .nav-group { color: var(--sd-text-muted); font-size: var(--sd-fs-xs); text-transform: uppercase; letter-spacing: .06em; padding: 12px 14px 4px; display: none; }
.form-section { padding: 18px; border-bottom: 1px solid var(--sd-divider); }
.form-section:last-child { border-bottom: 0; }
.form-section h2 { font-size: 1.1rem; font-weight: var(--sd-fw-bold); }
.form-section .section-sub { color: var(--sd-text-muted); font-size: var(--sd-fs-small); margin: 2px 0 14px; }
.logo-box { border: 1px solid var(--sd-border); border-radius: var(--sd-radius-md); height: 82px; display: flex; align-items: center; justify-content: center; background: var(--sd-bg-surface); }
.logo-box img { max-height: 64px; }
.radio-inline { display: flex; flex-wrap: wrap; gap: 18px; }
.radio-inline .form-check { align-items: center; }

/* ---------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 34px; }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: -2px; width: 2px; background: var(--sd-tone-blue-bg); }
.timeline li:last-child::before { display: none; }
.timeline li[class*="tone-"] .t-dot { border-color: var(--tone-fg); }
.timeline .t-dot { position: absolute; left: 0; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--sd-bg-surface); border: 4px solid var(--tone-fg, var(--sd-primary)); }
.timeline strong { display: block; color: var(--sd-text-heading); font-weight: var(--sd-fw-medium); }
.timeline span { color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }

/* ---------------------------------------------------------------- milestones */
.date-tile { width: 44px; min-height: 46px; border-radius: var(--sd-radius-md); background: var(--sd-tone-blue-bg); color: var(--sd-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1; }
.date-tile strong { font-family: var(--sd-font-heading); font-size: 1.1rem; }
.date-tile span { font-size: 10px; font-weight: 700; text-transform: uppercase; margin-top: 2px; }
.date-tile.tone-orange { background: var(--sd-tone-orange-bg); color: var(--sd-tone-orange-text); }
.date-tile.tone-purple { background: var(--sd-tone-purple-bg); color: var(--sd-tone-purple-text); }

/* ---------------------------------------------------------------- knowledge base */
.kb-hero { position: relative; overflow: hidden; border-radius: var(--sd-radius-2xl); background: var(--sd-bg-help); padding: 26px 22px; }
.kb-hero h2 { font-size: 1.6rem; font-weight: var(--sd-fw-extrabold); }
.kb-hero p { color: var(--sd-text-secondary); margin: 6px 0 16px; }
.kb-hero .kb-search { position: relative; max-width: 610px; z-index: 1; }
.kb-hero .kb-search .form-control { height: 50px; padding-left: 50px; border-color: transparent; box-shadow: var(--sd-shadow-card); }
.kb-hero .kb-search .ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--sd-text-heading); }
.kb-hero .kb-art { display: none; position: absolute; right: 30px; bottom: 0; width: 230px; }
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.category-tile { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--sd-radius-xl); background: var(--sd-bg-surface); border: 1px solid var(--sd-border); box-shadow: var(--sd-shadow-card); color: inherit; text-decoration: none !important; }
.category-tile:hover { box-shadow: var(--sd-shadow-raised); }
.category-tile strong { display: block; color: var(--sd-text-heading); font-weight: var(--sd-fw-semibold); line-height: 1.25; }
.category-tile span { color: var(--sd-text-muted); font-size: var(--sd-fs-small); }
.article-row { display: flex; align-items: center; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--sd-divider); color: inherit; text-decoration: none !important; }
.article-row:last-child { border-bottom: 0; }
.article-row:hover .row-title { color: var(--sd-primary); }
.article-row .meta-right { margin-left: auto; display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.article-body { font-size: 1rem; line-height: 1.7; color: var(--sd-text); }
.article-body h2 { font-size: 1.3rem; font-weight: var(--sd-fw-bold); margin: 26px 0 8px; scroll-margin-top: 90px; }
.article-body h2:first-child { margin-top: 0; }
.article-body h3 { font-size: 1.05rem; margin: 18px 0 6px; scroll-margin-top: 90px; }
.article-body img { border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); margin: 10px 0; box-shadow: var(--sd-shadow-card); }
.article-body code { background: var(--sd-bg-table-head); padding: 2px 6px; border-radius: 4px; color: var(--sd-text-heading); }
.article-body blockquote { border-left: 3px solid var(--sd-primary-soft); padding-left: 14px; color: var(--sd-text-secondary); }
.article-body.steps h2[id^="step"] { display: flex; align-items: center; gap: 14px; }
.article-body.steps h2[id^="step"]::before { counter-increment: step; content: counter(step); width: 40px; height: 40px; border-radius: 50%; background: var(--sd-tone-blue-bg); color: var(--sd-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.article-body.steps { counter-reset: step; }
.toc { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--sd-divider); }
.toc a { display: block; padding: 9px 18px; color: var(--sd-text-secondary); text-decoration: none; margin-left: -2px; border-left: 3px solid transparent; }
.toc a:hover { color: var(--sd-text-heading); }
.toc a.active { color: var(--sd-text-heading); background: var(--sd-bg-selected); border-left-color: var(--sd-primary); border-radius: 0 var(--sd-radius-md) var(--sd-radius-md) 0; font-weight: var(--sd-fw-medium); }
.helpful { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.helpful .btn { min-height: 48px; }
.helpful .btn.chosen { background: var(--sd-primary-soft); border-color: var(--sd-primary); color: var(--sd-primary); }

/* ---------------------------------------------------------------- notifications page */
.notif-group-title { font-family: var(--sd-font-heading); font-weight: var(--sd-fw-bold); color: var(--sd-text-heading); font-size: 1.1rem; margin: 18px 0 8px; }
.notif-list { list-style: none; margin: 0; padding: 0 16px; background: var(--sd-bg-surface); border: 1px solid var(--sd-border); border-radius: var(--sd-radius-xl); box-shadow: var(--sd-shadow-card); }
.notif-list li { display: flex; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--sd-divider); align-items: flex-start; }
.notif-list li:last-child { border-bottom: 0; }
.notif-list .n-body { flex: 1; min-width: 0; }
.notif-list .n-title { font-weight: var(--sd-fw-bold); color: var(--sd-text-heading); }
.notif-list .n-msg { color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }
.notif-list .n-side { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.notif-list .n-time { color: var(--sd-text-muted); font-size: var(--sd-fs-small); white-space: nowrap; }
.notif-list li.unread .n-title::after { content: ""; }
.filter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.filter-list label { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--sd-radius-md); cursor: pointer; }
.filter-list label:hover, .filter-list label.on { background: var(--sd-bg-selected); }
.filter-list .count { margin-left: auto; color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }
.pref-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.pref-list li { display: flex; align-items: center; gap: 12px; }
.pref-list .p-body { flex: 1; min-width: 0; }
.pref-list strong { display: block; color: var(--sd-text-heading); font-weight: var(--sd-fw-semibold); font-size: .92rem; }
.pref-list span { color: var(--sd-text-muted); font-size: var(--sd-fs-xs); }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); background: var(--sd-bg-surface); }
.auth-panel { display: none; position: relative; overflow: hidden; background: var(--sd-bg-auth-panel); }
.auth-panel .auth-copy { position: relative; z-index: 2; padding: 80px 0 40px 76px; max-width: 520px; }
.auth-panel .auth-logo { width: 280px; height: auto; margin: -12px 0 32px -10px; }
.auth-panel h1 { font-size: var(--sd-fs-display); font-weight: var(--sd-fw-extrabold); line-height: 1.08; letter-spacing: -.03em; }
.auth-panel .lead-sd { font-size: 1.25rem; color: var(--sd-text-secondary); line-height: 1.45; margin: 14px 0 34px; max-width: 350px; }
.feature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.feature-list li { display: flex; align-items: center; gap: 20px; }
.feature-list .icon-tile { width: 66px; height: 66px; border-radius: 16px; }
.feature-list strong { display: block; font-family: var(--sd-font-heading); font-size: 1.2rem; color: var(--sd-text-heading); font-weight: var(--sd-fw-bold); }
.feature-list span { color: var(--sd-text-secondary); font-size: 1.02rem; }
.carousel-dots { display: flex; gap: 14px; margin: 40px 0 34px; }
.carousel-dots span { width: 26px; height: 7px; border-radius: 4px; background: var(--sd-border-strong); }
.carousel-dots span.on { width: 62px; background: var(--sd-primary-strong); }
.auth-quote { display: flex; gap: 12px; font-style: italic; color: var(--sd-text-heading); font-size: 1.15rem; line-height: 1.55; max-width: 360px; }
.auth-quote .q { font-size: 3.4rem; line-height: .9; color: var(--sd-tone-blue-fg); opacity: .55; font-style: normal; font-family: Georgia, serif; }
.auth-panel .auth-art { position: absolute; right: 0; top: 140px; width: 500px; height: auto; z-index: 1; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--sd-bg-auth-form); }
.auth-card { width: 100%; max-width: 532px; border: 1px solid var(--sd-border); border-radius: var(--sd-radius-2xl); padding: 34px 22px; background: var(--sd-bg-surface); box-shadow: 0 2px 20px rgba(16, 42, 92, .05); }
.auth-card .card-logo { display: block; width: 230px; max-width: 100%; height: auto; margin: -6px auto 20px; }
.auth-card h2 { text-align: center; font-size: var(--sd-fs-h2); font-weight: var(--sd-fw-extrabold); }
.auth-card .auth-sub { text-align: center; color: var(--sd-text-secondary); margin: 10px 0 30px; }
.auth-card .form-control { min-height: 54px; font-size: 1rem; }
.auth-card .btn-lg { width: 100%; min-height: 54px; font-size: 1.1rem; }
.or-divider { display: flex; align-items: center; gap: 18px; color: var(--sd-text-secondary); margin: 22px 0; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--sd-border); }
.btn-google { width: 100%; min-height: 54px; background: var(--sd-bg-surface); border: 1px solid var(--sd-border-strong); color: var(--sd-text-heading); font-size: 1.05rem; }
.btn-google:hover { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
.auth-foot { text-align: center; margin-top: 26px; color: var(--sd-text-secondary); }
.pw-toggle { border: 0; background: none; color: var(--sd-text-secondary); width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--sd-radius-md); }
.pw-toggle:hover { background: var(--sd-bg-hover); }
.auth-mobile-brand { text-align: center; margin-bottom: 18px; }

/* ---------------------------------------------------------------- error pages */
.error-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 40px 16px; }
.error-page .code { font-family: var(--sd-font-heading); font-weight: var(--sd-fw-extrabold); font-size: 4.5rem; color: var(--sd-primary-strong); line-height: 1; letter-spacing: -.04em; }
.error-page h1 { font-size: 1.6rem; margin: 10px 0; }
.error-page p { color: var(--sd-text-secondary); max-width: 480px; margin: 0 auto 22px; }

/* ---------------------------------------------------------------- misc */
.divider { height: 1px; background: var(--sd-divider); margin: 16px 0; }
.hstack-sd { display: flex; align-items: center; gap: 10px; }
.stars { display: inline-flex; gap: 4px; }
.stars .ic { width: 18px; height: 18px; color: var(--sd-priority-medium); fill: var(--sd-priority-medium); }
.stars .ic.off { color: var(--sd-border-strong); fill: none; }
.rating-input { display: flex; gap: 8px; flex-direction: row-reverse; justify-content: flex-end; }
.rating-input input { position: absolute; opacity: 0; pointer-events: none; }
.rating-input label { cursor: pointer; color: var(--sd-border-strong); }
.rating-input label .ic { width: 34px; height: 34px; }
.rating-input input:checked ~ label .ic, .rating-input label:hover .ic, .rating-input label:hover ~ label .ic { color: var(--sd-priority-medium); fill: var(--sd-priority-medium); }
.rating-input input:focus-visible + label { box-shadow: var(--sd-focus-ring); border-radius: 6px; }
.code-block { background: var(--sd-bg-table-head); border-radius: var(--sd-radius-md); padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--sd-fs-small); color: var(--sd-text-heading); word-break: break-all; }
.qr-box { background: #fff; padding: 12px; border-radius: var(--sd-radius-lg); border: 1px solid var(--sd-border); display: inline-block; }
.qr-box svg { width: 180px; height: 180px; display: block; }
.bulk-bar { display: none; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--sd-radius-lg); background: var(--sd-primary-soft); color: var(--sd-text-heading); margin-bottom: 12px; }
.bulk-bar.show { display: flex; }
.matrix { width: 100%; border-collapse: collapse; font-size: var(--sd-fs-small); }
.matrix th, .matrix td { padding: 10px 8px; border-bottom: 1px solid var(--sd-divider); text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix thead th { background: var(--sd-bg-table-head); color: var(--sd-text-heading); font-weight: var(--sd-fw-semibold); position: sticky; top: 0; }
.matrix .group td { background: var(--sd-bg-page); font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); text-align: left; }
.tone-radio + .avatar { cursor: pointer; border: 2px solid transparent; }
.tone-radio:checked + .avatar { border-color: var(--sd-primary); box-shadow: var(--sd-focus-ring); }
.tone-radio:focus-visible + .avatar { box-shadow: var(--sd-focus-ring); }
.offline-banner { position: fixed; left: 50%; transform: translateX(-50%); top: 10px; z-index: 2000; background: var(--sd-text-heading); color: #fff; padding: 8px 16px; border-radius: var(--sd-radius-pill); font-size: var(--sd-fs-small); display: none; }
.offline-banner.show { display: block; }
.print-only { display: none; }

/* ==========================================================================
   Breakpoints (see tokens.css): sm 576 · md 768 · lg 992 · xl 1200 · xxl 1400
   ========================================================================== */
@media (min-width: 576px) {
  .content { padding: 24px 20px 40px; }
  .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-card { padding: 40px 38px; }
  .perm-box { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .donut-wrap { grid-template-columns: 156px minmax(0, 1fr); }
}

@media (min-width: 768px) {
  .topbar { height: 76px; padding: 0 var(--sd-content-pad); }
  .ticket-head.is-sticky { top: 76px; }
  .topbar-search { display: block; }
  .topbar .brand-mobile { display: none; }
  .user-menu .name { display: inline; }
  .topbar-divider { display: block; }
  .content { padding: 26px var(--sd-content-pad) 40px; }
  .page-title { font-size: var(--sd-fs-h1); }
  .page-subtitle { font-size: var(--sd-fs-lead); }
  .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .category-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kb-hero { padding: 34px 28px; }
  .kb-hero .kb-art { display: block; }
  .kb-hero .kb-search { max-width: calc(100% - 260px); }
  .info-list { grid-template-columns: 113px minmax(0, 1fr); }
  .stat-card { padding: 20px; }
  .card-head { padding: 20px 20px 8px; }
  .card-body-sd { padding: 12px 20px 20px; }
  .card-sd.p { padding: 20px; }
}

@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none; visibility: visible; flex-shrink: 0; box-shadow: none; }
  .sidebar-backdrop, .topbar .menu-toggle, .sidebar .sidebar-close { display: none !important; }
  /* with the sidebar taking 232px, four stat cards only fit from xl up */
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters.tickets, .filters.users, .filters.projects { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters.tickets > .input-icon, .filters.users > .input-icon, .filters.projects > .input-icon { grid-column: 1 / -1; }
}

@media (min-width: 1200px) {
  .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .settings-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
  .settings-nav { flex-direction: column; overflow: visible; }
  .settings-nav a { white-space: normal; }
  .settings-nav .nav-group { display: block; }
  .grid-rail { grid-template-columns: minmax(0, 1fr) var(--sd-right-rail); }
  .grid-rail.narrow { grid-template-columns: minmax(0, 1fr) 220px; }
  .grid-rail.wide { grid-template-columns: minmax(0, 1fr); }   /* users / projects tables need the full width until 1600px */
  .auth { grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); }
  .auth-panel { display: block; }
  .auth-mobile-brand { display: none; }
  .auth-form-side { padding: 40px 46px 40px 40px; }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
  /* beside a rail the content column is ~700px: KPI tiles go 2×2 and settings pages drop their inner rail */
  .grid-rail .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-rail:has(> .settings-layout) { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 1400px) {
  .auth-panel .auth-art { width: 500px; }
  .grid-rail.narrow { grid-template-columns: minmax(0, 1fr) 260px; }
  .filters.tickets { grid-template-columns: minmax(200px, 1.4fr) repeat(4, minmax(130px, 1fr)) auto; }
  .filters.users { grid-template-columns: minmax(220px, 1.6fr) minmax(140px, 1fr) minmax(140px, 1fr) auto; }
  .filters.projects { grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(140px, 1fr)) auto; }
  .filters.tickets > .input-icon, .filters.users > .input-icon, .filters.projects > .input-icon { grid-column: auto; }
}

@media (min-width: 1600px) {
  /* wide tables (users, projects) only share the row with a rail on large screens */
  .grid-rail.wide { grid-template-columns: minmax(0, 1fr) 372px; }
}

/* secondary table columns that are dropped on tablet/laptop widths (phones show every field as a card row) */
@media (min-width: 768px) and (max-width: 1199.98px) { .hide-lt-xl { display: none !important; } }
@media (min-width: 768px) and (max-width: 1399.98px) { .hide-lt-xxl { display: none !important; } }

@media (max-width: 1399.98px) and (min-width: 1200px) {
  .auth-panel .auth-copy { padding-left: 48px; }
  .auth-panel h1 { font-size: 2.9rem; }
  .auth-panel .auth-art { width: 420px; top: 170px; }
}

@media (max-width: 575.98px) {
  .page-actions .btn:not(.btn-icon) { flex: 1 1 calc(50% - 5px); }   /* at most two buttons per row so labels keep room */
  .qa-grid { grid-template-columns: minmax(0, 1fr); }
  .hbar-list li { grid-template-columns: minmax(70px, 110px) minmax(0, 1fr) 38px; }
  .hbar-list .hb-pct { display: none; }
  .article-row .meta-right { display: none; }
  .message-card { padding: 14px; gap: 12px; }
  .message-card .avatar { width: 36px; height: 36px; }
  .info-list { grid-template-columns: 96px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .sidebar, .topbar, .page-actions, .no-print, .composer, .toast-host { display: none !important; }
  .content { padding: 0; }
  .card-sd { box-shadow: none; }
  .print-only { display: block; }
}

/* ---------- Footer ("Built with ❤ by Sriggle") ---------- */
.app-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 18px; padding: 14px var(--sd-content-pad-mobile) 18px; border-top: 1px solid var(--sd-border); color: var(--sd-text-muted); font-size: var(--sd-fs-small); }
.app-footer p { margin: 0; }
.app-footer a { color: var(--sd-text-muted); text-decoration: underline; text-underline-offset: 2px; }
.app-footer a:hover { color: var(--sd-primary); }
.app-footer .heart { color: var(--sd-heart); font-size: 1.05em; }
.auth-form-side { flex-direction: column; }
.auth-form-side .app-footer { width: 100%; max-width: 480px; margin-top: 28px; border-top: 0; flex-direction: column; gap: 4px; text-align: center; padding: 0; }
.plain-brand img { display: block; width: 200px; height: auto; }
.plain-topbar { background: var(--sd-bg-surface); }   /* logo artwork sits on white */
@media (min-width: 992px) {
  .app-footer { padding: 14px var(--sd-content-pad) 18px; }
}

/* Dark mode: midnight-navy text/icons on dark surfaces would be invisible; use the light primary. */
[data-theme="dark"] .sidebar-help .help-head .ic,
[data-theme="dark"] .sidebar-help .btn { color: var(--sd-primary); }

/* ---------- Customer portal (Client Admin / Client User) ---------- */
.portal-header { position: sticky; top: 0; z-index: 1030; background: var(--sd-bg-surface); border-bottom: 1px solid var(--sd-border); }
.portal-bar { max-width: 1240px; margin: 0 auto; padding: 10px var(--sd-content-pad-mobile); display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.portal-brand { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; color: var(--sd-text-heading); text-decoration: none; }
.portal-brand img { display: block; }
.portal-content .grid-rail > .card-sd { align-self: start; }
.portal-actions { flex: none; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.portal-actions .user-menu .name { display: none; }
.portal-nav { order: 3; flex-basis: 100%; }
.portal-nav > ul { list-style: none; margin: 0; padding: 6px 0 4px; display: flex; flex-direction: column; gap: 2px; }
.portal-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--sd-radius-md); color: var(--sd-nav-text); font-weight: var(--sd-fw-medium); text-decoration: none; }
.portal-nav a:hover { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
.portal-nav a.active, .portal-more-btn.active { background: var(--sd-primary-soft); color: var(--sd-tone-blue-text); }
/* items that do not fit the bar move here (app.js, fitPortalNav); shown only at widths where the bar is inline */
.portal-more { display: none; position: relative; }
.portal-more-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; background: transparent; border-radius: 50%; color: var(--sd-nav-text); }
.portal-more-btn:hover { background: var(--sd-bg-hover); color: var(--sd-text-heading); }
.portal-more .dropdown-menu { min-width: 200px; margin-top: 8px; }
.portal-more .dropdown-menu li + li { margin-top: 2px; }
.portal-more .dropdown-menu a { white-space: nowrap; }
.portal-content { max-width: 1240px; width: 100%; margin: 0 auto; padding: 20px var(--sd-content-pad-mobile) 40px; flex: 1; }
.portal-hero { background: var(--sd-bg-help); border-radius: var(--sd-radius-2xl); padding: 26px 20px; margin-bottom: 20px; }
.portal-eyebrow { margin: 0 0 6px; font-size: var(--sd-fs-xs); font-weight: var(--sd-fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--sd-tone-blue-text); }
.portal-hero h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin: 0 0 16px; }
.portal-search { display: flex; align-items: center; gap: 8px; max-width: 720px; padding: 6px 6px 6px 14px; background: var(--sd-bg-surface); border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); box-shadow: var(--sd-shadow-card); color: var(--sd-text-secondary); }
.portal-search:focus-within { box-shadow: var(--sd-focus-ring); border-color: var(--sd-border-focus); }
.portal-search .form-control { border: 0; box-shadow: none; padding-left: 0; min-width: 0; background: transparent; }
.portal-hero-sub { margin: 12px 0 0; color: var(--sd-text-secondary); }
.portal-tiles { margin-bottom: 20px; }
.portal-tile { display: flex; align-items: center; gap: 14px; padding: 18px; color: var(--sd-text); text-decoration: none; transition: box-shadow var(--sd-transition), border-color var(--sd-transition); }
.portal-tile:hover { text-decoration: none; box-shadow: var(--sd-shadow-raised); border-color: var(--sd-border-strong); }
.portal-tile strong { display: block; color: var(--sd-text-heading); font-weight: var(--sd-fw-semibold); }
.portal-tile > span:last-child > span { font-size: var(--sd-fs-small); color: var(--sd-text-secondary); }
.portal-tile.primary { border-color: var(--sd-primary-soft); background: var(--sd-bg-selected); }
.portal-tile.attention { border-color: var(--sd-tone-orange-fg); }
.topic-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--sd-radius-pill); background: var(--sd-tone-blue-bg); color: var(--sd-tone-blue-text); font-size: var(--sd-fs-small); font-weight: var(--sd-fw-medium); text-decoration: none; }
.topic-chip:hover { box-shadow: inset 0 0 0 1px currentColor; }
.topic-chip .count { font-weight: var(--sd-fw-regular); }
body.portal { display: flex; flex-direction: column; min-height: 100vh; background: var(--sd-bg-page); }
body.portal .app-footer { max-width: 1240px; width: 100%; margin: 0 auto; border-top: 0; }
.portal-fab { position: fixed; right: 16px; bottom: 16px; z-index: 1020; width: 56px; height: 56px; padding: 0; border-radius: 50%; box-shadow: var(--sd-shadow-raised); }
@media (min-width: 768px) {
  .portal-actions .user-menu .name { display: inline; }
  .portal-hero { padding: 36px 40px; }
}
@media (min-width: 992px) {
  .portal-bar { padding: 12px var(--sd-content-pad); }
  .portal-content { padding: 28px var(--sd-content-pad) 40px; }
}
/* From 768 px the menu is inline; items that do not fit move behind the round "…" button (app.js, fitPortalNav),
   so none is ever hidden under the action buttons. Below 768 px it is the menu button. */
@media (min-width: 768px) {
  .portal-bar { flex-wrap: nowrap; }
  .portal-brand { flex: none; }
  .portal-nav { display: block !important; order: 0; flex: 1 1 auto; flex-basis: auto; min-width: 0; }
  .portal-nav > ul { flex-direction: row; padding: 0; gap: 4px; }
  .portal-nav > ul > li { flex: none; }
  .portal-nav a { padding: 8px 12px; }
  .portal-toggle { display: none; }
  .portal-more.has-items { display: block; }
}


/* Customer portal header: the AssistZen logo (≥ 180 px visible, brand guideline); icon-only on phones and in dark mode */
.portal-brand img.logo-full { width: 200px; max-width: none; max-height: none; height: auto; }
.portal-brand img.logo-icon, .portal-brand img.logo-icon-dark { display: none; width: 40px; height: 40px; border-radius: 10px; }
@media (max-width: 575.98px) {
  .portal-brand img.logo-full { display: none; }
  .portal-brand img.logo-icon { display: block; }
}
[data-theme="dark"] .portal-brand img.logo-full, [data-theme="dark"] .portal-brand img.logo-icon { display: none; }
[data-theme="dark"] .portal-brand img.logo-icon-dark { display: block; }

/* ---------- Settings › Import ---------- */
.import-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 0; }
.import-stats > div { background: var(--sd-bg-table-head); border-radius: var(--sd-radius-md); padding: 10px 12px; }
.import-stats dt { font-size: var(--sd-fs-xs); font-weight: var(--sd-fw-medium); color: var(--sd-text-secondary); }
.import-stats dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); font-variant-numeric: tabular-nums; }
.import-log li { gap: 10px; align-items: flex-start; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
/* service records */
.svc-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.svc-links > li + li { border-top: 1px solid var(--sd-divider); padding-top: 14px; }
.svc-update { margin: 8px 0 0 38px; padding: 8px 10px; border-radius: var(--sd-radius-md); background: var(--sd-bg-table-head); }
.svc-update .message-body p:last-child { margin-bottom: 0; }
.icon-tile.xs { width: 30px; height: 30px; border-radius: var(--sd-radius-sm); flex: none; }
.icon-tile.xs .ic { width: 16px; height: 16px; }
.timeline .message-body strong { display: inline; font-weight: var(--sd-fw-semibold); }
.timeline .message-body p { margin-bottom: 4px; }
/* work: task lists */
.task-group { display: flex; align-items: center; gap: 8px; margin: 18px 0 6px; font-size: var(--sd-fs-small); font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); }
.task-group .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone-fg); }
.task-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--sd-divider); }
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--sd-divider); min-width: 0; }
.task-row.done .task-title { color: var(--sd-text-subtle); text-decoration: line-through; }
.task-main { flex: 1 1 auto; min-width: 0; color: inherit; text-decoration: none !important; }
.task-title { display: block; color: var(--sd-text-heading); font-weight: var(--sd-fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: var(--sd-fs-xs); color: var(--sd-text-secondary); }
.task-side { display: flex; align-items: center; gap: 8px; flex: none; }
.task-due { min-width: 78px; text-align: right; font-size: var(--sd-fs-small); }
.check-btn { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--sd-border-strong); background: var(--sd-bg-surface); display: inline-flex; align-items: center; justify-content: center; padding: 0; color: transparent; cursor: pointer; }
.check-btn .ic { width: 14px; height: 14px; }
.check-btn:hover { border-color: var(--sd-success-text); color: var(--sd-success-text); }
.check-btn.checked { background: var(--sd-success-text); border-color: var(--sd-success-text); color: #fff; }
.check-btn.sm { width: 20px; height: 20px; border-radius: 6px; }
.avatar-placeholder { width: 28px; height: 28px; border-radius: 50%; border: 1.5px dashed var(--sd-border-strong); display: inline-block; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 10px; min-height: 34px; }
@media (max-width: 767.98px) { .task-side .badge-sd:not(:last-of-type), .task-due { display: none; } }
/* work: board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(212px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: var(--sd-bg-table-head); border-radius: var(--sd-radius-lg); padding: 10px; min-height: 240px; display: flex; flex-direction: column; }
.board-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 10px; font-size: var(--sd-fs-small); }
.board-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 60px; border-radius: var(--sd-radius-md); }
.board-cards.over { outline: 2px dashed var(--sd-primary); outline-offset: 2px; }
.board-card { background: var(--sd-bg-surface); border: 1px solid var(--sd-border); border-radius: var(--sd-radius-md); padding: 10px 12px; box-shadow: var(--sd-shadow-card); cursor: grab; }
.board-card.dragging { opacity: .5; }
.board-title { display: block; color: var(--sd-text-heading); font-weight: var(--sd-fw-medium); text-decoration: none !important; margin-bottom: 6px; }
.board-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--sd-fs-xs); color: var(--sd-text-secondary); }
.board-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; min-height: 28px; }
/* work: timeline */
.gantt { overflow-x: auto; }
.gantt-row { display: grid; grid-template-columns: 280px minmax(560px, 1fr); border-bottom: 1px solid var(--sd-divider); min-height: 52px; }
.gantt-head { min-height: 36px; font-size: var(--sd-fs-xs); color: var(--sd-text-secondary); font-weight: var(--sd-fw-semibold); background: var(--sd-bg-table-head); }
.gantt-label { padding: 8px 14px; min-width: 0; border-right: 1px solid var(--sd-divider); font-size: var(--sd-fs-small); }
.gantt-head .gantt-label { display: flex; align-items: center; }
.gantt-track { position: relative; }
.gantt-week { position: absolute; top: 10px; padding-left: 6px; border-left: 1px solid var(--sd-divider); height: 100%; white-space: nowrap; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--sd-danger-text); opacity: .5; }
.gantt-bar { position: absolute; top: 14px; height: 24px; border-radius: 6px; background: var(--tone-bg); border: 1px solid var(--tone-fg); color: var(--tone-text); font-size: var(--sd-fs-xs); padding: 0 8px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; text-decoration: none !important; }
/* timesheets */
.week-totals { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-totals > div { background: var(--sd-bg-table-head); border-radius: var(--sd-radius-md); padding: 8px 10px; display: flex; flex-direction: column; }
.week-totals > div.today { outline: 2px solid var(--sd-primary); }
.week-totals span { font-size: var(--sd-fs-xs); color: var(--sd-text-secondary); }
.week-totals strong { color: var(--sd-text-heading); font-variant-numeric: tabular-nums; }
@media (max-width: 767.98px) { .week-totals { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.timer-big { font-size: 2rem; font-variant-numeric: tabular-nums; color: var(--sd-text-heading); }
.timer-pill { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border-radius: 999px; background: var(--sd-tone-red-bg); max-width: 260px; }
.timer-pill .timer-what { display: inline-flex; align-items: center; gap: 6px; color: var(--sd-tone-red-text); font-size: var(--sd-fs-small); font-weight: var(--sd-fw-semibold); text-decoration: none !important; font-variant-numeric: tabular-nums; min-width: 0; }
.timer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sd-danger-text); animation: timer-blink 1.4s infinite; flex: none; }
@keyframes timer-blink { 50% { opacity: .25; } }
.canned-menu { width: 320px; max-height: 360px; overflow-y: auto; padding: 8px; }
.canned-menu .dropdown-item { white-space: normal; border-radius: var(--sd-radius-sm); }
.tag-x { background: none; border: 0; padding: 0 0 0 2px; color: inherit; line-height: 1; cursor: pointer; opacity: .7; }
.tag-x:hover { opacity: 1; }
/* command palette */
.cmd-backdrop { position: fixed; inset: 0; background: rgba(3, 29, 83, .28); z-index: 2000; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.cmd-backdrop[hidden] { display: none; }
.cmd-box { width: 100%; max-width: 620px; background: var(--sd-bg-surface); border-radius: var(--sd-radius-xl); box-shadow: 0 24px 60px rgba(0,0,0,.25); padding: 12px; }
.cmd-box ul { list-style: none; margin: 8px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.cmd-box li { padding: 9px 12px; border-radius: var(--sd-radius-md); cursor: pointer; color: var(--sd-text-heading); display: flex; gap: 10px; align-items: center; }
.cmd-box li.active, .cmd-box li:hover { background: var(--sd-bg-hover); }
.cmd-hint { font-size: var(--sd-fs-xs); color: var(--sd-text-secondary); min-width: 52px; }
.cmd-foot { margin: 8px 4px 0; font-size: var(--sd-fs-xs); color: var(--sd-text-subtle); }
/* change calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--sd-divider); }
.cal-head { padding: 8px 10px; font-size: var(--sd-fs-xs); font-weight: var(--sd-fw-semibold); color: var(--sd-text-secondary); text-transform: uppercase; border-bottom: 1px solid var(--sd-divider); }
.cal-cell { min-height: 108px; padding: 6px 8px; border-right: 1px solid var(--sd-divider); border-bottom: 1px solid var(--sd-divider); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: var(--sd-bg-table-head); }
.cal-cell.other .cal-day { color: var(--sd-text-subtle); }
.cal-cell.today .cal-day { background: var(--sd-primary); color: #fff; border-radius: 999px; padding: 0 7px; }
.cal-day { align-self: flex-start; font-size: var(--sd-fs-small); font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); }
.cal-item { display: flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: var(--sd-radius-sm); background: var(--tone-bg); color: var(--tone-text); font-size: var(--sd-fs-xs); font-weight: var(--sd-fw-medium); text-decoration: none !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 767.98px) { .cal-cell { min-height: 72px; padding: 4px; } .cal-item { font-size: 10px; padding: 1px 3px; } .cal-item .ic { display: none; } }
.import-meta { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0; font-size: var(--sd-fs-small); }
.import-meta > div { display: flex; gap: 6px; }
.import-meta dt { font-weight: var(--sd-fw-medium); color: var(--sd-text-secondary); }
.import-meta dd { margin: 0; color: var(--sd-text-heading); font-variant-numeric: tabular-nums; }
.import-meta dt::after { content: ":"; }
.import-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; color: var(--sd-text-secondary); }
.import-list li { display: flex; gap: 8px; align-items: flex-start; }
.import-list li .ic { flex: none; margin-top: 3px; color: var(--sd-tone-blue-fg); }
.import-list.ok li .ic { color: var(--sd-tone-green-fg); }
/* Settings › Import: the import sources. Third-party logos sit unaltered on a white tile in both themes (their single
   brand colour is made for white); brands without a logo get a neutral tile with their name. */
.import-sources { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.import-source { display: flex; flex-direction: column; gap: 10px; padding: 18px; min-width: 0; }
.import-source-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.import-source-name { font-family: var(--sd-font-heading); font-size: 1.02rem; font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); margin: 0 0 2px; overflow-wrap: anywhere; }
.import-logo { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: var(--sd-radius-md); background: #FFFFFF; border: 1px solid var(--sd-border); }
.import-logo img { width: 28px; height: 28px; object-fit: contain; }
.import-logo.is-icon { background: var(--sd-tone-blue-bg); border-color: transparent; color: var(--sd-tone-blue-text); }
.import-logo.is-icon .ic { width: 26px; height: 26px; }
.import-logo.is-text { width: auto; min-width: 48px; max-width: 96px; padding: 4px 8px; background: var(--sd-tone-gray-bg); border-color: var(--sd-border); color: var(--sd-tone-gray-text); font-size: 11px; font-weight: var(--sd-fw-semibold); line-height: 1.2; text-align: center; overflow: hidden; }
.import-source-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.import-source.is-soon .import-source-name { color: var(--sd-text-secondary); }
.import-notice { margin: 0; font-size: 11px; line-height: 1.4; color: var(--sd-text-muted); }
.import-notice-foot { padding: 4px 2px 0; }
.import-map-table select { min-width: 160px; }
.import-sample td { max-width: 260px; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ automation studio */
.alert-sd[hidden] { display: none; }
.rule-rows { display: grid; gap: 10px; margin-bottom: 12px; }
.rule-row { display: grid; grid-template-columns: 28px minmax(140px, 1fr) minmax(120px, .8fr) minmax(160px, 1.4fr) 36px; gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--sd-border); border-radius: var(--sd-radius-md); background: var(--sd-bg-surface); }
.rule-row.action { grid-template-columns: 28px minmax(220px, 1fr) minmax(200px, 2fr) 36px; }
.rule-row .rule-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 600; background: var(--sd-tone-blue-bg); color: var(--sd-tone-blue-text); margin-top: 6px; }
.rule-row.action .rule-no { background: var(--sd-tone-green-bg); color: var(--sd-tone-green-text); }
.rule-row .rule-help { grid-column: 2 / -1; font-size: .8rem; color: var(--sd-text-muted); margin-top: -2px; }
.rule-row .multi { max-height: 132px; overflow: auto; border: 1px solid var(--sd-border); border-radius: var(--sd-radius-sm); padding: 6px 10px; }
.rule-row .multi .form-check { margin-bottom: 2px; }
.rule-summary { display: grid; gap: 14px; }
.rule-step { display: flex; gap: 12px; align-items: flex-start; }
.dry-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; font-size: .88rem; }
.dry-list li { display: flex; gap: 6px; align-items: flex-start; }
.dry-list .ok { color: var(--sd-tone-green-fg); }
.dry-list .no { color: var(--sd-tone-red-fg); }
@media (max-width: 767.98px) {
  .rule-row, .rule-row.action { grid-template-columns: 28px 1fr 36px; }
  .rule-row > :nth-child(3), .rule-row > :nth-child(4) { grid-column: 2 / 3; }
}
.usage-bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.usage-bars span { flex: 1; background: var(--sd-tone-blue-fg); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }
.usage-bars span.has-errors { background: linear-gradient(var(--sd-tone-red-fg) 0 20%, var(--sd-tone-blue-fg) 20%); }
.code-block { background: var(--sd-bg-table-head); border: 1px solid var(--sd-border); border-radius: var(--sd-radius-sm); padding: 8px 10px; font-size: .78rem; white-space: pre-wrap; word-break: break-all; color: var(--sd-text); margin-bottom: 10px; }
/* ------------------------------------------------------------ presence */
.presence-avatar { position: relative; display: inline-flex; }
.presence-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--tone-fg); border: 2px solid var(--sd-bg-surface); }
.presence-dot.static { position: static; display: inline-block; margin-right: 8px; border: 0; width: 9px; height: 9px; vertical-align: middle; }
.presence-menu .dropdown-item.active { font-weight: 600; background: var(--sd-bg-selected); color: var(--sd-text-heading); }
.load-bar { height: 6px; border-radius: 3px; background: var(--sd-tone-gray-bg); overflow: hidden; min-width: 70px; }
.load-bar > span { display: block; height: 100%; background: var(--sd-tone-green-fg); }
.load-bar.warn > span { background: var(--sd-tone-orange-fg); }
.load-bar.full > span { background: var(--sd-tone-red-fg); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.divide-y > li + li { border-top: 1px solid var(--sd-divider); }
.stat-of { font-size: .8em; font-weight: 500; color: var(--sd-text-muted); }
/* ------------------------------------------------------------ copilot */
.copilot-h { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--sd-text-muted); margin: 12px 0 6px; font-weight: 600; }
.copilot-links, .copilot-list { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 6px; font-size: .86rem; }
.copilot-list { list-style: disc; padding-left: 18px; gap: 2px; font-size: .84rem; }
.copilot-result { border: 1px solid var(--sd-border); border-radius: var(--sd-radius-md); padding: 10px 12px; margin-bottom: 8px; background: var(--sd-bg-page); }
.copilot-draft { font-size: .88rem; white-space: normal; background: var(--sd-bg-surface); border: 1px dashed var(--sd-border-strong); border-radius: var(--sd-radius-sm); padding: 8px 10px; margin-bottom: 8px; max-height: 260px; overflow: auto; }
.copilot-feedback { display: flex; align-items: center; gap: 2px; margin-top: 6px; }
.tone-text-orange { color: var(--sd-tone-orange-text); }
/* ------------------------------------------------------------ surveys */
.effort-scale, .nps-scale { display: flex; gap: 6px; flex-wrap: wrap; }
.effort-scale input, .nps-scale input { position: absolute; opacity: 0; pointer-events: none; }
.effort-scale label, .nps-scale label { min-width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--sd-border-strong); border-radius: var(--sd-radius-sm); cursor: pointer; font-weight: 600; color: var(--sd-text); background: var(--sd-bg-surface); }
.effort-scale input:checked + label, .nps-scale input:checked + label { background: var(--sd-primary); border-color: var(--sd-primary); color: var(--sd-on-primary); }
.effort-scale input:focus-visible + label, .nps-scale input:focus-visible + label { outline: 2px solid var(--sd-focus-ring); outline-offset: 2px; }
.nps-card { border-left: 4px solid var(--sd-primary); }

/* ------------------------------------------------------------ live chat */
.chat-widget { position: fixed; right: 20px; bottom: 20px; z-index: 1040; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 12px; }
.chat-launcher { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 18px; background: var(--sd-primary-strong); color: #fff; font-weight: 600; box-shadow: 0 8px 24px rgba(3, 29, 83, .25); position: relative; }
.chat-launcher:focus-visible { outline: 3px solid var(--sd-focus, #3D8EF8); outline-offset: 2px; }
.chat-widget.open .chat-launcher span:not(.chat-unread) { display: none; }
.chat-unread { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; border-radius: 10px; background: #C81E3A; color: #fff; font-size: .72rem; display: grid; place-items: center; padding: 0 5px; }
.chat-panel { width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--sd-bg-surface); border: 1px solid var(--sd-border); border-radius: 16px; box-shadow: 0 16px 48px rgba(3, 29, 83, .22); overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--sd-border); }
.chat-panel .chat-head { background: var(--sd-primary-strong); color: #fff; }
.chat-panel .chat-head .btn { color: #fff; }
.chat-panel .chat-status { opacity: .85; }
.chat-messages { list-style: none; margin: 0; padding: 14px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.theirs { align-self: flex-start; }
.chat-msg.system { align-self: center; max-width: 95%; text-align: center; font-size: .78rem; color: var(--sd-text-muted); }
.chat-bubble { padding: 9px 12px; border-radius: 14px; background: var(--sd-bg-table-head); color: var(--sd-text); overflow-wrap: anywhere; font-size: .9rem; }
.chat-msg.mine .chat-bubble { background: var(--sd-primary-strong); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.theirs .chat-bubble { border-bottom-left-radius: 4px; }
.chat-msg.assistant .chat-bubble { border: 1px solid var(--sd-border); background: var(--sd-bg-surface); }
.chat-msg.pending { opacity: .6; }
.chat-meta { font-size: .7rem; color: var(--sd-text-muted); margin-top: 3px; }
.chat-sources { list-style: none; padding: 8px 0 0; margin: 8px 0 0; border-top: 1px solid var(--sd-border); font-size: .8rem; display: grid; gap: 4px; }
.chat-msg.typing .chat-bubble { display: inline-flex; gap: 4px; }
.chat-msg.typing span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .4; animation: chat-dot 1s infinite; }
.chat-msg.typing span:nth-child(2) { animation-delay: .15s; } .chat-msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chat-msg.typing span { animation: none; } }
.chat-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--sd-border); }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--sd-border); }
.chat-compose textarea { flex: 1; resize: none; border: 1px solid var(--sd-border); border-radius: 12px; padding: 8px 10px; font: inherit; background: var(--sd-bg-surface); color: var(--sd-text); max-height: 120px; }
.chat-console { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 300px); min-height: 480px; overflow: hidden; padding: 0; }
.chat-console-list { border-right: 1px solid var(--sd-border); overflow-y: auto; }
.chat-console-pane { display: flex; flex-direction: column; min-width: 0; }
.chat-console-pane .empty-state { margin: auto; }
.chat-console-body { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-group { padding: 10px 14px 4px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--sd-text-muted); }
.chat-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 14px; border-left: 3px solid transparent; color: var(--sd-text); }
.chat-item:hover { background: var(--sd-bg-hover); } .chat-item.active { background: var(--sd-bg-selected); }
.chat-item.active { border-left-color: var(--sd-primary-strong); }
.chat-item.waiting { border-left-color: #FBA21A; }
@media (max-width: 767.98px) {
  .chat-console { grid-template-columns: 1fr; height: auto; }
  .chat-console-list { border-right: 0; border-bottom: 1px solid var(--sd-border); max-height: 240px; }
  .chat-console-body { height: 70vh; }
  .chat-widget { right: 12px; bottom: 12px; }
}

/* ---------------------------------------------------------------- subscription & billing */
.plan-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.plan-option { position: relative; display: block; cursor: pointer; }
.plan-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.plan-option-body { display: flex; flex-direction: column; gap: 2px; border: 1.5px solid var(--sd-border); border-radius: var(--sd-radius-md); padding: 10px 12px; background: var(--sd-bg-surface); transition: border-color .15s, box-shadow .15s; }
.plan-option input:checked + .plan-option-body { border-color: var(--sd-primary); box-shadow: 0 0 0 3px var(--sd-primary-soft); }
.plan-option input:focus-visible + .plan-option-body { outline: 2px solid var(--sd-primary); outline-offset: 2px; }
.plan-option-name { font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.plan-option-price { font-size: .95rem; color: var(--sd-text); }
.plan-option-price small, .plan-card-price small { color: var(--sd-text-muted); font-size: .78rem; margin-left: 2px; }

.cycle-toggle { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--sd-radius-pill); background: var(--sd-bg-hover); }
.cycle-toggle label { position: relative; cursor: pointer; }
.cycle-toggle input { position: absolute; opacity: 0; }
.cycle-toggle span { display: inline-block; padding: 7px 16px; border-radius: var(--sd-radius-pill); font-weight: var(--sd-fw-medium); color: var(--sd-text-secondary); }
.cycle-toggle span em { font-style: normal; font-size: .78rem; color: var(--sd-tone-green-text); margin-left: 4px; }
.cycle-toggle input:checked + span { background: var(--sd-bg-surface); color: var(--sd-text-heading); box-shadow: var(--sd-shadow-button); }
.cycle-toggle input:focus-visible + span { outline: 2px solid var(--sd-primary); }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 6px; border: 1.5px solid var(--sd-border); border-radius: var(--sd-radius-lg); padding: 16px; cursor: pointer; background: var(--sd-bg-surface); min-width: 0; }
.plan-card input { position: absolute; top: 16px; right: 16px; }
.plan-card.recommended { border-color: var(--sd-tone-blue-bg); }
.plan-card:has(input:checked) { border-color: var(--sd-primary); box-shadow: 0 0 0 3px var(--sd-primary-soft); }
.plan-card.disabled { opacity: .55; cursor: not-allowed; }
.plan-card-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-right: 22px; color: var(--sd-text-heading); }
.plan-card-price { font-family: var(--sd-font-heading); font-size: 1.45rem; font-weight: var(--sd-fw-extrabold); color: var(--sd-text-heading); }
.plan-card-tag { color: var(--sd-text-secondary); font-size: .86rem; }

.order-summary { margin: 0; border: 1px solid var(--sd-border); border-radius: var(--sd-radius-md); padding: 10px 14px; }
.order-summary > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.order-summary dt { font-weight: var(--sd-fw-regular, 400); color: var(--sd-text-secondary); min-width: 0; overflow-wrap: anywhere; }
.order-summary dd { margin: 0; white-space: nowrap; }
.order-summary .total { border-top: 1px solid var(--sd-border); margin-top: 4px; padding-top: 7px; font-weight: var(--sd-fw-semibold); }
.order-summary .total dt, .order-summary .total dd { color: var(--sd-text-heading); font-size: 1.05rem; }

.billing-status { border-left: 4px solid var(--tone-text, var(--sd-primary)); }
.subscription-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 9px 14px; margin-bottom: 16px; border-radius: var(--sd-radius-lg); background: var(--tone-bg); color: var(--tone-text); font-weight: var(--sd-fw-medium); }
.subscription-banner .btn { margin-left: auto; }

.check-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.check-list li { display: flex; gap: 8px; align-items: flex-start; }
.check-list .ic { color: var(--sd-tone-green-text); flex-shrink: 0; margin-top: 2px; }
.list-plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }

.invoice-doc { padding: 28px; }
.invoice-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 1px solid var(--sd-border); padding-bottom: 18px; }
.invoice-logo { width: 170px; height: auto; }
.invoice-parties { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 18px 0; }
.invoice-lines tfoot td { border: 0; padding-top: 6px; padding-bottom: 6px; }
.invoice-lines tfoot .total td { font-weight: var(--sd-fw-bold, 700); font-size: 1.05rem; border-top: 1px solid var(--sd-border); }
@media print {
  .invoice-doc { box-shadow: none; border: 0; padding: 0; }
}
@media (max-width: 575.98px) {
  .plan-picker { grid-template-columns: minmax(0, 1fr); }
  .invoice-doc { padding: 18px; }
}

/* ---------------------------------------------------------------- platform console (workspaces of AssistZen) */
.text-success-sd { color: var(--sd-tone-green-text) !important; }
.text-warning-sd { color: var(--sd-tone-orange-text) !important; }
.text-danger-sd { color: var(--sd-tone-red-text) !important; }
.platform-stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.platform-stats .kpi-card { color: inherit; text-decoration: none; align-items: center; }
.platform-stats a.kpi-card:hover { box-shadow: var(--sd-shadow-raised); }
.platform-stats .kpi-value { font-size: 1.45rem; white-space: nowrap; }
.filters.platform { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) {
  .filters.platform { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters.platform > .input-icon { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
  .filters.platform { grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(130px, 1fr)) auto; }
  .filters.platform > .input-icon { grid-column: auto; }
}
.platform-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: -4px 0 14px; }
.toggle-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--sd-radius-pill); border: 1px solid var(--sd-border-strong);
  background: var(--sd-bg-surface); color: var(--sd-text-secondary); font-size: var(--sd-fs-small); font-weight: var(--sd-fw-medium); cursor: pointer; user-select: none; }
.toggle-chip input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-chip:has(input:checked) { background: var(--sd-tone-blue-bg); border-color: transparent; color: var(--sd-tone-blue-text); }
.toggle-chip:has(input:focus-visible) { outline: 2px solid var(--sd-highlight); outline-offset: 2px; }
.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--sd-primary); text-decoration: underline; }
.platform-table td { vertical-align: middle; }
.health-strip { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); margin-bottom: 18px; }
.health-strip .kpi-card { padding: 14px 16px; align-items: center; }
.health-strip .kpi-value { font-size: 1.25rem; }
.feature-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.feature-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--sd-border); border-radius: var(--sd-radius-md); min-width: 0; }
.feature-tile .ft-name { font-weight: var(--sd-fw-medium); color: var(--sd-text-heading); }
.feature-tile .ft-sub { color: var(--sd-text-muted); font-size: var(--sd-fs-xs); }
.feature-tile.off { background: var(--sd-tone-gray-bg); border-color: transparent; }
.feature-tile.off .ft-name { color: var(--sd-text-secondary); }
.countdown { display: flex; align-items: baseline; gap: 6px; }
.countdown strong { font-family: var(--sd-font-heading); font-size: 2rem; font-weight: var(--sd-fw-extrabold); color: var(--sd-text-heading); line-height: 1; }
.timeline-sd { list-style: none; margin: 0; padding: 0; }
.timeline-sd li { position: relative; padding: 0 0 14px 22px; }
.timeline-sd li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--sd-primary); }
.timeline-sd li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--sd-border); }
.timeline-sd li:last-child::after { display: none; }
.app-version { white-space: nowrap; }

/* ---------- Plan upsell: crown badge (<plan-badge>), upgrade cards (_UpgradeCard) and the upgrade page ----------
   Mist / Core Blue in light mode, the blue tone pair in dark mode: text contrast ≥ 7:1 in both. */
.plan-badge { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 20px; min-width: 22px; padding: 0 6px; border-radius: var(--sd-radius-pill); background: var(--sd-tone-blue-bg); color: var(--sd-tone-blue-text); border: 1px solid var(--sd-border-strong); font-size: var(--sd-fs-xs); font-weight: var(--sd-fw-semibold); line-height: 1; vertical-align: middle; cursor: help; }
.plan-badge .ic, .sidebar-nav a .plan-badge .ic, .settings-nav a .plan-badge .ic { width: 13px; height: 13px; stroke-width: 2; color: currentColor; margin: 0; }
.plan-badge.with-plan { padding: 0 8px 0 6px; }
.sidebar-nav a .plan-badge, .settings-nav a .plan-badge { margin-left: auto; }
.sidebar-nav a.active .plan-badge { border-color: transparent; }
.link-upsell { display: inline-flex; align-items: center; gap: 6px; }
.upgrade-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border: 1px dashed var(--sd-border-strong); }
.upgrade-card.compact { padding: 14px 16px; gap: 12px; }
.upgrade-tile { background: var(--sd-tone-blue-bg); }
.upgrade-tile .ic { color: var(--sd-tone-blue-text); }
.upgrade-card-title { font-size: 1rem; font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); margin: 0 0 2px; }
.upgrade-card-plan { display: flex; align-items: center; gap: 6px; font-size: var(--sd-fs-small); font-weight: var(--sd-fw-semibold); color: var(--sd-tone-blue-text); margin: 0 0 6px; }
.upgrade-card-text { color: var(--sd-text-secondary); margin: 0 0 10px; }
.upgrade-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.upgrade-card-ask { display: inline-flex; gap: 6px; align-items: center; font-size: var(--sd-fs-small); color: var(--sd-text-secondary); }
.upgrade-page { display: grid; gap: 16px; }
.upgrade-cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--sd-divider); }
.upgrade-ask { display: flex; gap: 12px; align-items: flex-start; }
.upgrade-compare tr.is-current > * { background: var(--sd-bg-selected); }
.upgrade-compare .perm .ic { width: 14px; height: 14px; margin-right: 4px; }
/* in the navigation the badge is a compact round icon at the end of the row; long labels may wrap to two lines */
.sidebar-nav a.nav-locked { white-space: normal; height: auto; min-height: 40px; padding-top: 6px; padding-bottom: 6px; line-height: 1.25; }
.settings-nav a.nav-locked { white-space: normal; line-height: 1.25; }
.sidebar-nav a.nav-locked .plan-badge, .settings-nav a.nav-locked .plan-badge { width: 22px; min-width: 22px; padding: 0; justify-content: center; margin-left: auto; }
.sidebar-nav a.nav-locked .plan-badge { margin-left: auto; margin-right: -6px; }
.upgrade-compare tbody th { padding: 13px 16px; font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); }
.upgrade-compare tbody th .badge-sd { margin-left: 6px; }
.upgrade-card.compact .upgrade-card-plan { margin-bottom: 8px; }
.upgrade-card.compact .upgrade-card-actions { gap: 4px 8px; }

/* ---------- Settings › SLA Policies › SLA alert e-mails ---------- */
.sla-alert-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1200px) { .sla-alert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sla-alert-col { border: 1px solid var(--sd-border); border-radius: var(--sd-radius-lg); padding: 16px; margin: 0; min-width: 0; }
.sla-alert-title { font-size: 1rem; font-weight: var(--sd-fw-semibold); color: var(--sd-text-heading); margin-bottom: 12px; }
.sla-alert-who.is-off { opacity: .5; }

/* ---------- Booking Trace ---------- */
.bt-search .form-label { display: block; min-height: 1.5em; }
.bt-search .form-control-lg, .bt-search .form-select-lg, .bt-search-btn { min-height: 48px; }
.bt-search .form-select-lg { text-overflow: ellipsis; }
.bt-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; margin: 0; }
.bt-facts dt { font-size: var(--sd-fs-small); color: var(--sd-text-secondary); font-weight: var(--sd-fw-regular, 400); }
.bt-facts dd { margin: 2px 0 0; color: var(--sd-text-heading); font-weight: var(--sd-fw-medium); overflow-wrap: anywhere; }
.bt-tone { color: var(--tone-text); }
.bt-answer { border-top: 1px solid var(--sd-divider); padding-top: 14px; margin-top: 16px; }
.bt-answer.latest { border: 1px solid var(--sd-tone-purple-bg); border-radius: var(--sd-radius-lg); padding: 14px 16px; background: var(--sd-bg-surface); }
.bt-answer-text { white-space: pre-line; }
.bt-finding { border-left: 3px solid var(--tone-fg); padding: 2px 0 10px 12px; margin-bottom: 10px; }
.bt-table { max-height: 420px; }
.bt-table .table-sd td { font-size: var(--sd-fs-small); vertical-align: top; overflow-wrap: anywhere; min-width: 70px; }
.bt-table .table-sd th { font-size: var(--sd-fs-small); white-space: nowrap; }
.bt-detail { white-space: pre-line; overflow-wrap: anywhere; }
.bt-table .table-sd td.bt-download { min-width: 0; width: 1%; white-space: nowrap; text-align: right; }
/* collapsible sections: the header is the button; closed until opened */
.bt-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bt-section > summary::-webkit-details-marker { display: none; }
.bt-section > summary .card-title { margin: 0; }
.bt-section > summary:hover { background: var(--sd-bg-hover); }
.bt-section > summary:focus-visible { outline: none; box-shadow: var(--sd-focus-ring); }
.bt-section:not([open]) > summary { border-bottom: 0; border-radius: inherit; }
.bt-summary-meta { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.bt-chevron { transition: transform .15s ease; color: var(--sd-text-secondary); }
.bt-section[open] > summary .bt-chevron { transform: rotate(180deg); }
.bt-sections-bar { padding: 4px 2px 0; }
@media (prefers-reduced-motion: reduce) { .bt-chevron { transition: none; } }
