/* Tarot admin — лёгкий нейтральный UI */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a1d26;
  --muted: #5c6370;
  --border: #e2e6ef;
  --accent: #6d28d9;
  --accent-soft: #ede9fe;
  --success: #059669;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(22, 30, 50, 0.06);
}

* {
  box-sizing: border-box;
}

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

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  min-height: 100vh;
}

.brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav a {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.main {
  flex: 1;
  padding: 1.75rem 2rem 3rem;
  max-width: 1200px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data th,
table.data td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.data th {
  background: #f8f9fc;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tr:hover td {
  background: #fafbfe;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-ok {
  background: #d1fae5;
  color: var(--success);
}

.badge-pending {
  background: #fef3c7;
  color: #b45309;
}

.badge-fail {
  background: #fee2e2;
  color: var(--danger);
}

form.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  min-width: 200px;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Страница входа (без сайдбара) */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.auth-card h1 {
  margin-bottom: 1.25rem;
  text-align: center;
}

.auth-card label {
  margin-bottom: 0.75rem;
}

.auth-card input {
  width: 100%;
  min-width: 0;
}

.auth-card button {
  width: 100%;
  margin-top: 0.5rem;
}

.error-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  margin-bottom: 1rem;
}

.success-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: var(--success);
  margin-bottom: 1rem;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 420px;
}

.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.stack-form input {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    min-height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .main {
    padding: 1rem;
  }
}
