:root {
    --ml-yellow: #fff159;
    --ml-blue: #3483fa;
    --ml-blue-dark: #2968c8;
    --ml-green: #00a650;
    --bg: #f5f5f5;
    --card: #ffffff;
    --text: #333333;
    --text-light: #777777;
    --border: #e5e5e5;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --radius: 8px;
}

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

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

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

/* Header */
.topbar {
    background: var(--ml-yellow);
    padding: 16px 24px;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.logo {
    font-size: 22px;
    font-weight: 700;
    color: #2d3277;
}
.search-form {
    display: flex;
    flex: 1;
    max-width: 480px;
}
.search-form input {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 14px;
}
.search-form button {
    background: white;
    border: none;
    padding: 0 16px;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    font-weight: 600;
    color: var(--ml-blue);
}

/* Categorias */
.categories {
    max-width: 1100px;
    margin: 16px auto 0;
    padding: 0 24px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.categories a {
    background: var(--card);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    box-shadow: var(--shadow);
    color: var(--text-light);
}
.categories a.active {
    background: var(--ml-blue);
    color: white;
}

/* Grid de produtos */
.container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 24px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease;
}
.card:hover { transform: translateY(-3px); }
.card img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background: white;
    padding: 12px;
}
.card-body {
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.card-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    min-height: 40px;
}
.card-price {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}
.card-cat {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
}
.btn-buy {
    margin-top: auto;
    background: var(--ml-blue);
    color: white;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
}
.btn-buy:hover { background: var(--ml-blue-dark); }

.empty {
    text-align: center;
    color: var(--text-light);
    padding: 60px 0;
}

footer {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
    font-size: 13px;
}

/* ===================== ADMIN ===================== */
.admin-body { background: #f2f4f7; min-height: 100vh; }
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: #1e2a4a;
    color: white;
    padding: 20px 0;
    flex-shrink: 0;
}
.sidebar h2 { padding: 0 20px 20px; font-size: 18px; }
.sidebar a {
    display: block;
    padding: 12px 20px;
    color: #c3cbe0;
    font-size: 14px;
}
.sidebar a:hover, .sidebar a.active { background: #2a3a63; color: white; }
.admin-main { flex: 1; padding: 28px; }
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.admin-header h1 { font-size: 22px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.stat-card .label { font-size: 13px; color: var(--text-light); }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }

.panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 24px;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
table th { color: var(--text-light); font-weight: 600; font-size: 13px; }

.badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-pendente { background: #fff3cd; color: #856404; }
.badge-aprovada { background: #d4edda; color: #155724; }
.badge-cancelada { background: #f8d7da; color: #721c24; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.btn-primary { background: var(--ml-blue); color: white; }
.btn-primary:hover { background: var(--ml-blue-dark); }
.btn-danger { background: #e63757; color: white; }
.btn-secondary { background: #eef0f4; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ml-blue), #2d3277);
}
.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 360px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.login-box h1 { font-size: 20px; margin-bottom: 24px; text-align: center; }
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error { background: #f8d7da; color: #721c24; }
.alert-success { background: #d4edda; color: #155724; }

/* Teclado numérico de PIN */
.pin-box { max-width: 320px; text-align: center; }
.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 10px 0 28px;
}
.pin-dots .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--ml-blue);
    background: transparent;
    transition: background 0.15s ease;
}
.pin-dots .dot.filled { background: var(--ml-blue); }

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.keypad .key {
    padding: 18px 0;
    font-size: 20px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: #f1f3f8;
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s ease;
}
.keypad .key:active { background: #dfe3ee; }
.keypad .key-action { background: #e9ecf3; color: var(--text-light); font-size: 16px; }

.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters input, .filters select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

@media (max-width: 700px) {
    .admin-wrap { flex-direction: column; }
    .sidebar { width: 100%; display: flex; overflow-x: auto; padding: 10px; }
    .sidebar h2 { display: none; }
    .sidebar a { white-space: nowrap; padding: 8px 14px; }
    .form-row { grid-template-columns: 1fr; }
}
