:root {
  --accent: #2563eb;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --line: #dce3ef;
  --tactical: #0f172a;
  --tactical-soft: #162033;
  --chip: rgba(15, 23, 42, 0.06);
  --shadow: 0 18px 55px rgba(25, 35, 60, 0.12);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0)),
    var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: calc(100% - 64px);
  margin: 0 auto;
  padding: 42px 0 28px;
}

.board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.04;
}

h2 {
  font-size: 1.45rem;
}

.subtitle {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14);
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 320px));
  gap: 18px;
  align-items: start;
  justify-content: start;
}

.board-tools {
  display: grid;
  gap: 12px;
  margin: 0 0 24px;
}

.search-box {
  max-width: 680px;
}

.tag-filters,
.tag-row,
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-groups {
  display: grid;
  gap: 10px;
}

.filter-group {
  display: grid;
  gap: 7px;
}

.filter-group > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.filter-chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.filter-chip.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 90%);
  color: var(--accent);
}

.note-card {
  position: relative;
  min-height: 220px;
  display: block;
  width: 100%;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.note-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--note-color, var(--accent)), var(--line) 52%);
  box-shadow: 0 22px 70px rgba(25, 35, 60, 0.16);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-screen[hidden],
#adminApp[hidden] {
  display: none;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 2.35rem;
}

.muted-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.quick-user-list,
.suggestion-row,
.attachment-tag-row,
.list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-pill,
.suggestion-chip,
.mini-chip {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.mini-chip.active,
.suggestion-chip.active,
.suggestion-chip:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 88%);
  color: var(--accent);
}

.user-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 800;
}

.note-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--note-color, var(--accent));
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.note-meta:empty {
  display: none;
}

.tag {
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.tactical-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.tactical-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--note-color, var(--accent)), transparent 90%);
  color: color-mix(in srgb, var(--note-color, var(--accent)), #0f172a 24%);
  font-size: 0.76rem;
  font-weight: 900;
}

.tactical-pill.muted {
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
}

.pin {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
}

.note-card h3 {
  margin: 0 0 12px;
  font-size: 1.18rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.note-body {
  margin: 0;
  color: #334155;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-card .note-body {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.card-media {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 16px;
}

.media-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
}

.media-tile:first-child:nth-last-child(1),
.media-tile:first-child:nth-last-child(2),
.media-tile:first-child:nth-last-child(3) {
  grid-column: span 2;
}

.media-tile img,
.media-tile video,
.media-tile .video-poster-placeholder,
.attachment-preview img,
.attachment-preview video,
.attachment-preview .video-poster-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-poster-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.18), rgba(37, 99, 235, 0.12)),
    #dbe3ee;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 900;
}

.play-badge,
.media-more {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.note-time {
  margin-top: 18px;
  color: #94a3b8;
  font-size: 0.78rem;
}

.empty-state {
  padding: 56px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
  color: var(--muted);
}

.empty-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(34, 197, 94, 0.12));
}

.site-footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.88rem;
}

.modal-open {
  overflow: hidden;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
}

.modal-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  width: min(1180px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.36);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
}

.modal-panel.text-only {
  grid-template-columns: 1fr;
  width: min(760px, 100%);
}

.modal-panel.text-only .modal-media {
  display: none;
}

.modal-panel.text-only .modal-close {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--text);
}

.modal-media {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 420px;
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  padding: 18px;
  background: var(--tactical);
}

.modal-stage {
  position: relative;
  display: grid;
  align-items: center;
  justify-items: center;
  min-height: 0;
  min-width: 0;
}

.modal-media-item {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  min-width: 0;
}

.modal-media-item video {
  display: block;
  width: 100%;
  max-height: 66vh;
  object-fit: contain;
  border-radius: 8px;
  background: #020617;
}

.zoom-viewport {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #020617;
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
}

.zoom-viewport.is-zoomed {
  cursor: grab;
}

.zoom-viewport.dragging,
.zoom-viewport.pinching {
  cursor: grabbing;
}

.zoom-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(66vh, 620px);
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.16s ease;
  will-change: transform;
  pointer-events: none;
  user-select: none;
}

.zoom-viewport.wide-media .zoom-image {
  width: 100%;
  max-height: none;
}

.zoom-viewport.tall-media .zoom-image {
  width: auto;
  max-height: min(66vh, 620px);
}

.zoom-viewport.dragging .zoom-image,
.zoom-viewport.pinching .zoom-image {
  transition: none;
}

.modal-media-item figcaption {
  display: grid;
  justify-self: stretch;
  gap: 5px;
  width: 100%;
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 0.82rem;
  line-height: 1.5;
}

.modal-media-item figcaption strong {
  color: #fff;
  font-size: 0.92rem;
}

.media-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 42px;
  height: 48px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.68);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
}

.media-nav.prev {
  left: 12px;
}

.media-nav.next {
  right: 12px;
}

.media-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.media-thumb {
  position: relative;
  flex: 0 0 76px;
  height: 52px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #1e293b;
}

.media-thumb.active {
  border-color: #fff;
}

.media-thumb img,
.media-thumb video,
.media-thumb .video-poster-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-thumb span {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.76);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
}

.media-hint {
  color: #94a3b8;
  font-size: 0.8rem;
  line-height: 1.5;
}

.modal-media-empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: #cbd5e1;
  border: 1px dashed rgba(203, 213, 225, 0.45);
  border-radius: 8px;
}

.modal-content {
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  padding: 28px;
}

.modal-content h2 {
  margin-top: 18px;
  font-size: 1.75rem;
}

.modal-body {
  margin: 16px 0 0;
  color: #334155;
  line-height: 1.78;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  width: calc(100% - 64px);
  margin: 0 auto;
  padding: 24px 0;
}

.admin-menu,
.admin-workspace,
.settings-panel,
.editor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.admin-menu,
.settings-panel {
  align-self: start;
  padding: 22px;
}

.admin-workspace,
.editor-panel {
  min-width: 0;
  padding: 22px;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-nav-btn {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  text-align: left;
}

.admin-nav-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 90%);
  color: var(--accent);
}

.admin-view {
  display: none;
}

.admin-view.active {
  display: block;
}

.settings-form {
  max-width: 560px;
}

.panel-title,
.editor-head {
  margin-bottom: 18px;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stack-form,
.note-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 84%);
}

.tag-editor-label {
  align-content: start;
}

.tag-sections {
  display: grid;
  gap: 14px;
}

.tag-section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.tag-section > div:first-child,
.tag-section > label > span {
  color: var(--text);
  font-weight: 900;
}

.tag-section small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.tag-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tag-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 84%);
}

.tag-editor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-edit-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent), transparent 88%);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
}

.tag-edit-chip span {
  font-size: 1rem;
  line-height: 1;
}

#tagInput {
  flex: 1 1 180px;
  width: auto;
  min-width: 160px;
  min-height: 28px;
  border: 0;
  padding: 2px;
  box-shadow: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr minmax(150px, 220px);
  gap: 14px;
}

.form-row.single {
  grid-template-columns: 1fr;
}

.form-row.compact {
  grid-template-columns: minmax(150px, 220px) auto;
  align-items: end;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.upload-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.upload-panel.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 94%);
}

.upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.upload-head div {
  display: grid;
  gap: 4px;
}

.upload-head .upload-actions {
  display: flex;
}

.upload-head span {
  color: var(--muted);
  font-size: 0.86rem;
}

.drop-hint {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.upload-panel.dragover .drop-hint {
  border-color: var(--accent);
  color: var(--accent);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.upload-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.attachment-list {
  display: grid;
  gap: 10px;
}

.attachment-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.attachment-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 76px;
  gap: 12px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.attachment-actions {
  display: grid;
  gap: 7px;
}

.attachment-preview {
  width: 112px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 8px;
  background: #e2e8f0;
}

.attachment-fields {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.attachment-fields label {
  gap: 5px;
  font-size: 0.78rem;
}

.attachment-fields input,
.attachment-fields textarea {
  min-height: 36px;
  padding: 8px 10px;
}

.attachment-fields textarea {
  min-height: 64px;
}

.attachment-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.danger-btn,
.ghost-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
}

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

.danger-btn {
  color: #b91c1c;
  background: #fff;
  border-color: #fecaca;
}

.ghost-btn {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.ghost-btn.mini {
  min-height: 34px;
  padding: 0 10px;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.list-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.list-filters label:first-child {
  grid-column: span 2;
}

.admin-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-width: 0;
}

.admin-item > div {
  min-width: 0;
}

.admin-item h3,
.admin-item p {
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .admin-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    width: calc(100% - 32px);
  }

  .list-filters label:first-child {
    grid-column: 1 / -1;
  }
}

.color-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--note-color, var(--accent));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.admin-item h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.admin-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.library-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
}

.library-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.library-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.library-meta {
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.compact-empty {
  padding: 22px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%);
}

.blue {
  --note-color: #2563eb;
}

.green {
  --note-color: #16a34a;
}

.amber {
  --note-color: #d97706;
}

.rose {
  --note-color: #e11d48;
}

.slate {
  --note-color: #475569;
}

@media (max-width: 820px) {
  .board-head,
  .editor-head,
  .upload-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-shell,
  .form-row,
  .form-row.compact,
  .list-filters,
  .modal-panel {
    grid-template-columns: 1fr;
  }

  .note-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .modal {
    align-items: stretch;
    justify-items: stretch;
    padding: 0;
  }

  .modal-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    overflow: hidden;
  }

  .modal-media {
    flex: 0 0 auto;
    gap: 8px;
    min-height: 0;
    max-height: 58dvh;
    overflow: auto;
    padding: 12px 12px 10px;
  }

  .modal-stage {
    min-height: 0;
  }

  .modal-media-item {
    gap: 6px;
  }

  .modal-media-item video {
    max-height: 42dvh;
  }

  .zoom-viewport {
    height: auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
  }

  .zoom-image {
    max-height: 42dvh;
  }

  .zoom-viewport.wide-media .zoom-image {
    width: 100%;
    max-height: none;
  }

  .zoom-viewport.tall-media .zoom-image {
    width: auto;
    max-height: 42dvh;
  }

  .modal-content {
    flex: 1 1 auto;
    max-height: none;
    overflow: auto;
    padding: 20px 18px 34px;
  }

  .modal-content h2 {
    margin-top: 14px;
    font-size: 1.55rem;
    line-height: 1.24;
  }

  .modal-close {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    z-index: 4;
  }

  .media-nav {
    width: 38px;
    height: 44px;
    font-size: 1.7rem;
  }

  .media-nav.prev {
    left: 6px;
  }

  .media-nav.next {
    right: 6px;
  }

  .media-thumbs {
    gap: 7px;
    padding-bottom: 2px;
  }

  .media-thumb {
    flex-basis: 74px;
    height: 52px;
  }

  .modal-media-item figcaption {
    margin-top: 4px;
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .modal-media-item figcaption strong {
    font-size: 0.88rem;
  }

  .media-hint {
    display: none;
  }

  .attachment-item {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .attachment-preview {
    width: 84px;
  }

  .attachment-item .ghost-btn {
    grid-column: auto;
  }

  .attachment-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }

  .page-shell,
  .admin-shell {
    width: calc(100% - 20px);
    max-width: 720px;
  }

  .page-shell {
    padding-top: 22px;
  }

  .status-chip {
    align-self: flex-start;
  }

  .tag-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .tag-filters::-webkit-scrollbar {
    display: none;
  }

  .filter-chip {
    flex: 0 0 auto;
  }

  .note-card {
    min-height: 190px;
    padding: 12px;
  }

  .note-card h3 {
    font-size: 1rem;
    line-height: 1.28;
  }

  .note-body {
    font-size: 0.9rem;
  }

  .tactical-line,
  .tag-row {
    gap: 5px;
  }

  .tactical-pill,
  .tag {
    min-height: 24px;
    padding: 3px 7px;
    font-size: 0.72rem;
  }

  .note-card:hover {
    transform: none;
  }

  .admin-menu,
  .admin-workspace {
    padding: 16px;
  }

  .library-item {
    grid-template-columns: 1fr;
  }

  .upload-actions {
    justify-content: stretch;
  }

  h1 {
    font-size: 2.25rem;
  }
}
