:root {
    --color-bg-1: #0f172a;
    --color-bg-2: #1e3a5f;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-entrada: #16a34a;
    --color-entrada-dark: #15803d;
    --color-saida: #ea580c;
    --color-saida-dark: #c2410c;
    --color-card: #ffffff;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-error-bg: #fef2f2;
    --color-error-text: #b91c1c;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

/* ---------- LOGIN ---------- */

.login-body {
    min-height: 100dvh;
    background: linear-gradient(160deg, var(--color-bg-1) 0%, var(--color-bg-2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 28px;
    text-align: center;
}

.brand-title {
    font-size: clamp(2rem, 8vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 4px;
    background: linear-gradient(135deg, var(--color-primary), #06b6d4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--color-text-muted);
    margin: 0 0 28px;
}

.login-form {
    text-align: left;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.field input,
.field select {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    background: #fff;
}

.btn {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    padding: 15px 20px;
    cursor: pointer;
    transition: transform 0.08s ease, filter 0.15s ease;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
}

.btn-block { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}
.btn-primary:hover { filter: brightness(1.08); }

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 18px;
    text-align: left;
}

.alert-error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid #fecaca;
}

/* ---------- APP (ABERTURA) ---------- */

.app-body {
    min-height: 100dvh;
    margin: 0;
    background: #f1f5f9;
    padding-bottom: 40px;
}

.app-header {
    background: linear-gradient(160deg, var(--color-bg-1) 0%, var(--color-bg-2) 100%);
    color: #fff;
    padding: 18px 20px 28px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
}

.app-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    font-size: 0.85rem;
}

.user-chip {
    background: rgba(255,255,255,0.12);
    padding: 6px 12px;
    border-radius: 999px;
}

.logout-link {
    color: #fecaca;
    text-decoration: none;
    font-weight: 600;
}

.app-title {
    font-size: clamp(1.3rem, 6vw, 1.9rem);
    font-weight: 800;
    text-align: center;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.app-subtitle {
    text-align: center;
    color: #cbd5e1;
    font-size: 0.95rem;
    margin: 0;
}

.app-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 0;
}

.ticket-field {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    max-width: 420px;
    margin: -18px auto 20px;
    text-align: center;
}

.ticket-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ticket-field input {
    width: 100%;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 14px 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
}

.ticket-field input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    background: #fff;
}

.panels {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 720px) {
    .panels {
        flex-direction: row;
    }
    .panel { flex: 1; }
}

.panel {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin: 0 0 16px;
}

.panel-entrada .panel-title { color: var(--color-entrada-dark); }
.panel-saida .panel-title { color: var(--color-saida-dark); }

.combo {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 42px;
}

.acesso-info {
    min-height: 22px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 4px 0 18px;
}

.btn-entrada {
    background: linear-gradient(135deg, var(--color-entrada), var(--color-entrada-dark));
}
.btn-entrada:hover { filter: brightness(1.08); }

.btn-saida {
    background: linear-gradient(135deg, var(--color-saida), var(--color-saida-dark));
}
.btn-saida:hover { filter: brightness(1.08); }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ---------- TOAST ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    background: #0f172a;
    color: #fff;
    padding: 14px 20px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: 90vw;
    text-align: center;
    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-success { background: var(--color-entrada-dark); }
.toast.toast-error { background: var(--color-saida-dark); }
