:root {
    --primary-dark: #1B5E20;
    --primary: #2E7D32;
    --primary-light: #4CAF50;
    --primary-lighter: #81C784;
    --primary-lightest: #C8E6C9;
    --primary-bg: #E8F5E9;
    --accent: #00C853;
    --sidebar-bg: #ffffff;
    --sidebar-hover: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    --sidebar-active: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    --text-dark: #1a1a2e;
    --text-medium: #4a4a5a;
    --text-light: #7a7a8a;
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f0f0f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --sidebar-width: 280px;
    --header-height: 64px;
    --transition: all 0.25s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 12px rgba(0,0,0,0.05);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(59,138,67,0.3);
    border-radius: 4px;
}

.sidebar-header {
    padding: 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.logo-img {
    width: 100%;
    max-width: 200px;
    height: 68px;
    object-fit: contain;
    background: transparent;
    border-radius: 0;
    padding: 0 6px;
    box-shadow: none;
}

.logo svg {
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-savi {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 2px;
}

.logo-nutrition {
    font-size: 10px;
    font-weight: 500;
    color: #3B8A43;
    letter-spacing: 3px;
}

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

.nav-item {
    display: flex;
    align-items: center;
    margin: 2px 10px;
    padding: 10px 14px;
    color: #4a4a5a;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    border-radius: 8px;
}

.nav-item:hover {
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    color: #1B5E20;
    box-shadow: 0 4px 10px rgba(59,138,67,0.25);
}

.nav-item.active {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 12px rgba(27,94,32,0.45);
}

.nav-item.active::before {
    display: none;
}

.nav-item i {
    width: 20px;
    margin-right: 12px;
    font-size: 15px;
    text-align: center;
}

.nav-item.has-submenu {
    display: block;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
}

.nav-item.has-submenu.active {
    background: transparent;
    box-shadow: none;
}

.nav-item.has-submenu.active > .nav-item-main {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 12px rgba(27,94,32,0.45);
}

.has-submenu .nav-item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    color: inherit;
    padding: 10px 4px;
    cursor: pointer;
}

.nav-left {
    display: flex;
    align-items: center;
}

.submenu-arrow {
    font-size: 11px;
    transition: transform 0.3s ease;
    margin-right: 0 !important;
    width: auto !important;
}

.has-submenu.active .submenu-arrow,
.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    display: none;
    flex-direction: column;
    padding: 4px 0 8px 0;
    width: 100%;
}

.submenu.open {
    display: flex;
}

.submenu-item {
    display: block;
    width: calc(100% - 40px);
    padding: 8px 16px 8px 32px;
    color: #6b7280;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 400;
    transition: var(--transition);
    border-left: 0;
    border-radius: 7px;
    margin-left: 24px;
    box-sizing: border-box;
}

.submenu-item:hover {
    color: #1B5E20;
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
}

.submenu-item.active {
    color: #ffffff;
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 20px;
}

.logout-item:hover {
    color: #ff5252 !important;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 900;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.hamburger:hover {
    background: var(--primary-bg);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-main);
    border-radius: 50px;
    padding: 8px 16px;
    min-width: 320px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--primary-light);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(76,175,80,0.1);
}

.search-bar i {
    color: var(--text-light);
    margin-right: 10px;
    font-size: 14px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    font-size: 13.5px;
    color: var(--text-dark);
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.search-bar input::placeholder {
    color: var(--text-light);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-medium);
    transition: var(--transition);
    position: relative;
    font-size: 15px;
}

.header-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #ff5252;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 8px;
}

.user-profile:hover {
    background: var(--primary-bg);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.user-role {
    font-size: 11px;
    color: var(--text-light);
}

.page-content {
    padding: 24px;
}

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

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 2px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}

.stat-card-icon.green {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-card-icon.blue {
    background: #e3f2fd;
    color: #1976d2;
}

.stat-card-icon.orange {
    background: #fff3e0;
    color: #f57c00;
}

.stat-card-icon.red {
    background: #fce4ec;
    color: #d32f2f;
}

.stat-card-icon.purple {
    background: #f3e5f5;
    color: #7b1fa2;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.stat-card-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 20px;
}

.stat-card-change.up {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-card-change.down {
    background: #fce4ec;
    color: #d32f2f;
}

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

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

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.card-body {
    padding: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(46,125,50,0.3);
}

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-medium);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-success {
    background: var(--accent);
    color: #fff;
}

.btn-success:hover {
    background: #00a844;
}

.btn-danger {
    background: #ff5252;
    color: #fff;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-main);
    color: var(--text-medium);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-dark);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--primary-bg);
}

/* Tables: secondary grey fonts are solid black (badges + icon buttons keep theirs) */
.data-table tbody td,
.production-prototype .prototype-card tbody td {
    color: #111111;
}
.data-table tbody td div:not(.badge):not(.action-btn),
.data-table tbody td span:not(.badge):not(.action-btn),
.data-table tbody td strong,
.production-prototype .prototype-card tbody td div:not(.badge),
.production-prototype .prototype-card tbody td span:not(.badge),
.production-prototype .prototype-card tbody td strong {
    color: #111111 !important;
}
/* Row hover keeps everything black */
.data-table tbody tr:hover td,
.data-table tbody tr:hover td div:not(.badge):not(.action-btn),
.data-table tbody tr:hover td span:not(.badge):not(.action-btn),
.data-table tbody tr:hover td strong,
.data-table tbody tr:hover td a:not(.action-btn) {
    color: #111111 !important;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-warning {
    background: #fff8e1;
    color: #f57f17;
}

.badge-danger {
    background: #fce4ec;
    color: #c62828;
}

.badge-info {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-secondary {
    background: #f5f5f5;
    color: #616161;
}

.badge-primary {
    background: #e8f5e9;
    color: var(--primary);
}

.action-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
    flex-shrink: 0;
}

.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.action-btn:hover {
    background: #c8e6c9;
    color: #1B5E20;
    box-shadow: inset 0 0 0 1px #a5d6a7;
}

.action-btn:active {
    background: linear-gradient(135deg, #3B8A43 0%, #256b2d 100%);
    color: #ffffff !important;
    transform: scale(0.92);
    box-shadow: 0 2px 6px rgba(59,138,67,0.5);
}

.action-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 100;
    display: none;
    border: 1px solid var(--border);
    padding: 6px;
    margin-top: 4px;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-medium);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.dropdown-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 13px;
    transition: var(--transition);
}

.filter-input:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.1);
}

.filter-input input,
.filter-input select {
    border: none;
    outline: none;
    font-size: 13px;
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
    background: transparent;
}

.filter-input i {
    color: var(--text-light);
    font-size: 13px;
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0;
    overflow-x: auto;
}

.tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--bg-main);
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.tab.active .count {
    background: var(--primary-bg);
    color: var(--primary);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-light);
}

.pagination-buttons {
    display: flex;
    gap: 4px;
}

.pagination-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-medium);
    transition: var(--transition);
}

.pagination-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.welcome-section {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    border-radius: var(--radius-xl);
    padding: 32px;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.welcome-section::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.welcome-section h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.welcome-section p {
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 20px;
}

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

.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.product-card-image {
    height: 160px;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.product-card-image img {
    max-width: 82%;
    max-height: 140px;
    object-fit: contain;
}

.product-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255,255,255,0.9);
    color: var(--primary);
}

.product-card-body {
    padding: 16px;
}

.product-card-category {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}

.product-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.product-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.product-card-price span {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-light);
}

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

.tracking-card:hover {
    box-shadow: var(--shadow-md);
}

.tracking-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
    flex-shrink: 0;
}

.tracking-info {
    flex: 1;
    min-width: 0;
}

.tracking-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.tracking-location {
    font-size: 12px;
    color: var(--text-light);
}

.tracking-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.tracking-actions {
    display: flex;
    gap: 6px;
}

.map-placeholder {
    height: 350px;
    background: var(--primary-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.map-grid {
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(46,125,50,0.18);
    border-radius: var(--radius-md);
    background:
        linear-gradient(rgba(46,125,50,0.10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(46,125,50,0.10) 1px, transparent 1px),
        linear-gradient(145deg, rgba(255,255,255,0.75), rgba(200,230,201,0.55));
    background-size: 20% 20%, 20% 20%, 100% 100%;
}

.map-label {
    position: absolute;
    color: rgba(46,125,50,0.42);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}

.map-label-north {
    top: 10px;
    left: 14px;
}

.map-label-south {
    right: 14px;
    bottom: 10px;
}

.map-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(27,94,32,0.28);
}

.map-marker.offline {
    background: #9e9e9e;
}

.map-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(76,175,80,0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(76,175,80,0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(76,175,80,0.1) 0%, transparent 70%);
}

.welcome-btn {
    background: #fff;
    color: var(--primary-dark);
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.welcome-btn:hover {
    background: var(--primary-lightest);
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-medium);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237a7a8a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.auto-refresh {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-medium);
}

.toggle-switch {
    width: 40px;
    height: 22px;
    background: #ccc;
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.toggle-switch.active::after {
    left: 20px;
}

.export-actions {
    display: flex;
    gap: 8px;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.chart-container {
    position: relative;
    height: 280px;
}

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

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.grid-6 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    color: var(--border);
}

.module-placeholder-card {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.module-placeholder-card h2 {
    color: var(--text-dark);
    font-size: 20px;
    margin-bottom: 8px;
}

.module-placeholder-card p {
    max-width: 520px;
    margin: 0 auto 20px;
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close {
        display: block;
    }
    .sidebar-overlay.show {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .hamburger {
        display: flex;
    }
    .search-bar {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .page-content { padding: 16px; }
    .top-header { padding: 0 16px; }
    .search-bar { min-width: 150px; }
    .user-info { display: none; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .welcome-section { padding: 24px; }
    .welcome-section h2 { font-size: 20px; }
    .tabs { gap: 2px; }
    .tab { padding: 8px 12px; font-size: 12px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-input { width: 100%; }
    .map-placeholder { height: 280px; }
    .map-marker { width: 20px; height: 20px; margin: -10px 0 0 -10px; font-size: 9px; }
}

@media (max-width: 480px) {
    .header-right { gap: 4px; }
    .page-content { padding: 12px; }
    .stat-card { padding: 16px; }
    .stat-card-value { font-size: 24px; }
}

body.modal-open {
    overflow: hidden;
}
body.modal-open .sidebar {
    z-index: 1;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
#maintenanceDialog { z-index: 9999; }
#maintenanceDialog .modal-overlay { background: rgba(0,0,0,.6); }

/* ============================================================
   Responsive Enhancements — adapt to any screen resolution
   ============================================================ */

/* Collapse inline multi-column form grids (modals, purchase,
   product materials, finished goods, drivers, raw materials,
   vendors product picker, etc.) into a single column — only when
   the window is genuinely narrow, to avoid snap-back when resizing. */
@media (max-width: 520px) {
    [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* Small/medium screens: header, cards, forms, actions */
@media (max-width: 992px) {
    body { overflow-x: hidden; }
    .main-content { max-width: 100vw; }
    .profile-dropdown {
        position: fixed;
        top: 56px;
        left: 8px;
        right: 8px;
        width: auto;
        max-width: calc(100vw - 16px);
    }
}

@media (max-width: 720px) {
    .top-header { padding: 0 10px; }
    .header-left { gap: 6px; min-width: 0; }
    .search-bar { min-width: 0 !important; flex: 1 1 auto; }
    .search-bar input { font-size: 13px; }
    .header-right { gap: 6px; }
    .header-btn { width: 36px; height: 36px; font-size: 14px; }
    .page-content { padding: 14px; }
    .card-header { padding: 12px 14px; }
    .card-body { padding: 14px; }
    .data-table th, .data-table td { padding: 9px 10px; font-size: 12.5px; }
    .btn { padding: 8px 14px; }
    .export-actions { flex-wrap: wrap; }
    .stat-card-icon { width: 42px; height: 42px; font-size: 17px; }
    .stat-card-value { font-size: 24px; }
    .welcome-section { padding: 20px; }
    .welcome-section h2 { font-size: 18px; }
    .page-title { font-size: 19px; }
    .modal-overlay { padding: 10px !important; }
    .modal-overlay > div { max-width: 100% !important; }
}

@media (max-width: 640px) {
    .modal-overlay > div { border-radius: 12px; }
}

/* Phones: compact everything so no page overflows */
@media (max-width: 480px) {
    body { overflow-x: hidden; }
    .header-btn { width: 32px; height: 32px; font-size: 13px; }
    .user-profile { padding: 4px; margin-left: 0; }
    .user-avatar { width: 32px; height: 32px; font-size: 12px; }
    .notification-badge { width: 16px; height: 16px; font-size: 9px; }
    .page-content { padding: 10px; }
    .modal-overlay { padding: 6px !important; }
    .modal-overlay > div { max-height: 94vh !important; overflow-y: auto; }
    .modal-overlay input,
    .modal-overlay select,
    .modal-overlay textarea { font-size: 16px; }
    .page-title { font-size: 17px; }
    .stat-card { padding: 14px; }
    .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { gap: 12px; }
}
