/* ============================================================
   Exceptional Farms - Main Stylesheet
   Poultry & Agro Supplies Inventory Management
   Theme: Green & White
   ============================================================ */

:root {
    --bg-base:       #f3f8f4;
    --bg-surface:    #ffffff;
    --bg-card:       #ffffff;
    --bg-hover:      #eef6f0;
    --sidebar-w:     260px;
    --accent:        #16a34a;
    --accent-hover:  #15803d;
    --accent-glow:   rgba(22,163,74,0.14);
    --accent-soft:   #22c55e;
    --info:          #0891b2;
    --info-glow:     rgba(8,145,178,0.14);
    --success:       #16a34a;
    --warning:       #d97706;
    --danger:        #dc2626;
    --text-primary:  #16241a;
    --text-secondary:#54685b;
    --text-muted:    #8a9a8f;
    --border:        rgba(22,101,52,0.12);
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 4px 24px rgba(16,60,30,0.08);
    --font-head:     'Poppins', sans-serif;
    --font-body:     'DM Sans', sans-serif;
    --transition:    0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 28px;
    min-height: 100vh;
    background: var(--bg-base);
    transition: margin-left var(--transition);
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 20px rgba(16,60,30,0.04);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), #65a30d);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
    box-shadow: 0 0 20px var(--accent-glow);
    color: #fff;
    overflow: hidden;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-name {
    display: block;
    font-family: var(--font-head);
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.brand-sub {
    display: block;
    font-size: 10px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 3px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 4px 12px;
}

.nav-section-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    padding: 14px 8px 6px;
    text-transform: uppercase;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all var(--transition);
    position: relative;
}

.sidebar-nav .nav-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link span {
    flex: 1;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-hover);
    color: var(--accent-hover);
}

.sidebar-nav .nav-link.active {
    background: var(--accent-glow);
    color: var(--accent-hover);
    font-weight: 700;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    left: -12px;
}

.nav-badge, .nav-badge-mobile {
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.nav-badge-mobile { position: absolute; top: -4px; right: -6px; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #65a30d);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-avatar-sm {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #65a30d);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-details { min-width: 0; }
.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.btn-logout {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(220,38,38,0.08);
    color: var(--danger);
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    transition: all var(--transition);
    font-size: 16px;
    flex-shrink: 0;
}
.btn-logout:hover {
    background: var(--danger);
    color: #fff;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,30,18,0.55);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* ============================================================
   CONTENT HEADER
   ============================================================ */

.content-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-title {
    font-family: var(--font-head);
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin: 4px 0 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--success);
    font-weight: 600;
}

.pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}

/* ============================================================
   STAT CARDS
   ============================================================ */

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-blue .stat-icon   { background: var(--info-glow); color: var(--info); }
.stat-green .stat-icon  { background: rgba(22,163,74,0.13);  color: var(--success); }
.stat-yellow .stat-icon { background: rgba(217,119,6,0.13); color: var(--warning); }
.stat-red .stat-icon    { background: rgba(220,38,38,0.13);  color: var(--danger); }
.stat-purple .stat-icon { background: rgba(124,58,237,0.13); color: #7c3aed; }

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-family: var(--font-head);
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 2px;
}

.stat-value-sm {
    font-size: 17px;
}

/* ============================================================
   CARDS
   ============================================================ */

.card-custom {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-custom-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

.card-custom-title {
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.chart-container {
    height: 220px;
    padding: 16px 20px;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-custom {
    margin: 0;
    width: 100%;
    color: var(--text-primary);
}

.table-custom thead th {
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 13.5px;
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

.table-custom tbody tr:hover td {
    background: var(--bg-hover);
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

.badge-in {
    background: rgba(22,163,74,0.13);
    color: var(--success);
    border: 1px solid rgba(22,163,74,0.3);
}

.badge-out {
    background: rgba(220,38,38,0.1);
    color: var(--danger);
    border: 1px solid rgba(220,38,38,0.28);
}

.badge-adj {
    background: rgba(124,58,237,0.1);
    color: #7c3aed;
    border: 1px solid rgba(124,58,237,0.28);
}

.bg-success { background-color: rgba(22,163,74,0.14) !important; color: var(--success) !important; }
.bg-warning { background-color: rgba(217,119,6,0.14) !important; color: var(--warning) !important; }
.bg-danger  { background-color: rgba(220,38,38,0.13)  !important; color: var(--danger)  !important; }
.bg-primary { background-color: var(--accent-glow) !important; color: var(--accent-hover)  !important; }
.bg-info    { background-color: var(--info-glow) !important; color: var(--info) !important; }
.bg-secondary{ background-color: rgba(84,104,91,0.12)!important; color: var(--text-secondary)!important; }
.bg-purple  { background-color: rgba(124,58,237,0.12) !important; color: #7c3aed !important; }

/* ============================================================
   FILTERS
   ============================================================ */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    flex-wrap: wrap;
}

.filter-search {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.filter-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.filter-search input {
    padding-left: 36px;
}

.filter-select {
    width: auto;
    min-width: 130px;
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */

.form-control, .form-select {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 13.5px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    background: #fff;
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-control-lg {
    padding: 14px 16px;
    font-size: 16px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    font-family: var(--font-body);
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 8px 16px;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); color: #fff; }

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); color: #fff; }

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}
.btn-warning:hover { filter: brightness(1.1); color: #fff; }

.btn-secondary {
    background: rgba(84,104,91,0.1);
    border-color: var(--border);
    color: var(--text-secondary);
}
.btn-secondary:hover { background: rgba(84,104,91,0.18); color: var(--text-primary); }

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent-hover);
}
.btn-outline-primary:hover { background: var(--accent-glow); color: var(--accent-hover); }

.btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-outline-success {
    background: transparent;
    border: 1px solid var(--success);
    color: var(--success);
}
.btn-outline-success:hover { background: rgba(22,163,74,0.08); color: var(--success); }

.btn-outline-warning {
    background: transparent;
    border: 1px solid var(--warning);
    color: var(--warning);
}
.btn-outline-warning:hover { background: rgba(217,119,6,0.08); color: var(--warning); }

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}
.btn-outline-danger:hover { background: rgba(220,38,38,0.08); color: var(--danger); }

.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ============================================================
   MODALS
   ============================================================ */

.modal-custom {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.modal-custom .modal-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
}

.modal-custom .modal-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 16px;
}

.modal-custom .modal-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-hover);
}

.modal-backdrop.show { opacity: 0.55; }

/* ============================================================
   ALERTS (bootstrap notice boxes)
   ============================================================ */

.alert {
    border-radius: var(--radius-sm);
    border: 1px solid;
    padding: 12px 16px;
    font-size: 13.5px;
    margin-bottom: 16px;
}

.alert-success {
    background: rgba(22,163,74,0.08);
    border-color: rgba(22,163,74,0.25);
    color: var(--accent-hover);
}

.alert-danger {
    background: rgba(220,38,38,0.08);
    border-color: rgba(220,38,38,0.25);
    color: var(--danger);
}

.alert-info {
    background: var(--info-glow);
    border-color: rgba(8,145,178,0.3);
    color: var(--info);
}

/* ============================================================
   PAGINATION
   ============================================================ */

.page-link {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-secondary);
    font-size: 12px;
}
.page-link:hover { background: var(--accent-glow); color: var(--accent-hover); border-color: var(--border); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-item.disabled .page-link { background: var(--bg-surface); color: var(--text-muted); }

/* ============================================================
   DASHBOARD SPECIFICS
   ============================================================ */

.alerts-list { padding: 4px 0; }

.alert-item {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}
.alert-item:last-of-type { border-bottom: none; }

.alert-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--danger);
    margin-top: 5px;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

.alert-product { font-weight: 600; font-size: 13px; }
.alert-msg { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.alert-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; gap: 4px; }

.low-stock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}
.low-stock-item:last-child { border-bottom: none; }

.low-stock-name { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.stock-bar { height: 4px; background: var(--bg-hover); border-radius: 2px; width: 120px; overflow: hidden; }
.stock-bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; min-width: 4px; }

.empty-state-sm {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.top-product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}
.top-product-item:last-child { border-bottom: none; }
.top-product-rank {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--accent-glow);
    color: var(--accent-hover);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.top-product-name { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; }
.top-product-qty { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.activity-feed-item {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}
.activity-feed-item:last-child { border-bottom: none; }
.activity-feed-icon {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

/* ============================================================
   PRODUCT PAGE
   ============================================================ */

.product-name { font-weight: 600; font-size: 13.5px; }
.product-sku { font-size: 11px; color: var(--text-muted); font-family: monospace; }
.product-desc { margin-top: 2px; }
.action-btns { display: flex; gap: 6px; }

.product-thumb {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--bg-hover);
    flex-shrink: 0;
}
.product-thumb-placeholder {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
}
.product-cell { display: flex; align-items: center; gap: 10px; }

.image-upload-box {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    background: var(--bg-hover);
    cursor: pointer;
    transition: border-color var(--transition);
}
.image-upload-box:hover { border-color: var(--accent); }
.image-upload-preview {
    width: 72px; height: 72px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    margin: 0 auto 8px;
    display: block;
    border: 1px solid var(--border);
}

/* ============================================================
   STOCK IN / OUT / ADJUSTMENT PAGES
   ============================================================ */

.product-info-box {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.info-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-value {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

/* ============================================================
   ALERTS PAGE
   ============================================================ */

.alerts-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: transform var(--transition);
}

.alert-card:hover { transform: translateY(-1px); }

.alert-card-unread {
    border-color: rgba(220,38,38,0.25);
    background: rgba(220,38,38,0.03);
}

.alert-card-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    color: #fff;
}

.alert-card-body { flex: 1; min-width: 0; }
.alert-card-product { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.alert-card-msg { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.alert-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-card-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* ============================================================
   REPORTS PAGE
   ============================================================ */

.export-card {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.export-icon { font-size: 32px; }
.export-info h5 { font-family: var(--font-head); font-size: 15px; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.export-info p { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ============================================================
   SUPPLIER / CATEGORY CARDS
   ============================================================ */

.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.entity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.entity-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.entity-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.entity-icon {
    width: 42px; height: 42px;
    border-radius: var(--radius-sm);
    background: var(--accent-glow);
    color: var(--accent-hover);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.entity-name { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--text-primary); }
.entity-meta { font-size: 12.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.entity-meta i { color: var(--text-muted); width: 14px; }
.entity-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.category-icon-lg { font-size: 26px; color: var(--accent); }

/* ============================================================
   LINE ITEM ROWS (Purchases / Sales forms)
   ============================================================ */

.line-items-wrapper { display: flex; flex-direction: column; gap: 10px; }

.line-item-row {
    display: grid;
    grid-template-columns: 2.2fr 0.8fr 1fr 1fr auto;
    gap: 8px;
    align-items: end;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
}

.line-item-row .form-label { margin-bottom: 4px; font-size: 10px; }
.line-item-remove {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(220,38,38,0.3);
    background: rgba(220,38,38,0.08);
    color: var(--danger);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.line-item-remove:hover { background: var(--danger); color: #fff; }

.line-item-total-row {
    display: flex;
    justify-content: flex-end;
    gap: 24px;
    padding: 14px 4px 4px;
    border-top: 1px dashed var(--border);
    margin-top: 6px;
}
.line-item-total-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.line-item-total-value { font-family: var(--font-head); font-size: 20px; font-weight: 800; color: var(--accent-hover); }

/* ============================================================
   ROLE BADGES
   ============================================================ */

.role-admin   { background: rgba(124,58,237,0.13) !important; color: #7c3aed !important; }
.role-manager { background: var(--accent-glow) !important; color: var(--accent-hover) !important; }
.role-staff   { background: var(--info-glow) !important; color: var(--info) !important; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-body {
    background: linear-gradient(160deg, #eef8f0 0%, #f6faf5 45%, #ffffff 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 24px 70px rgba(16,60,30,0.12);
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-icon {
    width: 68px; height: 68px;
    background: linear-gradient(135deg, var(--accent), #65a30d);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
    margin: 0 auto 16px;
    box-shadow: 0 8px 32px var(--accent-glow);
    color: #fff;
    overflow: hidden;
}

.login-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-title {
    font-family: var(--font-head);
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-title span { color: var(--accent); }

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.form-group-custom { margin-bottom: 18px; }
.form-group-custom label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper > i:first-child {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

.input-wrapper .form-control {
    padding-left: 42px;
    padding-right: 42px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 15px;
}

.btn-login {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), #65a30d);
    border: none;
    color: #fff;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    transition: all var(--transition);
}
.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.login-demo {
    margin-top: 24px;
    padding: 14px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.login-demo p {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.demo-creds {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.demo-creds span {
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background var(--transition);
}

.demo-creds span:hover {
    background: var(--accent-glow);
    color: var(--accent-hover);
}

.login-features {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.feature-item i { color: var(--success); }

/* ============================================================
   MOBILE TOPBAR (mobile only)
   ============================================================ */

.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    z-index: 998;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    display: flex; align-items: center;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast-custom {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13.5px;
    min-width: 280px;
    box-shadow: var(--shadow);
}

.toast-custom.toast-success { border-color: rgba(22,163,74,0.35); }
.toast-custom.toast-danger  { border-color: rgba(220,38,38,0.35);  }

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #c9dccd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
    }
    .main-content {
        margin-left: 0;
        padding: 76px 16px 24px;
    }
    .mobile-topbar {
        display: flex;
    }
    .stat-value { font-size: 22px; }
    .page-title { font-size: 20px; }
    .content-header { flex-direction: column; align-items: flex-start; }
    .filter-bar { padding: 12px 16px; }
    .alert-card { flex-direction: column; }
    .alert-card-actions { flex-direction: row; }
    .export-card { padding: 14px; }
    .line-item-row { grid-template-columns: 1fr 1fr; }
    .line-item-remove { grid-column: span 2; width: 100%; }
}

@media (max-width: 576px) {
    .login-card { padding: 28px 20px; }
    .login-features { gap: 12px; }
    .chart-container { height: 180px; }
    .table-custom thead th, .table-custom tbody td { padding: 8px 12px; }
}

/* ============================================================
   RECEIPT
   ============================================================ */

.receipt-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.receipt-paper {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    font-family: 'Courier New', monospace;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px dashed var(--border);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.receipt-logo {
    width: 56px; height: 56px;
    border-radius: 12px;
    object-fit: cover;
    margin: 0 auto 10px;
    display: block;
}

.receipt-header h2 {
    font-family: var(--font-head);
    font-size: 17px;
    font-weight: 800;
    margin: 0 0 2px;
    color: var(--text-primary);
}

.receipt-header p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}

.receipt-meta {
    font-size: 12px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.receipt-meta div { display: flex; justify-content: space-between; }
.receipt-meta span { color: var(--text-muted); }

.receipt-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.receipt-table th {
    text-align: left;
    border-bottom: 1px dashed var(--border);
    padding: 4px 2px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.receipt-table th:not(:first-child), .receipt-table td:not(:first-child) { text-align: right; }

.receipt-table td {
    padding: 6px 2px;
    border-bottom: 1px dotted var(--border);
    vertical-align: top;
}

.receipt-sku { font-size: 10px; color: var(--text-muted); }

.receipt-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px dashed var(--border);
    padding-top: 12px;
    margin-bottom: 16px;
    font-size: 15px;
}
.receipt-total strong { font-family: var(--font-head); font-size: 18px; color: var(--accent-hover); }

.receipt-footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}
.receipt-small { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

@media print {
    .sidebar, .mobile-topbar, .sidebar-overlay, .no-print, .toast-container { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    body { background: #fff !important; }
    .receipt-paper { box-shadow: none; border: none; max-width: 100%; }
}

/* ============================================================
   OFFLINE ORDER SUPPORT
   ============================================================ */

.offline-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
    font-weight: 600;
    background: rgba(217,119,6,0.12);
    color: #b45309;
    border: 1px solid rgba(217,119,6,0.3);
}

.offline-banner-syncing {
    background: var(--accent-glow);
    color: var(--accent-hover);
    border-color: rgba(22,163,74,0.3);
}

.offline-banner i { font-size: 16px; flex-shrink: 0; }

.spin {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.offline-receipt-tag {
    background: rgba(217,119,6,0.14);
    color: #b45309;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 6px;
    border-radius: 6px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

@media print {
    .offline-receipt-tag { display: none; }
}
