:root {
    --primary: #0d6efd;
    --primary-dark: #0b5ed7;
    --bg: #f4f6fb;
    --card-bg: #ffffff;
    --border: #e3e7ef;
    --text: #1f2937;
    --muted: #6b7280;
    --danger: #dc3545;
    --green: #198754;
    --gray: #6c757d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

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

.sidebar {
    width: 230px;
    background: #101828;
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 20px 0;
}
.sidebar-brand { font-weight: 700; font-size: 1.1rem; padding: 0 20px 20px; }
.sidebar nav { display: flex; flex-direction: column; flex: 1; }
.sidebar nav a {
    color: #cbd5e1;
    padding: 12px 20px;
    text-decoration: none;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active { background: rgba(13,110,253,0.15); color: #fff; border-left-color: var(--primary); }
.sidebar-footer { padding: 15px 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; }
.admin-name { margin-bottom: 6px; color: #cbd5e1; }
.logout-link { color: #f87171; }

.content { flex: 1; padding: 30px 40px; max-width: 1100px; }

/* ---------- Page header ---------- */
.page-header { margin-bottom: 24px; }
.page-header h1 { margin: 0 0 4px; font-size: 1.6rem; }

/* ---------- Cards ---------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 22px 24px;
    margin-bottom: 24px;
}
.card h2 { margin-top: 0; font-size: 1.1rem; }

/* ---------- Stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group-full { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 8px; }
.checkbox-group { flex-direction: row; align-items: center; gap: 8px; }

label { font-weight: 600; font-size: 0.9rem; }
input[type=text], input[type=url], input[type=number], input[type=password],
input[type=file], input[type=color], select, textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
}
textarea { resize: vertical; }
input[type=color] { padding: 4px; height: 42px; }

.inline-form { display: flex; align-items: center; gap: 10px; }
.inline-form select { width: auto; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #eef1f6; color: var(--text); }
.btn-danger { background: #fdeaea; color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.review-text-cell { max-width: 320px; }
.icon-cell { font-size: 1.3rem; }
.table-logo { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.small-link { font-size: 0.85rem; word-break: break-all; }

/* ---------- Badges ---------- */
.badge { padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-green { background: #e7f8ee; color: var(--green); }
.badge-gray { background: #eef1f6; color: var(--gray); }
.badge-blue { background: #e8f1fe; color: var(--primary); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: #fdeaea; color: var(--danger); }

/* ---------- Login page ---------- */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #0d6efd, #101828);
}
.login-box {
    background: #fff; padding: 40px; border-radius: 12px; width: 340px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-box h1 { margin: 0 0 4px; font-size: 1.4rem; }
.login-box form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.logo-preview { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; margin-top: 8px; }

/* ---------- QR page ---------- */
.qr-card { text-align: center; }
.qr-box { display: flex; justify-content: center; margin: 20px 0; }
.qr-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

@media (max-width: 800px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px; }
    .sidebar nav { flex-direction: row; }
    .sidebar-footer { display: none; }
    .content { padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
}
