:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --panel-2: #232d3a;
  --border: #2e3a4a;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #3d9cfd;
  --accent-2: #2dd4a8;
  --danger: #f07178;
  --ok: #7fd99a;
  --sidebar: 240px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1a3050 0%, transparent 55%),
              radial-gradient(900px 500px at 100% 0%, #163528 0%, transparent 50%),
              var(--bg);
  color: var(--text);
  line-height: 1.45;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video, iframe, svg { max-width: 100%; height: auto; }
pre {
  overflow-x: auto;
  max-width: 100%;
  word-break: break-word;
  white-space: pre-wrap;
}

.layout { display: flex; min-height: 100vh; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 900;
}
.sidebar-backdrop[hidden] { display: none !important; }
.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  background: rgba(18, 24, 32, 0.92);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 950;
}
.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.nav-close {
  display: none;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.6rem 1rem;
  color: #fff;
}
.brand span { color: var(--accent-2); }
.nav-group { margin-bottom: 1.1rem; }
.nav-group h3 {
  margin: 0 0 0.35rem;
  padding: 0 0.6rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.nav-group a {
  display: block;
  padding: 0.42rem 0.65rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.92rem;
  border-left: 3px solid transparent;
}
.nav-group a:hover {
  background: var(--panel-2);
  text-decoration: none;
  color: #fff;
}
.nav-group a.active {
  background: rgba(61, 156, 253, 0.16);
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  border-left-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(61, 156, 253, 0.28);
}

.mobile-bar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  margin: -0.25rem 0 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.mobile-bar-brand {
  font-weight: 700;
  color: #fff;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-bar-brand span { color: var(--accent-2); }
.mobile-bar-user {
  font-size: 0.8rem;
  max-width: 36%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  padding: 0;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle-bars::before { top: -5px; }
.nav-toggle-bars::after { top: 5px; }

.main { flex: 1; padding: 1.5rem 1.75rem 3rem; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.topbar h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 650;
  line-height: 1.25;
  word-break: break-word;
}
.meta {
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
  text-align: right;
}

.flash-wrap { margin-bottom: 1rem; }
.flash {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  background: var(--panel);
}
.flash.ok { border-color: #2f6b45; color: var(--ok); }
.flash.error { border-color: #7a3340; color: var(--danger); }

.card {
  background: rgba(26, 34, 44, 0.9);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.card h2, .card h3 { margin-top: 0; }
.card:has(> table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.45rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}

/* All text-like controls (incl. <input> without type=) — exclude buttons/toggles/files */
input:not([type]),
input[type=text],
input[type=password],
input[type=number],
input[type=url],
input[type=email],
input[type=search],
input[type=tel],
input[type=date],
input[type=time],
input[type=datetime-local],
select,
textarea {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #121820;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.35;
  margin-bottom: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

input:not([type]):hover,
input[type=text]:hover,
input[type=password]:hover,
input[type=number]:hover,
input[type=url]:hover,
input[type=email]:hover,
input[type=search]:hover,
input[type=tel]:hover,
input[type=date]:hover,
input[type=time]:hover,
input[type=datetime-local]:hover,
select:hover,
textarea:hover {
  border-color: #3d4f66;
  background: #151d27;
}

input:not([type]):focus,
input[type=text]:focus,
input[type=password]:focus,
input[type=number]:focus,
input[type=url]:focus,
input[type=email]:focus,
input[type=search]:focus,
input[type=tel]:focus,
input[type=date]:focus,
input[type=time]:focus,
input[type=datetime-local]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #0e1520;
  box-shadow: 0 0 0 3px rgba(61, 156, 253, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

input::placeholder,
textarea::placeholder {
  color: #5f7085;
  opacity: 1;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #0c1016;
}

/* Chrome / Safari autofill — keep dark theme instead of stark white */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #121820 inset;
  box-shadow: 0 0 0 1000px #121820 inset;
  caret-color: var(--text);
  border-color: var(--border);
  transition: background-color 99999s ease-in-out 0s;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b9aab' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px 8px;
  padding-right: 2rem;
  cursor: pointer;
}
select.multi-select {
  background-image: none;
  padding-right: 0.75rem;
  min-height: 8.5rem;
  cursor: auto;
}
select option {
  background: var(--panel);
  color: var(--text);
}

.kb-picker {
  margin-bottom: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121820;
  overflow: hidden;
}
.kb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.kb-toolbar-check {
  display: inline-flex;
  align-items: center;
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}
.kb-toolbar .btn-sm {
  padding: 0.28rem 0.65rem;
  font-size: 0.82rem;
}
.kb-toolbar #kb-count {
  margin-left: auto;
  font-size: 0.82rem;
}
.kb-table-wrap {
  max-height: 280px;
  overflow: auto;
  margin: 0;
}
.kb-table {
  margin: 0;
}
.kb-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1a222c;
}
.kb-col-check {
  width: 2.4rem;
  text-align: center;
}
.kb-table tbody tr[hidden] {
  display: none;
}
.kb-pager {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}
.kb-pager .btn-sm:disabled,
.kb-pager .btn-disabled {
  opacity: 0.45;
  pointer-events: none;
}

textarea {
  min-height: 120px;
  font-family: var(--mono);
  font-size: 0.85rem;
  resize: vertical;
  line-height: 1.5;
}
textarea.large { min-height: 420px; }

input[type=number] {
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=file] {
  width: 100%;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.75rem;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  background: #121820;
  border: 1px dashed #3d4f66;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
input[type=file]:hover {
  border-color: var(--accent);
  background: #151d27;
  color: var(--text);
}
input[type=file]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
input[type=file]::file-selector-button:hover {
  filter: brightness(1.1);
}

input[type=checkbox],
input[type=radio] {
  width: auto;
  margin: 0 0.4rem 0 0;
  accent-color: var(--accent);
  vertical-align: middle;
}

.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }

.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 7px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font: inherit;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-primary { background: #1d4f8c; border-color: #2b6cb0; color: #fff; font-weight: 600; }
.btn-danger { background: #5c2430; border-color: #8a3a48; color: #ffd6da; }
.btn-ghost { background: transparent; }
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.preset-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
}
.preset-card.is-active {
  border-color: #2f6b45;
  box-shadow: inset 0 0 0 1px rgba(47, 107, 69, 0.35);
}
.preset-title { font-weight: 600; margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.preset-active-badge { background: #1e3d2a; color: var(--ok); border: 1px solid #2f6b45; }
.preset-blurb { font-size: 0.88rem; margin-bottom: 0.35rem; }
.preset-meta { font-size: 0.78rem; word-break: break-all; }
.preset-card button:disabled { opacity: 0.7; cursor: default; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.actions-reply {
  margin-top: 0.85rem;
  align-items: center;
  gap: 1.25rem;
}
.actions-reply .btn-primary {
  min-width: 7.5rem;
  padding: 0.5rem 1.1rem;
}
.actions-reply .btn-danger {
  margin-left: auto;
  opacity: 0.9;
}
.confirm-modal-message {
  margin: 0.75rem 0 1rem;
  color: var(--text);
  line-height: 1.45;
}
.modal-card.modal-confirm { width: min(420px, 100%); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.85rem; }
.upload-urls-toolbar { margin: 0.35rem 0 0.5rem; }
.upload-urls-box {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 0.6rem 0.75rem;
}
.upload-results-table .upload-url-cell input {
  width: 100%;
  min-width: 12rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
}
.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}
.badge-ok {
  border-color: #2f6b4f;
  color: #b7f0d0;
  background: #163528;
}
.badge-bad {
  border-color: #8a3a48;
  color: #ffd6da;
  background: #2a151a;
}
.stat { font-size: 1.8rem; font-weight: 700; }
.error-box {
  border: 1px solid #8a3a48;
  background: #2a151a;
  color: #ffd6da;
  padding: 1rem;
  border-radius: 8px;
}
.login-wrap {
  max-width: 400px;
  margin: 12vh auto;
  padding: 0 1rem;
}
.geo-wrap {
  max-width: 560px;
  margin: 18vh auto;
  padding: 0 1rem;
  text-align: center;
}
.geo-wrap h1 { color: var(--danger); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none !important; }
.modal-card {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.2rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.modal-card.modal-wide { width: min(820px, 100%); }
.batch-preview-list {
  list-style: none;
  margin: 0.35rem 0 0.75rem;
  padding: 0.55rem 0.7rem;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}
.batch-preview-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  padding: 0.2rem 0;
  align-items: baseline;
}
.batch-progress {
  margin: 0.5rem 0 0;
  padding: 0.65rem 0.75rem;
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  white-space: pre-wrap;
  font-size: 0.85rem;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }

/* Resource list tooling */
.page-back { margin: 0 0 1rem; }
.page-back a {
  font-size: 1.35rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0;
  line-height: 1.3;
}
.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.list-toolbar-hint { margin: 0; font-size: 0.88rem; }
.card-flush { padding: 0; overflow: hidden; }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.data-table { margin: 0; }
.data-table thead th {
  position: sticky;
  top: 0;
  background: #1c2530;
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.65rem;
}
.data-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.data-table td { vertical-align: middle; padding: 0.55rem 0.65rem; }
.edit-table .col-id { width: 3.2rem; color: var(--muted); }
.edit-table .col-color { width: 7.5rem; }
.edit-table .col-name { min-width: 9rem; }
.edit-table .col-slug { min-width: 8rem; }
.edit-table .col-desc { min-width: 12rem; }
.edit-table .col-count { width: 5.5rem; text-align: center; }
.edit-table .col-actions { width: 9.5rem; white-space: nowrap; }
.input-compact {
  width: 100%;
  margin-bottom: 0 !important;
  padding: 0.42rem 0.55rem !important;
  font-size: 0.88rem !important;
}
.input-color {
  font-family: var(--mono);
  font-size: 0.8rem !important;
  max-width: 5.5rem;
  display: inline-block;
  vertical-align: middle;
}
.color-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 4px;
  background: var(--swatch);
  border: 1px solid rgba(255, 255, 255, 0.18);
  margin-right: 0.35rem;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.count-pill {
  display: inline-block;
  min-width: 1.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}
.row-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}
.inline-form { display: inline; margin: 0; }
.btn-sm {
  padding: 0.28rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 6px;
}
.empty-cell {
  text-align: center;
  padding: 2.2rem 1rem !important;
}
.empty-cell .muted { margin: 0 0 0.85rem; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.75rem;
}
.pagination + table { margin-top: 0; }
table + .pagination { margin: 0.75rem 0 0; }
.pagination-links {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.btn-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

/* —— Responsive: large tablet / small laptop —— */
@media (max-width: 1100px) {
  :root { --sidebar: 210px; }
  .main { padding: 1.25rem 1.25rem 2.5rem; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* —— Responsive: tablet & below — drawer nav —— */
@media (max-width: 900px) {
  .mobile-bar { display: flex; }
  .sidebar-backdrop:not([hidden]) {
    display: block;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    height: 100%;
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    border-right: 1px solid var(--border);
    box-shadow: none;
    padding-top: 1rem;
  }
  .layout.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
  }
  .nav-close { display: inline-flex; align-items: center; justify-content: center; }
  .brand { padding-bottom: 0.75rem; }
  body.nav-lock { overflow: hidden; }

  .main { padding: 1rem 1rem 2.25rem; }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin-bottom: 1rem;
  }
  .topbar h1 { font-size: 1.25rem; }
  .meta {
    text-align: left;
    font-size: 0.8rem;
  }

  .grid-2,
  .grid-3 { grid-template-columns: 1fr; }

  .row > * { min-width: min(100%, 160px); }

  .stat { font-size: 1.55rem; }

  .page-back a { font-size: 1.15rem; }

  .list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-reply {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .actions-reply .btn-primary,
  .actions-reply .btn-danger {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }

  .pagination {
    flex-direction: column;
    align-items: stretch;
  }
  .pagination-links {
    flex-wrap: wrap;
  }

  .modal-card {
    width: min(640px, 100%);
    max-height: min(90vh, 90dvh);
  }

  textarea.large { min-height: 280px; }

  .edit-table .col-desc { min-width: 10rem; }
  .edit-table .col-actions { width: auto; }
}

/* —— Responsive: phone —— */
@media (max-width: 600px) {
  .main { padding: 0.85rem 0.75rem 2rem; }

  .mobile-bar {
    margin: 0 0 0.85rem;
    padding-bottom: 0.7rem;
  }
  .mobile-bar-user { display: none; }

  .topbar h1 { font-size: 1.12rem; }
  .card {
    padding: 0.85rem 0.8rem;
    border-radius: 8px;
  }
  .card-flush { padding: 0; }

  table { font-size: 0.85rem; }
  th, td { padding: 0.45rem 0.35rem; }
  .data-table thead th,
  .data-table td { padding: 0.55rem 0.5rem; }

  .btn {
    padding: 0.5rem 0.75rem;
    min-height: 2.4rem;
  }
  .btn-sm {
    min-height: 2rem;
    padding: 0.32rem 0.55rem;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
  }
  .row > * {
    min-width: 0;
    width: 100%;
  }
  .row .actions {
    width: 100%;
  }
  .row .actions .btn {
    flex: 1;
  }

  .login-wrap {
    margin: 8vh auto;
    max-width: none;
  }
  .geo-wrap {
    margin: 12vh auto;
  }

  .stat { font-size: 1.4rem; }

  input:not([type]),
  input[type=text],
  input[type=password],
  input[type=number],
  input[type=url],
  input[type=email],
  input[type=search],
  input[type=tel],
  input[type=date],
  input[type=time],
  input[type=datetime-local],
  select,
  textarea {
    font-size: 16px; /* avoid iOS zoom on focus */
    padding: 0.65rem 0.75rem;
  }

  textarea.large { min-height: 220px; }

  .modal-overlay { padding: 0.65rem; align-items: flex-end; }
  .modal-card {
    width: 100%;
    max-height: min(92vh, 92dvh);
    border-radius: 12px 12px 8px 8px;
  }
  .modal-card.modal-confirm,
  .modal-card.modal-wide { width: 100%; }

  .row-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .row-actions .btn,
  .row-actions .inline-form,
  .row-actions .inline-form .btn {
    width: 100%;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* Fine pointer / hover not required — keep tap targets usable */
@media (hover: none) and (pointer: coarse) {
  .nav-group a {
    padding: 0.55rem 0.7rem;
  }
  .btn {
    min-height: 2.5rem;
  }
}

