@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #12161d;
    --surface: #1a212b;
    --surface-2: #212a36;
    --border: #2a333f;
    --text: #e9ecf1;
    --text-muted: #8b93a3;
    --accent: #d4a13d;
    --accent-dim: #8a6a2a;
    --positive: #4fb787;
    --negative: #e0705f;
    --radius: 10px;
}

[data-theme="light"] {
    --bg: #f5f3ee;
    --surface: #ffffff;
    --surface-2: #f0eee6;
    --border: #ddd8cc;
    --text: #1e1b16;
    --text-muted: #6c6558;
    --accent: #b07f2e;
    --accent-dim: #d4a13d;
    --positive: #2f8f66;
    --negative: #c14a3a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    transition: background 0.2s, color 0.2s;
}

a { color: inherit; text-decoration: none; }

.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topnav-brand {
    font-weight: 700;
    font-size: 20px;
    color: var(--accent);
    letter-spacing: 0.5px;
}
.topnav-links { display: flex; gap: 20px; }
.topnav-links a {
    color: var(--text-muted);
    font-weight: 500;
    padding: 6px 4px;
    border-bottom: 2px solid transparent;
}
.topnav-links a:hover { color: var(--text); }
.topnav-user {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-size: 14px;
}
.logout-link {
    color: var(--negative);
    font-weight: 500;
}
.theme-toggle-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 20px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}
.theme-toggle-btn:hover { border-color: var(--accent); }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at top, rgba(212, 161, 61, 0.08), transparent 60%),
        var(--bg);
}
.login-box {
    width: 100%;
    max-width: 380px;
    padding: 40px 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
}
.brand {
    margin: 0 0 4px;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
}
.subtitle {
    margin: 0 0 28px;
    color: var(--text-muted);
    text-align: center;
    font-size: 14px;
}
.login-box form label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin: 16px 0 6px;
}
.login-box form input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
}
.login-box form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 161, 61, 0.15);
}
.login-box button {
    width: 100%;
    margin-top: 24px;
    padding: 12px;
    background: var(--accent);
    color: #1a1204;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.login-box button:hover { background: #e0ac47; }
.login-box button:focus-visible { outline: 3px solid rgba(212, 161, 61, 0.4); }
.help-text {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
}
.alert-error {
    background: rgba(224, 112, 95, 0.12);
    border: 1px solid rgba(224, 112, 95, 0.35);
    color: var(--negative);
}
.login-theme-toggle {
    position: absolute;
    top: 14px;
    left: 14px;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}
.page-header h1 {
    margin: 0 0 2px;
    font-size: 24px;
    font-weight: 700;
}
.page-header .subtitle {
    text-align: right;
    margin: 0 0 24px;
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.balance-banner {
    padding: 18px 22px;
    border-radius: var(--radius);
    font-size: 16px;
    margin-bottom: 24px;
    border: 1px solid;
}
.balance-banner strong {
    font-size: 20px;
    margin-inline-start: 6px;
}
.balance-banner.positive {
    background: rgba(79, 183, 135, 0.08);
    border-color: rgba(79, 183, 135, 0.35);
    color: var(--positive);
}
.balance-banner.negative {
    background: rgba(224, 112, 95, 0.08);
    border-color: rgba(224, 112, 95, 0.35);
    color: var(--negative);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-label {
    font-size: 12.5px;
    color: var(--text-muted);
}
.stat-value {
    font-size: 22px;
    font-weight: 600;
}

.section h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--text-muted);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 13.5px;
}
.data-table th, .data-table td {
    padding: 10px 14px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12.5px;
    background: var(--surface-2);
}
.data-table tr:last-child td { border-bottom: none; }
.order-text { color: var(--text); max-width: 260px; }
.person-phone {
    display: block;
    color: var(--text-muted);
    font-size: 11.5px;
    margin-top: 2px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-pending { background: rgba(212, 161, 61, 0.15); color: var(--accent); }
.badge-confirmed { background: rgba(79, 183, 135, 0.15); color: var(--positive); }
.badge-cancelled { background: rgba(224, 112, 95, 0.15); color: var(--negative); }

@media (max-width: 640px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .topnav-links { display: none; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .order-text { max-width: 140px; }
}

.qr-box {
    max-width: 420px;
    margin: 40px auto;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}
.status-line {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.status-ok {
    color: var(--positive);
    font-weight: 600;
    font-size: 18px;
}
#qr-image {
    width: 100%;
    max-width: 280px;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}
.secondary-btn {
    margin-top: 20px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    font-family: inherit;
    cursor: pointer;
}
.secondary-btn:hover { border-color: var(--accent); color: var(--accent); }
