:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #eef4fb;
  --line: #d9e3ef;
  --text: #18212f;
  --muted: #64748b;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --danger: #c2410c;
  --danger-soft: #fff0e8;
  --success: #166534;
  --success-soft: #eaf8ee;
  --warning: #854d0e;
  --warning-soft: #fff6d8;
  --shadow: 0 22px 44px rgba(15, 23, 42, 0.08);
  --radius: 22px;
  --radius-sm: 14px;
  --font: "Segoe UI Variable Text", "Segoe UI", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 24rem),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--font);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  padding: 1.5rem;
  background: linear-gradient(180deg, #082f49 0%, #0f172a 100%);
  color: #e2e8f0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #14b8a6, #22c55e);
  color: white;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.brand-subtitle,
.page-subtitle,
.text-muted {
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 0.45rem;
}

.nav-link,
.mobile-link,
.ghost-link,
.tool-tab {
  transition: 0.2s ease;
}

.nav-link {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  color: #cbd5e1;
  background: transparent;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: 2rem;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #dbeafe;
}

.app-main {
  padding: 1.6rem 1.6rem 6rem;
}

.app-main.is-loading {
  opacity: 0.72;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.autosave-indicator {
  margin: -0.2rem 0 0.35rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: #f4f8fc;
  border: 1px solid rgba(15, 23, 42, 0.07);
  color: var(--muted);
  font-size: 0.84rem;
}

.ajax-progress {
  display: none;
  margin: -0.15rem 0 0.8rem;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid rgba(29, 78, 216, 0.1);
}

.ajax-progress.is-visible {
  display: block;
}

.ajax-progress-bar {
  width: 0%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), #2563eb);
  transition: width 0.18s ease;
}

.ajax-progress-label {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.2rem;
}

.page-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.55rem, 2vw, 2.25rem);
  line-height: 1.1;
}

.scope-form {
  min-width: 300px;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.scope-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.scope-select,
.form-control,
.form-select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.page-grid {
  display: grid;
  gap: 1rem;
}

.grid-2,
.tool-grid,
.cards-grid,
.metrics-grid {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
}

.tool-grid {
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
}

.cards-grid,
.metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.cards-grid > .list-empty {
  display: none;
}

.card,
.metric-card,
.list-card,
.soft-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(217, 227, 239, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card,
.soft-card,
.list-card {
  padding: 1.2rem;
}

.metric-card {
  padding: 1.1rem 1.2rem;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -2rem -2rem auto;
  width: 7rem;
  height: 7rem;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.14), transparent 70%);
}

.metric-label {
  font-size: 0.88rem;
  color: var(--muted);
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  margin-top: 0.35rem;
}

.section-title,
.card-title {
  margin: 0 0 0.8rem;
  font-size: 1.05rem;
}

.section-subtitle {
  margin: -0.25rem 0 1rem;
  color: var(--muted);
}

.toolbar,
.inline-form,
.button-row,
.meta-row,
.filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.btn,
button,
input[type="submit"] {
  border: 0;
  border-radius: 14px;
  padding: 0.8rem 1rem;
  cursor: pointer;
  font: inherit;
}

.btn-primary,
button,
input[type="submit"] {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
}

.btn-secondary {
  background: var(--panel-soft);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.flash-stack {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
}

.flash-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(22, 101, 52, 0.16);
}

.flash-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(194, 65, 12, 0.16);
}

.flash-info {
  background: #eef6ff;
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.12);
}

.flash-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(133, 77, 14, 0.24);
}

.item-list {
  display: grid;
  gap: 0.8rem;
}

.list-item {
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.list-item.is-active {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.item-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.item-meta,
.pill-row,
.attachment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pill,
.file-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.34rem 0.65rem;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.83rem;
}

.status-pill.status-open,
.status-pill.status-otwarte,
.status-pill.status-w-toku {
  background: #e0f2fe;
  color: #075985;
}

.status-pill.status-zamknięte,
.status-pill.status-solved {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.status-krytyczny,
.status-pill.status-high {
  background: var(--danger-soft);
  color: var(--danger);
}

.detail-body {
  display: grid;
  gap: 1rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.field-label {
  margin-bottom: 0.35rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.comment-box,
.message-box {
  padding: 0.9rem 1rem;
  border-left: 4px solid rgba(15, 118, 110, 0.3);
  background: #fbfdff;
  border-radius: 12px;
}

.comments-list {
  gap: 1rem;
}

.comment-box {
  display: grid;
  gap: 0.45rem;
}

.comment-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.comment-like-form {
  margin: 0;
}

.comment-like-button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2rem;
  padding: 0.28rem 0.7rem;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  line-height: 1;
}

.comment-like-button.is-liked,
.comment-like-button:hover {
  background: #dbeafe;
  border-color: rgba(37, 99, 235, 0.45);
  color: #1e40af;
}

.comment-like-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.comment-liked-by {
  color: var(--muted);
  font-size: 0.88rem;
}

.task-comment-date {
  margin-bottom: 0.35rem;
}

.task-comment-text {
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.task-comment-submit-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.task-comment-submit-row > button {
  width: auto;
}

.task-comment-status {
  min-height: 1.2em;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-comment-status.is-success {
  color: #15803d;
}

.task-comment-status.is-error {
  color: #b42318;
}

.task-comment-status.is-pending {
  color: #9a4b13;
}

.attachment-grid {
  margin-top: 0.55rem;
}

.attachment-preview {
  max-width: 180px;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.tool-sidebar {
  display: grid;
  gap: 0.4rem;
}

.tool-tab {
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: var(--panel-soft);
}

.tool-tab.is-active {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.1));
  color: var(--brand-strong);
}

.mobile-nav {
  display: none;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    display: none;
  }

  .app-main {
    padding-bottom: 6.5rem;
  }

  .grid-2,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.5rem;
    position: fixed;
    inset: auto 0 0 0;
    padding: 0.8rem;
    background: rgba(8, 15, 28, 0.95);
    backdrop-filter: blur(14px);
    z-index: 50;
  }

  .mobile-link {
    padding: 0.65rem 0.35rem;
    color: #cbd5e1;
    text-align: center;
    border-radius: 12px;
    font-size: 0.76rem;
  }

  .mobile-link.is-active {
    background: rgba(20, 184, 166, 0.16);
    color: white;
  }
}

@media (max-width: 720px) {
  .app-main {
    padding: 1rem 1rem 6.5rem;
  }

  .topbar {
    flex-direction: column;
  }

  .scope-form {
    min-width: 100%;
  }

  .split {
    grid-template-columns: 1fr;
  }
}

/* Mobile task workspace and camera */
.task-upload-box {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-soft);
}

.task-photo-picker {
  grid-column: 1 / -1;
}

.task-photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.task-photo-picker-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.task-photo-size-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(220px, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.task-photo-size-row .field-label {
  margin: 0;
}

.task-photo-native-button {
  position: relative;
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  cursor: pointer;
}

.task-photo-native-control {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.task-photo-status {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.task-save-status {
  align-self: center;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-save-status:empty {
  display: none;
}

.task-save-status.is-pending {
  color: var(--brand);
}

.task-save-status.is-success {
  color: var(--success);
}

.task-save-status.is-error {
  color: var(--danger);
}

.topbar-logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  white-space: nowrap;
}

.task-photo-picker.is-processing .task-photo-trigger {
  opacity: 0.55;
  pointer-events: none;
}

.task-photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.task-photo-preview-grid:empty {
  display: none;
}

.task-photo-preview-card {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.task-photo-preview-card > img {
  width: 92px;
  height: 100%;
  min-height: 112px;
  object-fit: cover;
  background: var(--panel-soft);
}

.task-photo-preview-content {
  display: grid;
  align-content: center;
  min-width: 0;
  gap: 4px;
  padding: 11px 38px 11px 11px;
}

.task-photo-preview-content strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-photo-preview-content > span {
  color: var(--muted);
  font-size: 10px;
}

.task-photo-caption {
  min-height: 36px;
  margin-top: 5px;
  padding: 7px 9px;
  font-size: 11px;
}

.task-photo-remove {
  position: absolute;
  top: 7px;
  right: 7px;
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: 50%;
  background: #fff1f2;
  color: #be123c;
  font-size: 19px;
  line-height: 1;
}

.attachment-caption {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.task-mobile-quick-action {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.pwa-install-button,
.network-status {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
}

.pwa-install-button[hidden],
.network-status[hidden] {
  display: none !important;
}

.pwa-install-button {
  padding: 9px 13px;
  border: 1px solid color-mix(in srgb, var(--brand) 42%, var(--line));
  background: color-mix(in srgb, var(--brand) 10%, var(--panel));
  color: var(--brand);
}

.pwa-install-button:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.network-status {
  padding: 8px 11px;
  border: 1px solid #f5c76c;
  background: #fff8df;
  color: #8a5500;
}

html.is-offline .app-main::before {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1100;
  height: 3px;
  background: #f59e0b;
  content: "";
}

html[data-theme="dark"] .task-upload-box,
html[data-theme="dark"] .task-photo-preview-card {
  border-color: rgba(73, 169, 255, 0.2);
  background: rgba(4, 17, 29, 0.5);
}

html[data-theme="dark"] .task-photo-remove {
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(159, 18, 57, 0.24);
  color: #fda4af;
}

html[data-theme="dark"] .pwa-install-button {
  border-color: rgba(73, 169, 255, 0.34);
  background: rgba(39, 135, 232, 0.12);
  color: #8cc8ff;
}

html[data-theme="dark"] .network-status {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(146, 87, 0, 0.2);
  color: #ffd17a;
}

@media (max-width: 720px) {
  .task-editor-backdrop {
    padding: 0 !important;
    place-items: stretch !important;
    background: var(--panel) !important;
    backdrop-filter: none !important;
  }

  .task-editor-modal {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--panel) !important;
    box-shadow: none !important;
  }

  .task-editor-modal > .modal-header {
    padding: calc(10px + env(safe-area-inset-top)) 13px 10px !important;
    border-color: var(--line) !important;
    background: var(--panel) !important;
  }

  .task-editor-modal .modal-kicker {
    font-size: 9px;
  }

  .task-editor-modal .modal-title {
    max-width: calc(100vw - 74px);
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .task-editor-modal .task-modal-body {
    padding: 12px 12px 20px !important;
    overscroll-behavior: contain;
    background: var(--panel) !important;
  }

  .task-editor-modal .task-modal-main,
  .task-editor-modal .modal-editor-grid {
    gap: 13px;
  }

  .task-editor-modal .task-modal-summary {
    gap: 7px;
  }

  .task-editor-modal .task-modal-summary > div {
    padding: 9px 10px;
  }

  .task-editor-modal .field-grid,
  .task-editor-modal .split {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-editor-modal .rich-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .task-editor-modal .modal-rich-editor-surface {
    min-height: 180px;
  }

  .task-upload-box {
    padding: 12px;
  }

  .task-photo-picker-actions {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr);
  }

  .task-photo-size-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-photo-preview-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-photo-preview-card {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .task-photo-preview-card > img {
    width: 104px;
  }

  .task-editor-footer {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 7px !important;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom)) !important;
    border-color: var(--line) !important;
    background: color-mix(in srgb, var(--panel) 94%, transparent) !important;
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(14px);
  }

  .task-editor-footer > [data-modal-close] {
    display: none !important;
  }

  .task-editor-footer > * {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 9px 8px !important;
    font-size: 12px !important;
  }

  .task-mobile-quick-action {
    display: inline-flex;
  }

  .task-editor-footer > .btn-new-note {
    grid-column: auto;
  }

  .task-editor-footer > .task-save-status {
    grid-column: 1 / -1;
    min-height: 0;
    padding: 0 3px !important;
  }

  .task-modal-sidebar .soft-card {
    padding: 13px;
  }

  body.has-open-modal .mobile-nav,
  body.has-open-modal .site-back-to-top {
    visibility: hidden;
    pointer-events: none;
  }

  .pwa-install-button {
    flex: 1 1 auto;
  }

  .network-status {
    width: 100%;
  }
}

@media (display-mode: standalone) {
  .app-main {
    padding-top: env(safe-area-inset-top);
  }

  .mobile-nav {
    padding-bottom: max(9px, env(safe-area-inset-bottom));
  }
}

/* Task list and unified task window */
.tasks-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.tasks-workspace .task-detail-host {
  display: none;
}

.tasks-list-card {
  min-width: 0;
}

.task-modal-body {
  display: grid;
  gap: 18px;
}

.task-modal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.task-modal-summary > div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f9fb;
}

.task-modal-summary span,
.task-modal-summary strong {
  display: block;
}

.task-modal-summary span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.task-modal-summary strong {
  overflow-wrap: anywhere;
  color: #1f2937;
  font-size: 13px;
}

.task-modal-main {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.task-modal-main.is-new-task {
  grid-template-columns: minmax(0, 1fr);
}

.task-modal-main.is-new-task .task-modal-sidebar {
  display: none;
}

.task-modal-sidebar {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.task-modal-extras {
  display: grid;
  gap: 14px;
}

.task-modal-extras > .soft-card {
  margin-top: 0 !important;
  padding: 17px;
  box-shadow: none;
}

.task-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-modal-actions form {
  margin: 0;
}

.task-modal-actions button {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 12px;
}

.task-modal-sidebar .section-title {
  margin-bottom: 12px;
}

.task-modal-sidebar .comments-list {
  max-height: 38vh;
  padding-right: 4px;
  overflow-y: auto;
}

.task-modal-sidebar .comment-box {
  padding: 12px 13px;
}

.task-modal-sidebar textarea {
  min-height: 92px;
}

.task-modal-sidebar .attachment-preview {
  width: min(100%, 180px);
  max-width: 180px;
}

@media (max-width: 1100px) {
  .task-modal-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-modal-sidebar .comments-list {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .task-modal-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-modal-actions,
  .task-modal-actions form,
  .task-modal-actions button {
    width: 100%;
  }
}

.page-heading {
  display: grid;
  gap: 0.75rem;
}

.header-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.context-pill {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 118, 110, 0.14);
}

.sidebar-context {
  padding: 0.95rem 1rem;
  margin-bottom: 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-context strong {
  display: block;
  color: #fff;
  margin-bottom: 0.25rem;
}

.scope-form {
  display: grid;
  gap: 0.7rem;
}

.scope-form::after {
  content: "Zmiana profilu odświeża wszystkie moduły dla tej samej firmy i uprawnień.";
  font-size: 0.78rem;
  color: var(--muted);
}

.card,
.metric-card,
.list-card,
.soft-card {
  backdrop-filter: blur(10px);
}

.card-title {
  font-size: 1.12rem;
}

.toolbar {
  align-items: start;
  justify-content: space-between;
}

.inline-form {
  flex: 1 1 520px;
  align-items: end;
}

.list-item {
  display: grid;
  gap: 0.45rem;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.list-item:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.22);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.06);
}

.item-title {
  font-size: 1rem;
  line-height: 1.35;
}

.item-meta {
  align-items: center;
}

.item-summary {
  color: var(--muted);
  line-height: 1.55;
}

.pill-row {
  align-items: center;
}

.pill,
.file-pill,
.status-pill {
  border: 1px solid transparent;
  font-weight: 600;
}

.priority-pill.priority-niski {
  background: #eff6ff;
  color: #1d4ed8;
}

.priority-pill.priority-normalny {
  background: #eef4fb;
  color: #334155;
}

.priority-pill.priority-wysoki {
  background: #fff6d8;
  color: #92400e;
}

.priority-pill.priority-krytyczny {
  background: #fff0e8;
  color: #c2410c;
}

.status-pill.status-otwarte {
  background: #e0f2fe;
  color: #0c4a6e;
}

.status-pill.status-w-toku {
  background: #e0f7f4;
  color: #115e59;
}

.status-pill.status-oczekuje-na-klienta,
.status-pill.status-oczekuje-na-czesci {
  background: #fff7d6;
  color: #92400e;
}

.status-pill.status-zamkniete {
  background: #eaf8ee;
  color: #166534;
}

.status-pill.status-anulowane,
.status-pill.status-krytyczny {
  background: #fff0e8;
  color: #c2410c;
}

.detail-body {
  gap: 1.1rem;
}

.detail-section {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.92));
}

.detail-section + .detail-section {
  margin-top: 0.2rem;
}

.section-caption {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.sticky-card {
  position: sticky;
  top: 1.25rem;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.mini-stat {
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.mini-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.mini-stat-value {
  margin-top: 0.3rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.attachment-preview {
  width: min(100%, 220px);
  max-width: 220px;
  background: #fff;
  object-fit: cover;
}

.task-image-preview {
  cursor: zoom-in;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.task-image-preview:hover,
.task-image-preview:focus-visible {
  transform: translateY(-2px);
  outline: 3px solid color-mix(in srgb, var(--brand) 28%, transparent);
  outline-offset: 2px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  place-items: center;
  background: rgba(2, 8, 23, 0.9);
  backdrop-filter: blur(12px);
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox-panel {
  position: relative;
  display: grid;
  max-width: 96vw;
  max-height: 94vh;
  place-items: center;
}

.image-lightbox-image {
  display: block;
  max-width: 96vw;
  max-height: calc(94vh - 48px);
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.image-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(2, 8, 23, 0.72);
  color: #fff;
}

.image-lightbox-caption {
  max-width: min(90vw, 900px);
  margin: 10px 0 0;
  color: #fff;
  font-size: 13px;
  text-align: center;
  overflow-wrap: anywhere;
}

.attachment-grid {
  align-items: flex-start;
}

.comment-box,
.message-box {
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-left: 4px solid rgba(15, 118, 110, 0.34);
}

.list-empty {
  padding: 1.1rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.mobile-nav {
  box-shadow: 0 -14px 30px rgba(8, 15, 28, 0.22);
}

@media (min-width: 1101px) {
  .sidebar-nav {
    max-height: calc(100vh - 250px);
    overflow: auto;
    padding-right: 0.25rem;
  }
}

@media (max-width: 1100px) {
  .sticky-card {
    position: static;
  }
}

@media (max-width: 720px) {
  .header-pills {
    gap: 0.4rem;
  }

  .pill,
  .file-pill,
  .status-pill {
    font-size: 0.77rem;
  }

  .stats-strip {
    grid-template-columns: 1fr 1fr;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .mobile-link {
    display: grid;
    place-items: center;
    min-height: 48px;
  }
}

.notes-filter-grid {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  align-items: center;
}

.btn-action,
.btn-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 2.45rem;
  padding: 0.58rem 0.9rem;
  border-radius: 10px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

a.btn-action,
a.btn-compact {
  text-decoration: none;
}

.btn-filter {
  background: #2563eb;
  color: #fff;
}

.btn-filter:hover {
  background: #1d4ed8;
}

.btn-new-note {
  background: #16a34a;
  color: #fff;
}

.btn-new-note:hover {
  background: #15803d;
}

.notes-filter-grid .btn-action {
  justify-self: start;
}

.preview-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 1rem;
}

.rich-editor {
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem;
  border-bottom: 1px solid var(--line);
  border-radius: 13px 13px 0 0;
  background: #f8fbff;
}

.rich-tool {
  display: inline-grid;
  place-items: center;
  min-width: 2.15rem;
  min-height: 2.05rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(100, 116, 139, 0.24);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.rich-tool:hover,
.rich-tool:focus-visible {
  border-color: rgba(37, 99, 235, 0.42);
  background: #eff6ff;
  color: #1d4ed8;
}

.rich-editor-surface {
  min-height: 180px;
  padding: 0.9rem 1rem;
  border-radius: 0 0 13px 13px;
  outline: none;
  line-height: 1.6;
}

.rich-editor-surface:focus {
  box-shadow: inset 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.rich-content {
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.rich-content p,
.rich-content ul,
.rich-content ol,
.rich-content blockquote,
.rich-content pre,
.rich-content div {
  margin: 0 0 0.85rem;
}

.rich-content > :last-child {
  margin-bottom: 0;
}

.rich-content ul,
.rich-content ol {
  padding-left: 1.35rem;
}

.rich-content blockquote {
  padding: 0.7rem 0.85rem;
  border-left: 4px solid rgba(37, 99, 235, 0.32);
  border-radius: 10px;
  background: #f8fbff;
  color: #334155;
}

.rich-content pre,
.rich-content code {
  border-radius: 8px;
  background: #f1f5f9;
  font-family: Consolas, "Liberation Mono", monospace;
}

.rich-content pre {
  overflow: auto;
  padding: 0.85rem;
}

.rich-content code {
  padding: 0.12rem 0.3rem;
}

.rich-content a {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
}

.modal-panel {
  width: min(1500px, 98vw);
  height: min(980px, 94vh);
  max-height: 94vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(217, 227, 239, 0.86);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.24);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.modal-kicker {
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.modal-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.modal-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 1.35rem;
  line-height: 1;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: #cbd5e1;
}

.modal-body {
  overflow: auto;
  padding: 1.4rem;
  background: #fff;
}

.note-preview-body {
  font-size: 1rem;
}

.note-preview-content {
  max-width: 92ch;
}

.modal-editor-body {
  min-height: 0;
}

.modal-editor-grid {
  display: grid;
  gap: 1rem;
}

.modal-rich-editor {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr);
  min-height: min(58vh, 620px);
}

.modal-rich-editor-surface {
  min-height: min(54vh, 580px);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-top: 1px solid var(--line);
  background: #f8fbff;
}

body.has-open-modal {
  overflow: hidden;
}

@media (max-width: 720px) {
  .notes-filter-grid {
    grid-template-columns: 1fr;
  }

  .notes-filter-grid .btn-action,
  .btn-compact {
    width: 100%;
  }

  .rich-toolbar {
    gap: 0.3rem;
  }

  .rich-tool {
    min-width: 2rem;
  }

  .modal-backdrop {
    align-items: stretch;
    padding: 0.75rem;
  }

  .modal-panel {
    width: 100%;
    height: 92vh;
    max-height: 92vh;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }
}

/* CMS-inspired visual system */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-soft: #f8f9fb;
  --line: #e5e7eb;
  --text: #172033;
  --muted: #6b7280;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --success: #14804a;
  --success-soft: #eaf8f0;
  --warning: #9a6700;
  --warning-soft: #fff8db;
  --shadow: 0 12px 34px rgba(17, 24, 39, 0.07);
  --radius: 16px;
  --radius-sm: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
  background: var(--bg);
  color: var(--text);
}

body.app-body {
  overflow-x: clip;
  background:
    radial-gradient(circle at 82% 0, rgba(37, 99, 235, 0.07), transparent 28rem),
    var(--bg);
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.app-shell {
  grid-template-columns: 260px minmax(0, 1fr);
}

.app-sidebar {
  display: flex;
  flex-direction: column;
  padding: 28px 20px 20px;
  background: linear-gradient(165deg, #111827 0%, #0b111d 100%);
  color: #d7dce5;
}

.brand-block {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  overflow: hidden;
  place-items: center;
  border-radius: 12px;
  background: rgba(73, 169, 255, 0.1);
  box-shadow: 0 8px 20px rgba(15, 111, 221, 0.2);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.brand-mark img {
  width: 46px;
  height: 46px;
  max-width: none;
  object-fit: contain;
}

.brand-name,
.brand-subtitle {
  display: block;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin-top: 2px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 7px;
  margin-top: 46px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 10px;
  background: transparent;
  color: #b9c0cd;
  font-size: 14px;
  font-weight: 650;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-link.is-active {
  background: rgba(37, 99, 235, 0.19);
  box-shadow: inset 3px 0 var(--brand);
  color: #fff;
}

.nav-icon {
  display: inline-grid;
  width: 18px;
  place-items: center;
  color: #60a5fa;
  font-size: 19px;
  line-height: 1;
}

.sidebar-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.sidebar-context {
  margin: 0;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.sidebar-context .scope-label {
  margin-bottom: 7px;
  color: #9ca3af;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-context strong {
  margin-bottom: 3px;
  color: #fff;
  font-size: 13px;
}

.sidebar-context .text-muted {
  color: #9ca3af;
  font-size: 12px;
}

.sidebar-user-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.user-avatar {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
  font-size: 13px;
  font-weight: 900;
}

.sidebar-user {
  min-width: 0;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user strong {
  color: #fff;
  font-size: 12px;
}

.sidebar-user small {
  margin-top: 2px;
  color: #8f98a8;
  font-size: 10px;
}

.logout-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: #9ca3af;
  font-size: 17px;
}

.logout-button:hover,
.logout-button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.app-main {
  min-width: 0;
  padding: 0 34px 64px;
}

.topbar {
  min-height: 116px;
  margin: 0 -34px 28px;
  padding: 23px 34px 20px;
  align-items: center;
  border-bottom: 1px solid rgba(229, 231, 235, 0.88);
  background: rgba(245, 246, 248, 0.82);
  backdrop-filter: blur(14px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-actions .scope-form {
  margin-left: auto;
}

.theme-toggle {
  display: inline-flex;
  width: auto;
  min-height: 42px;
  padding: 8px 12px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.05);
  color: #4c596c;
  font-size: 11px;
  font-weight: 800;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: rgba(37, 99, 235, 0.35);
  background: #fff;
  color: var(--brand-strong);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
}

.theme-toggle-icon {
  font-size: 17px;
  line-height: 1;
}

.theme-toggle-moon,
.theme-toggle[aria-pressed="true"] .theme-toggle-sun {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-toggle-moon {
  display: inline;
}

.page-heading {
  gap: 4px;
}

.page-eyebrow,
.section-kicker {
  color: var(--brand);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  color: #111827;
  font-size: clamp(1.7rem, 2.2vw, 2.25rem);
  letter-spacing: -0.035em;
}

.page-subtitle {
  margin: 3px 0 0;
  font-size: 13px;
}

.header-pills {
  margin-top: 7px;
}

.context-pill {
  padding: 4px 8px;
  border-color: var(--line);
  background: #fff;
  color: #5f6878;
  font-size: 10px;
}

.scope-form {
  display: grid;
  min-width: 280px;
  gap: 5px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.05);
  backdrop-filter: none;
}

.scope-form::after {
  display: none;
}

.scope-form .scope-label {
  margin: 0;
  color: #8a93a2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scope-select {
  padding: 7px 34px 7px 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.page-grid {
  width: min(1540px, 100%);
  margin-inline: auto;
  gap: 18px;
}

.card,
.metric-card,
.list-card,
.soft-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.card,
.soft-card,
.list-card {
  padding: 22px;
}

.soft-card {
  background: #fbfcfd;
}

.grid-2,
.tool-grid,
.cards-grid,
.metrics-grid {
  gap: 18px;
}

.grid-2 {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr);
}

.dashboard-welcome {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  min-height: 156px;
  padding: 28px 30px;
  overflow: hidden;
  border: 1px solid #dce8fb;
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 25%, rgba(37, 99, 235, 0.13), transparent 13rem),
    linear-gradient(115deg, #fff 0%, #f6f9ff 100%);
  box-shadow: var(--shadow);
}

.dashboard-welcome h2 {
  margin: 7px 0 8px;
  color: #111827;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  letter-spacing: -0.035em;
}

.dashboard-welcome p {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.dashboard-primary-action {
  flex: 0 0 auto;
}

.dashboard-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  display: flex;
  min-height: 112px;
  gap: 16px;
  align-items: center;
  padding: 19px 20px;
  overflow: visible;
}

.metric-card::after {
  display: none;
}

.metric-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 850;
}

.metric-icon-orange { color: #2563eb; background: #eff6ff; }
.metric-icon-green { color: #14804a; background: #eaf8f0; }
.metric-icon-blue { color: #2563eb; background: #edf3ff; }
.metric-icon-purple { color: #7c3aed; background: #f3efff; }
.metric-icon-slate { color: #475569; background: #f1f5f9; }
.metric-icon-teal { color: #0f766e; background: #e8f7f5; }

.metric-value {
  margin: 0 0 3px;
  color: #111827;
  font-size: 1.75rem;
  line-height: 1;
}

.metric-label {
  line-height: 1.35;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-heading .card-title {
  margin: 5px 0 0;
  color: #111827;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.panel-heading > a {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.panel-heading > a:hover {
  color: var(--brand-strong);
}

.item-list {
  gap: 0;
}

.list-item {
  gap: 6px;
  padding: 14px 2px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: transparent;
}

.list-item:first-child {
  padding-top: 4px;
}

.list-item:last-child {
  padding-bottom: 2px;
  border-bottom: 0;
}

.list-item:hover {
  z-index: 1;
  margin-inline: -10px;
  padding-inline: 10px;
  transform: none;
  border-color: transparent;
  border-radius: 10px;
  background: #faf7f5;
  box-shadow: none;
}

.item-title {
  color: #1f2937;
  font-size: 14px;
}

.pill,
.file-pill,
.status-pill {
  padding: 4px 8px;
  background: #f3f4f6;
  font-size: 10px;
}

.dashboard-context .field-grid > div {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.dashboard-context .field-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-context strong {
  display: block;
  overflow-wrap: anywhere;
  color: #273244;
  font-size: 13px;
}

.btn,
button,
input[type="submit"] {
  border-radius: 10px;
  font-weight: 750;
}

.btn-primary,
button,
input[type="submit"] {
  background: var(--brand);
  box-shadow: 0 7px 16px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--brand-strong);
}

.btn-secondary {
  border: 1px solid var(--line);
  background: #fff;
}

.form-control,
.form-select,
textarea {
  border-radius: 10px;
  padding: 11px 13px;
}

.scope-select:focus,
.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11);
}

.field-label {
  color: #596273;
  font-weight: 700;
}

.flash {
  border-radius: 11px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.04);
}

.tool-tab.is-active,
.list-item.is-active {
  border-color: rgba(37, 99, 235, 0.38);
  background: #eff6ff;
  color: var(--brand-strong);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.comment-box,
.message-box {
  border-color: rgba(37, 99, 235, 0.13);
  border-left-color: rgba(37, 99, 235, 0.42);
}

.rich-tool:hover,
.rich-tool:focus-visible {
  border-color: rgba(37, 99, 235, 0.42);
  background: #eff6ff;
  color: var(--brand-strong);
}

.modal-backdrop {
  background: rgba(5, 12, 20, 0.7);
}

.modal-panel {
  border-color: var(--line);
  border-radius: 18px;
}

.modal-header,
.modal-footer,
.rich-toolbar {
  background: #f8f9fb;
}

/* Login */
.auth-body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(145deg, #fff 0%, #f5f9ff 48%, #e7f1fc 100%);
}

.auth-background-art {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-background-art::before,
.auth-background-art::after {
  position: absolute;
  border-radius: 50%;
  content: "";
  filter: blur(2px);
}

.auth-background-art::before {
  top: -22rem;
  left: 50%;
  width: 56rem;
  height: 56rem;
  background: radial-gradient(circle, rgba(67, 163, 255, 0.13), transparent 67%);
  transform: translateX(-50%);
}

.auth-background-art::after {
  right: -18rem;
  bottom: -24rem;
  width: 58rem;
  height: 58rem;
  background: radial-gradient(circle, rgba(31, 116, 225, 0.14), transparent 67%);
}

.auth-network {
  position: absolute;
  color: rgba(44, 135, 230, 0.15);
}

.auth-network-left {
  bottom: -60px;
  left: -45px;
  width: min(39vw, 560px);
}

.auth-network-right {
  right: -35px;
  bottom: -25px;
  width: min(35vw, 520px);
  color: rgba(30, 109, 205, 0.12);
}

.auth-dot-grid {
  position: absolute;
  top: 8%;
  right: 7%;
  width: 180px;
  height: 140px;
  opacity: 0.36;
  background-image: radial-gradient(circle, #5ba4ea 1.5px, transparent 1.7px);
  background-size: 18px 18px;
  mask-image: linear-gradient(135deg, #000, transparent 78%);
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(590px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 42px 0;
  align-content: center;
}

.auth-brand {
  display: grid;
  justify-items: center;
  margin-bottom: 25px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5edf7;
  text-align: center;
}

.auth-program-logo {
  width: 108px;
  height: 108px;
  margin-bottom: 8px;
  object-fit: contain;
  filter: drop-shadow(0 12px 16px rgba(4, 81, 167, 0.18));
}

.auth-product-name {
  color: #071a44;
  font-size: clamp(2rem, 6vw, 2.65rem);
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1;
}

.auth-brand p {
  margin: 9px 0 0;
  color: #5d6f8c;
  font-size: 14px;
}

.auth-card {
  padding: 34px 48px 26px;
  border: 1px solid rgba(187, 205, 226, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 80px rgba(23, 74, 130, 0.15);
  backdrop-filter: blur(18px);
}

.auth-heading {
  margin-bottom: 24px;
  text-align: center;
}

.auth-card h1 {
  margin: 0;
  color: #071a44;
  font-size: clamp(1.65rem, 5vw, 2rem);
  letter-spacing: -0.04em;
}

.auth-lead {
  margin: 7px 0 0;
  color: #6c7c94;
  font-size: 14px;
}

.auth-card .page-grid {
  gap: 16px;
}

.auth-card .field-label {
  margin-bottom: 7px;
  color: #263b5c;
  font-size: 12px;
  font-weight: 750;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-wrap > svg {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 17px;
  width: 19px;
  height: 19px;
  color: #8191a8;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transform: translateY(-50%);
  pointer-events: none;
}

.auth-input-wrap .form-control {
  min-height: 54px;
  padding: 12px 48px;
  border-color: #cdd9e7;
  border-radius: 10px;
  background: rgba(250, 252, 255, 0.92);
  color: #132846;
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.auth-input-wrap .form-control::placeholder {
  color: #9ba9ba;
}

.auth-input-wrap .form-control:focus {
  border-color: #2580e8;
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 128, 232, 0.13);
}

.auth-password-toggle {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 9px;
  display: grid;
  width: 37px;
  height: 37px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #718198;
  box-shadow: none;
  transform: translateY(-50%);
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  background: #edf5fd;
  color: #1269ce;
  box-shadow: none;
}

.auth-password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.auth-eye-closed,
.auth-password-toggle[aria-pressed="true"] .auth-eye-open {
  display: none;
}

.auth-password-toggle[aria-pressed="true"] .auth-eye-closed {
  display: block;
}

.auth-remember {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 9px;
  color: #566981;
  font-size: 12px;
  cursor: pointer;
}

.auth-remember input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #0b6ff0;
}

.auth-submit {
  width: 100%;
  min-height: 52px;
  margin-top: 2px;
  border: 1px solid #095ecb;
  border-radius: 10px;
  background: linear-gradient(135deg, #0b6ff0 0%, #0b5ed7 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(11, 105, 224, 0.23);
}

.auth-submit:hover,
.auth-submit:focus-visible {
  border-color: #084faa;
  background: linear-gradient(135deg, #0965df 0%, #094fb9 100%);
  color: #fff;
  box-shadow: 0 13px 26px rgba(11, 105, 224, 0.3);
  transform: translateY(-1px);
}

.auth-session-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 18px;
  padding: 12px 13px;
  border: 1px solid #bfd8f3;
  border-radius: 11px;
  background: #f1f7fe;
  color: #214a77;
  font-size: 13px;
  line-height: 1.5;
}

.auth-session-alert-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #dceeff;
  color: #0966ce;
  font-size: 12px;
  font-weight: 900;
}

.auth-session-recovery {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 13px;
  border: 1px solid #e3e8ee;
  border-radius: 11px;
  background: #f8fafc;
  color: #384354;
  cursor: pointer;
}

.auth-session-recovery input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: #0b6ff0;
}

.auth-session-recovery span,
.auth-session-recovery strong,
.auth-session-recovery small {
  display: block;
}

.auth-session-recovery strong {
  font-size: 13px;
}

.auth-session-recovery small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.auth-footnote {
  display: flex;
  margin: 24px 0 0;
  padding-top: 18px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid #e5edf7;
  color: #8190a5;
  font-size: 11px;
  text-align: center;
}

.auth-footnote img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.auth-footnote span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-footnote i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #a5b3c5;
}

@media (min-width: 1101px) {
  .sidebar-nav {
    max-height: none;
    padding-right: 0;
  }
}

@media (max-width: 1250px) {
  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-main {
    padding: 0 22px 92px;
  }

  .topbar {
    margin-inline: -22px;
    padding-inline: 22px;
  }

  .mobile-nav {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 9px 12px max(9px, env(safe-area-inset-bottom));
    background: rgba(11, 17, 29, 0.97);
    scrollbar-width: none;
  }

  .mobile-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-link {
    display: grid;
    flex: 0 0 82px;
    min-height: 52px;
    padding: 7px 5px;
    place-items: center;
    gap: 3px;
    border-radius: 9px;
    font-size: 9px;
  }

  .mobile-link.is-active {
    background: rgba(37, 99, 235, 0.2);
    box-shadow: inset 0 -2px var(--brand);
  }

  .mobile-nav-icon {
    color: #ed8a4d;
    font-size: 17px;
    line-height: 1;
  }
}

@media (max-width: 720px) {
  .app-main {
    padding: 0 14px 88px;
  }

  .topbar {
    min-height: auto;
    margin: 0 -14px 18px;
    padding: 18px 14px;
    align-items: stretch;
  }

  .scope-form {
    width: 100%;
    min-width: 0;
  }

  .dashboard-welcome {
    min-height: 0;
    padding: 23px 21px;
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-primary-action {
    width: 100%;
  }

  .dashboard-metrics {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 96px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .card,
  .soft-card,
  .list-card {
    padding: 18px;
  }

  .panel-heading {
    gap: 10px;
  }

  .panel-heading > a {
    max-width: 110px;
    white-space: normal;
    text-align: right;
  }

  .auth-shell {
    padding: 26px 0;
  }

  .auth-card {
    padding: 25px 21px;
  }
}

/* Responsive containment for data-heavy editors */
.app-shell,
.app-main,
.page-grid,
.grid-2 > *,
.tool-grid > *,
.detail-body,
.field-grid > *,
.rich-editor,
.rich-editor-surface,
.modal-panel,
.modal-body,
.modal-editor-grid {
  min-width: 0;
}

.form-control,
.form-select,
textarea,
input,
select {
  max-width: 100%;
}

.mini-stat {
  min-width: 0;
}

.mini-stat-value,
.item-title,
.item-summary,
.sidebar-user strong,
.sidebar-user small {
  overflow-wrap: anywhere;
}

.editor-source-form.is-modal-source {
  display: none;
}

.btn-secondary,
.btn-danger,
.btn-warning {
  display: inline-flex;
  width: auto;
  min-height: 2.45rem;
  padding: 0.58rem 0.9rem;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 750;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
}

.btn-secondary {
  border: 1px solid var(--line);
}

@media (max-width: 1100px) {
  .grid-2,
  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sticky-card {
    position: static;
  }
}

@media (max-width: 720px) {
  .stats-strip,
  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar,
  .inline-form {
    align-items: stretch;
  }

  .toolbar > *,
  .inline-form > *,
  .btn-secondary,
  .btn-danger,
  .btn-warning {
    width: 100%;
  }
}

/* Attachment availability across desktop and web storage */
.attachment-entry {
  display: grid;
  width: fit-content;
  max-width: 100%;
  gap: 7px;
}

.attachment-delete-button {
  width: fit-content;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 9px;
  background: rgba(254, 226, 226, 0.78);
  color: #b42318;
  font-size: 11px;
  font-weight: 800;
}

.attachment-delete-button:hover,
.attachment-delete-button:focus-visible {
  border-color: rgba(220, 38, 38, 0.42);
  background: #fee2e2;
}

.attachment-entry.is-unavailable {
  opacity: 0.78;
}

.attachment-entry.is-unavailable .file-pill {
  border: 1px dashed #cbd1da;
  background: #f3f4f6;
  color: #667085;
}

.attachment-storage-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #cfe0f6;
  border-radius: 11px;
  background: #f3f8ff;
  color: #385675;
}

.attachment-storage-notice > span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
}

.attachment-storage-notice p,
.attachment-storage-notice strong {
  display: block;
}

.attachment-storage-notice p {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.attachment-storage-notice strong {
  margin-bottom: 2px;
  color: #253f5d;
  font-size: 12px;
}

/* Tasks use a single full-width workspace; the editor lives in a modal. */
.grid-2.tasks-workspace {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

.tasks-workspace .tasks-list-card {
  width: 100%;
}

.task-assignees-select {
  min-height: 112px;
  padding-block: 7px;
}

.field-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.task-progress-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 12px;
  align-items: center;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.task-progress-control input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.task-progress-control output {
  display: inline-grid;
  min-height: 30px;
  place-items: center;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 800;
}

.rich-toolbar-separator {
  width: 1px;
  min-height: 28px;
  margin: 2px 3px;
  background: var(--line);
}

.rich-tool-wide {
  min-width: auto;
  padding-inline: 0.7rem;
  font-size: 11px;
}

.rich-align-left {
  justify-items: start;
}

.rich-align-center {
  justify-items: center;
}

.rich-align-right {
  justify-items: end;
}

.rich-color-button {
  color: #2563eb;
  text-decoration: underline;
  text-decoration-color: #ef4444;
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
}

.rich-editor-surface h2,
.rich-content h2 {
  margin: 0.75rem 0 0.45rem;
  font-size: 1.45rem;
  line-height: 1.25;
}

.rich-editor-surface h3,
.rich-content h3 {
  margin: 0.65rem 0 0.4rem;
  font-size: 1.2rem;
  line-height: 1.3;
}

.rich-editor-surface table,
.rich-content table {
  width: 100%;
  margin: 0.75rem 0;
  border-collapse: collapse;
}

.rich-editor-surface th,
.rich-editor-surface td,
.rich-content th,
.rich-content td {
  min-width: 80px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.rich-editor-surface th,
.rich-content th {
  background: #eef3f8;
  font-weight: 800;
}

.tasks-list-card .task-list {
  gap: 10px;
}

.tasks-list-card > .toolbar,
.notes-list-card > .toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  margin-bottom: 18px;
}

.task-add-button,
.note-add-button {
  position: static;
  z-index: auto;
  display: inline-flex;
  min-height: 44px;
  padding: 10px 16px;
  align-items: center;
  justify-content: center;
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
  color: #fff;
  font-weight: 850;
  white-space: nowrap;
}

.task-add-button:hover,
.task-add-button:focus-visible,
.note-add-button:hover,
.note-add-button:focus-visible {
  border-color: #1e40af;
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  color: #fff;
  box-shadow: 0 13px 28px rgba(37, 99, 235, 0.3);
}

.tasks-list-card .task-list-item,
.tasks-list-card .task-list-item:first-child,
.tasks-list-card .task-list-item:last-child {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid #e4e9ef;
  border-radius: 14px;
  background: #fff;
}

.tasks-list-card .task-list-item:hover {
  margin: 0;
  padding: 16px 18px;
  border-color: rgba(37, 99, 235, 0.3);
  border-radius: 14px;
  background: #f8fbff;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.06);
}

.tasks-list-card .task-list-item.is-active {
  border-color: rgba(37, 99, 235, 0.46);
  background: #f3f7ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.task-list-item-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.task-list-item-header .item-title {
  min-width: 0;
  margin: 2px 0 0;
  color: #18212f;
  font-size: 15px;
  line-height: 1.4;
}

.task-list-badges {
  justify-content: flex-end;
  align-items: center;
}

.task-list-details {
  display: grid;
  grid-template-columns: minmax(150px, 0.75fr) minmax(170px, 0.85fr) minmax(260px, 1.4fr);
  gap: 12px;
}

.task-list-detail {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.task-list-detail > span,
.task-list-progress-label > span {
  color: #7a8493;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.055em;
  line-height: 1.2;
  text-transform: uppercase;
}

.task-list-detail > strong,
.task-list-assignees > strong {
  overflow-wrap: anywhere;
  color: #394354;
  font-size: 12px;
  font-weight: 700;
}

.task-assignee-chips {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.task-assignee-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  padding: 4px 8px;
  overflow-wrap: anywhere;
  border: 1px solid #dce6f1;
  border-radius: 999px;
  background: #f3f7fb;
  color: #334155;
  font-size: 10px;
  font-weight: 750;
}

.task-list-progress {
  display: grid;
  width: min(280px, 100%);
  gap: 6px;
  justify-self: start;
}

.task-list-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-list-progress-label strong {
  color: #394354;
  font-size: 11px;
}

.task-list-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf2;
}

.task-list-progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width 0.2s ease;
}

.task-list-footer {
  justify-content: flex-end;
  padding-top: 1px;
  font-size: 11px;
}

.site-back-to-top {
  --reading-progress: 0%;
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 1030;
  display: inline-flex;
  width: 3.25rem;
  height: 3.25rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(
    #ff6a32 var(--reading-progress),
    rgba(7, 27, 45, 0.38) var(--reading-progress)
  );
  box-shadow:
    0 0 0 1px rgba(7, 27, 45, 0.68),
    0 0.65rem 1.5rem rgba(7, 27, 45, 0.38);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.75rem);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.site-back-to-top::before {
  position: absolute;
  inset: 0.2rem;
  z-index: 0;
  border-radius: inherit;
  background: linear-gradient(145deg, #ef4b23, #c92f1f);
  box-shadow: 0 0 0 1px rgba(7, 27, 45, 0.62);
  content: "";
  transition: background 0.2s ease;
}

.site-back-to-top::after {
  position: absolute;
  right: calc(100% + 0.65rem);
  top: 50%;
  padding: 0.42rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.45rem;
  background: rgba(7, 27, 45, 0.94);
  box-shadow: 0 0.4rem 1rem rgba(7, 27, 45, 0.25);
  color: #fff;
  content: attr(data-progress-label);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.2;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(0.3rem, -50%);
  transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
}

.site-back-to-top-content {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.site-back-to-top-arrow {
  font-size: 1rem;
  font-weight: 900;
  line-height: 0.8;
}

.site-back-to-top-value {
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: -0.02em;
  line-height: 1;
}

.site-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.site-back-to-top:hover,
.site-back-to-top:focus-visible {
  color: #fff;
  opacity: 1;
  transform: translateY(-0.125rem);
  box-shadow: 0 0.8rem 1.75rem rgba(7, 27, 45, 0.4);
}

.site-back-to-top:hover::before {
  background: linear-gradient(145deg, #ff6037, #d93622);
}

.site-back-to-top:hover::after,
.site-back-to-top:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}

.site-back-to-top:focus-visible {
  outline: 0.2rem solid #fff;
  outline-offset: 0.18rem;
}

@media (max-width: 720px) {
  .tasks-list-card > .toolbar,
  .notes-list-card > .toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-add-button,
  .note-add-button {
    width: 100%;
  }

  .task-category-progress-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-list-item-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-list-badges {
    justify-content: flex-start;
  }

  .task-list-details {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-list-footer {
    justify-content: flex-start;
  }

  .site-back-to-top {
    right: max(0.85rem, env(safe-area-inset-right));
    bottom: calc(5.6rem + env(safe-area-inset-bottom));
    width: 3rem;
    height: 3rem;
  }

  .site-back-to-top::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-back-to-top {
    transition: none;
  }
}

/* Light/dark appearance shared by login and the application panel */
.auth-theme-toggle {
  position: fixed;
  z-index: 5;
  top: 22px;
  right: 22px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071421;
  --panel: rgba(12, 32, 49, 0.9);
  --panel-soft: rgba(4, 17, 29, 0.62);
  --line: rgba(73, 169, 255, 0.2);
  --text: #dcecff;
  --muted: #8fa9bf;
  --brand: #ff7a2f;
  --brand-strong: #ff9a5f;
  --danger: #ff7b72;
  --danger-soft: rgba(255, 123, 114, 0.1);
  --success: #52d391;
  --success-soft: rgba(82, 211, 145, 0.11);
  --warning: #ffc45f;
  --warning-soft: rgba(255, 196, 95, 0.1);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
}

html[data-theme="dark"],
html[data-theme="dark"] body.app-body {
  color: var(--text);
  background:
    linear-gradient(rgba(28, 99, 155, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 99, 155, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 0, rgba(14, 101, 186, 0.34), transparent 37%),
    #071421;
  background-size: 42px 42px, 42px 42px, auto, auto;
}

html[data-theme="dark"] :focus-visible {
  outline-color: rgba(73, 169, 255, 0.48);
}

html[data-theme="dark"] .app-sidebar {
  border-right: 1px solid rgba(73, 169, 255, 0.18);
  background: linear-gradient(165deg, rgba(12, 32, 49, 0.98), rgba(5, 17, 28, 0.99));
}

html[data-theme="dark"] .brand-mark {
  background: rgba(73, 169, 255, 0.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .nav-link.is-active,
html[data-theme="dark"] .mobile-link.is-active {
  background: rgba(255, 122, 47, 0.16);
}

html[data-theme="dark"] .nav-icon,
html[data-theme="dark"] .mobile-nav-icon,
html[data-theme="dark"] .page-eyebrow,
html[data-theme="dark"] .section-kicker {
  color: #ff9a5f;
}

html[data-theme="dark"] .user-avatar {
  background: rgba(73, 169, 255, 0.14);
  color: #8cc8ff;
}

html[data-theme="dark"] .app-main {
  background: transparent;
}

html[data-theme="dark"] .topbar {
  border-color: rgba(73, 169, 255, 0.16);
  background: rgba(7, 20, 33, 0.82);
  backdrop-filter: blur(18px);
}

html[data-theme="dark"] .page-title,
html[data-theme="dark"] .dashboard-welcome h2,
html[data-theme="dark"] .metric-value,
html[data-theme="dark"] .panel-heading .card-title,
html[data-theme="dark"] .item-title,
html[data-theme="dark"] .task-list-item-header .item-title,
html[data-theme="dark"] .task-list-detail > strong,
html[data-theme="dark"] .task-list-assignees > strong,
html[data-theme="dark"] .task-list-progress-label strong,
html[data-theme="dark"] .dashboard-context strong {
  color: var(--text);
}

html[data-theme="dark"] .page-subtitle,
html[data-theme="dark"] .field-label,
html[data-theme="dark"] .task-list-detail > span,
html[data-theme="dark"] .task-list-progress-label > span {
  color: #9db4c8;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .list-card,
html[data-theme="dark"] .soft-card,
html[data-theme="dark"] .modal-panel,
html[data-theme="dark"] .task-modal-summary > div {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

html[data-theme="dark"] .soft-card,
html[data-theme="dark"] .task-modal-summary > div {
  background: rgba(4, 17, 29, 0.44);
}

html[data-theme="dark"] .dashboard-welcome {
  border-color: var(--line);
  background:
    radial-gradient(circle at 92% 25%, rgba(73, 169, 255, 0.14), transparent 13rem),
    rgba(12, 32, 49, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

html[data-theme="dark"] .context-pill,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .file-pill,
html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .task-assignee-chip {
  border-color: rgba(73, 169, 255, 0.18);
  background: rgba(73, 169, 255, 0.08);
  color: #bdd2e5;
}

html[data-theme="dark"] .scope-form,
html[data-theme="dark"] .theme-toggle {
  border-color: rgba(73, 169, 255, 0.22);
  background: rgba(12, 32, 49, 0.86);
  color: #bdd2e5;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .theme-toggle:focus-visible {
  border-color: rgba(73, 169, 255, 0.48);
  background: rgba(17, 45, 68, 0.96);
  color: #dcecff;
}

html[data-theme="dark"] .scope-form .scope-label {
  color: #8fa9bf;
}

html[data-theme="dark"] .scope-select,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="file"],
html[data-theme="dark"] select {
  border-color: rgba(73, 169, 255, 0.28);
  background-color: rgba(4, 17, 29, 0.82);
  color: var(--text);
  color-scheme: dark;
}

html[data-theme="dark"] .scope-select {
  border: 0;
  background-color: transparent;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus {
  border-color: rgba(73, 169, 255, 0.58);
  box-shadow: 0 0 0 3px rgba(73, 169, 255, 0.13);
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .btn-warning {
  border-color: rgba(73, 169, 255, 0.28);
  background: rgba(73, 169, 255, 0.08);
  color: #dcecff;
}

html[data-theme="dark"] .btn-danger {
  border-color: rgba(255, 123, 114, 0.35);
  color: #ff9a91;
}

html[data-theme="dark"] .list-item {
  border-color: var(--line);
}

html[data-theme="dark"] .list-item:hover,
html[data-theme="dark"] .tool-tab:hover {
  background: rgba(73, 169, 255, 0.055);
}

html[data-theme="dark"] .list-item.is-active,
html[data-theme="dark"] .tool-tab.is-active {
  border-color: rgba(255, 122, 47, 0.34);
  background: rgba(255, 122, 47, 0.09);
  color: #ffb178;
  box-shadow: 0 0 0 3px rgba(255, 122, 47, 0.07);
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .rich-toolbar {
  border-color: var(--line);
  background: rgba(7, 20, 33, 0.9);
}

html[data-theme="dark"] .modal-body,
html[data-theme="dark"] .rich-editor,
html[data-theme="dark"] .rich-editor-surface {
  border-color: var(--line);
  background: rgba(4, 17, 29, 0.82);
  color: var(--text);
}

html[data-theme="dark"] .rich-tool,
html[data-theme="dark"] .modal-close {
  border-color: rgba(73, 169, 255, 0.24);
  background: rgba(73, 169, 255, 0.08);
  color: var(--text);
}

html[data-theme="dark"] .rich-tool:hover,
html[data-theme="dark"] .rich-tool:focus-visible,
html[data-theme="dark"] .modal-close:hover {
  border-color: rgba(73, 169, 255, 0.42);
  background: rgba(73, 169, 255, 0.13);
  color: #8cc8ff;
}

html[data-theme="dark"] .rich-content blockquote,
html[data-theme="dark"] .rich-content pre,
html[data-theme="dark"] .rich-content code,
html[data-theme="dark"] .rich-editor-surface th,
html[data-theme="dark"] .rich-content th {
  border-color: var(--line);
  background: rgba(73, 169, 255, 0.07);
  color: #bdd2e5;
}

html[data-theme="dark"] .comment-box,
html[data-theme="dark"] .message-box {
  border-color: rgba(73, 169, 255, 0.2);
  border-left-color: rgba(255, 122, 47, 0.5);
  background: rgba(4, 17, 29, 0.38);
}

html[data-theme="dark"] .comment-like-button {
  border-color: rgba(73, 169, 255, 0.28);
  background: rgba(73, 169, 255, 0.1);
  color: #8cc8ff;
}

html[data-theme="dark"] .task-progress-control,
html[data-theme="dark"] .tasks-list-card .task-list-item {
  border-color: var(--line);
  background: rgba(4, 17, 29, 0.54);
}

html[data-theme="dark"] .tasks-list-card .task-list-item:hover {
  border-color: rgba(73, 169, 255, 0.42);
  background: rgba(73, 169, 255, 0.055);
}

html[data-theme="dark"] .tasks-list-card .task-list-item.is-active {
  border-color: rgba(255, 122, 47, 0.46);
  background: rgba(255, 122, 47, 0.08);
  box-shadow: 0 0 0 3px rgba(255, 122, 47, 0.07);
}

html[data-theme="dark"] .task-progress-control output {
  background: rgba(255, 122, 47, 0.11);
  color: #ffb178;
}

html[data-theme="dark"] .task-list-progress-track {
  background: rgba(143, 169, 191, 0.18);
}

html[data-theme="dark"] .task-list-progress-track > span {
  background: linear-gradient(90deg, #49a9ff, #ff7a2f);
}

html[data-theme="dark"] .attachment-entry.is-unavailable .file-pill {
  border-color: rgba(143, 169, 191, 0.32);
  background: rgba(143, 169, 191, 0.08);
  color: #a7bacb;
}

html[data-theme="dark"] .attachment-storage-notice {
  border-color: rgba(73, 169, 255, 0.25);
  background: rgba(73, 169, 255, 0.08);
  color: #bdd2e5;
}

html[data-theme="dark"] .attachment-storage-notice > span {
  background: rgba(73, 169, 255, 0.14);
  color: #8cc8ff;
}

html[data-theme="dark"] .attachment-storage-notice strong {
  color: var(--text);
}

html[data-theme="dark"] .flash {
  border-color: rgba(73, 169, 255, 0.28);
  background: rgba(73, 169, 255, 0.12);
  color: #bcdcff;
}

html[data-theme="dark"] .flash-success {
  border-color: rgba(82, 211, 145, 0.25);
  background: rgba(82, 211, 145, 0.11);
  color: #75e6aa;
}

html[data-theme="dark"] .flash-error {
  border-color: rgba(255, 123, 114, 0.25);
  background: rgba(255, 123, 114, 0.1);
  color: #ffaaa3;
}

html[data-theme="dark"] .flash-warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(120, 73, 0, 0.24);
  color: #ffd17a;
}

html[data-theme="dark"] .auth-body {
  background:
    linear-gradient(rgba(28, 99, 155, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 99, 155, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 0, rgba(14, 101, 186, 0.34), transparent 37%),
    #071421;
  background-size: 42px 42px, 42px 42px, auto, auto;
}

html[data-theme="dark"] .auth-background-art::before {
  background: radial-gradient(circle, rgba(73, 169, 255, 0.14), transparent 67%);
}

html[data-theme="dark"] .auth-background-art::after {
  background: radial-gradient(circle, rgba(14, 101, 186, 0.2), transparent 67%);
}

html[data-theme="dark"] .auth-network {
  color: rgba(73, 169, 255, 0.18);
}

html[data-theme="dark"] .auth-card {
  border-color: rgba(73, 169, 255, 0.24);
  background: rgba(12, 32, 49, 0.9);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

html[data-theme="dark"] .auth-brand {
  border-color: var(--line);
}

html[data-theme="dark"] .auth-product-name,
html[data-theme="dark"] .auth-card h1 {
  color: var(--text);
}

html[data-theme="dark"] .auth-brand p,
html[data-theme="dark"] .auth-lead,
html[data-theme="dark"] .auth-card .field-label {
  color: #9db4c8;
}

html[data-theme="dark"] .auth-input-wrap .form-control {
  border-color: rgba(73, 169, 255, 0.28);
  background: rgba(4, 17, 29, 0.82);
  color: var(--text);
}

html[data-theme="dark"] .auth-input-wrap .form-control:focus {
  border-color: #49a9ff;
  background: rgba(4, 17, 29, 0.94);
  box-shadow: 0 0 0 3px rgba(73, 169, 255, 0.14);
}

html[data-theme="dark"] .auth-input-wrap > svg,
html[data-theme="dark"] .auth-password-toggle {
  color: #8fa9bf;
}

html[data-theme="dark"] .auth-password-toggle:hover,
html[data-theme="dark"] .auth-password-toggle:focus-visible {
  background: rgba(73, 169, 255, 0.1);
  color: #8cc8ff;
}

html[data-theme="dark"] .auth-remember {
  color: #a7bacb;
}

html[data-theme="dark"] .auth-submit {
  border-color: #e86420;
  background: linear-gradient(135deg, #ff7a2f 0%, #e86420 100%);
  box-shadow: 0 10px 22px rgba(255, 122, 47, 0.2);
}

html[data-theme="dark"] .auth-submit:hover,
html[data-theme="dark"] .auth-submit:focus-visible {
  border-color: #ff9a5f;
  background: linear-gradient(135deg, #ff8a47 0%, #ee6a25 100%);
  box-shadow: 0 13px 26px rgba(255, 122, 47, 0.28);
}

html[data-theme="dark"] .auth-session-alert {
  border-color: rgba(73, 169, 255, 0.28);
  background: rgba(73, 169, 255, 0.1);
  color: #bcdcff;
}

html[data-theme="dark"] .auth-session-alert-icon {
  background: rgba(73, 169, 255, 0.14);
  color: #8cc8ff;
}

html[data-theme="dark"] .auth-session-recovery {
  border-color: var(--line);
  background: rgba(4, 17, 29, 0.45);
  color: var(--text);
}

html[data-theme="dark"] .auth-footnote {
  border-color: var(--line);
  color: #8fa9bf;
}

@media (max-width: 1100px) {
  .topbar-actions {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .topbar-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions .theme-toggle,
  .topbar-actions .scope-form {
    width: 100%;
  }

  .auth-theme-toggle {
    top: 12px;
    right: 12px;
  }

  .auth-theme-toggle [data-theme-label] {
    display: none;
  }
}

/* Notes use the same single-column list and modal workflow as tasks */
.grid-2.notes-workspace {
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
}

.notes-workspace .note-detail-host {
  display: none;
}

.notes-list-card,
.notes-filter-form {
  min-width: 0;
}

.notes-list-card .notes-list {
  gap: 10px;
}

.notes-list-card .note-list-item {
  gap: 13px;
}

.note-list-title {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
}

.note-color-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  margin-top: 7px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: var(--note-color, #2563eb);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16);
}

.note-list-details {
  grid-template-columns: minmax(160px, 0.75fr) minmax(260px, 1.5fr) minmax(120px, 0.5fr);
}

.note-save-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.note-save-row > button {
  width: auto;
}

.note-save-status {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.note-save-status.is-pending {
  color: #9a6700;
}

.note-save-status.is-success {
  color: #14804a;
}

.note-save-status.is-error {
  color: #b42318;
}

input[type="color"].form-control {
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 5px;
  cursor: pointer;
}

input[type="color"].form-control::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"].form-control::-webkit-color-swatch {
  border: 0;
  border-radius: 8px;
}

input[type="color"].form-control::-moz-color-swatch {
  border: 0;
  border-radius: 8px;
}

.note-modal-extras-slot:empty {
  display: none;
}

.note-modal-extras {
  box-shadow: none;
}

/* Visual color and emoji pickers for rich-text editors */
.rich-tool-picker {
  position: relative;
  display: inline-flex;
}

.rich-picker[hidden] {
  display: none !important;
}

.rich-picker {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  width: 246px;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.2);
}

.rich-picker::before {
  position: absolute;
  top: -5px;
  left: 15px;
  width: 9px;
  height: 9px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: inherit;
  content: "";
  transform: rotate(45deg);
}

.rich-picker-title {
  color: #334155;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rich-color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.rich-color-swatch {
  display: block;
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px #cbd5e1;
}

.rich-color-swatch:hover,
.rich-color-swatch:focus-visible {
  background: var(--swatch);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
  transform: scale(1.08);
}

.rich-custom-color {
  display: flex;
  min-height: 36px;
  padding-top: 9px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.rich-custom-color input {
  width: 42px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.rich-emoji-palette {
  right: 0;
  left: auto;
  width: 310px;
}

.rich-emoji-palette::before {
  right: 15px;
  left: auto;
}

.rich-emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.rich-emoji-grid button {
  display: grid;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  font-size: 19px;
  line-height: 1;
}

.rich-emoji-grid button:hover,
.rich-emoji-grid button:focus-visible {
  border-color: rgba(37, 99, 235, 0.2);
  background: #eff6ff;
  box-shadow: none;
  transform: translateY(-1px);
}

html[data-theme="dark"] .rich-picker {
  border-color: rgba(73, 169, 255, 0.28);
  background: #0c2031;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.38);
}

html[data-theme="dark"] .rich-picker-title {
  color: #bdd2e5;
}

html[data-theme="dark"] .rich-color-swatch {
  border-color: #0c2031;
  box-shadow: 0 0 0 1px rgba(143, 169, 191, 0.55);
}

html[data-theme="dark"] .rich-custom-color input {
  border-color: rgba(73, 169, 255, 0.28);
  background: rgba(4, 17, 29, 0.82);
}

html[data-theme="dark"] .rich-emoji-grid button:hover,
html[data-theme="dark"] .rich-emoji-grid button:focus-visible {
  border-color: rgba(73, 169, 255, 0.28);
  background: rgba(73, 169, 255, 0.11);
}

html[data-theme="dark"] .note-color-dot {
  border-color: #0c2031;
  box-shadow: 0 0 0 1px rgba(143, 169, 191, 0.5);
}

html[data-theme="dark"] .note-save-status.is-pending {
  color: #ffc45f;
}

html[data-theme="dark"] .note-save-status.is-success {
  color: #75e6aa;
}

html[data-theme="dark"] .note-save-status.is-error {
  color: #ffaaa3;
}

html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface * {
  background-color: transparent !important;
  background-image: none !important;
}

html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface p,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface div,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface li,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface h2,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface h3,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface h4,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface blockquote,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface td,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface th {
  background-color: transparent !important;
  color: var(--text) !important;
}

html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface span {
  background-color: transparent !important;
}

html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface a {
  background-color: transparent !important;
  color: #8cc8ff !important;
}

html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface pre,
html[data-theme="dark"] .note-preview-modal .modal-rich-editor-surface code {
  border-color: rgba(73, 169, 255, 0.2) !important;
  background: rgba(73, 169, 255, 0.07) !important;
  color: #bdd2e5 !important;
}

html[data-theme="dark"] .modal-panel {
  border-color: var(--line) !important;
  background: #0c2031 !important;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
  border-color: var(--line) !important;
  background: #071421 !important;
}

html[data-theme="dark"] .modal-body {
  background: #0c2031 !important;
}

/* Forum: działy -> tematy -> odpowiedzi */
.dashboard-panel-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.dashboard-panel-links a {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-schedule {
  display: grid;
  gap: 18px;
}

.dashboard-schedule-section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.dashboard-schedule-section + .dashboard-schedule-section {
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.dashboard-schedule-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dashboard-schedule-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.dashboard-schedule-dot.is-reminder {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}

.dashboard-schedule-empty {
  margin: 4px 0;
  font-size: 12px;
}

.forum-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.forum-breadcrumbs a {
  color: var(--brand);
  font-weight: 750;
  text-decoration: none;
}

.forum-breadcrumbs strong {
  max-width: min(680px, 72vw);
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-main-card {
  width: 100%;
}

.forum-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.forum-card-heading .card-title {
  margin-bottom: 5px;
}

.forum-card-heading p {
  margin: 0;
}

.forum-section-list,
.forum-topic-list,
.forum-post-list {
  display: grid;
  gap: 10px;
}

.forum-section-row,
.forum-topic-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(185px, auto) auto;
  align-items: center;
  gap: 16px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.forum-section-row:hover,
.forum-topic-row:hover {
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.forum-section-icon,
.forum-topic-state {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
  color: var(--brand);
  font-size: 19px;
  font-weight: 900;
}

.forum-section-copy,
.forum-topic-copy,
.forum-section-metrics,
.forum-topic-metrics,
.forum-post-author > span:last-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.forum-section-copy strong,
.forum-topic-copy > strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-section-copy small,
.forum-topic-copy small,
.forum-section-metrics small,
.forum-topic-metrics small,
.forum-post-author small,
.forum-post-meta small {
  color: var(--muted);
}

.forum-section-metrics,
.forum-topic-metrics {
  justify-items: end;
  text-align: right;
}

.forum-section-metrics > span {
  display: inline-flex;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.forum-topic-metrics > strong {
  color: var(--brand);
  font-size: 18px;
}

.forum-topic-metrics > span {
  color: var(--muted);
  font-size: 11px;
}

.forum-row-arrow {
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}

.forum-search-form {
  margin-bottom: 16px;
}

.forum-search-form .form-control {
  flex: 1 1 380px;
}

.forum-editor-modal {
  width: min(1380px, 100%);
  height: min(920px, 100%);
  max-width: 100%;
  max-height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.forum-editor-modal .modal-editor-form {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  max-height: none;
  overflow: hidden;
}

.forum-editor-modal .autosave-indicator {
  margin: 0;
  padding: 8px 18px;
  border-width: 0 0 1px;
  border-radius: 0;
  font-size: 11px;
}

.forum-editor-modal .modal-body {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.forum-editor-modal .modal-body,
.forum-editor-modal .detail-body,
.forum-editor-modal .rich-editor,
.forum-editor-modal .rich-toolbar,
.forum-editor-modal .rich-editor-surface,
.forum-editor-modal .form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.forum-thread-heading {
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.forum-post {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
}

.forum-post.is-root-post {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
}

.forum-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-soft) 76%, var(--panel));
}

.forum-post-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.forum-post-meta {
  display: grid;
  justify-items: end;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.forum-post-content {
  min-height: 70px;
  padding: 18px;
}

.forum-post-content .rich-content > :first-child {
  margin-top: 0;
}

.forum-post-content .rich-content > :last-child {
  margin-bottom: 0;
}

.forum-attachments {
  display: grid;
  gap: 9px;
  padding: 0 18px 17px;
}

.forum-attachment-unavailable {
  display: inline-grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
}

.forum-attachment-unavailable small {
  color: #b45309;
  font-size: 10px;
  font-weight: 750;
}

.forum-post-actions {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.forum-post-actions details {
  flex: 1 1 auto;
}

.forum-post-actions summary {
  width: fit-content;
  list-style: none;
  cursor: pointer;
}

.forum-post-actions summary::-webkit-details-marker {
  display: none;
}

.forum-edit-form {
  margin-top: 12px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.forum-reply-box {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-soft);
}

.forum-reply-box .rich-editor-surface,
.forum-edit-form .rich-editor-surface,
.forum-editor-modal .rich-editor-surface {
  min-height: 170px;
}

html[data-theme="dark"] .forum-section-row:hover,
html[data-theme="dark"] .forum-topic-row:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .forum-editor-modal .autosave-indicator {
  border-color: var(--line);
  background: rgba(73, 169, 255, 0.06);
  color: #9db4c8;
}

html[data-theme="dark"] .forum-post {
  border-color: rgba(73, 169, 255, 0.2);
  background: rgba(7, 25, 39, 0.72);
}

html[data-theme="dark"] .forum-post.is-root-post {
  border-color: rgba(73, 169, 255, 0.34);
}

html[data-theme="dark"] .forum-post-header,
html[data-theme="dark"] .forum-post-actions,
html[data-theme="dark"] .forum-reply-box {
  border-color: rgba(73, 169, 255, 0.2);
  background: rgba(4, 17, 29, 0.52);
}

html[data-theme="dark"] .forum-post-content .rich-content,
html[data-theme="dark"] .forum-post-content .rich-content p,
html[data-theme="dark"] .forum-post-content .rich-content div,
html[data-theme="dark"] .forum-post-content .rich-content span,
html[data-theme="dark"] .forum-post-content .rich-content li,
html[data-theme="dark"] .forum-post-content .rich-content h2,
html[data-theme="dark"] .forum-post-content .rich-content h3,
html[data-theme="dark"] .forum-post-content .rich-content h4 {
  background: transparent !important;
  color: var(--text) !important;
}

html[data-theme="dark"] .forum-post-content .rich-content a {
  background: transparent !important;
  color: #8cc8ff !important;
}

html[data-theme="dark"] .forum-attachment-unavailable small {
  color: #ffc45f;
}

@media (max-width: 720px) {
  .dashboard-panel-links {
    justify-content: flex-start;
  }

  .forum-editor-modal {
    width: 100%;
    height: calc(100vh - 18px);
    max-width: 100%;
    max-height: calc(100vh - 18px);
  }

  .forum-card-heading,
  .forum-post-header {
    align-items: stretch;
    flex-direction: column;
  }

  .forum-section-row,
  .forum-topic-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .forum-section-metrics,
  .forum-topic-metrics {
    grid-column: 2 / -1;
    justify-items: start;
    text-align: left;
  }

  .forum-post-meta {
    justify-items: start;
  }

  .notes-filter-form {
    width: 100%;
  }

  .notes-filter-form > * {
    width: 100%;
  }

  .note-list-details {
    grid-template-columns: minmax(0, 1fr);
  }

  .rich-picker {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: calc(5.4rem + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-height: 48vh;
    overflow-y: auto;
  }

  .rich-picker::before {
    display: none;
  }

  .rich-color-grid {
    grid-template-columns: repeat(6, minmax(28px, 1fr));
  }

  .rich-color-swatch {
    justify-self: center;
  }

  .rich-emoji-grid {
    grid-template-columns: repeat(7, minmax(34px, 1fr));
  }

  .rich-emoji-grid button {
    justify-self: center;
  }
}

/* Customer equipment */
.equipment-company-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  align-items: end;
  gap: 20px;
}

.equipment-company-card .card-title,
.equipment-company-card p {
  margin-bottom: 0;
}

.equipment-company-selector {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.equipment-company-selector .field-label {
  grid-column: 1 / -1;
}

.equipment-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.equipment-tabs a {
  flex: 1 0 max-content;
  padding: 11px 16px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.equipment-tabs a:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.equipment-tabs a.is-active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 28%, transparent);
}

.equipment-main-card {
  display: grid;
  gap: 18px;
}

.equipment-heading,
.equipment-fields-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.equipment-heading .card-title,
.equipment-fields-heading h4 {
  margin: 0;
}

.equipment-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 0.7fr)) minmax(220px, 1.4fr) auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.equipment-entry-list,
.equipment-definition-list,
.equipment-fields-list {
  display: grid;
  gap: 12px;
}

.equipment-entry-card,
.equipment-definition-list > article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.equipment-entry-card:hover,
.equipment-definition-list > article:hover {
  border-color: color-mix(in srgb, var(--brand) 34%, var(--line));
  box-shadow: 0 12px 28px rgba(21, 45, 74, 0.08);
}

.equipment-entry-card > header,
.equipment-definition-list > article {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.equipment-entry-card h3,
.equipment-definition-list h3 {
  margin: 0 0 9px;
  color: var(--text);
  font-size: 16px;
}

.equipment-definition-list p {
  margin: 0 0 10px;
  color: var(--muted);
}

.equipment-definition-list small,
.equipment-entry-card > footer {
  color: var(--muted);
  font-size: 12px;
}

.equipment-entry-card > footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.equipment-actions,
.equipment-field-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.equipment-actions form {
  margin: 0;
}

.equipment-values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 9px;
  margin-top: 15px;
}

.equipment-values-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
}

.equipment-values-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.equipment-values-grid strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}

.equipment-small-modal {
  width: min(720px, 100%);
  height: auto;
  max-height: min(760px, calc(100vh - 34px));
  grid-template-rows: auto minmax(0, 1fr);
}

.equipment-large-modal {
  width: min(1320px, 100%);
  height: min(900px, calc(100vh - 34px));
  max-width: 1320px;
  grid-template-rows: auto minmax(0, 1fr);
}

.equipment-modal-form {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.equipment-modal-form > .modal-body {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.equipment-fields-heading {
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.equipment-field-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.15fr) minmax(130px, 0.75fr) minmax(160px, 1fr) minmax(190px, 1.25fr) auto auto;
  align-items: end;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-soft);
}

.equipment-field-row > [hidden] {
  display: none;
}

.equipment-required,
.equipment-checkbox,
.equipment-radio-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.equipment-field-actions button {
  min-width: 42px;
  padding-inline: 11px;
}

.equipment-field-actions button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.equipment-entry-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 6px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.equipment-entry-fields > .is-wide {
  grid-column: 1 / -1;
}

.equipment-radio-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  min-height: 44px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
}

html[data-theme="dark"] .equipment-tabs,
html[data-theme="dark"] .equipment-entry-card,
html[data-theme="dark"] .equipment-definition-list > article {
  border-color: rgba(73, 169, 255, 0.2);
  background: rgba(7, 25, 39, 0.74);
}

html[data-theme="dark"] .equipment-filter-grid,
html[data-theme="dark"] .equipment-values-grid > div,
html[data-theme="dark"] .equipment-field-row {
  border-color: rgba(73, 169, 255, 0.18);
  background: rgba(4, 17, 29, 0.5);
}

html[data-theme="dark"] .equipment-radio-options {
  border-color: rgba(73, 169, 255, 0.2);
  background: rgba(3, 16, 28, 0.62);
}

html[data-theme="dark"] .equipment-entry-card:hover,
html[data-theme="dark"] .equipment-definition-list > article:hover {
  border-color: rgba(73, 169, 255, 0.42);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
}

@media (max-width: 1100px) {
  .equipment-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .equipment-field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .equipment-field-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 720px) {
  .equipment-company-card,
  .equipment-company-selector {
    grid-template-columns: minmax(0, 1fr);
  }

  .equipment-company-selector .field-label {
    grid-column: auto;
  }

  .equipment-company-selector > * {
    width: 100%;
  }

  .equipment-tabs a {
    flex: 0 0 auto;
  }

  .equipment-heading,
  .equipment-entry-card > header,
  .equipment-definition-list > article {
    align-items: stretch;
    flex-direction: column;
  }

  .equipment-heading > .btn,
  .equipment-actions {
    width: 100%;
  }

  .equipment-actions > *,
  .equipment-actions form,
  .equipment-actions button {
    flex: 1 1 auto;
  }

  .equipment-filter-grid,
  .equipment-entry-fields,
  .equipment-field-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .equipment-filter-grid > *,
  .equipment-field-actions,
  .equipment-field-actions button {
    width: 100%;
  }

  .equipment-field-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .equipment-small-modal,
  .equipment-large-modal {
    width: 100%;
    height: calc(100vh - 18px);
    max-width: 100%;
    max-height: calc(100vh - 18px);
  }
}

/* Offline queue, push notifications, QR and task activity */
.offline-queue-status,
.push-toggle-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
}

.offline-queue-status {
  border: 1px solid #f5c76c;
  background: #fff8df;
  color: #8a5500;
}

.push-toggle-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

.push-toggle-button.is-active {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  background: color-mix(in srgb, var(--brand) 10%, var(--panel));
  color: var(--brand);
}

.offline-queue-status[hidden],
.push-toggle-button[hidden] {
  display: none !important;
}

.task-activity-timeline {
  position: relative;
  display: grid;
  gap: 0;
}

.task-activity-timeline::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 15px;
  width: 2px;
  background: var(--line);
  content: "";
}

.task-activity-item {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 11px;
  padding: 9px 0;
}

.task-activity-icon {
  z-index: 1;
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 14%, var(--panel));
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.task-activity-item strong,
.task-activity-item small {
  display: block;
}

.task-activity-item strong {
  color: var(--text);
  font-size: 12px;
}

.task-activity-item p {
  margin: 3px 0;
  color: var(--muted);
  font-size: 11px;
}

.task-activity-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.equipment-heading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.equipment-qr-modal {
  width: min(620px, 100%);
  height: auto;
  max-height: calc(100vh - 34px);
  grid-template-rows: auto minmax(0, 1fr);
}

.equipment-qr-body {
  overflow-y: auto;
  text-align: center;
}

.equipment-qr-output {
  display: grid;
  width: min(390px, 100%);
  margin: 0 auto 13px;
  padding: 15px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.equipment-qr-output svg {
  display: block;
  width: 100%;
  height: auto;
}

.equipment-qr-camera {
  position: relative;
  width: min(460px, 100%);
  aspect-ratio: 1;
  margin: 0 auto 13px;
  overflow: hidden;
  border-radius: 18px;
  background: #020617;
}

.equipment-qr-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.equipment-qr-frame {
  position: absolute;
  inset: 18%;
  border: 3px solid #fff;
  border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .offline-queue-status {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(146, 87, 0, 0.2);
  color: #ffd17a;
}

html[data-theme="dark"] .push-toggle-button {
  border-color: rgba(73, 169, 255, 0.2);
  background: rgba(4, 17, 29, 0.5);
}

html[data-theme="dark"] .task-activity-icon {
  border-color: #071725;
}

@media (max-width: 720px) {
  .offline-queue-status {
    width: 100%;
  }

  .push-toggle-button {
    flex: 1 1 auto;
  }

  .equipment-heading-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .equipment-heading-actions > * {
    width: 100%;
  }

  .equipment-qr-modal {
    width: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
}

/*
 * Final mobile shell guard.
 *
 * The stylesheet contains the original layout followed by the redesigned
 * desktop shell. The latter restores `.app-sidebar { display: flex; }`, so
 * without this final breakpoint the sidebar becomes a full-height first row
 * on phones and pushes the actual page below the viewport.
 */
@media (max-width: 1100px) {
  .app-shell {
    display: block;
    width: 100%;
    min-height: 100dvh;
  }

  .app-sidebar {
    display: none !important;
  }

  .app-main {
    width: 100%;
    min-width: 0;
    min-height: 100dvh;
  }
}

@media (max-width: 720px) {
  .page-grid {
    width: 100%;
    min-width: 0;
  }

  .topbar,
  .topbar-actions,
  .page-heading {
    min-width: 0;
  }

  .page-subtitle {
    max-width: 100%;
  }

  .topbar-logout-button {
    display: inline-flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .topbar-actions .scope-form {
    margin-left: 0;
  }
}
