/* ════════════════════════════════════════════════════════════════════════
   MSINDAHA design system — COMPONENTS
   Buttons, inputs, cards, stat tiles, modals, popovers & menus, toasts,
   notifications, empty/loading states, avatars and the sign-in screens.
   Shared by every page; class names used by the website pages
   (pages/*.html) are kept intact.
════════════════════════════════════════════════════════════════════════ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition:
    background var(--dur-fast),
    border-color var(--dur-fast),
    color var(--dur-fast),
    box-shadow var(--dur-fast),
    transform var(--dur-fast);
}
.btn:hover {
  background: #202941;
  border-color: #354159;
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 6px 16px -8px rgba(59, 130, 246, 0.7);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: transparent;
}
.btn-primary:disabled {
  box-shadow: none;
}
.btn-success {
  background: #16a34a;
  border-color: transparent;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-success:hover {
  background: #15803d;
  border-color: transparent;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-sub);
}
.btn-ghost:hover,
.btn-ghost.active {
  background: var(--bg-hover);
  border-color: transparent;
  color: var(--text-primary);
}
.btn-danger {
  background: var(--danger-dim);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger-text);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.5);
}
.btn-danger-solid {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}
.btn-danger-solid:hover {
  background: #dc2626;
  border-color: transparent;
}
.btn-sm {
  height: 30px;
  padding: 0 10px;
  gap: 6px;
  font-size: 12.5px;
  border-radius: 7px;
}
.btn-sm svg {
  width: 14px;
  height: 14px;
}
.btn-lg {
  height: 42px;
  padding: 0 18px;
  font-size: 14px;
}
.btn-block {
  width: 100%;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  color: var(--accent-text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.link-btn:hover {
  text-decoration: underline;
}
.link-btn svg {
  width: 13px;
  height: 13px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sub);
  cursor: pointer;
  transition:
    background var(--dur-fast),
    color var(--dur-fast),
    border-color var(--dur-fast);
}
.icon-btn:hover,
.icon-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.icon-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  background: transparent;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}
.icon-btn.sm {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
}
.icon-btn.sm svg {
  width: 14px;
  height: 14px;
}
.icon-btn.danger:hover {
  background: var(--danger-dim);
  color: var(--danger-text);
}

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}
.form-stack > .form-group:last-child,
.form-stack > .form-grid:last-child .form-group {
  margin-bottom: 0;
}
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 7px;
}
.form-label .req {
  color: var(--danger-text);
  margin-left: 3px;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13.5px;
  transition:
    border-color var(--dur-fast),
    box-shadow var(--dur-fast),
    background var(--dur-fast);
}
.form-textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-faint);
}
.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: #334059;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.form-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0aabb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 14px;
}
.form-select option,
select option {
  background: #131927;
  color: var(--text-primary);
}
.input-lg,
.form-input.input-lg {
  height: 42px;
  font-size: 14.5px;
}
.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.45;
}
.form-error {
  font-size: 12px;
  color: var(--danger-text);
  margin-top: 6px;
  animation: fadeIn 0.2s ease;
}
.has-error .form-input,
.has-error .form-textarea {
  border-color: rgba(239, 68, 68, 0.65);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0 14px;
}
@media (max-width: 640px) {
  .form-grid,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}
.input-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.input-group .form-input {
  flex: 1;
  min-width: 0;
}
/* Input with an icon button inside its right edge (password reveal). */
.input-affix {
  position: relative;
}
.input-affix .form-input {
  padding-right: 44px;
}
.input-affix .icon-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
}
.static-field {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  color: var(--text-sub);
  font-size: 13px;
}
.static-field svg {
  width: 14px;
  height: 14px;
}
.inline-select {
  height: 32px;
  max-width: 100%;
  padding: 0 28px 0 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  appearance: none;
  -webkit-appearance: none;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737e93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
    no-repeat right 9px center / 13px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition:
    border-color var(--dur-fast),
    background-color var(--dur-fast);
}
.inline-select:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-input);
}
.inline-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-flush {
  padding: 0;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
}
.card-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent-text);
}
.card-head-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.card-pad {
  padding: 18px;
}
.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}
.card-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.section-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.section-head svg {
  width: 16px;
  height: 16px;
  color: var(--accent-text);
}
.section-head-count {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 8px;
  border-radius: 99px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-active);
}
.section-head-meta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

/* ── Stat tiles ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-row-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1100px) {
  .stat-row-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 16px 18px;
  text-align: left;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: riseIn 0.42s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 55ms);
  transition:
    border-color var(--dur),
    transform var(--dur) var(--ease-out),
    box-shadow var(--dur),
    background var(--dur);
}
.stat-click {
  cursor: pointer;
}
.stat-click:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-card.selected {
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.55),
    var(--shadow-md);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.09), transparent 75%),
    var(--bg-card);
}
.stat-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--tone-bg, var(--accent-dim));
  color: var(--tone-text, var(--accent-text));
}
.stat-icon svg {
  width: 17px;
  height: 17px;
}
.stat-lbl {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-sub);
  padding-right: 40px;
}
.stat-val {
  display: flex;
  align-items: center;
  min-height: 36px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
  line-height: 1.2;
  color: var(--text-primary);
}
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}
/* Website pages render value then label. */
.stat-card > .stat-val:first-child {
  margin-top: 0;
}

/* ── Badges are in badges.css ── */

/* ── Segmented control / tabs ── */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar {
  display: none;
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-sub);
  white-space: nowrap;
  transition:
    background var(--dur-fast),
    color var(--dur-fast),
    box-shadow var(--dur-fast);
}
.seg-btn:hover {
  color: var(--text-primary);
}
.seg-btn.active {
  background: var(--bg-raised);
  color: var(--text-primary);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px var(--border-strong);
}
.seg-btn svg {
  width: 14px;
  height: 14px;
}
.seg-count {
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  padding: 0 6px;
  border-radius: 99px;
  color: var(--text-muted);
  background: var(--bg-active);
}
.seg-btn.active .seg-count {
  color: var(--accent-text);
  background: var(--accent-dim);
}
.seg-sm .seg-btn {
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
}

/* Website-page filter pills */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.f-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--dur-fast),
    border-color var(--dur-fast),
    color var(--dur-fast);
}
.f-btn:hover {
  border-color: #3a4763;
  color: var(--text-primary);
}
.f-btn.active {
  background: var(--accent-dim);
  border-color: rgba(59, 130, 246, 0.55);
  color: var(--accent-text);
}
.f-count {
  font-size: 10.5px;
  font-weight: 700;
  padding: 0 6px;
  line-height: 16px;
  border-radius: 99px;
  background: var(--bg-active);
  color: var(--text-muted);
}
.f-btn.active .f-count {
  background: rgba(59, 130, 246, 0.25);
  color: var(--accent-text);
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

/* ── Switch ── */
.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 99px;
  background: #2a3448;
  transition: background var(--dur);
}
.switch.on {
  background: var(--accent);
}
.switch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: transform var(--dur) var(--ease-spring);
}
.switch.on .switch-thumb {
  transform: translateX(16px);
}

/* ── Keyboard key ── */
.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--bg-raised);
  color: var(--text-sub);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.18s ease both;
}
.modal-overlay.closing {
  animation: fadeOut 0.18s ease both;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 8vh - 24px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.26s var(--ease-out) both;
}
.modal.closing {
  animation: modalOut 0.16s ease both;
}
.modal.shake {
  animation: shake 0.4s ease;
}
.modal-sm {
  max-width: 430px;
}
.modal-md {
  max-width: 540px;
}
.modal-lg,
.modal-wide,
.modal.modal-lg {
  max-width: 720px;
}
.modal-xl,
.modal.modal-xl {
  max-width: 920px;
}
.modal-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 16px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-hdr-text {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.modal-hdr-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--accent-dim);
  color: var(--accent-text);
}
.modal-hdr-icon svg {
  width: 18px;
  height: 18px;
}
.modal-danger .modal-hdr-icon {
  background: var(--danger-dim);
  color: var(--danger-text);
}
.modal-hdr h3 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.35;
  padding-top: 1px;
}
.modal-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.14);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.modal-footer-hint {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.confirm-msg {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-sub);
}
.confirm-msg strong {
  color: var(--text-primary);
}
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 12px;
  }
  .modal {
    max-height: calc(100vh - 24px);
  }
  .modal-footer-hint {
    display: none;
  }
}

/* ── Popover & menus ── */
.popover {
  position: fixed;
  z-index: 420;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  transform-origin: top center;
  animation: popIn 0.16s var(--ease-out) both;
}
.popover.up {
  transform-origin: bottom center;
}
.popover.closing {
  animation: popOut 0.12s ease both;
}
.menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 5px 9px;
  border-radius: 7px;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--bg-hover);
  outline: none;
}
.menu-item:focus-visible {
  box-shadow: inset 0 0 0 1px var(--accent-glow);
}
.menu-item.danger {
  color: var(--danger-text);
}
.menu-item.danger:hover {
  background: var(--danger-dim);
}
.menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.menu-icon {
  display: inline-grid;
  place-items: center;
}
.menu-icon svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}
.menu-item.danger .menu-icon svg {
  color: inherit;
}
.menu-check {
  width: 16px;
  display: inline-grid;
  place-items: center;
  color: var(--accent-text);
}
.menu-check svg {
  width: 13px;
  height: 13px;
}
.menu-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.menu-hint {
  margin-left: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.menu-sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--border);
}
.menu-label-head {
  padding: 6px 9px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Toasts ── */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 12px 13px 15px;
  overflow: hidden;
  pointer-events: auto;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.38s var(--ease-spring) both;
}
.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.toast.leaving {
  animation: toastOut 0.22s ease forwards;
}
.toast.success::before {
  background: var(--success);
}
.toast.warning::before {
  background: var(--warning);
}
.toast.error::before {
  background: var(--danger);
}
.toast.assign::before,
.toast.comment::before {
  background: var(--purple);
}
.toast-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--accent-dim);
  color: var(--accent-text);
}
.toast-icon svg {
  width: 16px;
  height: 16px;
}
.toast.success .toast-icon {
  background: var(--success-dim);
  color: var(--success-text);
}
.toast.warning .toast-icon {
  background: var(--warning-dim);
  color: var(--warning-text);
}
.toast.error .toast-icon {
  background: var(--danger-dim);
  color: var(--danger-text);
}
.toast.assign .toast-icon,
.toast.comment .toast-icon {
  background: var(--purple-dim);
  color: var(--purple-text);
}
.toast-body {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}
.toast-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.toast-msg {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-sub);
  margin-top: 2px;
  word-break: break-word;
}
.toast-msg:empty {
  display: none;
}
.toast-action {
  margin-top: 8px;
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  transition: border-color var(--dur-fast);
}
.toast-action:hover {
  border-color: var(--accent);
}
.toast-close {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition:
    background var(--dur-fast),
    color var(--dur-fast);
}
.toast-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.toast-close svg {
  width: 12px;
  height: 12px;
}
@media (max-width: 640px) {
  .toast-stack {
    right: 16px;
    left: 16px;
    bottom: 16px;
    width: auto;
  }
}

/* ── Notifications (bell, panel and list rows) ── */
.notif-bell-btn {
  position: relative;
}
.notif-bell-btn.ringing svg {
  animation: bellRing 0.8s ease;
  transform-origin: top center;
}
.notif-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg-primary);
  pointer-events: none;
  animation: badgePop 0.3s var(--ease-spring) both;
}
.notif-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--dur-fast);
}
.notif-item:last-child {
  border-bottom: none;
}
.notif-item:hover,
.notif-item:focus-visible {
  background: var(--bg-hover);
  outline: none;
}
.notif-item.unread {
  background: rgba(59, 130, 246, 0.06);
}
.notif-item.unread:hover {
  background: rgba(59, 130, 246, 0.1);
}
.notif-item.unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.notif-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.notif-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tone-bg, var(--accent-dim));
  color: var(--tone-text, var(--accent-text));
}
.notif-item-icon svg {
  width: 16px;
  height: 16px;
}
.notif-type-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--tone, var(--accent));
  border: 2px solid var(--bg-card-alt);
}
.notif-type-badge svg {
  width: 9px;
  height: 9px;
}
.notif-type-badge.notif-type-comment {
  background: #a855f7;
}
.notif-type-badge.notif-type-resolved,
.notif-type-badge.notif-type-completed {
  background: #22c55e;
}
.notif-item-body {
  flex: 1;
  min-width: 0;
}
.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}
.notif-item:not(.unread) .notif-item-title {
  font-weight: 500;
  color: var(--text-sub);
}
.notif-item-msg {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.notif-item-time {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-faint);
}
.notif-item-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ── Empty / loading ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.empty-state.compact {
  padding: 28px 18px;
}
.empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 6px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-sub);
}
.empty-icon svg {
  width: 22px;
  height: 22px;
}
.empty-state.compact .empty-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}
.empty-state > svg {
  width: 30px;
  height: 30px;
  opacity: 0.45;
}
.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.empty-text {
  max-width: 380px;
  line-height: 1.55;
}
.empty-state .btn {
  margin-top: 8px;
}
.skeleton {
  display: inline-block;
  max-width: 100%;
  background: linear-gradient(90deg, var(--bg-raised) 25%, #232c41 37%, var(--bg-raised) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.spinner {
  display: inline-block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.btn .spinner {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}
.loading-screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 13px;
}
.boot-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 55%, #8b5cf6 100%);
  box-shadow: 0 12px 32px -10px rgba(59, 130, 246, 0.7);
  animation: bootPulse 1.6s ease-in-out infinite;
}

/* ── Avatars ── */
.avatar {
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.2px;
  color: #fff;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.avatar-stack {
  display: inline-flex;
  align-items: center;
}
.avatar-stack .avatar {
  box-shadow:
    0 0 0 2px var(--bg-card),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.avatar-stack .avatar + .avatar {
  margin-left: -7px;
}
.avatar-more {
  background: var(--bg-raised) !important;
  color: var(--text-sub);
}
.avatar-ph {
  display: inline-block;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px dashed var(--text-faint);
}

/* ── Sign-in & access screens ── */
.auth-wrap {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-primary);
}
.auth-card {
  width: 100%;
  max-width: 410px;
  padding: 34px 32px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.4s var(--ease-out) both;
}
.auth-card-center {
  text-align: center;
}
.auth-brand {
  margin-bottom: 22px;
  text-align: center;
}
.auth-brand h1,
.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-align: center;
}
.auth-brand p {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}
.auth-sub {
  margin: 6px 0 22px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-sub);
  text-align: center;
}
.auth-err {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: var(--danger-dim);
  color: var(--danger-text);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  animation: shake 0.4s ease;
}
.auth-err svg {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}
.auth-foot {
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  text-align: center;
}
.access-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--warning-dim);
  color: var(--warning-text);
}
.access-icon svg {
  width: 24px;
  height: 24px;
}
.access-email {
  margin: -6px 0 18px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-sub);
  word-break: break-all;
}

/* ── Website page editors (pages/insights.html) ── */
.article-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px 4px;
  margin-bottom: 12px;
  background: var(--bg-input);
}
.article-section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.article-section-hdr strong {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.article-section-controls {
  display: flex;
  gap: 6px;
}
.article-section-controls .icon-btn {
  width: 26px;
  height: 26px;
}
.article-section-controls .icon-btn svg {
  width: 13px;
  height: 13px;
}
.cover-upload {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.cover-upload img {
  max-width: 100%;
  max-height: 170px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto 12px;
}
.cover-upload-empty {
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 10px 0 4px;
}
.cover-upload-empty svg {
  width: 26px;
  height: 26px;
  margin: 0 auto 8px;
  display: block;
  opacity: 0.6;
}
.cover-upload-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}
.comment-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
}
.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 3px;
  font-size: 11px;
  color: var(--text-muted);
}
.comment-author {
  font-weight: 600;
  color: var(--text-sub);
}
.comment-text {
  color: var(--text-primary);
  line-height: 1.5;
}
