:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #1b2430;
  --muted: #6b7280;
  --accent: #2f80ed;
  --shadow: 0 18px 40px rgba(20, 28, 40, 0.08);
  --radius: 18px;
  --danger: #b91c1c;
  --ok: #047857;
}

body {
  background: linear-gradient(180deg, #f7f9fc 0%, #eff3f8 60%, #ecf1f7 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans", sans-serif;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff 0%, #f2f7ff 55%, #eef6ff 100%);
  box-shadow: var(--shadow);
  border: 1px solid #e3e9f3;
}

.head h1 {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.1;
  font-weight: 600;
}

.head .meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
}

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

.card {
  background: var(--panel);
  border: 1px solid #e7edf6;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 600;
}

.card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 600;
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

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

.row.one {
  grid-template-columns: minmax(0, 1fr);
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #7b8593;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #dfe7f2;
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  font-size: 14px;
  line-height: 1.25;
  color: #1f2937;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3.2 5.2L7 9l3.8-3.8' fill='none' stroke='%23475569' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}

input::placeholder,
textarea::placeholder {
  color: #98a3b3;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #b8cdf1;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.12);
}

.actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.head .actions {
  margin-top: 0;
}

button,
.btn {
  border: 1px solid #d8e0ec;
  border-radius: 999px;
  padding: 9px 15px;
  background: #eef3f9;
  color: #445066;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button:hover,
.btn:hover {
  background: #e7edf7;
}

button.primary {
  border: 1px solid #111827;
  background: #111827;
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
}

button.primary:hover {
  background: #0b1220;
}

#registerRequestBtn {
  border: 0;
  background: #0f172a;
  color: #ffffff;
  min-height: 42px;
  padding: 10px 20px;
  font-size: 13px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.26);
}

#registerRequestBtn:hover {
  background: #020617;
}

#loginBtn {
  border: 0;
  background: #0f172a;
  color: #ffffff;
  min-height: 42px;
  padding: 10px 20px;
  font-size: 13px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.26);
}

#loginBtn:hover {
  background: #020617;
}

.actions--stack {
  width: 100%;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

#remindPinBtn.secondary-small {
  min-height: 34px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  background: #eef3f9;
  color: #445066;
  border: 1px solid #d8e0ec;
  box-shadow: none;
}

#remindPinBtn.secondary-small:hover {
  background: #e7edf7;
}

button.danger {
  border-color: #ffd7d7;
  background: #fff3f3;
  color: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f4f8ff;
  border: 1px solid #d8e4f5;
  font-size: 13px;
}

.msg.ok {
  color: var(--ok);
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.msg.err {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff1f2;
}

/* Keep top navigation button colors identical on Admin and Cron pages. */
.head .actions .btn,
.head .actions button {
  border: 1px solid #d8e0ec;
  background: #eef3f9;
  color: #445066;
}

.head .actions .btn:hover,
.head .actions button:hover {
  background: #e7edf7;
}

.head .actions button.danger {
  border-color: #ffd7d7;
  background: #fff3f3;
  color: var(--danger);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid #e6edf7;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  min-width: 980px;
}

th,
td {
  border-bottom: 1px solid #e5edf6;
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: #6b7280;
  font-weight: 600;
  background: #f8fbff;
  position: sticky;
  top: 0;
  z-index: 1;
}

#usersTable .telegram-cell {
  white-space: normal;
  min-width: 180px;
}

#usersTable .telegram-cell__line {
  display: block;
  line-height: 1.35;
}

#usersTable .telegram-cell__line + .telegram-cell__line {
  margin-top: 2px;
}

#usersTable th:nth-child(7),
#usersTable td:nth-child(7) {
  white-space: nowrap;
  width: 1%;
}

#usersTable td:nth-child(7) select[data-role] {
  min-width: 122px;
}

.chips {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  background: #f3f4f6;
  color: #111827;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d1d5db;
}

.chip input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #111827;
}

.auth-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  background: #f8fbff;
  border: 1px solid #e5edf8;
  border-radius: 12px;
  padding: 10px 12px;
}

.kpi__label {
  font-size: 11px;
  text-transform: uppercase;
  color: #7b8593;
}

.kpi__value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

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

  .auth-kpis {
    grid-template-columns: 1fr;
    order: 3;
  }

  .grid.grid--two {
    order: 2;
  }
}

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

  .page {
    padding: 12px;
  }

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