/* ==========================================================================
   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: 0 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);
  white-space: nowrap; text-decoration: none !important;
}
.btn-lg { min-height: var(--sd-button-height); font-size: 1.0625rem; padding: 0 var(--sd-space-6); }
.btn-sm { min-height: var(--sd-control-height-sm); padding: 0 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; }
.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-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; }
.sidebar-help {
  margin-top: auto; 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; }
.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; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 6px; }
.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; }
.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; white-space: nowrap; }
.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 .kpi-label { overflow-wrap: anywhere; }
.kpi-card .kpi-label { color: var(--sd-text-secondary); font-size: var(--sd-fs-small); }
.kpi-card .kpi-value { white-space: nowrap; 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; }
.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); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.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 12px; 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 12px; border-bottom: 1px solid var(--sd-divider); vertical-align: middle; }
.table-sd tbody tr:last-child td { border-bottom: 0; }
.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: 120px; }
.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 { 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; }
.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; }

/* ---------------------------------------------------------------- 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); }
.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); }
.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); }
.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); }
  .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; }
  .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 .nav-group { display: block; }
  .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; }
}

@media (min-width: 1200px) {
  .grid-rail { grid-template-columns: minmax(0, 1fr) var(--sd-right-rail); }
  .grid-rail.wide { grid-template-columns: minmax(0, 1fr) 372px; }
  .grid-rail.narrow { grid-template-columns: minmax(0, 1fr) 260px; }
  .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: 1400px) {
  .auth-panel .auth-art { width: 500px; }
}

@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 { flex: 1; }
  .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 { background: var(--sd-primary-soft); color: var(--sd-tone-blue-text); }
.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 { flex-wrap: nowrap; padding: 12px var(--sd-content-pad); }
  .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 a { padding: 8px 12px; }
  .portal-toggle { display: none; }
  .portal-content { padding: 28px var(--sd-content-pad) 40px; }
}


/* 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; }
.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); }
