:root {
  color-scheme: light dark;
  --bg: #f3f3ef;
  --surface: #ffffff;
  --surface-2: #f8f8f4;
  --ink: #191a18;
  --muted: #686b64;
  --line: #dedfd7;
  --line-strong: #85877e;
  --accent: #2c5b4c;
  --accent-hover: #244b3f;
  --accent-soft: #e8f0ec;
  --accent-ink: #ffffff;
  --danger: #9b342e;
  --danger-hover: #7f2924;
  --danger-solid: #9b342e;
  --danger-solid-hover: #7f2924;
  --danger-ink: #ffffff;
  --danger-soft: #fbefed;
  --warning: #7a5b1c;
  --warning-soft: #faf2df;
  --shadow: 0 18px 50px rgba(18, 24, 20, 0.16);
  --radius: 10px;
  --radius-lg: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141513;
    --surface: #1c1e1b;
    --surface-2: #232621;
    --ink: #eceee8;
    --muted: #a3a79e;
    --line: #30342d;
    --line-strong: #6f7569;
    --accent: #7fb59c;
    --accent-hover: #94c5af;
    --accent-soft: #24352d;
    --accent-ink: #101713;
    --danger: #e28a82;
    --danger-hover: #eda39c;
    --danger-solid: #8f3a34;
    --danger-solid-hover: #a3463f;
    --danger-ink: #ffffff;
    --danger-soft: #32211f;
    --warning: #dfbd76;
    --warning-soft: #302818;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Кнопки и поля */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
}

.btn-quiet:hover {
  background: var(--surface-2);
}

.btn-danger {
  border-color: var(--line-strong);
  color: var(--danger);
}

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

.btn-danger-solid {
  border-color: var(--danger-solid);
  background: var(--danger-solid);
  color: var(--danger-ink);
}

.btn-danger-solid:hover {
  border-color: var(--danger-solid-hover);
  background: var(--danger-solid-hover);
}

.btn-small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.field input,
.field select,
.search input {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
}

.field input:focus,
.field select:focus,
.search input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.field input::placeholder,
.search input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field input[type="file"] {
  height: auto;
  padding: 8px;
  background: var(--surface-2);
  font-size: 14px;
}

.field-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--danger-soft);
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

/* Шапка */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  height: calc(56px + env(safe-area-inset-top));
  margin: 0 auto;
  padding: env(safe-area-inset-top) 20px 0;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
}

.brand-logo-lg {
  width: 52px;
  height: 52px;
  border-radius: 12px;
}

.brand-logo-sm {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

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

.account {
  position: relative;
}

.account-button {
  max-width: 190px;
}

.account-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caret {
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.menu-item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item-danger {
  color: var(--danger);
}

.menu-admin {
  display: none;
}

/* Каркас */

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 36px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 72px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.shell-admin {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1000px;
}

.sidebar {
  position: sticky;
  top: calc(84px + env(safe-area-inset-top));
  align-self: start;
  max-height: calc(100vh - 110px - env(safe-area-inset-top));
  max-height: calc(100dvh - 110px - env(safe-area-inset-top));
  overflow: auto;
  padding-right: 4px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 8px;
}

.sidebar-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.folder-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 9px;
  border-radius: 7px;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.tree-item:hover {
  background: var(--surface-2);
}

.tree-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.tree-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.tree-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 13px;
  padding-left: 7px;
  border-left: 1px solid var(--line);
}

.sidebar-empty {
  padding: 8px 9px;
  color: var(--muted);
  font-size: 13px;
}

/* Контент */

.content {
  min-width: 0;
}

.catalog[aria-busy="true"] {
  opacity: 0.6;
  cursor: progress;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--line-strong);
}

.breadcrumb-current {
  color: var(--ink);
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.view-title {
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.view-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.breadcrumbs {
  overflow-wrap: anywhere;
}

.dialog-subtitle,
#confirm-message {
  overflow-wrap: anywhere;
}

.view-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search {
  position: relative;
  width: 220px;
  max-width: 100%;
}

.search input {
  min-height: 38px;
  padding-left: 33px;
  font-size: 14px;
}

.search::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 12px;
  width: 11px;
  height: 11px;
  margin-top: -7px;
  border: 1.6px solid var(--muted);
  border-radius: 50%;
  pointer-events: none;
}

.search::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 22px;
  width: 5px;
  height: 1.6px;
  margin-top: 3px;
  background: var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.folder-jump {
  display: none;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}

.section-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 26px;
}

.folder-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.folder-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 11px 13px;
  color: var(--ink);
  text-decoration: none;
}

.folder-card-main:hover {
  background: var(--surface-2);
}

.folder-mark {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 23px;
  margin-top: 4px;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
}

.folder-mark::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -1.5px;
  width: 13px;
  height: 5px;
  border: 1.5px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: var(--surface);
}

.folder-card-text {
  min-width: 0;
}

.folder-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 550;
}

.folder-count {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.folder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 8px 8px;
}

.folder-actions .btn {
  flex: 1 1 auto;
}

.report-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.report-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.report-row:last-child {
  border-bottom: 0;
}

.report-row:hover {
  background: var(--surface-2);
}

.report-link {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.report-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 550;
}

.report-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.report-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.report-edit {
  flex: 0 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-muted {
  background: var(--surface-2);
  color: var(--muted);
}

.no-script {
  margin: 40px;
}

.empty {
  padding: 44px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-title {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 550;
}

.empty p {
  font-size: 13.5px;
}

.loading-block {
  padding: 44px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

/* Администрирование */

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 10px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.admin-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.user-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.user-row:last-child {
  border-bottom: 0;
}

.user-main {
  flex: 1 1 190px;
  min-width: 0;
}

.user-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 550;
}

.user-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.select-compact {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}

.log-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.log-row {
  display: flex;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.log-row:last-child {
  border-bottom: 0;
}

.log-time {
  flex: 0 0 150px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.log-body {
  min-width: 0;
}

.log-event {
  font-weight: 550;
}

.log-details {
  margin-top: 2px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Диалоги */

dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: auto;
}

dialog::backdrop {
  background: rgba(14, 19, 15, 0.45);
}

.dialog-form {
  padding: 22px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.dialog-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.dialog-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.dialog-actions .btn-danger {
  margin-right: auto;
}

.dialog-error {
  margin-top: 14px;
}

.dialog-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

progress {
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: var(--line);
}

progress::-webkit-progress-value {
  background: var(--accent);
}

progress::-moz-progress-bar {
  background: var(--accent);
}

.file-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
}

/* Вход */

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 372px;
  padding: 34px 30px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  font-size: 17px;
  font-weight: 650;
}

.auth-title {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin-top: 5px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
}

.auth-footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Просмотр отчёта */

.viewer-page {
  --viewer-bar: 54px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  overflow: hidden;
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--viewer-bar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0
    max(12px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.viewer-logo {
  display: inline-flex;
  flex: 0 0 auto;
  text-decoration: none;
}

.viewer-bar .btn {
  min-height: 34px;
  padding: 0 10px;
}

.viewer-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14.5px;
  font-weight: 550;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.viewer-main {
  position: relative;
  height: calc(100vh - var(--viewer-bar) - env(safe-area-inset-top));
  height: calc(100dvh - var(--viewer-bar) - env(safe-area-inset-top));
}

.report-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.viewer-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.viewer-error {
  position: fixed;
  inset: calc(var(--viewer-bar) + env(safe-area-inset-top)) 0 0;
  z-index: 5;
  padding: 18vh 20px 20px;
  background: var(--surface);
  text-align: center;
  overflow: auto;
}

.viewer-error h1 {
  font-size: 20px;
  font-weight: 650;
}

.viewer-error p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 14px;
}

/* Уведомление */

.toast {
  position: fixed;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 20px;
  z-index: 50;
  width: fit-content;
  max-width: min(420px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--ink);
  color: var(--surface);
  font-size: 13.5px;
  box-shadow: var(--shadow);
}

.toast-error {
  background: var(--danger-solid);
  border-color: var(--danger-solid);
  color: var(--danger-ink);
}

.boot {
  display: grid;
  place-items: center;
  min-height: 60vh;
  color: var(--muted);
  font-size: 14px;
}

/* Адаптивность */

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-top: 20px;
  }

  .sidebar {
    display: none;
  }

  .folder-jump {
    display: block;
    flex: 1 1 220px;
    width: 100%;
    font-size: 16px;
  }

  .view-title {
    font-size: 22px;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    height: calc(52px + env(safe-area-inset-top));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .topbar-actions {
    gap: 2px;
  }

  #admin-link {
    display: none;
  }

  .menu-admin {
    display: block;
  }

  .topbar-actions .btn {
    min-height: 38px;
    padding: 0 9px;
    font-size: 13px;
  }

  .btn-small {
    min-height: 40px;
  }

  .dialog-close {
    width: 40px;
    height: 40px;
  }

  .select-compact {
    min-height: 40px;
    font-size: 16px;
  }

  .account-button {
    max-width: 120px;
  }

  .shell {
    padding: 18px 14px 64px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .view-head {
    align-items: flex-start;
    gap: 14px;
  }

  .view-tools {
    width: 100%;
  }

  .search {
    flex: 1 1 100%;
    width: 100%;
  }

  .folder-jump {
    display: block;
    flex: 1 1 100%;
    width: 100%;
    font-size: 16px;
  }

  .field input,
  .field select,
  .search input {
    font-size: 16px;
  }

  .folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .report-row {
    padding: 10px 12px;
    gap: 8px;
  }

  .report-title {
    font-size: 14.5px;
  }

  .report-edit {
    padding: 0 8px;
    font-size: 12px;
  }

  dialog {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    margin: 0;
    border-radius: 16px 16px 0 0;
  }

  .dialog-form {
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }

  .dialog-actions {
    flex-wrap: wrap;
  }

  .dialog-actions .btn {
    flex: 1;
  }

  .dialog-actions .btn-danger {
    flex: 0 0 100%;
    margin-right: 0;
    order: 10;
  }

  .auth-card {
    padding: 28px 22px 24px;
  }

  .auth-page {
    padding: 16px;
    align-items: start;
    padding-top: max(10vh, env(safe-area-inset-top));
  }

  .user-row {
    align-items: flex-start;
  }

  .user-controls {
    width: 100%;
  }

  .log-row {
    flex-direction: column;
    gap: 3px;
  }

  .log-time {
    flex-basis: auto;
  }

  .viewer-page {
    --viewer-bar: 50px;
  }

  .viewer-bar {
    gap: 6px;
  }

  .viewer-actions .btn {
    min-height: 38px;
    padding: 0 8px;
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
