/* 汤坑同城 · 管理后台（与 prototype/admin-design 对齐）
 * 部署：与 public/assets/admin.css 为同一份；改样式时请两处一起替换，或只改 assets 后复制到 public/assets。 */
:root {
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #fff;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --page-bg: #f1f5f9;
  --card-bg: #fff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --sidebar-w: 240px;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--page-bg);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 45%, #0f172a 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.login-card .sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.login-card label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 13px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.login-card .btn-primary {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
}

.login-hint {
  margin-top: 20px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}

.error {
  color: var(--danger-text);
  background: var(--danger-bg);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand strong {
  display: block;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar-brand span {
  font-size: 11px;
  color: var(--sidebar-text);
  opacity: 0.85;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 2px;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover-bg);
  color: #e2e8f0;
}

.sidebar-nav a.active {
  background: rgba(59, 130, 246, 0.2);
  color: var(--sidebar-active);
  font-weight: 500;
}

.sidebar-nav .icon {
  width: 20px;
  text-align: center;
  opacity: 0.9;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
}

.sidebar-footer a {
  color: var(--sidebar-text);
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: #e2e8f0;
  text-decoration: underline;
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-icon {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  position: relative;
}

.mobile-menu-icon::before,
.mobile-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.mobile-menu-icon::before {
  top: -6px;
}

.mobile-menu-icon::after {
  top: 6px;
}

body.sidebar-open .mobile-menu-icon {
  background: transparent;
}

body.sidebar-open .mobile-menu-icon::before {
  top: 0;
  transform: rotate(45deg);
}

body.sidebar-open .mobile-menu-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.sidebar-overlay {
  display: none;
}

.topbar {
  height: 56px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.topbar-meta a {
  color: var(--muted);
}

.topbar-meta a:hover {
  color: var(--accent);
}

.content {
  padding: 24px;
  flex: 1;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.card-title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}

.btn:hover {
  background: #f8fafc;
}

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

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

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar:last-child {
  margin-bottom: 0;
}

.toolbar form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}

textarea {
  min-height: 88px;
  width: 100%;
  resize: vertical;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

tr:hover td {
  background: #fafbfc;
}

.table-actions a,
.table-actions form {
  margin-right: 6px;
  white-space: nowrap;
}

.table-actions form {
  display: inline;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.badge-ok,
.badge-normal {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-warn,
.badge-offline {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge-danger,
.badge-deleted {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-vip {
  color: #92400e;
  background: #fef3c7;
}

.badge-merchant {
  color: #1e40af;
  background: #dbeafe;
}

.user-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 100px;
}

.user-settings-card .user-setting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.user-settings-card .user-setting-row:last-of-type {
  border-bottom: none;
}

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

.user-setting-main strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
}

.user-setting-main p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.user-setting-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
  max-width: 320px;
}

.user-setting-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.user-setting-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.user-setting-option span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.user-setting-option-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-style: normal;
  color: var(--muted);
  font-weight: 400;
}

.user-setting-option:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.user-setting-option:has(input:checked) span {
  color: #1d4ed8;
}

.user-setting-option:has(input:checked) .user-setting-option-hint {
  color: #3b82f6;
}

.user-setting-option--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.user-setting-na {
  flex-shrink: 0;
  font-size: 13px;
  padding: 8px 0;
}

.user-setting-row--stack {
  flex-direction: column;
  align-items: stretch;
}

.user-setting-row--stack .user-setting-options {
  max-width: none;
}

.user-merchant-create {
  margin-top: 8px;
  padding: 20px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.user-merchant-create__title {
  margin: 0 0 8px;
  font-size: 15px;
}

.user-merchant-create__hint {
  margin: 0 0 16px;
}

.card-inset .mer-form-grid {
  margin-top: 12px;
}

.user-setting-options--inline {
  justify-content: flex-start;
}

@media (max-width: 900px) {
  .user-settings-card .user-setting-row {
    flex-direction: column;
    gap: 14px;
  }

  .user-setting-options {
    max-width: none;
    width: 100%;
  }

  .user-setting-option {
    flex: 1;
    min-width: 0;
  }
}

.badge-muted,
.badge-top {
  background: #f1f5f9;
  color: var(--muted);
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-card.accent {
  border-color: rgba(59, 130, 246, 0.25);
  background: linear-gradient(135deg, #fff 0%, #eff6ff 100%);
}

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

.detail-body {
  white-space: pre-wrap;
  line-height: 1.65;
  margin-bottom: 20px;
}

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

.thumb,
.img-thumb {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.banner-thumb {
  width: 200px;
  max-height: 88px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.form-row {
  margin-bottom: 14px;
}

.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

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

.category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.category-row:last-child {
  border-bottom: none;
}

.banner-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.banner-row:last-child {
  border-bottom: none;
}

.announcement-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.announcement-block:last-child {
  border-bottom: none;
}

code {
  font-size: 12px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

/* 商家管理 · 门店表单网格 */
.mer-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
}

.mer-form-grid .field-full {
  grid-column: 1 / -1;
}

.mer-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.mer-field input[type="text"],
.mer-field input[type="number"],
.mer-field textarea {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.mer-form-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* 商家管理 · 商品 */
.mer-products-wrap .mer-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.mer-products-wrap .mer-section-head .card-title {
  margin: 0 0 4px;
}

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

.mer-count-badge {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: #eff6ff;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
}

.mer-required {
  color: #dc2626;
}

.mer-panel {
  margin-bottom: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 48%);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.mer-panel--add {
  border-style: dashed;
  border-color: #cbd5e1;
}

.mer-panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
}

.mer-panel__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.mer-panel__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.mer-add-form__body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  padding: 18px;
  align-items: start;
}

.mer-upload-slot__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

.mer-upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 140px;
  padding: 16px 12px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.mer-upload-zone:hover {
  border-color: var(--accent);
  background: #f8fafc;
}

.mer-upload-zone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.mer-upload-zone__hint {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  pointer-events: none;
}

.mer-upload-zone__meta {
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}

.mer-add-form__fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mer-field-row {
  display: grid;
  gap: 12px 16px;
  align-items: end;
}

.mer-field-row--3 {
  grid-template-columns: 1fr 120px 100px;
}

.mer-field--grow {
  min-width: 0;
}

.mer-field--narrow,
.mer-field--price {
  min-width: 0;
}

.mer-field--price {
  width: 110px;
}

.mer-field--cat {
  width: 96px;
}

.mer-add-form__submit {
  padding-top: 4px;
}

/* 商品缩略图（固定尺寸，防止原图撑破布局） */
.mer-products-wrap .mer-thumb-box {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.mer-products-wrap .mer-thumb-box__img {
  display: block;
  width: 96px;
  height: 96px;
  max-width: 96px;
  max-height: 96px;
  object-fit: cover;
  vertical-align: top;
}

.mer-products-wrap .mer-thumb-box__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 12px;
  color: var(--muted);
}

.mer-product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mer-product-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.mer-product-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.mer-product-card__form {
  min-width: 0;
}

.mer-product-card__layout {
  display: grid;
  grid-template-columns: 112px 1fr 100px;
  gap: 18px;
  padding: 16px 18px;
  align-items: start;
}

.mer-product-card__visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mer-file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.mer-file-btn:hover {
  background: #dbeafe;
}

.mer-file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.mer-product-card__main > .mer-field-row {
  grid-template-columns: 1fr 110px 96px;
}

.mer-product-card__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mer-product-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mer-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  line-height: 1.4;
}

.mer-badge--id {
  color: #475569;
  background: #f1f5f9;
}

.mer-badge--cat {
  color: #1d4ed8;
  background: #eff6ff;
}

.mer-product-card__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding-top: 2px;
}

.mer-price-tag {
  display: block;
  padding: 8px 10px;
  font-size: 18px;
  font-weight: 700;
  color: #ea580c;
  text-align: center;
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid #fed7aa;
  border-radius: 8px;
  letter-spacing: -0.02em;
}

.mer-btn-block {
  width: 100%;
  justify-content: center;
}

.mer-product-card__delete {
  margin: 0;
  padding: 10px 12px;
  border-left: 1px solid var(--border);
  background: #fafbfc;
  display: flex;
  align-items: center;
}

.mer-product-card__delete .mer-btn-block {
  min-width: 72px;
}

.mer-empty {
  padding: 40px 24px;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.mer-empty__icon {
  display: block;
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.85;
}

.mer-empty p {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.mer-empty .muted {
  font-size: 13px;
}

@media (max-width: 900px) {
  .mer-form-grid {
    grid-template-columns: 1fr;
  }

  .mer-add-form__body {
    grid-template-columns: 1fr;
  }

  .mer-field-row--3,
  .mer-field-row {
    grid-template-columns: 1fr;
  }

  .mer-field--price,
  .mer-field--cat {
    width: auto;
  }

  .mer-product-card {
    grid-template-columns: 1fr;
  }

  .mer-product-card__layout {
    grid-template-columns: 96px 1fr;
    grid-template-rows: auto auto;
  }

  .mer-product-card__actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .mer-price-tag {
    flex: 1;
    min-width: 100px;
  }

  .mer-product-card__delete {
    border-left: none;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    width: min(280px, 86vw);
    box-shadow: none;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.25);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(15, 23, 42, 0.45);
    -webkit-tap-highlight-color: transparent;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .main-wrap {
    margin-left: 0;
  }

  .topbar {
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0);
    height: auto;
    min-height: 52px;
  }

  .topbar-meta {
    flex-shrink: 0;
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .content {
    padding: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0));
  }

  .card {
    padding: 16px;
    margin-bottom: 14px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-card .value {
    font-size: 24px;
  }

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

  .toolbar select,
  .toolbar input[type="text"],
  .toolbar input[type="number"] {
    width: 100%;
    max-width: none;
  }

  .toolbar .btn,
  .toolbar button[type="submit"] {
    width: 100%;
  }

  .toolbar form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .form-row select,
  .form-row input[type="text"] {
    max-width: none !important;
    width: 100%;
  }

  th,
  td {
    padding: 8px 10px;
    font-size: 12px;
  }

  .pagination {
    flex-wrap: wrap;
  }
}

@media (max-width: 380px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}
