:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-subtle: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #111827;
  --text-soft: #374151;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
  --focus: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="file"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.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;
}

.hidden,
[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  backdrop-filter: blur(12px);
}

.app-header__inner,
.nav-tabs__inner,
.app-main {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}

.app-header__inner {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 28px;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.2);
}

.brand-mark svg,
.selected-file-card__icon svg,
.nav-tab svg,
.btn-icon,
.input-with-icon svg,
.icon-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.app-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.app-subtitle {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tabs {
  border-top: 1px solid #f1f5f9;
}

.nav-tabs__inner {
  display: flex;
  gap: 28px;
  overflow-x: auto;
  padding: 0 28px;
  scrollbar-width: none;
}

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

.nav-tab {
  position: relative;
  display: inline-flex;
  min-height: 48px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
  transition: color 160ms ease;
}

.nav-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
  content: "";
  opacity: 0;
  transform: scaleX(0.7);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.nav-tab.active {
  color: var(--primary);
}

.nav-tab.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-tab svg {
  width: 18px;
  height: 18px;
}

.app-main {
  padding: 28px;
}

.page {
  display: none;
}

.page.active {
  display: grid;
  gap: 20px;
  animation: page-in 180ms ease-out;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.page-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 32px;
  padding: 26px 28px;
}

.page-header__copy {
  align-self: center;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.page-header h1,
.section-heading h2,
.table-card__header h2,
.modal-header h2 {
  margin: 0;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.page-header h1 {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 760;
}

.page-header p,
.section-heading p,
.table-card__header p,
.modal-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.page-header p {
  max-width: 600px;
  font-size: 14px;
}

.stats-grid {
  display: grid;
  min-width: min(100%, 480px);
  grid-template-columns: repeat(3, minmax(128px, 1fr));
  gap: 10px;
}

.stat-card {
  display: flex;
  min-height: 82px;
  flex-direction: column;
  justify-content: center;
  padding: 14px 16px;
  border: 1px solid #e7edf5;
  border-radius: var(--radius);
  background: var(--panel-subtle);
}

.stat-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.stat-value {
  color: var(--text);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.toolbar-card,
.file-controls-card {
  padding: 20px;
}

.section-heading,
.table-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2,
.table-card__header h2,
.modal-header h2 {
  font-size: 16px;
  font-weight: 730;
}

.section-heading p,
.table-card__header p,
.modal-header p {
  font-size: 13px;
}

.compact-heading {
  margin-bottom: 16px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
}

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

.field-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.form-control,
.file-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--panel);
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.form-control {
  padding: 9px 12px;
}

select.form-control {
  padding-right: 34px;
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:hover:not(:disabled),
.file-input:hover:not(:disabled) {
  border-color: #94a3b8;
}

.form-control:focus,
.file-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus);
}

.form-control:disabled,
.file-input:disabled {
  cursor: not-allowed;
  background: #f8fafc;
  color: #94a3b8;
}

.input-with-icon {
  position: relative;
  display: block;
}

.input-with-icon svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
  transform: translateY(-50%);
}

.input-with-icon .form-control {
  padding-left: 40px;
}

.search-field {
  max-width: 560px;
}

.page-size-field {
  width: 124px;
}

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

.btn,
.icon-btn,
.text-btn {
  border: 0;
  background: none;
}

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 680;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.btn-secondary {
  border-color: var(--border-strong);
  background: var(--panel);
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  border-color: #94a3b8;
  background: var(--panel-subtle);
  color: var(--text);
}

.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
}

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

.btn-compact {
  min-height: 38px;
  padding: 8px 12px;
}

.btn-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.btn.is-loading .btn-icon {
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin 700ms linear infinite;
  fill: none;
  stroke: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.table-card {
  overflow: hidden;
}

.table-card__header {
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.table-status {
  min-height: 20px;
}

.table-status.error-text {
  color: var(--danger);
}

.sort-help {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.table-wrapper {
  width: 100%;
  min-height: 240px;
  max-height: min(62vh, 720px);
  overflow: auto;
  background: var(--panel);
  overscroll-behavior: contain;
}

.data-table {
  width: max-content;
  min-width: 100%;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  font-size: 13px;
}

.data-table th,
.data-table td {
  height: 48px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 126px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 20px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 20px;
}

.data-table tbody td {
  max-width: 300px;
  overflow: hidden;
  color: var(--text-soft);
  text-overflow: ellipsis;
}

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

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

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

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 140ms ease, color 140ms ease;
}

.data-table th.sortable:hover,
.data-table th.sortable:focus-visible {
  background: #eff4fa;
  color: var(--text);
}

.data-table th.sorted-asc,
.data-table th.sorted-desc {
  background: #eef5ff;
  color: var(--primary-hover);
}

.th-content {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sort-indicator {
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 5px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1;
}

.sorted-asc .sort-indicator,
.sorted-desc .sort-indicator {
  background: #dbeafe;
  color: var(--primary-hover);
}

.state-row td {
  height: 238px;
  padding: 36px 20px !important;
  border: 0;
  background: var(--panel) !important;
  text-align: center;
  white-space: normal;
}

.table-state {
  display: flex;
  max-width: 420px;
  margin: 0 auto;
  flex-direction: column;
  align-items: center;
  color: var(--muted);
}

.state-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 11px;
  place-items: center;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 20px;
  font-weight: 700;
}

.table-state strong {
  margin-bottom: 3px;
  color: var(--text-soft);
  font-size: 14px;
}

.table-state p {
  margin: 0;
  font-size: 13px;
}

.table-state.error .state-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.loading-dots::after {
  display: inline-block;
  width: 1.4em;
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

.table-footer {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: #fcfdff;
}

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

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.pagination-btn {
  min-height: 38px;
  padding: 8px 12px;
}

.page-indicator {
  min-width: 92px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  white-space: nowrap;
}

.page-header--files {
  align-items: center;
}

.selected-file-card {
  display: flex;
  width: min(100%, 330px);
  min-width: 250px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  background: var(--primary-soft);
}

.selected-file-card__icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 9px;
  background: #dbeafe;
  color: var(--primary-hover);
}

.selected-file-card__icon svg {
  width: 21px;
  height: 21px;
}

.selected-file-card strong {
  display: block;
  max-width: 240px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-controls-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(430px, 1.2fr);
  align-items: end;
  gap: 18px;
}

.upload-form {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.file-input {
  padding: 5px;
  color: var(--muted);
  font-size: 12px;
}

.file-input::file-selector-button {
  height: 30px;
  margin-right: 10px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: #eef2f7;
  color: var(--text-soft);
  font: inherit;
  font-weight: 650;
}

.status-message {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}

.status-message::before {
  display: grid;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  place-items: center;
  border-radius: 999px;
  content: "i";
  font-size: 11px;
  font-weight: 800;
}

.status-message.success {
  border-color: #bbf7d0;
  background: var(--success-soft);
  color: #166534;
}

.status-message.success::before {
  background: #dcfce7;
  content: "✓";
}

.status-message.error {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: #991b1b;
}

.status-message.error::before {
  background: #fee2e2;
  content: "!";
}

.status-message.info {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: #1e40af;
}

.status-message.info::before {
  background: #dbeafe;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(15, 23, 42, 0.52);
  cursor: default;
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  animation: modal-in 160ms ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
}

.icon-btn {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background-color 140ms ease, color 140ms ease;
}

.icon-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.column-selector__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 13px 24px;
  border-bottom: 1px solid var(--border);
  background: #fcfdff;
}

.text-btn {
  padding: 3px 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.text-btn:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

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

.columns-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  overflow-y: auto;
  padding: 20px 24px 12px;
}

.column-option {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.column-option:hover {
  border-color: #bfdbfe;
  background: var(--primary-soft);
}

.column-option:has(input:checked) {
  border-color: #93c5fd;
  background: var(--primary-soft);
  color: #1e40af;
}

.column-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--primary);
}

.column-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-hint {
  min-height: 31px;
  margin: 0;
  padding: 5px 24px 8px;
  color: var(--muted);
  font-size: 12px;
}

.selection-hint.error-text {
  color: var(--danger);
  font-weight: 650;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #fcfdff;
}

body.modal-open {
  overflow: hidden;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  display: flex;
  width: min(380px, calc(100vw - 32px));
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #334155;
  border-radius: var(--radius);
  background: #1e293b;
  color: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
  font-size: 13px;
  font-weight: 600;
  animation: toast-in 180ms ease-out;
}

.toast::before {
  display: grid;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  content: "i";
  font-size: 11px;
  font-weight: 800;
}

.toast.success {
  border-color: #15803d;
  background: #166534;
}

.toast.success::before {
  content: "✓";
}

.toast.error {
  border-color: #b91c1c;
  background: #991b1b;
}

.toast.error::before {
  content: "!";
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 180ms ease, transform 180ms ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Authentication */
.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.09), transparent 34%),
    var(--bg);
}

.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(420px, 100%);
}

.login-card {
  width: 100%;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.1);
}

.login-docs-link {
  margin-top: 20px;
}

.brand.center {
  justify-content: center;
  margin-bottom: 26px;
  font-size: 17px;
  font-weight: 750;
}

.brand.center .logo {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
}

.auth-form h1 {
  margin: 0 0 18px;
  font-size: 20px;
}

.auth-form > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.auth-form input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus);
}

.btn.block {
  width: 100%;
  margin-top: 3px;
}

.auth-form .row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.auth-form .row .btn {
  flex: 1;
}

.link {
  display: inline-block;
  margin-top: 14px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

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

.auth-msg {
  min-height: 20px;
  margin-top: 13px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 1024px) {
  .app-header__inner,
  .nav-tabs__inner,
  .app-main {
    padding-right: 22px;
    padding-left: 22px;
  }

  .page-header {
    flex-direction: column;
    gap: 20px;
  }

  .stats-grid {
    width: 100%;
    min-width: 0;
  }

  .toolbar {
    grid-template-columns: minmax(220px, 1fr) 124px;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .file-controls-grid {
    grid-template-columns: 1fr;
  }

  .selected-file-card {
    width: 100%;
    min-width: 0;
  }

  .selected-file-card strong {
    max-width: calc(100vw - 170px);
  }
}

@media (max-width: 768px) {
  .app-header {
    position: relative;
  }

  .app-header__inner {
    min-height: 68px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .app-subtitle {
    display: none;
  }

  .nav-tabs__inner {
    gap: 24px;
  }

  .app-main {
    padding-top: 20px;
    padding-bottom: 24px;
  }

  .page.active {
    gap: 16px;
  }

  .page-header,
  .toolbar-card,
  .file-controls-card {
    padding: 20px;
  }

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

  .search-field,
  .page-size-field {
    width: 100%;
    max-width: none;
  }

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

  #tab-files .toolbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-actions .btn {
    width: 100%;
  }

  .sort-help {
    display: none;
  }

  .table-wrapper {
    max-height: 58vh;
  }

  .table-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .pagination-summary {
    text-align: center;
  }

  .pagination {
    justify-content: center;
  }

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

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

@media (max-width: 480px) {
  .app-header__inner,
  .nav-tabs__inner,
  .app-main {
    padding-right: 14px;
    padding-left: 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .app-title {
    font-size: 15px;
  }

  .btn-compact {
    width: 38px;
    padding: 0;
  }

  .btn-compact span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .nav-tab {
    min-height: 46px;
  }

  .app-main {
    padding-top: 14px;
  }

  .card {
    border-radius: var(--radius);
  }

  .page-header,
  .toolbar-card,
  .file-controls-card {
    padding: 17px;
  }

  .page-header {
    gap: 17px;
  }

  .page-header h1 {
    font-size: 23px;
  }

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

  .stat-card:last-child {
    grid-column: 1 / -1;
  }

  .toolbar-actions,
  #tab-files .toolbar-actions {
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .section-heading > .btn {
    width: 100%;
  }

  .table-card__header {
    padding: 16px;
  }

  .data-table th,
  .data-table td {
    height: 46px;
    padding-right: 13px;
    padding-left: 13px;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    padding-left: 16px;
  }

  .table-footer {
    padding: 14px;
  }

  .pagination {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .page-indicator {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .pagination-btn {
    width: 100%;
  }

  .selected-file-card strong {
    max-width: calc(100vw - 140px);
  }

  .modal {
    align-items: end;
    padding: 0;
  }

  .modal-panel {
    width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal-header {
    padding: 20px 18px 16px;
  }

  .column-selector__tools {
    gap: 14px;
    padding: 12px 18px;
  }

  .columns-grid {
    grid-template-columns: 1fr;
    padding: 16px 18px 10px;
  }

  .selection-hint {
    padding-right: 18px;
    padding-left: 18px;
  }

  .modal-footer {
    padding: 14px 18px max(14px, env(safe-area-inset-bottom));
  }

  .modal-footer .btn {
    flex: 1;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }

  .login-body {
    padding: 16px;
  }

  .login-card {
    padding: 24px 20px;
  }

  .auth-form .row {
    flex-direction: column;
  }
}

/* API Keys tab */
.key-reveal {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 24px;
}

.key-reveal__value {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
  word-break: break-all;
}

.key-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.key-status-active {
  background: var(--success-soft);
  color: var(--success);
}

.key-status-expired,
.key-status-revoked {
  background: var(--danger-soft);
  color: var(--danger);
}

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