:root {
  --sky: #87ceeb;
  --navy: #000080;
  --navy-soft: #1a237e;
  --ink: #14204a;
  --paper: #f4f8fc;
  --card: #ffffff;
  --line: rgba(0, 0, 128, 0.12);
  --muted: #5a6a8a;
  --danger: #8b1e3f;
  --radius: 10px;
  --font: "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
}

body {
  background:
    linear-gradient(180deg, rgba(135, 206, 235, 0.35), rgba(0, 0, 128, 0.08) 220px),
    var(--paper);
}

a { color: var(--navy); }

.app-shell {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(90deg, #000080, #1a3a8a);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.app-shell__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.app-shell__brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  color: #fff;
  text-decoration: none;
}

.app-shell__brand:hover {
  color: #fff;
}

.app-shell__logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.app-shell__brand-text {
  white-space: nowrap;
}

.app-shell__menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(135, 206, 235, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.app-shell__menu-btn:hover {
  background: rgba(135, 206, 235, 0.18);
}

.app-shell__nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  width: auto;
  flex: 0 1 auto;
}

.app-shell__nav a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.25rem 0.15rem;
  border-bottom: 2px solid transparent;
}

.app-shell__nav a:hover,
.app-shell__nav a.is-active {
  color: #fff;
  border-bottom-color: var(--sky);
}

.app-shell__logout {
  margin-left: 0.4rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(135, 206, 235, 0.45);
  border-radius: 6px;
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.app-shell__logout:hover {
  background: rgba(135, 206, 235, 0.18);
  color: #fff;
}

.page {
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1.25rem 2.5rem;
}

.page h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.page p { color: var(--muted); }
.page .form-error { color: var(--danger); }

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 22rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.5rem 1.4rem;
  box-shadow: 0 10px 30px rgba(0, 0, 128, 0.08);
}

.auth-card__logo {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 0.85rem;
  border-radius: 12px;
  object-fit: cover;
}

.auth-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  text-align: center;
}

.auth-card .lede {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy-soft);
}

.field input {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.field input:focus {
  outline: 2px solid rgba(135, 206, 235, 0.8);
  border-color: var(--sky);
}

.btn-primary {
  width: 100%;
  margin-top: 0.35rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--navy);
  border: 0;
  border-radius: 7px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
}

.btn-primary:hover { background: var(--navy-soft); }

.form-error {
  min-height: 1.2rem;
  margin: 0.4rem 0 0;
  color: var(--danger);
  font-size: 0.85rem;
}

.page--wide { max-width: 1100px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy-soft);
  margin: 1.4rem 0 0.7rem;
}

.section-title--first {
  margin-top: 0.75rem;
}

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

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
}

.stat-card__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.stat-card__value {
  margin-top: 0.25rem;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.15;
}

.stat-card--danger .stat-card__value { color: var(--danger); }

.stat-card__meta {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.donations-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.donations-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.donations-list li:last-child { border-bottom: none; }

.shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.shortcut {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 11rem;
  padding: 0.9rem 1.05rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}

.shortcut strong { color: var(--navy); }
.shortcut span { color: var(--muted); font-size: 0.85rem; }
.shortcut:hover { border-color: var(--sky); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  margin: 1rem 0;
}

.panel__title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem 0.85rem;
}

.field--grow { grid-column: 1 / -1; }

.field textarea,
.field select {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(135, 206, 235, 0.8);
  border-color: var(--sky);
}

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 7px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  border: 0;
}

.btn--primary {
  color: #fff;
  background: var(--navy);
}

.btn--primary:hover { background: var(--navy-soft); }

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

.btn--danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(139, 30, 63, 0.28);
}

.btn--small {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.28rem 0.55rem;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}

.view-toggle button {
  font: inherit;
  font-size: 0.88rem;
  padding: 0.4rem 0.85rem;
  border: 0;
  background: transparent;
  color: var(--navy-soft);
  cursor: pointer;
}

.view-toggle button.is-active {
  background: var(--navy);
  color: #fff;
}

.empty { margin: 0; }

.muted { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.is-overdue { color: var(--danger); font-weight: 600; font-size: 0.85rem; }

.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.task-table th,
.task-table td {
  text-align: left;
  padding: 0.65rem 0.45rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.task-table th {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.task-table__actions {
  white-space: nowrap;
  text-align: right;
}

.task-user-group + .task-user-group {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.task-user-group__title {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy-soft);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.task-item:last-child { border-bottom: 0; }

.task-item__main {
  flex: 1 1 14rem;
  min-width: 0;
}

.task-item__title {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 0.2rem;
}

.task-item__description {
  margin: 0.15rem 0 0.35rem;
  white-space: pre-wrap;
}

.task-item__meta { font-size: 0.82rem; }

.task-item__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
}

.task-item__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.status-quick {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
}

.status-quick__btn {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.28rem 0.65rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--navy-soft);
  cursor: pointer;
  white-space: nowrap;
}

.status-quick__btn:hover {
  background: rgba(20, 32, 74, 0.06);
}

.status-quick__btn.is-active {
  background: var(--navy);
  color: #fff;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 2rem;
}

.kanban-col {
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 0.7rem;
  min-height: 12rem;
}

.kanban-col.is-drop-target {
  border-color: var(--sky);
  background: rgba(135, 206, 235, 0.18);
}

.kanban-col h2 {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-col__count {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8rem;
}

.kanban-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 4rem;
}

.kanban-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.75rem;
  cursor: grab;
}

.kanban-card.is-dragging { opacity: 0.45; }

.kanban-card__actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  width: min(32rem, calc(100% - 2rem));
  background: var(--card);
  color: var(--ink);
}

.modal::backdrop { background: rgba(20, 32, 74, 0.35); }

.modal--picker {
  width: min(36rem, calc(100% - 2rem));
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.modal__head h2 {
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.75rem 0 0;
}

.field span {
  font-size: 0.85rem;
  color: var(--muted);
}

.field input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.field input:focus {
  outline: 2px solid rgba(0, 0, 128, 0.25);
  outline-offset: 1px;
}

.link-picker-list {
  display: flex;
  flex-direction: column;
  max-height: min(18rem, 50vh);
  overflow: auto;
  margin: 0.75rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(135, 206, 235, 0.08);
}

.link-picker-item {
  display: flex;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 0.65rem 0.8rem;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.link-picker-item:last-child {
  border-bottom: 0;
}

.link-picker-item:hover {
  background: rgba(0, 0, 128, 0.06);
}

.link-picker-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.link-picker-row .link-picker-item {
  flex: 1;
  border-bottom: 0;
}

.link-picker-row .btn {
  flex: 0 0 auto;
  margin: 0.35rem 0.45rem;
  align-self: center;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.file-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.file-upload {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.35rem 0 0.75rem;
  font-size: 0.9rem;
}

.breadcrumb a {
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb__sep { color: var(--muted); }

.is-hidden { display: none !important; }

.btn.is-active {
  background: rgba(0, 0, 128, 0.12);
  font-weight: 700;
}

#toggle-chat.is-active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  line-height: 0;
}

.btn--icon .btn__icon {
  display: block;
}

.btn__icon--bot {
  stroke-width: 1.65;
}

.files-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 3.5rem);
}

.files-layout.files-layout--assistant-open {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
}

.bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(0, 0, 128, 0.06);
  font-size: 0.9rem;
}

.file-table__check {
  width: 2.25rem;
  text-align: center;
}

.file-table__check input {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.file-row--selected {
  background: rgba(0, 0, 128, 0.06);
}

.file-row--previewing {
  background: rgba(0, 0, 128, 0.1);
}

.file-name-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--accent, #000080);
  cursor: pointer;
  text-align: left;
}

.file-name-btn:hover,
.file-name-btn:focus-visible {
  text-decoration: underline;
}

.file-name-btn--pdf::before {
  content: '📄 ';
  font-weight: 400;
}

.modal--pdf {
  width: min(92vw, 56rem);
  max-width: none;
  padding: 0;
  overflow: hidden;
  display: none;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
}

.modal--pdf[open] {
  display: flex;
  position: fixed;
  left: 50%;
  top: max(1rem, env(safe-area-inset-top));
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(92vw, 56rem);
  max-width: 56rem;
  height: auto;
  margin: 0;
}

.pdf-preview-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 80, 0.1);
  flex-shrink: 0;
}

.pdf-preview-dialog__head h2 {
  margin: 0;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.pdf-preview-dialog__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.pdf-zoom-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.1rem;
  background: rgba(255, 255, 255, 0.6);
}

.pdf-zoom-btn {
  min-width: 2rem;
  padding: 0.28rem 0.45rem;
  font-size: 1rem;
  line-height: 1;
}

.pdf-zoom-level {
  min-width: 3.25rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
}

.modal--pdf .file-preview-content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  background: rgba(0, 0, 80, 0.04);
}

.file-preview-loading {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem;
}

.file-preview-embed {
  display: block;
  width: 100%;
  height: calc(100vh - 8rem);
  min-height: 70vh;
  border: none;
  background: #fff;
}

.file-preview-fallback {
  margin: 0;
  padding: 0.5rem 0.75rem;
  text-align: center;
  border-top: 1px solid rgba(0, 0, 80, 0.08);
}

.pdf-viewer-scaler {
  transform-origin: top center;
}

.pdf-viewer-pages {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.5rem;
  min-height: min-content;
}

.pdf-viewer-page {
  display: flex;
  justify-content: center;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 80, 0.08);
  margin: 0 auto;
  max-width: 100%;
}

.pdf-viewer-page canvas {
  display: block;
  max-width: none;
  height: auto;
}

.files-main {
  min-width: 0;
}

.assistant-panel {
  border-left: 1px solid rgba(0, 0, 80, 0.12);
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 3.5rem);
  position: sticky;
  top: 3.5rem;
}

.assistant-panel.is-collapsed {
  display: none;
}

.assistant-panel__head {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 80, 0.1);
}

.assistant-panel__hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.assistant-msg {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.assistant-msg--user {
  background: rgba(0, 0, 128, 0.1);
  align-self: flex-end;
  max-width: 92%;
}

.assistant-msg--assistant {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 80, 0.08);
  align-self: flex-start;
  max-width: 100%;
}

.assistant-msg__author {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(0, 0, 80, 0.65);
  margin-bottom: 0.2rem;
}

.assistant-msg__body {
  white-space: pre-wrap;
}

.assistant-load-more {
  align-self: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.25rem 0;
}

.assistant-form {
  flex-shrink: 0;
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(0, 0, 80, 0.1);
}

.assistant-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 3rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 80, 0.2);
  padding: 0.55rem 0.65rem;
  font: inherit;
}

.assistant-status {
  flex-shrink: 0;
  margin: 0 1rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.1em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 1100px) {
  .files-layout.files-layout--assistant-open {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  }
}

@media (max-width: 720px) {
  .app-shell {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding:
      max(0.75rem, env(safe-area-inset-top))
      max(0.85rem, env(safe-area-inset-right))
      0.75rem
      max(0.85rem, env(safe-area-inset-left));
  }

  .app-shell__bar {
    width: 100%;
  }

  .app-shell__menu-btn {
    display: inline-flex;
  }

  .app-shell__nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.15rem;
    padding: 0.5rem 0 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 0.35rem;
  }

  .app-shell__nav.is-open {
    display: flex;
  }

  .app-shell__nav a {
    padding: 0.6rem 0.35rem;
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
  }

  .app-shell__nav a.is-active {
    border-left-color: var(--sky);
    background: rgba(255, 255, 255, 0.06);
  }

  .app-shell__logout {
    margin-left: 0;
    margin-top: 0.35rem;
    align-self: stretch;
    text-align: center;
    padding: 0.55rem 0.7rem;
  }

  .page {
    margin: 0.85rem auto;
    padding: 0 0.85rem 1.75rem;
  }

  .page--wide {
    max-width: none;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .page-head__actions {
    width: 100%;
    justify-content: stretch;
  }

  .page-head__actions .btn--primary {
    flex: 1;
  }

  .panel {
    padding: 0.85rem;
    margin: 0.75rem 0;
  }

  .file-toolbar {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .file-toolbar .btn:not(.btn--icon) {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
    justify-content: center;
    text-align: center;
  }

  .file-toolbar .file-upload {
    flex: 1 1 100%;
    justify-content: center;
  }

  .file-toolbar #toggle-chat {
    flex: 0 0 auto;
  }

  .files-main.page {
    max-width: none;
    margin: 0;
    padding: 0.75rem 0.85rem 1.25rem;
  }

  .bulk-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .bulk-toolbar .btn {
    width: 100%;
    justify-content: center;
  }

  .file-table--responsive thead {
    display: none;
  }

  .file-table--responsive tbody {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  .file-table--responsive tr {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.65rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
  }

  .file-table--responsive td {
    display: block;
    padding: 0;
    border: none;
    text-align: left;
  }

  .file-table--responsive .file-table__check {
    grid-row: 1;
    grid-column: 1;
    align-self: start;
    padding-top: 0.15rem;
  }

  .file-table--responsive td:first-child:not(.file-table__check) {
    grid-row: 1;
    grid-column: 1 / -1;
    min-width: 0;
    font-size: 0.95rem;
  }

  .file-table--responsive td:nth-child(2):not(.file-table__check):not(.task-table__actions) {
    grid-row: 1;
    grid-column: 2;
    min-width: 0;
    font-size: 0.95rem;
  }

  .file-table--responsive td:nth-child(3):not(.task-table__actions),
  .file-table--responsive td:nth-child(4):not(.task-table__actions) {
    grid-column: 1 / -1;
    font-size: 0.8rem;
    color: var(--muted);
  }

  .file-table--responsive .file-table__check ~ td:nth-child(3):not(.task-table__actions),
  .file-table--responsive .file-table__check ~ td:nth-child(4):not(.task-table__actions) {
    grid-column: 2;
  }

  .file-table--responsive td:nth-child(3)::after {
    content: ' · ';
  }

  .file-table--responsive td:nth-child(4):empty {
    display: none;
  }

  .file-table--responsive .task-table__actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
    white-space: normal;
    text-align: left;
  }

  .file-table--responsive .task-table__actions .btn {
    flex: 1 1 calc(50% - 0.2rem);
    min-width: 0;
    justify-content: center;
  }

  .task-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .task-item__aside {
    align-items: stretch;
    width: 100%;
  }

  .status-quick {
    justify-content: stretch;
    border-radius: 8px;
  }

  .status-quick__btn {
    flex: 1;
    text-align: center;
  }

  .task-item__actions {
    justify-content: stretch;
    width: 100%;
  }

  .task-item__actions .btn {
    flex: 1;
    justify-content: center;
  }

  .modal {
    width: calc(100vw - 1rem);
    max-width: none;
    max-height: calc(100vh - 1rem - env(safe-area-inset-top));
    margin: auto;
  }

  .modal__actions {
    flex-direction: column-reverse;
  }

  .modal__actions .btn {
    width: 100%;
  }

  .btn {
    min-height: 2.75rem;
  }

  .btn--small {
    min-height: 2.35rem;
    padding: 0.4rem 0.65rem;
  }

  .file-table__check input {
    width: 1.15rem;
    height: 1.15rem;
  }
}

@media (max-width: 800px) {
  .kanban { grid-template-columns: 1fr; }
  .files-layout {
    grid-template-columns: 1fr;
  }
  .modal--pdf[open] {
    left: max(0.35rem, env(safe-area-inset-left));
    right: max(0.35rem, env(safe-area-inset-right));
    top: max(0.35rem, env(safe-area-inset-top));
    bottom: max(0.35rem, env(safe-area-inset-bottom));
    transform: none;
    width: auto;
    max-width: none;
  }

  .pdf-preview-dialog__head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .pdf-preview-dialog__actions {
    justify-content: space-between;
  }

  .pdf-preview-dialog__actions .btn--small {
    min-height: 2.35rem;
  }

  #pdf-open-tab {
    flex: 1;
    text-align: center;
  }
  .assistant-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-height: min(70vh, calc(100vh - env(safe-area-inset-top) - 3rem));
    border-left: none;
    border-top: 1px solid rgba(0, 0, 80, 0.15);
    z-index: 40;
    background: #eef6fb;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .files-layout.files-layout--assistant-open {
    grid-template-columns: 1fr;
  }
}

.file-link-canonical {
  font-weight: normal;
  font-size: 0.85em;
  color: var(--muted, #666);
}

.breadcrumb--compact {
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

.modal__hint {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--muted, #666);
}

.modal__actions {
  margin-top: 0.75rem;
}

.references-list p {
  margin: 0.35rem 0;
}

