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

:root {
    --primary: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #4caf50;
    --danger: #d32f2f;
    --warning: #f57c00;
    --info: #1976d2;
    --gray: #757575;
    --light: #f5f5f5;
    --white: #fff;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light);
    color: #333;
    font-size: 14px;
}

/* Login */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
}
.login-container {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 380px;
    text-align: center;
}
.login-logo h1 { color: var(--primary-dark); font-size: 28px; margin-bottom: 4px; }
.login-logo p { color: var(--gray); margin-bottom: 24px; }
.login-footer { margin-top: 20px; color: var(--gray); font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 14px; outline: none;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 2px rgba(46,125,50,0.15);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* Buttons */
.btn {
    padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer;
    font-size: 14px; font-weight: 600; display: inline-flex; align-items: center;
    gap: 6px; transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #b71c1c; }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-info { background: var(--info); color: var(--white); }
.btn-secondary { background: var(--gray); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Alert */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #ffebee; color: var(--danger); border: 1px solid #ffcdd2; }
.alert-success { background: #e8f5e9; color: var(--primary-dark); border: 1px solid #c8e6c9; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px; background: var(--primary-dark); color: var(--white);
    padding: 20px 0; flex-shrink: 0; position: fixed; height: 100vh;
    overflow-y: auto;
}
.sidebar-brand { padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 10px; }
.sidebar-brand h2 { font-size: 18px; }
.sidebar-brand small { opacity: 0.7; font-size: 11px; }
.sidebar a {
    display: block; padding: 12px 20px; color: rgba(255,255,255,0.8);
    text-decoration: none; font-size: 14px; transition: all 0.2s;
}
.sidebar a:hover, .sidebar a.active {
    background: rgba(255,255,255,0.1); color: var(--white);
}
.sidebar .sidebar-section { padding: 8px 20px 4px; font-size: 11px; text-transform: uppercase; opacity: 0.5; }

.main-content { margin-left: 220px; flex: 1; padding: 20px 24px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h2 { font-size: 22px; color: var(--primary-dark); }

/* Table */
.table-container { background: var(--white); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--primary); color: var(--white); padding: 12px; text-align: left; font-size: 13px; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:hover { background: #f9f9f9; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* POS Layout */
.pos-layout { display: flex; gap: 16px; height: calc(100vh - 80px); }
.pos-products { flex: 1; display: flex; flex-direction: column; }
.pos-cart { width: 420px; background: var(--white); border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; }

.pos-search { margin-bottom: 12px; }
.pos-search input {
    width: 100%; padding: 12px 16px; border: 2px solid var(--primary);
    border-radius: 8px; font-size: 16px; outline: none;
}
.pos-search input:focus { box-shadow: 0 0 0 3px rgba(46,125,50,0.2); }

.product-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px; overflow-y: auto; flex: 1; padding: 4px;
}
.product-card {
    background: var(--white); border: 1px solid var(--border); border-radius: 8px;
    padding: 14px; cursor: pointer; transition: all 0.2s; text-align: center;
}
.product-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.product-card .name { font-weight: 600; font-size: 13px; margin-bottom: 6px; word-break: break-word; }
.product-card .price { color: var(--primary); font-weight: 700; font-size: 15px; }
.product-card .stock { color: var(--gray); font-size: 11px; margin-top: 4px; }
.product-card.out-of-stock { opacity: 0.5; pointer-events: none; }

/* Cart */
.cart-header { padding: 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; color: var(--primary-dark); }
.cart-items { flex: 1; overflow-y: auto; padding: 8px; }
.cart-item {
    display: flex; align-items: center; gap: 8px; padding: 8px;
    border-bottom: 1px solid var(--border); font-size: 13px;
}
.cart-item .item-info { flex: 1; }
.cart-item .item-name { font-weight: 600; }
.cart-item .item-price { color: var(--gray); font-size: 12px; }
.cart-item .item-qty {
    display: flex; align-items: center; gap: 4px;
}
.cart-item .item-qty button {
    width: 26px; height: 26px; border: 1px solid var(--border);
    background: var(--light); border-radius: 4px; cursor: pointer;
    font-size: 14px; font-weight: 700;
}
.cart-item .item-qty input {
    width: 40px; text-align: center; border: 1px solid var(--border);
    border-radius: 4px; padding: 4px; font-size: 13px;
}
.cart-item .item-subtotal { font-weight: 700; min-width: 80px; text-align: right; }
.cart-item .item-remove { color: var(--danger); cursor: pointer; font-size: 16px; padding: 4px; }

.cart-summary { padding: 12px 16px; border-top: 2px solid var(--primary); background: #f9f9f9; }
.cart-summary .summary-row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.cart-summary .summary-row.total { font-size: 18px; font-weight: 700; color: var(--primary-dark); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

.cart-actions { padding: 12px 16px; display: flex; gap: 8px; border-top: 1px solid var(--border); }
.cart-actions .btn { flex: 1; justify-content: center; }

/* Modal */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1000; justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--white); border-radius: 12px; padding: 24px;
    width: 460px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal h3 { margin-bottom: 16px; color: var(--primary-dark); }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; }

/* Badge */
.badge {
    display: inline-block; padding: 3px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
}
.badge-success { background: #e8f5e9; color: var(--primary-dark); }
.badge-danger { background: #ffebee; color: var(--danger); }

/* Misc */
.empty-state { text-align: center; padding: 40px; color: var(--gray); }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }

/* GR Form */
.gr-items-table th, .gr-items-table td { padding: 8px; }
.gr-items-table input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; }

/* Print styles */
@media print {
    body * { visibility: hidden; }
    #receipt, #receipt * { visibility: visible; }
    #receipt { position: absolute; left: 0; top: 0; width: 80mm; font-size: 12px; }
}

/* Discount input in cart */
.discount-row input {
    width: 70px; padding: 4px 8px; border: 1px solid var(--border);
    border-radius: 4px; text-align: right; font-size: 13px;
}
