:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', system-ui, sans-serif; 
}

html, body { 
    touch-action: pan-x pan-y;
    overscroll-behavior: none;
    user-select: none;
    -webkit-user-select: none;
    background: var(--bg-main); 
    color: var(--text-dark); 
    display: flex;
    flex-direction: column; 
    min-height: 100vh;
    font-size: 0.75rem;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

input, textarea, select {
    user-select: text !important;
    -webkit-user-select: text !important;
    font-size: 16px !important;
}

.navbar { 
    background: #0f172a; 
    color: white; 
    padding: 0.4rem 1rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 6px; 
    position: sticky;
    top: 0;
    z-index: 10000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.navbar h1 { font-size: 0.9rem; }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a { color: #f1f5f9; text-decoration: none; font-size: 0.72rem; font-weight: 500; }
.btn-logout { background: var(--danger); padding: 2px 8px; border-radius: 3px; }

.btn-refresh {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.container { 
    width: 99%; 
    max-width: 800px; 
    margin: 8px auto; 
    flex: 1; 
}
.card { 
    background: var(--card-bg); 
    border-radius: 4px; 
    padding: 10px; 
    margin-bottom: 10px; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.04); 
    border: 1px solid var(--border); 
}
.card h3 { font-size: 0.85rem; margin-bottom: 8px; }

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
    gap: 10px; 
}

.form-group { margin-bottom: 6px; }
.form-group label { display: block; font-size: 0.7rem; font-weight: 600; margin-bottom: 2px; }
.form-group input, 
.form-group select, 
.form-group textarea { 
    width: 100%; 
    height: 28px; 
    padding: 2px 6px; 
    border: 1px solid var(--border); 
    border-radius: 4px; 
    font-size: 0.75rem; 
}

.btn { 
    height: 28px; 
    border: none; 
    border-radius: 4px; 
    padding: 0 10px; 
    font-size: 0.72rem;
    font-weight: 600; 
    cursor: pointer; 
    color: white; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    text-decoration: none; 
}
.btn-primary { background: var(--primary); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); }
.btn-danger { background: var(--danger); }
.btn-block { width: 100%; }

table { width: 100%; border-collapse: collapse; margin-top: 4px; }
th, td { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.73rem; }
th { background: #f1f5f9; font-weight: 600; font-size: 0.7rem; text-transform: uppercase; }

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-micro th, 
.table-micro td {
    text-align: center !important;
    vertical-align: middle !important;
}

.code-bon {
    font-size: 0.60rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: -0.5px;
    white-space: nowrap;
    background: #f1f5f9;
    padding: 1px 3px;
    border-radius: 3px;
    display: inline-block;
}

.truncate {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-micro {
    height: 24px;
    padding: 0 6px;
    font-size: 0.7rem;
}

.badge { padding: 1px 5px; border-radius: 3px; font-size: 0.65rem; font-weight: bold; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fee2e2; color: #b91c1c; }

.edit-row td {
    background-color: #fefce8 !important;
    padding: 4px !important;
}

.form-control-sm {
    height: 26px;
    padding: 2px 4px;
    font-size: 0.72rem;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 3px;
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 2px 4px;
    margin-top: 6px;
    border-top: 1px solid var(--border);
}

.btn-page {
    background: #f1f5f9;
    border: 1px solid var(--border);
    color: var(--text-dark);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.72rem;
    font-weight: bold;
    color: var(--text-muted);
}

footer { 
    background: #0f172a; 
    color: #94a3b8; 
    text-align: center; 
    padding: 6px; 
    font-size: 0.7rem; 
    margin-top: auto; 
}

.dropdown-menu-container { 
    position: relative; 
    display: inline-block; 
}

.dropdown-content { 
    display: none; 
    position: absolute; 
    left: 0; 
    top: 100%; 
    margin-top: 5px; 
    background-color: #ffffff; 
    min-width: 260px; 
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2); 
    border-radius: 6px; 
    z-index: 10001; 
    border: 1px solid #e5e7eb; 
}

.dropdown-content a { 
    color: #1f2937; 
    padding: 10px 14px; 
    text-decoration: none; 
    display: block; 
    font-size: 0.85rem; 
    border-bottom: 1px solid #f3f4f6; 
    cursor: pointer; 
}

.dropdown-content a:hover { 
    background-color: #f1f5f9; 
    color: #2563eb; 
}

.dropdown-content.show { 
    display: block; 
}
