/* =============================================================
 * Психологическое тестирование — Админ-панель
 * Дизайн-токены:
 *   --bg:        #F6F9FA
 *   --surface:   #FFFFFF
 *   --primary:   #B8390B
 *   --primary-d: #8F2D0A
 *   --text:      #0F172A
 *   --muted:     #64748B
 *   --border:    #E2E8F0
 *   --radius:    14px
 * ============================================================ */

:root {
  --bg: #F6F9FA;
  --surface: #FFFFFF;
  --primary: #B8390B;
  --primary-d: #8F2D0A;
  --primary-accent: #E95C20;
  --primary-soft: #FFF1E8;
  --text: #0F172A;
  --muted: #475569;
  --border: #CBD5E1;
  --success: #166534;
  --success-soft: #DCFCE7;
  --warn: #92400E;
  --warn-soft: #FEF3C7;
  --danger: #B91C1C;
  --danger-soft: #FEE2E2;
  --focus-ring: rgba(233, 92, 32, 0.28);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.04);
  --font-stack: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

button, input, select { font: inherit; }

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ========== Top bar ========== */

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

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-text { min-width: 0; }

.brand-logo {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.topbar-meta {
  color: var(--muted);
  font-size: 12px;
}

.topbar-meta.is-ok { color: var(--success); }
.topbar-meta.is-err { color: var(--danger); }

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

/* ========== Tabs ========== */

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 0;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

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

.tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ========== Layout ========== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.panel { display: none; }
.panel.is-active:not([hidden]) { display: block; }
.panel[hidden] { display: none; }

.panel + .panel { margin-top: 16px; }

/* ========== Cards ========== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.card-kicker {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid #FED7AA;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-d);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.35px;
  line-height: 1.3;
  white-space: nowrap;
}

.card-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}

.card-subtitle {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.card-desc {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.card-heading .card-desc { max-width: 720px; }

.card-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ========== Buttons ========== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
  text-decoration: none;
  touch-action: manipulation;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn:focus-visible,
.tab:focus-visible,
.search-input:focus-visible,
.status-filter:focus-visible,
.form-control:focus-visible,
.security-input:focus-visible,
.field__input:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-d); border-color: var(--primary-d); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--primary-soft); }

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: #FECACA;
}

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

.btn-large {
  min-height: 48px;
  padding: 12px 22px;
  font-size: 14px;
}

.btn-small {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn.is-loading { cursor: progress; }

/* ========== Form controls ========== */

.search-input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  background: var(--surface);
  outline: none;
  font-family: inherit;
  min-width: 260px;
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(233, 92, 32, 0.15);
}

.file-input {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  background: var(--bg);
  flex: 1 1 auto;
  min-width: 280px;
  min-height: 48px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.file-input input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-input:focus-within {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.file-input.is-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.file-input.is-disabled {
  cursor: progress;
  opacity: 0.72;
}

.file-input-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-input-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.file-input-name {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* ========== Uploader ========== */

.uploader {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap;
}

.external-load-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.uploader > .btn {
  min-height: 44px;
  flex: 0 0 auto;
}

.upload-result {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
}

.upload-result b { font-weight: 650; }

.upload-result.is-ok {
  background: var(--success-soft);
  color: #14532D;
  border: 1px solid #BBF7D0;
}

.upload-result.is-warn {
  background: var(--warn-soft);
  color: #78350F;
  border: 1px solid #FDE68A;
}

.upload-result.is-err {
  background: var(--danger-soft);
  color: #7F1D1D;
  border: 1px solid #FECACA;
}

.upload-result ul {
  margin: 8px 0 0;
  padding-left: 18px;
  max-height: 180px;
  overflow: auto;
}

/* ========== Import format notes ========== */

.format-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.format-note {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.format-note h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 650;
}

.format-note p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.format-note code {
  display: block;
  overflow-x: auto;
  padding: 7px 8px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
}

.format-note .format-note__hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

/* ========== Direct applicant entry ========== */

.direct-entry-form { margin-top: 20px; }

.direct-entry-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.direct-entry-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.direct-entry-field--third { grid-column: span 4; }
.direct-entry-field--quarter { grid-column: span 3; }
.direct-entry-field--half { grid-column: span 6; }

.direct-entry-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.field-optional {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.required-mark { color: var(--primary-d); }

.form-control {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.form-control::placeholder { color: #64748B; }

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-control[aria-invalid="true"] {
  border-color: var(--danger);
  background: #FFF8F8;
}

.direct-entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}

.required-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.form-result {
  margin-top: 16px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.45;
}

.form-result.is-ok {
  border-color: #BBF7D0;
  background: var(--success-soft);
  color: #14532D;
}

.form-result.is-err {
  border-color: #FECACA;
  background: var(--danger-soft);
  color: #7F1D1D;
}

/* ========== Code block ========== */

.codeblock {
  background: #0F172A;
  color: #E2E8F0;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 12.5px;
  overflow-x: auto;
  margin: 0;
}

/* ========== Table ========== */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  background: var(--bg);
  text-align: left;
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table tbody tr:nth-child(even) td {
  background: var(--bg);
}

.data-table tbody tr:hover td {
  background: var(--primary-soft);
}

.data-table .status-filter-row th {
  padding: 8px 10px;
  background: var(--surface);
  vertical-align: top;
  text-transform: none;
  letter-spacing: 0;
}

.filter-label {
  display: block;
  min-width: 0;
}

.status-filter {
  display: block;
  width: 100%;
  min-width: 120px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.status-filter::placeholder { color: #64748B; }

.status-filter:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.action-header {
  width: 1%;
  min-width: 112px;
  white-space: nowrap;
}

.action-cell {
  width: 1%;
  white-space: nowrap;
}

.action-cell .btn { min-width: 82px; }

.cell-center { text-align: center; }

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px !important;
}

.table-hint {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  background: var(--bg);
  font-size: 12px;
}

.inline-feedback {
  margin: -4px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
}

.inline-feedback.is-err {
  border-color: #FECACA;
  background: var(--danger-soft);
  color: #7F1D1D;
}

.inline-feedback.is-ok {
  border-color: #BBF7D0;
  background: var(--success-soft);
  color: #14532D;
}

.muted-action {
  color: var(--muted);
  font-size: 12px;
}

/* ========== Status badges ========== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-empty { background: #F1F5F9; color: var(--muted); }
.badge-progress { background: var(--warn-soft); color: var(--warn); }
.badge-done { background: var(--success-soft); color: var(--success); }

.legend {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ========== Export ========== */

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

.export-meta {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.export-meta.is-ok { color: var(--success); }
.export-meta.is-err { color: var(--danger); }

/* ========== Footer ========== */

.footer {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ========== Toast ========== */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 20;
  max-width: 360px;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-err { background: var(--danger); }
.toast.is-ok { background: var(--success); }

/* ========== Security tab ========== */

.security-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 13px;
}

.security-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.12);
  transition: background 0.15s, box-shadow 0.15s;
}

.security-dot.is-on {
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.security-dot.is-off {
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.security-label {
  font-weight: 500;
  color: var(--text);
}

.security-label.is-on { color: var(--success); }
.security-label.is-off { color: var(--danger); }

.security-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.security-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 320px;
  min-width: 280px;
}

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

.security-input {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  letter-spacing: 0.5px;
}

.security-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(233, 92, 32, 0.15);
}

.security-result {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
}

.security-result.is-ok {
  background: var(--success-soft);
  color: #14532D;
  border: 1px solid #BBF7D0;
}

.security-result.is-err {
  background: var(--danger-soft);
  color: #7F1D1D;
  border: 1px solid #FECACA;
}

.security-warning {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--warn-soft);
  border: 1px solid #FDE68A;
  color: #78350F;
  font-size: 13px;
  line-height: 1.5;
}

.security-warning code {
  background: rgba(15, 23, 42, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ========== Admin login ========== */

.admin-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  padding: 24px;
}

.admin-login-overlay:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: admin-login-fade-in 0.2s ease-out;
}

@keyframes admin-login-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.admin-login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.06),
    0 20px 48px rgba(15, 23, 42, 0.08);
  padding: 32px;
  animation: admin-login-card-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes admin-login-card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.admin-login-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.admin-login-subtitle {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--muted);
}

.admin-login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-login-error {
  background: var(--danger-soft);
  color: #7F1D1D;
  border: 1px solid #FECACA;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.4;
}

.admin-login-btn {
  width: 100%;
  padding: 11px 18px;
  font-size: 14px;
  margin-top: 4px;
}

/* ========== Field (shared form input) ========== */

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

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.field__input {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  letter-spacing: 0.5px;
  width: 100%;
}

.field__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(233, 92, 32, 0.15);
}

.field--shake {
  animation: field-shake 0.4s ease-in-out;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 200;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--text);
  color: white;
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.15s ease-out;
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid var(--primary-accent);
  outline-offset: 2px;
}

@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@media (max-width: 900px) {
  .direct-entry-field--third,
  .direct-entry-field--half { grid-column: span 6; }

  .direct-entry-field--quarter { grid-column: span 6; }
}

@media (max-width: 720px) {
  .topbar-inner { padding: 12px 16px; flex-wrap: wrap; gap: 8px 12px; }
  .brand { flex: 1 1 auto; }
  .tabs { order: 3; flex: 1 1 100%; padding: 0; }
  .container { padding: 16px; }
  .card { padding: 18px; }
  .card-heading { flex-direction: column; gap: 8px; }
  .card-kicker { align-self: flex-start; }
  .card-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-actions { width: 100%; flex-wrap: wrap; }
  .toolbar-actions .btn { flex: 1 1 auto; }
  .search-input { flex: 1; min-width: 0; }
  .format-notes { grid-template-columns: 1fr; }
  .file-input { width: 100%; min-width: 0; }
  .file-input-content { width: 100%; }
  .file-input-name { flex: 1; }
  .uploader > .btn { width: 100%; }
  .direct-entry-grid { grid-template-columns: 1fr; }
  .direct-entry-field--third,
  .direct-entry-field--quarter,
  .direct-entry-field--half { grid-column: auto; }
  .direct-entry-footer { align-items: stretch; flex-direction: column; }
  .direct-entry-footer .btn { width: 100%; }
  .security-form { flex-direction: column; align-items: stretch; }
  .security-form .btn { width: 100%; }
  .table-hint { display: block; }
  .data-table thead th,
  .data-table tbody td { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 480px) {
  .topbar-actions {
    width: 100%;
    margin-left: 0;
  }

  .topbar-actions .btn { width: 100%; }
  .card { padding: 16px; }
  .export-actions .btn { width: 100%; }
}

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