*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f13;
  --surface: #1a1a22;
  --surface2: #22222d;
  --border: #2e2e3d;
  --red: #e53935;
  --red-hover: #c62828;
  --green: #2e7d32;
  --orange: #e65100;
  --text: #e8e8f0;
  --text-muted: #888;
  --sidebar-w: 220px;
}

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

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-logo {
  padding: 16px 16px 14px;
  font-size: 18px;
  font-weight: bold;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.nav-links {
  list-style: none;
  flex: 1;
  padding: 12px 0;
}

.nav-links li a {
  display: block;
  padding: 12px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-links li a:hover,
.nav-links li a.active {
  background: var(--surface2);
  color: var(--text);
  border-left-color: var(--red);
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.sidebar-username {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.btn-logout-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.btn-logout-icon:hover { color: var(--red); background: rgba(229,57,53,0.1); }

/* ── Main content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 28px;
  max-width: calc(100vw - var(--sidebar-w));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Page header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.page-header h1 { font-size: 22px; font-weight: 700; }

/* ── Auth pages ─────────────────────────────────────────── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
}

.auth-card-wide {
  max-width: 640px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo-text {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo-accent { color: var(--red); }

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-link a {
  color: var(--red);
  text-decoration: none;
  font-weight: 500;
}

.auth-link a:hover { text-decoration: underline; }



/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.card-header {
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.card-body {
  padding: 20px;
}

/* ── Status grid ────────────────────────────────────────── */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.status-value {
  font-size: 15px;
  font-weight: 600;
}

.text-warning { color: var(--orange); }

/* ── Credentials ────────────────────────────────────────── */
.credential-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.credential-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.credential-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 60px;
}

.credential-value {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
}

.btn-copy {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
  line-height: 1;
}

.btn-copy:hover { background: var(--border); }
.btn-copy.copied { color: #4caf50; }

/* ── Update details ─────────────────────────────────────── */
.update-form-details > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--red);
  user-select: none;
  padding: 4px 0;
}

.update-form-details > summary:hover { text-decoration: underline; }

/* ── Forms ──────────────────────────────────────────────── */
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 10px;
}

.form-section-title:first-child { margin-top: 0; }

.form-section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

input:focus { border-color: var(--red); }
input.input-error { border-color: var(--red); }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--red);
  color: #fff;
}

/* ── Logo preview ───────────────────────────────────────── */
.logo-preview-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.logo-preview {
  max-height: 80px;
  max-width: 200px;
  object-fit: contain;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}

.hint-text {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-primary:hover { background: var(--red-hover); }

.btn-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-outline:hover { background: var(--surface2); color: var(--text); }

.btn-sm { padding: 6px 14px; font-size: 12px; }

.btn-block { width: 100%; text-align: center; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-error {
  background: rgba(229, 57, 53, 0.12);
  border-color: rgba(229, 57, 53, 0.35);
  color: #ff8a80;
}

.alert-success {
  background: rgba(46, 125, 50, 0.12);
  border-color: rgba(46, 125, 50, 0.35);
  color: #69f0ae;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active { background: rgba(46,125,50,0.2); color: #69f0ae; }
.badge-cancelled { background: rgba(229,57,53,0.15); color: #ff8a80; }
.badge-suspended { background: rgba(230,81,0,0.15); color: #ffab40; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 500px) {
  .auth-card { padding: 28px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Login history table ─────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.login-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.login-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-table tbody tr:hover { background: var(--surface2); }

