:root {
  --bg: #050505;
  --surface: #111113;
  --surface-2: #17171a;
  --border: #232326;
  --text: #f2f2f3;
  --text-muted: #9a9aa2;
  --accent: #5865f2;
  --accent-hover: #6b74f5;
  --danger: #ed4245;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* Nav */

.navbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.navbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--text);
  font-weight: 600;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-user img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: block;
}

.nav-user .username {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.logout-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
}

.logout-link:hover {
  color: var(--text);
  border-color: var(--text-muted);
  text-decoration: none;
}

/* Centered page (login / no-access / error) */

main.main-center {
  display: flex;
  flex-direction: column;
}

.center-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 2rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.card h1 {
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 1.5rem;
}

.card .icon {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

/* Dashboard content */

main {
  flex: 1 0 auto;
  width: 100%;
}

main h1 {
  font-size: 1.4rem;
  margin: 0 0 1.5rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 600;
}

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

.stat-card .status-ok {
  color: #3ba55d;
}

.stat-card .status-missing {
  color: var(--danger);
}

.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.panel h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.panel li {
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}

.panel li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.panel .empty {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

@media (max-width: 480px) {
  .card {
    padding: 1.75rem 1.25rem;
  }
}

/* Custom commands: list + form */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
}

main .empty {
  color: var(--text-muted);
  font-size: 0.92rem;
}

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

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.data-table .actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.data-table .actions form {
  margin: 0;
  display: inline;
}

.link-danger {
  background: none;
  border: none;
  padding: 0;
  color: var(--danger);
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}

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

.container-narrow {
  max-width: 560px;
}

.form .form-group {
  margin-bottom: 1.25rem;
}

.form label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.form input[type='text'],
.form input[type='number'],
.form input[type='file'],
.form textarea,
.form select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
}

.form textarea {
  resize: vertical;
}

.form .hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0.4rem 0 0;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  margin: 0;
}

.checkbox-label input {
  width: auto;
}

.radio-row {
  display: flex;
  gap: 1.5rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  margin: 0;
}

.radio-label input {
  width: auto;
}

.form-error {
  background: rgba(237, 66, 69, 0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

.gif-preview {
  max-width: 160px;
  max-height: 160px;
  border-radius: 6px;
  display: block;
  margin-top: 0.5rem;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem;
  margin-top: 2rem;
}

.site-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.site-footer-inner a {
  color: var(--text-muted);
}

.site-footer-inner a:hover {
  color: var(--text);
}

.site-footer .dot {
  color: var(--border);
}

/* Legal pages */

.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1rem;
}

.legal-page h1 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.legal-page .updated {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 2rem;
}

.legal-page h2 {
  font-size: 1.05rem;
  margin: 2rem 0 0.75rem;
}

.legal-page p,
.legal-page li {
  color: #d3d3d6;
  font-size: 0.92rem;
  line-height: 1.7;
}

.legal-page ul {
  padding-left: 1.25rem;
}

.legal-page a {
  color: var(--accent);
}

.legal-page .back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
