/* static/styles.css */
:root {
    --primary: #0068c9;
    --primary-hover: #0053a0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
    background-color: var(--bg);
    color: var(--text);
    overscroll-behavior-y: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.app-container {
    max-width: 540px;
    margin: 0 auto;
    padding: 12px;
}

/* Barra Superior */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.logo-wrap {
    text-align: center;
    margin: 8px 0 12px 0;
}

.logo-wrap img {
    max-width: 130px;
    height: auto;
}

/* Tarjetas y Contenedores */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

h1 {
    font-size: 1.45rem;
    text-align: center;
    margin-bottom: 6px;
}

.subtitle-bar {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
    background: #f1f5f9;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* Inputs grandes para Pistola Escáner y Dedos */
label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: #334155;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="search"],
select {
    width: 100%;
    height: 58px;
    font-size: 20px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    margin-bottom: 12px;
    user-select: auto;
    -webkit-user-select: auto;
    transition: border-color 0.15s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Botones Táctiles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 54px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    margin-top: 4px;
    transition: opacity 0.15s, background-color 0.15s;
}

.btn:active {
    transform: scale(0.99);
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #1e293b;
}

.btn-danger {
    background-color: #fee2e2;
    color: var(--danger);
}

.btn-warning {
    background-color: #fef3c7;
    color: #b45309;
}

.btn-sm {
    height: 40px;
    font-size: 14px;
    padding: 0 12px;
    width: auto;
}

/* Selector de Modo de Escaneo (Radio Tabs) */
.mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.mode-tab {
    height: 46px;
    border: 2px solid var(--border);
    background: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-tab.active {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary);
}

/* Métricas y Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.metric-box {
    background: #f8fafc;
    border: 2px solid var(--border);
    border-radius: 8px;
    height: 58px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.metric-val {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

/* Alertas */
.alert {
    padding: 12px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 12px;
    text-align: center;
}

.alert-info { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

.badge-erp {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}
.badge-real { background: #dcfce7; color: #166534; }
.badge-draft { background: #fef3c7; color: #92400e; }

/* Tabla de Historial */
.table-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}

th, td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f1f5f9;
    font-weight: 700;
}

details {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

summary {
    font-weight: 700;
    cursor: pointer;
    padding: 4px 0;
}

.hidden {
    display: none !important;
}