:root {
  --pico-font-family: "Manrope", "Segoe UI", sans-serif;
  --pico-font-size: 87.5%;
  --pico-spacing: .8rem;
  --pico-form-element-spacing-vertical: .45rem;
  --pico-form-element-spacing-horizontal: .6rem;
  --admin-font-family: "Manrope", "Segoe UI", sans-serif;
  --admin-page-bg:
    radial-gradient(circle at top left, rgba(176, 205, 234, .42), transparent 26%),
    linear-gradient(180deg, #f4f7fb, #eaf0f7);
  --admin-card-bg: rgba(255, 255, 255, .9);
  --admin-card-border: rgba(36, 56, 89, .08);
  --admin-card-shadow: 0 18px 48px rgba(24, 39, 75, .08);
  --admin-hero-bg: linear-gradient(135deg, #11243d, #1d3f63 48%, #d7e6f7 135%);
  --admin-link: #0d61ff;
  --admin-text: #203244;
  --admin-muted: #5b6b7f;
}

body {
  position: relative;
  min-height: 100vh;
  background: var(--admin-page-bg);
  background-attachment: fixed;
  color: var(--admin-text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("/admin/assets/img/admin-doodles-clean-bg.png");
  background-size: 900px 900px;
  background-position: top 1.5rem right 1.5rem;
  background-repeat: repeat;
  opacity: .36;
}

main.container {
  position: relative;
  z-index: 1;
  font-family: var(--admin-font-family);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  font-size: .9rem;
}

.topbar nav ul {
  align-items: center;
}

.topbar nav a {
  padding: .35rem .65rem;
  border-radius: 999px;
  color: #22364c;
  text-decoration: none;
}

.topbar nav a:hover {
  background: rgba(13, 97, 255, .08);
}

.topbar nav a[aria-current="page"],
.topbar nav strong,
.topbar .is-active {
  font-weight: 700;
}

.langs a[aria-current="true"] {
  font-weight: 700;
  text-decoration: underline;
}

article {
  border: 1px solid var(--admin-card-border);
  border-radius: 1.15rem;
  background: var(--admin-card-bg);
  box-shadow: var(--admin-card-shadow);
  backdrop-filter: blur(10px);
}

.page-hero {
  padding: 1.15rem 1.25rem 1.3rem;
  color: #f7fbff;
  background: var(--admin-hero-bg);
  position: relative;
  overflow: hidden;
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -38% auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}

.page-hero > * {
  position: relative;
  z-index: 1;
}

.page-kicker {
  display: inline-flex;
  align-items: center;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #f7fbff;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.page-title {
  margin: .7rem 0 .3rem;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -.03em;
  color: #fff;
}

.page-subtitle {
  margin: 0;
  max-width: 60rem;
  color: rgba(247, 251, 255, .84);
}

.notice {
  padding: .75rem 1rem;
  border: 1px solid #ffd8a8;
  border-radius: .75rem;
  background: #fff4e6;
  color: #8f4b00;
  margin: .9rem 0 0;
  font-weight: 600;
}

.section-card {
  padding: 1.1rem 1.2rem 1.2rem;
}

.filter-shell {
  padding: .95rem 1rem 1rem;
  background: rgba(255, 255, 255, .84);
}

.filter-form {
  margin: 0;
}

.filter-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.filter-grid + .filter-grid,
.filter-grid + .filter-actions {
  margin-top: .75rem;
}

.filter-grid.is-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.filter-field {
  margin: 0;
}

.filter-field > span {
  display: inline-flex;
  margin-bottom: .35rem;
  color: var(--admin-muted);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.filter-field input,
.filter-field select {
  margin-bottom: 0;
  height: 2.6rem;
  border-radius: .85rem;
  background: rgba(255, 255, 255, .96);
}

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  flex-wrap: wrap;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .55rem;
  flex-wrap: wrap;
  margin-top: .9rem;
}

.form-note {
  margin: .85rem 0 0;
  padding: .8rem .9rem;
  border: 1px solid #dbe6f1;
  border-radius: .9rem;
  background: rgba(247, 250, 252, .92);
  color: var(--admin-muted);
  font-size: .92rem;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1px solid #b9c9db;
  background: rgba(255, 255, 255, .95);
  color: #4d6480;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  user-select: none;
}

.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + .55rem);
  transform: translateX(-50%);
  min-width: 14rem;
  max-width: 24rem;
  padding: .65rem .75rem;
  border-radius: .8rem;
  background: #19324d;
  color: #f7fbff;
  box-shadow: 0 14px 34px rgba(24, 39, 75, .2);
  font-size: .84rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  z-index: 40;
}

.help-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + .18rem);
  transform: translateX(-50%);
  border: .35rem solid transparent;
  border-top-color: #19324d;
  opacity: 0;
  transition: opacity .16s ease;
  z-index: 40;
}

.help-tip:hover::after,
.help-tip:hover::before,
.help-tip:focus-visible::after,
.help-tip:focus-visible::before {
  opacity: 1;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}

.panel-head h3 {
  margin: 0;
  letter-spacing: -.02em;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}

.panel-actions a[role="button"],
.filter-actions a[role="button"],
.filter-actions button,
.form-actions button,
.form-actions a[role="button"],
.row-actions button,
.row-actions a[role="button"],
.actions button,
.actions a[role="button"] {
  width: auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .62rem .95rem;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(24, 39, 75, .08);
}

.row-actions,
.actions {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}

.row-actions form,
.actions form {
  margin: 0;
}

.action-btn {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: -.01em;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, border-color .12s ease;
}

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

.row-actions .action-btn,
.actions .action-btn {
  padding: .42rem .72rem;
  font-size: .78rem;
  line-height: 1.1;
  box-shadow: 0 6px 14px rgba(24, 39, 75, .08);
}

.action-btn.is-view {
  background: #eef3fb;
  border-color: #c6d9f2;
  color: #23486e;
}

.action-btn.is-edit {
  background: #eaf3ff;
  border-color: #9dc2ff;
  color: #0b5bd3;
}

.action-btn.is-send {
  background: #edf8f2;
  border-color: #9bd6b0;
  color: #1d6b42;
}

.action-btn.is-enable {
  background: #edf8f2;
  border-color: #8fceaa;
  color: #1c6b41;
}

.action-btn.is-disable {
  background: #fff6e8;
  border-color: #f0ca8f;
  color: #9a5b06;
}

.action-btn.is-delete {
  background: #fff0f0;
  border-color: #efb2b6;
  color: #b42318;
}

.action-btn.is-neutral {
  background: #f2f5f9;
  border-color: #d7e0ea;
  color: #42576d;
}

.metric-grid {
  display: grid;
  gap: .85rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card {
  padding: .95rem 1rem;
  border: 1px solid #dbe6f1;
  border-radius: .95rem;
  background: rgba(255, 255, 255, .92);
}

.metric-card small {
  display: block;
  margin-bottom: .35rem;
  color: var(--admin-muted);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.05;
  letter-spacing: -.03em;
  color: #10243a;
}

.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

.stat-table th,
.stat-table td {
  padding: .62rem .72rem;
  border-bottom: 1px solid #e4ebf2;
  text-align: left;
  white-space: nowrap;
}

.stat-table thead th {
  color: var(--admin-muted);
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

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

.pager-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .9rem;
}

.pager-summary {
  color: var(--admin-muted);
  font-size: .9rem;
}

.pager-links {
  display: flex;
  gap: .45rem;
  align-items: center;
  flex-wrap: wrap;
}

.pager-links a,
.pager-links span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.3rem;
  height: 2.2rem;
  padding: 0 .8rem;
  border: 1px solid #d6e0ea;
  border-radius: .8rem;
  background: rgba(255, 255, 255, .95);
  color: #24354d;
  text-decoration: none;
}

.pager-links span.is-current {
  color: #0f3f88;
  background: #e7f0ff;
  border-color: #b9cffb;
  font-weight: 700;
}

.panel-kicker {
  display: inline-flex;
  align-items: center;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: #edf4fb;
  color: #294866;
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.table-panel {
  width: calc(100vw - 2rem);
  margin-left: calc(50% - 50vw + 1rem);
  margin-right: calc(50% - 50vw + 1rem);
  border-radius: 1.15rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #e3ebf3;
  border-radius: .95rem;
  background: rgba(255, 255, 255, .88);
}

.table-wrap table {
  width: 100%;
  font-size: .84rem;
}

.table-wrap th,
.table-wrap td {
  padding: .58rem .7rem;
}

.table-wrap thead th {
  color: var(--admin-muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: .8rem;
}

a {
  color: var(--admin-link);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .18rem .48rem;
  border-radius: .7rem;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 0;
  box-shadow: none;
}

.badge::before {
  content: "";
  width: .42rem;
  height: .42rem;
  border-radius: 999px;
  background: currentColor;
  opacity: .9;
}

.badge.is-success { background: #edf8f2; color: #17663a; }
.badge.is-warning { background: #fff7e7; color: #8a5a00; }
.badge.is-danger { background: #fff0f0; color: #b42318; }
.badge.is-muted { background: #f1f4f8; color: #5f7083; }
.badge.is-accent { background: #eef4ff; color: #1b57b7; }

.gridjs-wrapper {
  border: 1px solid #dbe6f1;
  border-radius: .95rem;
  overflow: hidden;
  background: rgba(255, 255, 255, .92);
  font-size: .84rem;
}

.gridjs-wrapper table td,
.gridjs-wrapper table th {
  white-space: nowrap;
  padding: .56rem .66rem !important;
}

.gridjs-head {
  padding: .3rem .2rem .65rem;
}

.gridjs-search-input {
  border-radius: .8rem;
}

.gridjs-footer {
  background: #f7fafc;
  color: #405266;
}

.gridjs-summary {
  color: #405266;
}

.gridjs-pages button {
  color: #24354d;
  background: #fff;
  border-color: #d6e0ea;
}

.gridjs-pages button:hover {
  background: #edf4fb;
}

.gridjs-pages button.gridjs-currentPage {
  color: #0f3f88;
  background: #e7f0ff;
  border-color: #b9cffb;
}

.empty-note {
  color: var(--admin-muted);
}

@media (max-width: 720px) {
  .page-hero {
    padding: 1rem;
  }

  .section-card {
    padding: .95rem;
  }

  .filter-shell {
    padding: .9rem;
  }

  .table-panel {
    width: auto;
    margin-left: 0;
    margin-right: 0;
  }
}

@media (max-width: 980px) {
  .filter-grid,
  .filter-grid.is-two,
  .filter-grid.is-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 620px) {
  .filter-grid,
  .filter-grid.is-two,
  .filter-grid.is-three {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    justify-content: stretch;
  }

  .filter-actions a[role="button"],
  .filter-actions button,
  .form-actions button {
    width: 100%;
  }

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

  .pager-links {
    width: 100%;
  }

  .pager-links a,
  .pager-links span {
    flex: 1 1 auto;
  }
}
