:root {
    /* Bamas brand palette (from logo) */
    --brand: #4B2FED;
    --brand-dark: #2A1694;
    --brand-light: #8C66FD;
    --brand-lighter: #CE98FD;
    --brand-gradient: linear-gradient(135deg, #4B2FED 0%, #7A4FF5 45%, #CE98FD 100%);
    --brand-gradient-soft: linear-gradient(135deg, #EFEBFF 0%, #F7EEFF 100%);

    --success: #1a7f5a;
    --success-dark: #145f43;
    --danger: #c0392b;
    --warn: #b8860b;

    --bg: #f6f5fb;
    --card: #ffffff;
    --text: #1e2430;
    --muted: #6b7280;
    --border: #e6e3f5;
    --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---- Brand mark (logo + wordmark), used on auth pages, nav, wizard ---- */
.brand-mark {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
}
.brand-mark img { width: 36px; height: 36px; display: block; }
.brand-mark-text { text-align: left; line-height: 1.15; }
.brand-mark-name { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand-mark-sub { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.03em; text-transform: uppercase; }

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 0.8rem 1.3rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    min-height: 44px; /* comfortable tap target */
}
.btn-primary { background: var(--brand-gradient); border-color: transparent; color: #fff; font-weight: 600; }
.btn-primary:hover, .btn-primary:active { filter: brightness(0.95); }
.btn-small { padding: 0.5rem 0.9rem; font-size: 0.85rem; min-height: 38px; }
.btn-whatsapp { background: #25d366; border-color: #25d366; color: #fff; }
.btn-block { display: block; width: 100%; }

/* ---- Forms (mobile-first: 16px+ inputs prevent iOS zoom) ---- */
input, select, textarea, button { font-family: inherit; }
input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="tel"], select, textarea {
    font-size: 16px;
}

/* ---- Auth pages ---- */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    background: var(--brand-gradient-soft);
}
.auth-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 4px 24px rgba(75,47,237,0.10);
}
.auth-card .brand-mark { margin-bottom: 1.4rem; justify-content: flex-start; }
.auth-card h1 { margin-top: 0; }
.auth-card form label, .settings-form label, .feedback-form label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}
.auth-card input, .settings-form input, .settings-form select,
.feedback-form input, .feedback-form textarea {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-weight: normal;
}
.auth-card input:focus, .settings-form input:focus, .feedback-form input:focus,
.feedback-form textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(75,47,237,0.12);
}

.alert { padding: 0.8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: #fdecea; color: var(--danger); }
.alert-warn { background: #fff8e6; color: var(--warn); }
.alert-success { background: #e9f9f0; color: var(--success-dark); }
.alert-info { background: #EFEBFF; color: var(--brand-dark); }

/* ---- Public scan page ---- */
.scan-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.25rem;
    background: var(--brand-gradient-soft);
}
.scan-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 24px rgba(75,47,237,0.10);
}
.scan-card .brand-mark { margin-bottom: 1rem; justify-content: center; }
.big-check { font-size: 3rem; color: var(--success); margin: 0.5rem 0; }
.star-row { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.5rem; }
.star-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 1.1rem;
    font-family: inherit;
    min-height: 44px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    text-align: left;
}
.star-btn:hover, .star-btn:active { border-color: var(--brand); background: var(--brand-gradient-soft); }
.star-glyphs { color: #f5a623; letter-spacing: 2px; }
.star-label { font-size: 0.85rem; color: var(--muted); }
.feedback-form textarea { resize: vertical; }

/* ---- Dashboard ---- */
.dash-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.dash-nav-links {
    display: flex;
    align-items: center;
}
.dash-nav-links a {
    margin-left: 1.2rem;
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}
.dash-nav-links a:hover { color: var(--brand); }
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    color: var(--brand-dark);
}
.dash-page { max-width: 900px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.dash-page h1 { margin-top: 0.2rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 1.2rem; text-align: center; box-shadow: 0 1px 6px rgba(75,47,237,0.06); }
.stat-card-alert { border: 1px solid var(--danger); }
.stat-number { font-size: 1.8rem; font-weight: 700; color: var(--brand-dark); }
.stat-card-alert .stat-number { color: var(--danger); }
.stat-label { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }

.bar-chart { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 2rem; }
.bar-row { display: flex; align-items: center; gap: 0.6rem; }
.bar-label { width: 30px; font-size: 0.85rem; }
.bar-track { flex: 1; background: #eee; border-radius: 6px; overflow: hidden; height: 14px; }
.bar-fill { background: var(--brand-gradient); height: 100%; }
.bar-count { width: 30px; text-align: right; font-size: 0.85rem; color: var(--muted); }

.simple-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.simple-table th, .simple-table td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }

.feedback-list { display: flex; flex-direction: column; gap: 1rem; }
.feedback-card { background: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: 0 1px 6px rgba(75,47,237,0.06); border-left: 4px solid var(--border); }
.feedback-card.status-new { border-left-color: var(--danger); }
.feedback-card.status-viewed { border-left-color: var(--warn); }
.feedback-card.status-resolved { border-left-color: var(--success); }
.feedback-card-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; }
.feedback-stars { color: #f5a623; letter-spacing: 1px; }
.feedback-from { font-weight: 600; margin: 0.4rem 0 0.2rem; }
.feedback-comment { margin: 0.2rem 0 0.8rem; }
.feedback-actions { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.inline-form select { padding: 0.5rem; border-radius: 8px; border: 1px solid var(--border); min-height: 38px; }

.qr-box { background: #fff; border-radius: var(--radius); padding: 2rem; text-align: center; max-width: 360px; }
.qr-box img { max-width: 100%; height: auto; border-radius: 8px; }
.qr-link { word-break: break-all; color: var(--muted); font-size: 0.85rem; margin: 0.8rem 0 1.2rem; }
.qr-box .btn { margin: 0.3rem; }

/* ---- Plans ---- */
.plan-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    margin: 0.5rem 0 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 1px 6px rgba(75,47,237,0.06);
}
.plan-pill-paid { border-left: 4px solid var(--brand); }
.plan-pill-free { border-left: 4px solid var(--border); }
.plan-pill-link {
    background: var(--brand-gradient);
    color: #fff;
    padding: 0.35rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.plan-card { background: #fff; border-radius: var(--radius); padding: 1.5rem; box-shadow: 0 1px 6px rgba(75,47,237,0.06); border: 2px solid transparent; }
.plan-card-current { border-color: var(--brand); }
.plan-card h2 { margin-top: 0; }
.plan-price { font-size: 1.6rem; font-weight: 700; color: var(--brand-dark); margin: 0.2rem 0 1rem; }
.plan-features { list-style: none; padding: 0; margin: 0 0 1rem; }
.plan-features li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.plan-features li:last-child { border-bottom: none; }
.plan-badge { display: inline-block; background: var(--brand-gradient-soft); color: var(--brand-dark); padding: 0.3rem 0.7rem; border-radius: 8px; font-size: 0.8rem; font-weight: 600; }

/* ---- Admin panel ---- */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { padding: 0.7rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: middle; }
.admin-table th { background: var(--brand-gradient-soft); font-weight: 700; }
.badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 6px; font-size: 0.78rem; font-weight: 600; }
.badge-free { background: #eee; color: var(--muted); }
.badge-paid { background: var(--brand-gradient-soft); color: var(--brand-dark); }
.badge-active { background: #e9f9f0; color: var(--success-dark); }
.badge-suspended { background: #fdecea; color: var(--danger); }
.admin-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.admin-actions form { display: inline; }

/* ---- Printable poster ---- */
.poster-page { display: flex; flex-direction: column; align-items: center; padding: 2rem 1rem; }
.poster {
    border: 2px solid var(--brand);
    border-radius: var(--radius);
    padding: 2.5rem 1.75rem;
    text-align: center;
    max-width: 420px;
    width: 100%;
    background: #fff;
}
.poster img { max-width: 100%; height: auto; }
.poster .brand-mark { justify-content: center; margin-bottom: 1rem; }
.poster h1 { font-size: 1.6rem; margin-top: 0; }
.poster-business { font-weight: 700; margin-top: 1rem; }
.poster-instruction { color: var(--muted); }
.no-print { margin-top: 1.5rem; }
@media print {
    .no-print { display: none; }
    body { background: #fff; }
}

/* ---- Setup wizard ---- */
.wizard-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    background: var(--brand-gradient-soft);
}
.wizard-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 4px 24px rgba(75,47,237,0.10);
}
.wizard-card .brand-mark { margin-bottom: 1.2rem; }
.wizard-steps {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
}
.wizard-steps span {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: var(--border);
}
.wizard-steps span.done, .wizard-steps span.active { background: var(--brand-gradient); }
.check-list { list-style: none; padding: 0; margin: 1rem 0; }
.check-list li { padding: 0.5rem 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.check-list li:last-child { border-bottom: none; }
.check-ok { color: var(--success); font-weight: 700; }
.check-fail { color: var(--danger); font-weight: 700; }
.check-pending { color: var(--muted); }

/* ---- Mobile nav (hamburger) ---- */
@media (max-width: 640px) {
    .nav-toggle { display: block; }
    .dash-nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 1.25rem 1rem;
        box-shadow: 0 6px 16px rgba(0,0,0,0.06);
        z-index: 20;
    }
    .dash-nav-links.open { display: flex; }
    .dash-nav-links a { margin-left: 0; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
    .dash-nav-links a:last-child { border-bottom: none; }

    .auth-card, .scan-card, .wizard-card { padding: 1.5rem 1.1rem; }
    .feedback-actions { flex-direction: column; align-items: stretch; }
    .feedback-actions .btn, .feedback-actions .inline-form { width: 100%; }
    .inline-form select { width: 100%; }
    .admin-table-wrap { overflow-x: auto; }
    .plan-pill { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
