:root {
  --bg: #f3f7fb;
  --bg-2: #eaf1fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --surface-blue: #eef6ff;
  --text: #142033;
  --muted: #66758c;
  --muted-2: #8a98aa;
  --border: #dfe8f3;
  --border-strong: #cbd8e8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e8f0ff;
  --success: #0f9f6e;
  --success-soft: #e6f8f0;
  --danger: #dc3545;
  --danger-soft: #ffedf0;
  --warning: #f59e0b;
  --warning-soft: #fff5df;
  --sidebar: #ffffffcc;
  --shadow-sm: 0 8px 24px rgba(34, 51, 84, .08);
  --shadow: 0 18px 55px rgba(34, 51, 84, .13);
  --shadow-lg: 0 32px 80px rgba(34, 51, 84, .16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-width: 292px;
  color-scheme: light;
}

* { box-sizing: border-box; }
body.modal-open { overflow: hidden; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 4% 2%, rgba(37, 99, 235, .14), transparent 30rem),
    radial-gradient(circle at 88% 8%, rgba(15, 159, 110, .12), transparent 28rem),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(37, 99, 235, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, .035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.75), transparent 72%);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  backdrop-filter: blur(24px);
  box-shadow: 16px 0 48px rgba(34, 51, 84, .06);
  z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand strong { display: block; font-size: 1.05rem; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); margin-top: 2px; font-size: .78rem; }
.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #54a1ff);
  box-shadow: 0 14px 30px rgba(37, 99, 235, .26);
}
.brand-mark ion-icon { font-size: 26px; }
.brand.compact .brand-mark { width: 40px; height: 40px; flex-basis: 40px; border-radius: 14px; }

.side-nav { display: grid; gap: 8px; margin-top: 8px; }
.side-link {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: 16px;
  color: var(--muted);
  font-weight: 800;
  transition: .18s ease;
}
.side-link ion-icon { font-size: 22px; }
.side-link:hover { color: var(--primary); background: var(--primary-soft); transform: translateX(2px); }
.side-link.danger { color: var(--danger); }
.logout-form { margin-top: auto; }
.logout-form .logout-link { width: 100%; border: 0; text-align: left; }
.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--surface), var(--surface-soft));
  box-shadow: var(--shadow-sm);
}
.sidebar-card p { margin: 12px 0 0; color: var(--muted); line-height: 1.45; }
.sidebar-card strong { color: var(--text); }
.sidebar-close { display: none !important; }
.sidebar-backdrop { display: none; }

.workspace { min-width: 0; }
.content-shell { width: min(1320px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 52px; }
.mobile-topbar { display: none; }
.content-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.page-title { margin: 4px 0 0; font-size: clamp(1.75rem, 4vw, 2.65rem); letter-spacing: -.045em; line-height: 1.05; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; }
.breadcrumbs a { color: var(--primary); font-weight: 900; }
.breadcrumbs ion-icon { color: var(--muted-2); }

.status-banner {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.status-banner ion-icon { font-size: 26px; }
.status-banner.success ion-icon { color: var(--success); }
.status-banner.danger ion-icon { color: var(--danger); }
.status-banner strong { display: block; font-size: .96rem; }
.status-banner span { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  min-height: 106px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface), transparent 0%);
  box-shadow: var(--shadow-sm);
  transition: .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon ion-icon { font-size: 26px; }
.stat-card strong { display: block; font-size: 1.7rem; letter-spacing: -.035em; line-height: 1; }
.stat-card span { color: var(--muted); font-size: .86rem; }
.stat-link { cursor: pointer; }

.flash-stack { display: grid; gap: 10px; margin-bottom: 18px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 800; }
.flash ion-icon { font-size: 22px; }
.flash.info ion-icon { color: var(--primary); }
.flash.danger { border-color: #ffcbd2; background: var(--danger-soft); color: #8f1523; }

.hero-card, .panel, .auth-card, .peer-card, .modal-card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.hero-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 20px;
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--radius-xl);
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -110px;
  top: -110px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.16), transparent 68%);
  pointer-events: none;
}
.hero-card h1 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.45rem); line-height: 1.08; letter-spacing: -.04em; }
.hero-card p { margin: 12px 0 0; max-width: 780px; color: var(--muted); line-height: 1.65; }
.hero-card > ion-icon { flex: 0 0 auto; font-size: clamp(70px, 12vw, 126px); color: rgba(37, 99, 235, .2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: .78rem; font-weight: 950; letter-spacing: .13em; text-transform: uppercase; }

.panel { padding: clamp(18px, 3vw, 28px); border-radius: var(--radius-xl); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: clamp(1.18rem, 3vw, 1.65rem); letter-spacing: -.02em; }
.counter { min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-weight: 950; }

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 15px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(34, 51, 84, .06);
  transition: .16s ease;
}
.btn ion-icon { font-size: 19px; }
.btn:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--primary), var(--border) 55%); box-shadow: 0 12px 28px rgba(34, 51, 84, .12); }
.btn:disabled { opacity: .52; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), #4f9cff); }
.btn.success { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--success), #33c591); }
.btn.danger { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--danger), #ff6875); }
.btn.danger-soft { color: var(--danger); border-color: #ffcbd2; background: var(--danger-soft); }
.btn.warning { color: #3a2600; border-color: transparent; background: linear-gradient(135deg, var(--warning), #ffd166); }
.btn.ghost { background: var(--surface-soft); }
.btn.small { min-height: 36px; padding: 0 11px; border-radius: 12px; font-size: .86rem; }
.btn.full { width: 100%; }
.icon-button { width: 44px; height: 44px; border-radius: 15px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-grid; place-items: center; box-shadow: var(--shadow-sm); }
.icon-button ion-icon { font-size: 24px; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(46, 126, 247, .34);
  outline-offset: 3px;
}
.link-button { min-height: 36px; display: inline-flex; align-items: center; border: 0; padding: 0 8px; border-radius: 10px; background: transparent; color: var(--primary); font-weight: 900; }
.link-button:hover { text-decoration: underline; }

.generate-form { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(260px, 1.4fr) auto; gap: 14px; align-items: end; }
label span { display: block; margin-bottom: 8px; color: var(--muted); font-size: .88rem; font-weight: 900; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface-soft);
  outline: none;
  transition: .16s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }

.responsive-table { width: 100%; overflow-x: auto; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 14px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: var(--surface-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .055em; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: #f7fbff; }
.key-code, code { display: inline-block; max-width: 340px; padding: 6px 9px; border-radius: 11px; background: #f4f7fb; color: #1f2c44; font-family: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; word-break: break-all; }
.action-grid { display: grid; grid-template-columns: 1fr; gap: 7px; min-width: 126px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.note-editor input { min-height: 38px; margin-top: 8px; }

.status-dot { width: 10px; height: 10px; display: inline-block; border-radius: 50%; margin-right: 8px; background: var(--muted-2); }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 6px rgba(15,159,110,.14); }
.status-dot.offline { background: var(--muted-2); }
.status-pill, .badge, .mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 950;
  white-space: nowrap;
}
.status-pill.online, .mini-badge.success { color: var(--success); background: var(--success-soft); border-color: #bcebd8; }
.status-pill.offline { color: var(--muted); background: #eef2f7; }
.badge.soft { color: var(--primary); background: var(--primary-soft); border-color: #cfe0ff; }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: #ffcbd2; }
.badge.warning { color: #8a5a00; background: var(--warning-soft); border-color: #ffe0a3; }
.badge.success { color: var(--success); background: var(--success-soft); border-color: #bcebd8; }
.status-pill.warning { color: #8a5a00; background: var(--warning-soft); border-color: #ffe0a3; }
.muted, .muted-text { color: var(--muted); }
.muted-text { font-size: .9rem; }
.tiny { font-size: .78rem; line-height: 1.35; }
.actions-cell .btn { margin: 3px 4px 3px 0; }

.empty-state { min-height: 150px; display: grid; place-items: center; text-align: center; color: var(--muted); gap: 8px; padding: 22px; }
.empty-state ion-icon { font-size: 52px; color: var(--primary); }
.empty-state strong { color: var(--text); font-size: 1.08rem; }
.card-list { display: grid; gap: 14px; }
.card-list.compact { gap: 10px; }
.peer-card { border-radius: 22px; padding: 18px; display: flex; justify-content: space-between; gap: 18px; }
.peer-card h3 { margin: 10px 0 8px; }
.peer-card p { margin: 6px 0; color: var(--muted); line-height: 1.45; }
.peer-card-main { min-width: 0; }
.peer-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); margin-bottom: 10px; }
.peer-actions { display: flex; flex-direction: column; gap: 8px; min-width: 148px; }
.mobile-only { display: none; }
.selected-row td, .selected-card { background: var(--primary-soft); }
.stale-row td { background: var(--warning-soft); }
.stale-card { border-color: #ffe0a3; background: #fffaf0; }
.monitoring-table td, .activity-table td { white-space: nowrap; }

.auth-page { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 34px 0; }
.public-shell { width: min(100% - 32px, 1120px); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.public-brand { margin-top: 26px; }
.public-flash { width: min(560px, 100%); margin: 20px auto 0; }
.auth-card { width: min(460px, 100%); border-radius: 30px; padding: 34px; text-align: center; }
.auth-card h1 { margin: 16px 0 10px; font-size: clamp(1.55rem, 5vw, 2rem); letter-spacing: -.035em; }
.auth-card p { color: var(--muted); line-height: 1.65; }
.auth-icon { width: 82px; height: 82px; margin: 0 auto; display: grid; place-items: center; border-radius: 28px; background: linear-gradient(135deg, var(--primary), #60a5fa); color: #fff; box-shadow: var(--shadow-sm); }
.auth-icon.warning { color: #3a2600; background: linear-gradient(135deg, var(--warning), #ffd166); }
.auth-icon ion-icon { font-size: 46px; }
.pending-card { max-width: 540px; }

.profile-grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; }
.profile-card { text-align: center; }
.avatar-wrap { width: 142px; height: 142px; border-radius: 44px; overflow: hidden; margin: 0 auto 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.avatar-wrap ion-icon { font-size: 92px; }
.profile-card h1 { margin: 0 0 6px; }
.info-list { display: grid; gap: 12px; margin: 0; }
.info-list div { display: grid; grid-template-columns: 160px 1fr; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.info-list dt { color: var(--muted); font-weight: 900; }
.info-list dd { margin: 0; word-break: break-word; }

.terminal, .config-preview { width: 100%; margin: 0 0 20px; padding: 16px; border-radius: 18px; border: 1px solid #10213b; background: #08111f; color: #d7e7ff; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: "JetBrains Mono", "Cascadia Code", ui-monospace, monospace; font-size: .86rem; }
.config-preview { max-height: 340px; text-align: left; }

.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .55); backdrop-filter: blur(12px); }
.modal-card { width: min(720px, 100%); max-height: min(780px, calc(100vh - 40px)); overflow: auto; border-radius: 28px; }
.modal-card.small { width: min(430px, 100%); }
.modal-card.large { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; }
.modal-body.centered { text-align: center; }
.modal-body img { max-width: 286px; border-radius: 18px; background: #fff; padding: 12px; box-shadow: var(--shadow-sm); }
.error-card { max-width: 560px; margin: 40px auto; text-align: center; }
.error-card ion-icon { font-size: 64px; color: var(--primary); }
.error-card p { color: var(--muted); }

[data-tooltip] { position: relative; }
.wg-tooltip { position: fixed; z-index: 10000; max-width: min(320px, calc(100vw - 24px)); padding: 9px 11px; border-radius: 12px; background: #111827; color: #fff; font-size: .78rem; font-weight: 800; line-height: 1.35; box-shadow: 0 18px 44px rgba(17, 24, 39, .24); pointer-events: none; transform: translate(-50%, -100%); opacity: 0; transition: opacity .12s ease; }
.wg-tooltip.show { opacity: 1; }

.wg-swal-popup { border-radius: 24px !important; font-family: Inter, Manrope, system-ui, sans-serif !important; }
.wg-swal-confirm, .wg-swal-cancel { border-radius: 13px !important; font-weight: 900 !important; padding: .72rem 1.05rem !important; }
.wg-swal-confirm { background: linear-gradient(135deg, var(--primary), #4f9cff) !important; }
.wg-swal-cancel { background: #eef2f7 !important; color: #142033 !important; }

@media (max-width: 1180px) { .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 960px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-grid !important; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .36); backdrop-filter: blur(5px); }
  .sidebar-backdrop:not(.open) { display: none; }
  .mobile-topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 70px; width: min(100% - 24px, 1320px); margin: 0 auto; padding: 10px 0; background: color-mix(in srgb, var(--bg), transparent 16%); backdrop-filter: blur(18px); }
  .content-shell { width: min(100% - 24px, 1320px); padding-top: 12px; }
  .content-topline { flex-direction: column; }
  .status-banner { width: 100%; min-width: 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .generate-form { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .desktop-only { display: none; }
  .mobile-only { display: grid; gap: 14px; }
}
@media (max-width: 680px) {
  body::before { display: none; }
  .content-shell { width: min(100% - 18px, 1320px); }
  .page-title { font-size: 1.75rem; }
  .hero-card { flex-direction: column; align-items: flex-start; border-radius: 22px; }
  .hero-card > ion-icon { display: none; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 150px; }
  .stats-grid { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .peer-card { flex-direction: column; }
  .peer-actions { min-width: 0; flex-direction: row; flex-wrap: wrap; }
  .peer-actions .btn { flex: 1 1 130px; }
  .responsive-table table, .responsive-table thead, .responsive-table tbody, .responsive-table th, .responsive-table td, .responsive-table tr { display: block; }
  .responsive-table thead { display: none; }
  .responsive-table { border: 0; background: transparent; }
  .responsive-table tr { border: 1px solid var(--border); border-radius: 18px; padding: 12px; margin-bottom: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
  .responsive-table td { border: 0; padding: 8px 0; display: flex; justify-content: space-between; gap: 12px; white-space: normal; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-weight: 950; min-width: 104px; }
  .responsive-table td[colspan] { display: block; text-align: center; }
  .responsive-table td[colspan]::before, .responsive-table .empty-cell::before { display: none; }
  .info-list div { grid-template-columns: 1fr; gap: 5px; }
  .auth-card, .panel, .hero-card, .modal-card { border-radius: 22px; }
}
@media (max-width: 440px) {
  .brand small { display: none; }
  .brand-mark { width: 40px; height: 40px; flex-basis: 40px; border-radius: 14px; }
  .btn { width: 100%; }
  .stat-card { min-height: 94px; }
  .auth-card { padding: 24px; }
}
.badge.info { color: var(--primary-dark); background: #eef6ff; border-color: #cfe0ff; }
.panel-note { margin: 8px 0 0; color: var(--muted); line-height: 1.55; max-width: 880px; }


.status-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.status-cell .status-dot { margin-right: 0; flex: 0 0 auto; }
.inline-actions.wrap { flex-wrap: wrap; }
.danger-counter { color: var(--danger); background: var(--danger-soft); }
.date-stack { display: inline-flex; flex-direction: column; gap: 2px; line-height: 1.2; white-space: nowrap; }
.date-stack .time { color: var(--muted); font-size: .82em; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.pagination .page-info { color: var(--muted); font-weight: 800; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.filter-grid label, .search-box label { display: grid; gap: 7px; font-weight: 900; color: var(--text); }
.search-box { display: grid; gap: 12px; }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.search-row input { min-width: min(320px, 100%); flex: 1; }
.helper-note { color: var(--muted); line-height: 1.55; margin: 8px 0 0; }
.rejected-card .auth-icon, .auth-icon.danger { color: var(--danger); background: var(--danger-soft); }

@media (max-width: 900px) {
  .mobile-topbar {
    position: sticky;
    top: 10px;
    margin: 10px auto 0;
    width: calc(100% - 20px);
    min-height: 58px;
    padding: 8px 10px;
    border: 1px solid rgba(203,216,232,.88);
    border-radius: 24px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(18px);
    box-shadow: 0 16px 42px rgba(34,51,84,.13);
  }
  .mobile-topbar .brand.compact { min-width: 0; }
  .mobile-topbar .brand.compact strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .content-topline { margin-top: 12px; }
  .status-banner { border-radius: 22px; align-items: flex-start; }
  .status-banner span { word-break: break-word; }
  .filter-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .content-shell { width: calc(100% - 20px); padding-top: 14px; }
  .hero-actions, .panel-head { align-items: stretch; }
  .hero-actions .btn, .panel-head .btn { width: 100%; }
  .pagination .btn { flex: 1; }
  .responsive-table { border-radius: 18px; }
}
.btn.disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.muted-small { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.code-inline { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.public-status-list { display: grid; gap: 10px; margin: 18px 0 0; text-align: left; }
.public-status-list > div { padding: 12px 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-soft); }
.public-status-list span { display: block; color: var(--muted); font-size: .82rem; font-weight: 900; margin-bottom: 4px; }
.public-status-list strong { display: block; overflow-wrap: anywhere; }
.status-pill.danger { color: var(--danger); background: var(--danger-soft); border-color: #ffcbd2; }
.status-pill.soft { color: var(--muted); background: #eef2f7; }

/* Choices.js подключён локально и применяется только к длинным спискам. */
.choices-panel { position: relative; z-index: 5; overflow: visible; }
.choices { width: 100%; margin: 0; color: var(--text); }
.choices__inner {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: var(--surface-soft);
  font-size: 1rem;
}
.is-focused .choices__inner, .is-open .choices__inner {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.choices[data-type*="select-one"]::after { right: 16px; border-color: var(--muted) transparent transparent; }
.choices[data-type*="select-one"].is-open::after { border-color: transparent transparent var(--muted); }
.choices__list--single { padding: 3px 30px 3px 0; }
.choices__list--dropdown, .choices__list[aria-expanded] {
  z-index: 120;
  width: min(100%, calc(100vw - 28px));
  max-height: min(340px, calc(100vh - 32px));
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(34, 51, 84, .2);
  overflow: hidden;
}
.choices__list--dropdown .choices__list, .choices__list[aria-expanded] .choices__list { max-height: min(280px, calc(100vh - 110px)); overscroll-behavior: contain; }
.choices__input { min-height: 42px; margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: #fff; }
.choices__item--choice { padding: 11px 14px; overflow-wrap: anywhere; }
.choices__item--choice.is-highlighted { background: var(--primary-soft); }
.choices.is-disabled .choices__inner { opacity: .6; cursor: not-allowed; }
@media (max-width: 640px) {
  .choices__list--dropdown, .choices__list[aria-expanded] { width: min(100%, calc(100vw - 20px)); }
}
