:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --line: #d8dee8;
  --text: #1f2633;
  --muted: #687385;
  --brand: #5865f2;
  --brand-dark: #4551d6;
  --danger: #c3392c;
  --ok: #267a45;
  --warn: #a86500;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 20px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.developer-info {
  display: grid;
  gap: 3px;
  flex: 1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  margin-bottom: 16px;
  font-size: 18px;
}

header p,
.muted,
td span {
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: flex;
  gap: 12px;
}

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

main {
  width: min(1280px, calc(100% - 40px));
  margin: 24px auto 48px;
}

.grid {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

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

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.login {
  max-width: 420px;
  margin: 80px auto;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #394150;
  font-size: 14px;
  font-weight: 650;
}

label small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #c7cfdb;
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--text);
  font: inherit;
  font-weight: 450;
}

textarea {
  resize: vertical;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.plan-grid {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 2fr) 120px;
  gap: 10px 12px;
  margin: 10px 0 12px;
}

.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check input {
  width: 18px;
  min-height: 18px;
}

.button-sort {
  display: grid;
  gap: 10px;
  margin: -4px 0 14px;
}

.button-sort-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f9fbff;
  cursor: grab;
}

.button-sort-item.dragging {
  opacity: 0.55;
}

.drag-handle {
  border-radius: 6px;
  padding: 5px 8px;
  background: #eef1f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.switch {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.switch input {
  width: 18px;
  min-height: 18px;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

a.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.secondary {
  background: #eef1f6 !important;
  color: var(--text) !important;
}

.danger {
  background: var(--danger);
}

.danger:hover {
  background: #a52f25;
}

.flash {
  margin-bottom: 16px;
  border: 1px solid #b7c0ff;
  border-radius: 8px;
  padding: 12px 14px;
  background: #eef1ff;
  color: #26307c;
  font-weight: 650;
}

.error {
  border-color: #f0bbb5;
  background: #fff0ee;
  color: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.active {
  background: #e9f7ee;
  color: var(--ok);
}

.expired {
  background: #f2f4f7;
  color: var(--muted);
}

.cancelled {
  background: #fff3df;
  color: var(--warn);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions form {
  display: flex;
  gap: 6px;
}

.actions input {
  width: 76px;
  min-height: 36px;
}

.actions button {
  min-height: 36px;
}

.toolbar,
.bulk-actions,
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
}

.toolbar label {
  min-width: min(100%, 300px);
  margin-bottom: 0;
}

.bulk-actions {
  align-items: center;
}

.select-box {
  width: 18px;
  min-height: 18px;
}

.pagination {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
}

.pagination a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 11px;
  background: #fff;
}

.pagination .disabled {
  color: var(--muted);
  pointer-events: none;
  opacity: 0.5;
}

.table-summary {
  margin: 8px 0 10px;
}

.scroll-table {
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.scroll-table table {
  border-collapse: separate;
  border-spacing: 0;
}

.scroll-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
}

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

@media (max-width: 860px) {
  header,
  .two,
  .row,
  .inline-form,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  header {
    display: grid;
    padding: 18px;
  }

  .developer-info {
    text-align: left;
  }

  main {
    width: min(100% - 24px, 1280px);
  }

  table:not(.scroll-table table),
  thead:not(.scroll-table thead),
  tbody:not(.scroll-table tbody),
  tr:not(.scroll-table tr),
  th:not(.scroll-table th),
  td:not(.scroll-table td) {
    display: block;
  }

  thead:not(.scroll-table thead) {
    display: none;
  }

  td:not(.scroll-table td) {
    border-bottom: 0;
    padding: 7px 0;
  }

  tr:not(.scroll-table tr) {
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
  }

  .toolbar,
  .bulk-actions,
  .pagination {
    align-items: stretch;
  }

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