:root {
  --bg: #f3f3f4;
  --surface: #ffffff;
  --border: #e7e7ea;
  --text: #111113;
  --muted: #6b6b74;
  --accent: #111113;
  --accent-hover: #2a2a2e;
  --focus: #2563eb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --ok: #15803d;
  --ok-bg: #f0fdf4;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 10px 30px rgba(17, 17, 19, 0.05);
  --font: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 17, 19, 0.28) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: rgba(17, 17, 19, 0.28);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(17, 17, 19, 0.42);
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0 0 0.4rem;
  letter-spacing: -0.03em;
  font-weight: 650;
}

h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 1rem; }

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

pre {
  margin: 0.6rem 0 1rem;
  white-space: pre-wrap;
  background: #f6f6f7;
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.muted { color: var(--muted); }

.hidden { display: none !important; }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}

.topnav-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 1.15rem;
  flex-shrink: 0;
  order: 1;
}

.brand-lg {
  justify-content: center;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--text);
  color: #fff;
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
  order: 2;
}

.nav-admin-start {
  margin-left: 1.15rem;
}

.nav-link svg {
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  font-weight: 550;
  white-space: nowrap;
}

.nav-link.is-active,
.nav-link:hover {
  color: var(--text);
  background: #ececef;
}

.topnav-user {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex-shrink: 0;
  order: 3;
}

.topnav-user form {
  margin: 0;
}

.topnav-user-name { font-weight: 600; font-size: 0.92rem; }
.topnav-user-role { color: var(--muted); font-size: 0.75rem; }
.topnav-user-label { display: none; }

.topnav-email {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0 0.35rem;
}

.content { min-width: 0; }

.page-head {
  padding: 0.5rem 1.75rem 0;
}

.icon-btn.menu-btn {
  display: none;
  order: 4;
}

.main {
  padding: 1rem 1.75rem 2.5rem;
  display: grid;
  gap: 1rem;
  justify-items: stretch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
}

.shorten-narrow {
  width: max(50vw, 36rem);
  max-width: 100%;
  justify-self: center;
}

.shorten-card {
  padding: 1.1rem 1.15rem;
}

.shorten-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
  align-items: end;
}

.shorten-submit {
  height: 46px;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stack { display: grid; gap: 0.9rem; }

.modal-body .stack {
  gap: 1.15rem;
}

.field { display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }

.password-field {
  position: relative;
  display: block;
  min-width: 0;
}

.password-field input {
  padding-right: 2.6rem;
}

.password-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 2.4rem;
  border: 0;
  border-radius: 0 9px 9px 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle .icon-hide {
  display: none;
}

.password-toggle.is-visible .icon-show {
  display: none;
}

.password-toggle.is-visible .icon-hide {
  display: block;
}

input, select, button, textarea {
  font: inherit;
}

input, select {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 0.72rem 0.85rem;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input:disabled {
  background: #f6f6f7;
  color: var(--muted);
  cursor: not-allowed;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 0.72rem 1rem;
  background: #ececef;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  position: relative;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn:disabled,
.btn:disabled:hover {
  opacity: 0.45;
  cursor: default;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
}

.btn-danger-ghost:hover { background: var(--danger-bg); }

.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn:hover { background: #ececef; }

.extras { border-top: 1px solid var(--border); padding-top: 0.85rem; }

.extras summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.95rem;
}

.extras .grid-3 + .field {
  margin-top: 0.95rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.85rem;
}

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  margin: 0.8rem 0 1rem;
  align-items: center;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 0.9rem;
}

.check input {
  width: auto;
}

.meta-list {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.meta-list div { display: flex; gap: 0.5rem; }
.meta-list dt { min-width: 110px; }
.meta-list dd { margin: 0; color: var(--text); }

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

.status-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  background: #f1f1f3;
  color: #444;
}

.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }

.table-card { padding: 0; overflow: hidden; }
.table-card h2 { padding: 1.15rem 1.25rem 0; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th[data-sort]:hover,
th[data-sort]:focus-visible {
  color: var(--text);
}

th[data-sort]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

th[data-sort]::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.4rem;
  vertical-align: middle;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  opacity: 0.28;
  border-top: 5px solid currentColor;
}

th[data-sort][data-dir='asc']::after {
  border-top: 0;
  border-bottom: 5px solid currentColor;
  opacity: 1;
}

th[data-sort][data-dir='desc']::after {
  opacity: 1;
}

tr:last-child td { border-bottom: 0; }

.truncate {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  white-space: nowrap;
}

.code-cell .code-copy {
  width: 28px;
  height: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.code-cell:hover .code-copy,
.code-cell:focus-within .code-copy {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .code-cell .code-copy {
    opacity: 1;
    pointer-events: auto;
  }
}

.row-actions {
  white-space: nowrap;
  text-align: right;
}

.row-actions .icon-action {
  vertical-align: middle;
}

.icon-action {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.icon-action:hover {
  background: #ececef;
  color: var(--text);
}

.icon-action-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}

.toolbar, .section-head, .actions, .form-row, .search-form {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
}

.search-form { width: 100%; }
.search-form input { max-width: 420px; }

.form-row .field { min-width: 180px; }
.form-row .btn { height: 46px; }

.code-block p { margin: 0.4rem 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.kpi strong {
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.bars {
  display: flex;
  align-items: end;
  gap: 4px;
  width: 100%;
  height: 140px;
  margin-top: 1rem;
}

.bars-axis {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.bar {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  background: #f4f4f5;
  border-radius: 4px 4px 0 0;
}

.bar > span {
  display: block;
  width: 100%;
  background: var(--text);
  border-radius: 4px 4px 0 0;
  height: var(--h, 8%);
  min-height: 4px;
}

.bar > span.is-empty {
  min-height: 0;
  height: 0;
  background: transparent;
}

.bar-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top, #ffffff 0, #f3f3f4 42%, #ececef 100%);
}

.auth-wrap { width: min(420px, calc(100% - 2rem)); }

.auth-card { padding: 1.6rem 1.5rem 1.5rem; }
.auth-card h1 { font-size: 1.8rem; }
.auth-card .btn { width: 100%; }

.auth-card form + form {
  margin-top: 0.75rem;
}

.btn.is-loading {
  pointer-events: none;
  cursor: wait;
}

.btn.is-loading:disabled {
  opacity: 1;
}

.btn.is-loading .btn-label {
  visibility: hidden;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.05rem;
  height: 1.05rem;
  margin: -0.525rem 0 0 -0.525rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

.btn-primary.is-loading,
.btn-primary.is-loading:hover {
  background: var(--accent);
  color: #fff;
}

.btn-ghost.is-loading,
.btn-ghost.is-loading:hover {
  background: transparent;
  color: var(--text);
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.login-code {
  font-size: 1.35rem;
  letter-spacing: 0.28em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.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;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 19, 0.32);
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal {
  width: min(560px, 100%);
  max-height: min(86vh, 820px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(17, 17, 19, 0.16);
}

.modal > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
  flex: 1;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1.05rem 1.15rem 0.25rem;
  background: #fff;
  flex-shrink: 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body {
  padding: 0.85rem 1rem 1.35rem 1.2rem;
  overflow: auto;
  overscroll-behavior: contain;
  min-height: 0;
  flex: 1 1 auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 17, 19, 0.22) transparent;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background-color: rgba(17, 17, 19, 0.22);
  border: 0;
  border-radius: 999px;
  background-clip: border-box;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
  margin: 0.35rem 0;
}

.modal-body .bars {
  overflow: hidden;
}

.modal-body h3 {
  margin-top: 1.15rem;
}

.detail-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
}

.detail-list > div {
  display: grid;
  gap: 0.12rem;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.detail-list dd {
  margin: 0;
  word-break: break-word;
}

.detail-url {
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.link-stats {
  display: grid;
  gap: 1.1rem;
}

.link-stats-urls {
  display: grid;
  gap: 1.15rem;
}

.link-stats-urls > div {
  display: grid;
  gap: 0.3rem;
}

.link-stats-urls p,
.link-stats-urls a {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.link-stats-urls .detail-url a {
  display: inline;
}

.link-stats-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.link-stats-kpis > div {
  background: #f6f6f7;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  display: grid;
  gap: 0.2rem;
}

.link-stats-kpis strong {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--text);
  word-break: break-word;
}

.link-stats-meta {
  margin: 0;
  font-size: 0.85rem;
}

.link-stats .bars {
  height: 96px;
  margin-top: 0.35rem;
}

.link-stats h3 {
  margin: 0.15rem 0 0;
}

.visit-side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
  text-align: right;
}

.date-cell {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .link-stats-kpis {
    grid-template-columns: 1fr;
  }
}

.visit-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.visit-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.88rem;
}

.visit-list li:last-child {
  border-bottom: 0;
}

.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.5rem;
  z-index: 40;
}

.toast {
  color: #fff;
  padding: 0.75rem 0.95rem;
  border-radius: 10px;
  min-width: 220px;
  max-width: 360px;
  border: 1px solid transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(17, 17, 19, 0.12);
}

.toast-ok {
  background: rgba(22, 101, 52, 0.58);
  border-color: rgba(255, 255, 255, 0.18);
}

.toast-error {
  background: rgba(185, 28, 28, 0.6);
  border-color: rgba(255, 255, 255, 0.18);
}

.toast-warn {
  background: rgba(180, 83, 9, 0.58);
  border-color: rgba(255, 255, 255, 0.18);
}

@media (max-width: 1080px) {
  .topnav-bar {
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
  }

  .icon-btn.menu-btn {
    display: grid;
    order: 4;
    margin-left: auto;
  }

  .nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 0.25rem 0 0;
    order: 5;
  }

  .nav-link svg { display: none; }

  .topnav.is-open .nav { display: flex; }

  .nav-admin-start {
    margin-left: 0;
    margin-top: 0.45rem;
  }

  .topnav-user {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    margin: 0;
    order: 6;
    padding: 0.45rem 0 0.5rem;
    border-top: 1px solid var(--border);
  }

  .topnav.is-open .topnav-user {
    display: flex;
  }

  .topnav-user form {
    display: flex;
    width: 100%;
  }

  .topnav-user-label {
    display: inline;
  }

  .topnav-email {
    max-width: none;
    padding: 0.45rem 0.7rem;
  }

  .topnav-user-action {
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 550;
    font-size: inherit;
    font-family: inherit;
  }

  .topnav-user-action:hover {
    color: var(--text);
  }

  .grid-2, .grid-3, .stats-grid, .shorten-row, .backup-layout, .backup-schedule-fields { grid-template-columns: 1fr; }
  .shorten-narrow { width: 100%; }
  .shorten-submit { width: 100%; }
  .main, .page-head { padding-left: 1rem; padding-right: 1rem; }
  .domain-add-row { flex-direction: column; align-items: stretch; }
  .pager { margin-left: 0; width: 100%; justify-content: flex-start; }

  .table-wrap table {
    width: max-content;
    min-width: 100%;
  }
}

.token-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  margin: 0.85rem 0 0.35rem;
}

.token-status {
  display: inline-flex;
  margin: 0;
  align-items: center;
}

.token-line {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  min-height: 36px;
}

.token-line code {
  font-size: 0.95rem;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.user-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #ececef;
  color: var(--muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.user-admin-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid var(--surface);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.55rem;
  padding-bottom: 0.35rem;
}

.form-actions .btn {
  width: auto;
}

.backup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1rem;
  align-items: stretch;
}

.backup-aside {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.backup-card h2,
.backup-history h2 {
  margin-bottom: 0.35rem;
}

.backup-card .muted {
  margin: 0 0 1rem;
}

.backup-history {
  min-height: 100%;
}

.backup-schedule-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.backup-next {
  color: var(--muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.backup-schedule-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.5rem;
  gap: 0.75rem;
}

.backup-schedule-actions {
  margin-top: 1rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-ui {
  position: absolute;
  inset: 0;
  background: #d4d4d8;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.switch-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.2);
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-ui {
  background: #16a34a;
}

.switch input:checked + .switch-ui::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-ui {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.file-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.file-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-pick-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
}

.file-pick:hover .file-pick-btn {
  border-color: var(--text);
}

.file-pick-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.2rem 1.2rem;
}

.table-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
}

.table-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.table-toolbar .btn {
  flex-shrink: 0;
  height: 46px;
}

.table-toolbar-actions .btn {
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.table-toolbar-actions .btn-icon {
  display: none;
  flex-shrink: 0;
}

.domain-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.domain-add-row .field {
  flex: 1;
  min-width: 0;
}

.domain-add-row .btn {
  height: 46px;
  flex-shrink: 0;
}

.modal-wide {
  width: min(640px, calc(100vw - 2rem));
}

#confirm-backdrop {
  z-index: 35;
}

.modal-confirm {
  width: min(420px, calc(100vw - 2rem));
}

#domains-backdrop .table-wrap {
  max-height: 320px;
  overflow: auto;
}

.table-search {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: 420px;
}

@media (max-width: 1080px) {
  .table-search {
    max-width: none;
  }

  .table-toolbar-actions {
    margin-left: 0;
  }

  .table-toolbar-actions .btn-icon {
    display: block;
  }

  .table-toolbar-actions .btn-text {
    display: none;
  }

  .table-toolbar-actions .btn {
    width: 46px;
    min-width: 46px;
    padding: 0;
  }
}

.table-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--border);
}

.page-size {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.page-size select {
  width: auto;
  min-width: 72px;
  padding: 0.4rem 0.55rem;
}

.pager {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.pager button {
  min-width: 34px;
  height: 34px;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.pager button.is-active,
.pager button:hover:not(:disabled) {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

.pager-gap {
  color: var(--muted);
  padding: 0 0.15rem;
  line-height: 34px;
}

.api-docs details {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0;
}

.api-docs details:first-child {
  border-top: 0;
  padding-top: 0.2rem;
}

.api-docs summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.api-docs h3 {
  margin-top: 0.4rem;
}
