:root {
  --bg: #121212;
  --card: #1e1e1e;
  --accent: #ff9f43;
  --text: #e0e0e0;
  --muted: #94a3b8;
  --danger: #ff5252;
  --warning: #f1c40f;
  --success: #2ecc71;
  --border: #2f2f2f;
  --panel-soft: #2d2d2d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: #121212;
}

/* Login page (/). */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  background: var(--card);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 450px;
  text-align: center;
}

.logo {
  font-size: 2.5rem;
  font-weight: 700;
  color: #ff5454;
  margin-bottom: 10px;
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 30px;
}

.lang-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.lang-select {
  border-radius: 8px;
  border: 2px solid #333;
  background: var(--panel-soft);
  color: #fff;
  padding: 8px 10px;
}

.footer {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #555;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

input {
  width: 100%;
  padding: 14px;
  border-radius: 8px;
  border: 2px solid #333;
  background: var(--panel-soft);
  color: #fff;
  font-size: 1rem;
  transition: all 0.3s;
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-login {
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: #121212;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 10px;
}

.btn-login:hover {
  background: #ff8c1a;
  transform: translateY(-2px);
}

.error-msg {
  background: rgba(255, 82, 82, 0.15);
  border-left: 4px solid var(--danger);
  color: var(--danger);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  display: none;
}

.success-msg {
  background: rgba(46, 204, 113, 0.15);
  border-left: 4px solid var(--success);
  color: var(--success);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  display: none;
}

.lock-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 159, 67, 0.3);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Admin page (/admin). */
body.admin-page {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

main {
  width: min(1100px, 100%);
  background: transparent;
  border: 0;
  border-radius: 16px;
  padding: 0;
}

h1 { margin: 0 0 10px; font-size: 1.8rem; color: var(--text); }
p { margin: 0 0 10px; color: var(--muted); }
code { color: var(--accent); }

.row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--card);
  padding-bottom: 10px;
}
.top-row .lang-select { width: auto; min-width: 86px; }

body.admin-page button {
  border: none;
  border-radius: 26px;
  padding: 12px 20px;
  cursor: pointer;
  color: white;
  background: var(--accent);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.3s;
  min-height: 44px;
}

body.admin-page button:hover { transform: scale(1.05); }
body.admin-page button.secondary { background: #2d2d2d; }
body.admin-page button.secondary:hover { background: #455a64; }
body.admin-page button.danger { background: var(--danger); }
body.admin-page button.danger:hover { background: #ff1744; }

body.admin-page input,
body.admin-page select {
  width: 100%;
  border: 2px solid #333;
  background: #2d2d2d;
  color: white;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
}

body.admin-page input:focus,
body.admin-page select:focus {
  outline: none;
  border-color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin-top: 16px;
}

.card {
  background: var(--card);
  border: 0;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 14px;
  border-bottom: 4px solid var(--accent);
}

.card h3 {
  margin: 0 0 10px;
  color: var(--text);
}
.status-card {
  margin-top: 16px;
}

.metric-ok { color: var(--success); }
.metric-warn { color: var(--warning); }
.metric-danger { color: var(--danger); }

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.toolbar input, .toolbar select {
  width: auto;
  min-width: 120px;
  flex: 1 1 180px;
}

.users-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.users-table th,
.users-table td {
  border-bottom: 1px solid #2a2a2a;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.users-table th {
  cursor: pointer;
  user-select: none;
  color: #bbb;
  position: sticky;
  top: 0;
  background: #252525;
  z-index: 1;
}

.users-table tbody tr { cursor: pointer; }
.users-table tbody tr:hover { background: #2a2a2a; }
.users-table tbody tr.active { background: rgba(255, 159, 67, 0.2); }

.muted { color: var(--muted); }

/* Docs wiki route (/docs). */
body.admin-page[data-route-shell="docs"] #wikiLangSelect {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 40;
  width: auto;
  min-width: 72px;
  padding: 5px 9px;
  border: 1px solid #d0d7de;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: #6b7280;
  font-size: 0.8rem;
  box-shadow: none;
  opacity: 0.72;
}

body.admin-page[data-route-shell="docs"] #wikiLangSelect:hover,
body.admin-page[data-route-shell="docs"] #wikiLangSelect:focus {
  opacity: 0.95;
  color: #374151;
  background: rgba(255, 255, 255, 0.98);
}

body.admin-page[data-route-shell="docs"] .wiki-title,
body.admin-page[data-route-shell="docs"] .wiki-card h3,
body.admin-page[data-route-shell="docs"] .wiki-section h2,
body.admin-page[data-route-shell="docs"] .wiki-article h1,
body.admin-page[data-route-shell="docs"] .wiki-article h2,
body.admin-page[data-route-shell="docs"] .wiki-article h3,
body.admin-page[data-route-shell="docs"] .wiki-article h4,
body.admin-page[data-route-shell="docs"] .wiki-table th,
body.admin-page[data-route-shell="docs"] .wiki-table td,
body.admin-page[data-route-shell="docs"] .wiki-box h3 {
  color: #202122;
}

body.admin-page[data-route-shell="docs"] .wiki-title a,
body.admin-page[data-route-shell="docs"] .wiki-card h3 a,
body.admin-page[data-route-shell="docs"] .wiki-section h2 a,
body.admin-page[data-route-shell="docs"] .wiki-article h1 a,
body.admin-page[data-route-shell="docs"] .wiki-article h2 a,
body.admin-page[data-route-shell="docs"] .wiki-article h3 a,
body.admin-page[data-route-shell="docs"] .wiki-article h4 a,
body.admin-page[data-route-shell="docs"] .wiki-title a:hover,
body.admin-page[data-route-shell="docs"] .wiki-card h3 a:hover,
body.admin-page[data-route-shell="docs"] .wiki-section h2 a:hover,
body.admin-page[data-route-shell="docs"] .wiki-article h1 a:hover,
body.admin-page[data-route-shell="docs"] .wiki-article h2 a:hover,
body.admin-page[data-route-shell="docs"] .wiki-article h3 a:hover,
body.admin-page[data-route-shell="docs"] .wiki-article h4 a:hover {
  color: #202122;
}

body.admin-page[data-route-shell="docs"] .wiki-subtitle {
  color: #3a4046;
}

body.admin-page[data-route-shell="docs"] .wiki-note,
body.admin-page[data-route-shell="docs"] .wiki-note p,
body.admin-page[data-route-shell="docs"] .wiki-note li,
body.admin-page[data-route-shell="docs"] .wiki-note span,
body.admin-page[data-route-shell="docs"] .wiki-card p,
body.admin-page[data-route-shell="docs"] .wiki-box p,
body.admin-page[data-route-shell="docs"] .wiki-box li,
body.admin-page[data-route-shell="docs"] .wiki-table td p,
body.admin-page[data-route-shell="docs"] .wiki-table td li,
body.admin-page[data-route-shell="docs"] .wiki-table td span {
  color: #2f3438;
}

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

  body.admin-page[data-route-shell="docs"] #wikiLangSelect {
    top: 10px;
    right: 10px;
    min-width: 66px;
    padding: 4px 8px;
    font-size: 0.76rem;
  }
}

@media (max-width: 480px) {
  .login-container { padding: 30px 20px; }
  .logo { font-size: 2rem; }
}
