/* ===== CSS Variables ===== */
:root {
    --primary:       #0D47A1;
    --primary-dark:  #0a3880;
    --secondary:     #1976D2;
    --accent:        #42A5F5;
    --bg:            #F5F7FA;
    --white:         #FFFFFF;
    --text:          #1F2937;
    --text-light:    #6B7280;
    --text-muted:    #9CA3AF;
    --border:        #E5E7EB;
    --border-light:  #F3F4F6;
    --success:       #10B981;
    --success-light: #D1FAE5;
    --warning:       #F59E0B;
    --warning-light: #FEF3C7;
    --danger:        #EF4444;
    --danger-light:  #FEE2E2;
    --info:          #3B82F6;
    --info-light:    #DBEAFE;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm:     6px;
    --radius:        10px;
    --radius-lg:     14px;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow:        0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
    --shadow-lg:     0 10px 30px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.06);
    --transition:    0.18s ease;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: 'Sora', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== Layout ===== */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    transition: transform var(--transition);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.sidebar-logo-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,.15);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-logo-title {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: white;
    letter-spacing: .5px;
}

.sidebar-logo-sub {
    display: block;
    font-size: 10px;
    color: rgba(255,255,255,.6);
    letter-spacing: .3px;
    margin-top: 1px;
}

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

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    margin: 2px 10px;
    border-radius: var(--radius);
    color: rgba(255,255,255,.75);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}

.sidebar-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-nav-item:hover {
    background: rgba(255,255,255,.1);
    color: white;
}

.sidebar-nav-item.active {
    background: var(--secondary);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.sidebar-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    margin-left: -10px;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.12);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: white;
    font-weight: 700;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,.55);
}

.sidebar-logout {
    color: rgba(255,255,255,.6);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.sidebar-logout:hover {
    color: white;
    background: rgba(255,255,255,.1);
}

/* ===== Main Wrapper ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* ===== Topbar ===== */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.topbar-toggle:hover {
    background: var(--border-light);
    color: var(--text);
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 420px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 8px 16px;
    transition: all var(--transition);
}

.topbar-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(66,165,245,.1);
}

.topbar-search i { color: var(--text-muted); font-size: 13px; }

.topbar-search input {
    border: none;
    background: none;
    outline: none;
    font-size: 13.5px;
    color: var(--text);
    width: 100%;
}

.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}

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

/* ===== Page Content ===== */
.page-content {
    padding: 28px;
    flex: 1;
}

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

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

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

/* ===== Cards ===== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    padding: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

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

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

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

.stat-icon.blue   { background: #DBEAFE; color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #F3E8FF; color: #7C3AED; }

.stat-body {}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin-top: 2px;
}

.stat-value.text-danger { color: var(--danger); }
.stat-value.text-warning { color: var(--warning); }
.stat-value.text-success { color: var(--success); }

.stat-trend {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ===== Charts Grid ===== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

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

/* ===== Tables ===== */
.table-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

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

.table-toolbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.table-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    transition: all var(--transition);
}

.table-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(66,165,245,.1);
}

.table-search i { color: var(--text-muted); font-size: 12px; }

.table-search input {
    border: none;
    background: none;
    outline: none;
    font-size: 13px;
    width: 180px;
    color: var(--text);
}

.table-search input::placeholder { color: var(--text-muted); }

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

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 13px 16px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

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

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover td { background: #F8FAFF; }

.table-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.table-empty {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-light);
}

.table-empty i {
    font-size: 36px;
    color: var(--border);
    margin-bottom: 12px;
    display: block;
}

.table-empty p { font-size: 14px; }

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-light);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1;
}

.btn i { font-size: 13px; }

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(13,71,161,.3);
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(13,71,161,.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}
.btn-secondary:hover { background: var(--primary); }

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover { background: #059669; }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: #DC2626; }

.btn-warning {
    background: var(--warning);
    color: white;
}
.btn-warning:hover { background: #D97706; }

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

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

.btn-icon {
    padding: 7px;
    border-radius: var(--radius-sm);
}

.btn-icon.btn-edit { background: var(--info-light); color: var(--info); }
.btn-icon.btn-edit:hover { background: var(--info); color: white; }

.btn-icon.btn-delete { background: var(--danger-light); color: var(--danger); }
.btn-icon.btn-delete:hover { background: var(--danger); color: white; }

.btn-icon.btn-view { background: var(--success-light); color: var(--success); }
.btn-icon.btn-view:hover { background: var(--success); color: white; }

/* ===== Forms ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-col-span-2 { grid-column: span 2; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.form-label span.req { color: var(--danger); margin-left: 2px; }

.form-control, .form-select {
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13.5px;
    color: var(--text);
    background: var(--white);
    outline: none;
    transition: all var(--transition);
    width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(66,165,245,.12);
}

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

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

.form-control.error { border-color: var(--danger); }

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 2px;
}

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn .15s ease;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp .2s ease;
}

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

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body { padding: 20px 24px; }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-light);
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-success { background: var(--success-light); color: #065F46; }
.badge-danger  { background: var(--danger-light);  color: #991B1B; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-info    { background: var(--info-light);    color: #1E40AF; }
.badge-neutral { background: var(--bg); color: var(--text-light); border: 1px solid var(--border); }

/* ===== Alert ===== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 16px;
}

.alert i { font-size: 15px; margin-top: 1px; flex-shrink: 0; }
.alert-danger { background: var(--danger-light); color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: var(--success-light); color: #065F46; border: 1px solid #A7F3D0; }
.alert-warning { background: var(--warning-light); color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: var(--info-light); color: #1E40AF; border: 1px solid #BFDBFE; }

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    color: var(--text);
    border-left: 4px solid var(--primary);
    min-width: 280px;
    animation: slideLeft .25s ease;
}

.toast i { font-size: 16px; }
.toast.success { border-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.danger { border-color: var(--danger); }
.toast.danger i { color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.warning i { color: var(--warning); }
.toast.info { border-color: var(--info); }
.toast.info i { color: var(--info); }

/* ===== Login ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 60%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 36px;
}

.login-logo-icon {
    width: 68px; height: 68px;
    background: var(--primary);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 28px;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(13,71,161,.35);
}

.login-logo-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}

.login-logo-sub {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
    text-align: center;
}

.login-form .form-group { margin-bottom: 18px; }

.login-form .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 6px;
    display: block;
}

.login-form .form-control {
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 10px;
}

.login-btn {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    border-radius: 10px;
    margin-top: 8px;
    justify-content: center;
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 12px;
    color: var(--text-muted);
}

.login-error {
    background: var(--danger-light);
    color: #991B1B;
    border: 1px solid #FECACA;
    border-radius: var(--radius);
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Section separator ===== */
.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 14px;
    margin-top: 28px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ===== Stock level indicators ===== */
.stock-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stock-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.stock-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .4s ease;
}

.stock-bar-fill.ok { background: var(--success); }
.stock-bar-fill.low { background: var(--warning); }
.stock-bar-fill.critical { background: var(--danger); }

/* ===== Divider ===== */
.divider {
    height: 1px;
    background: var(--border-light);
    margin: 20px 0;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes slideLeft {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ===== Utility ===== */
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.mt-16        { margin-top: 16px; }
.mt-24        { margin-top: 24px; }
.mb-16        { margin-bottom: 16px; }
.mb-24        { margin-bottom: 24px; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-light   { color: var(--text-light); }
.font-bold    { font-weight: 700; }
.font-medium  { font-weight: 500; }

.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }

    .sidebar {
        transform: translateX(-260px);
        width: 260px;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-wrapper { margin-left: 0; }

    .topbar-toggle { display: flex; }

    .topbar-search { max-width: 200px; }

    .topbar-user-name { display: none; }

    .page-content { padding: 16px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .form-grid { grid-template-columns: 1fr; }
    .form-col-span-2 { grid-column: span 1; }

    .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 32px 24px; }
    .table-filters { flex-direction: column; align-items: flex-start; }
}

/* ===== Status Badges (Estoque) ===== */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.status-pill .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-pill.adequado { background: #D1FAE5; color: #065F46; }
.status-pill.adequado .dot { background: #10B981; }
.status-pill.atencao  { background: #FEF3C7; color: #92400E; }
.status-pill.atencao  .dot { background: #F59E0B; }
.status-pill.critico  { background: #FEE2E2; color: #991B1B; }
.status-pill.critico  .dot { background: #EF4444; }

/* ===== Estoque stat strip ===== */
.estoque-stat-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.estat-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: box-shadow var(--transition), border-color var(--transition);
}
.estat-card:hover { box-shadow: var(--shadow); }
.estat-card.active { border-color: currentColor; box-shadow: 0 0 0 2px rgba(0,0,0,.06); }
.estat-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.estat-info { flex: 1; }
.estat-count { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }
.estat-label { font-size: 11.5px; color: var(--text-light); margin-top: 3px; }
.estat-card.all     .estat-dot { background: var(--secondary); }
.estat-card.adequado .estat-dot { background: #10B981; }
.estat-card.atencao  .estat-dot { background: #F59E0B; }
.estat-card.critico  .estat-dot { background: #EF4444; }
.estat-card.adequado .estat-count { color: #065F46; }
.estat-card.atencao  .estat-count { color: #92400E; }
.estat-card.critico  .estat-count { color: #991B1B; }

/* ===== Table sortable headers ===== */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition);
}
th.sortable:hover { color: var(--primary); }
th.sort-active { color: var(--primary); }
.sort-icon { font-size: 10px; margin-left: 4px; opacity: 0.5; }
th.sort-active .sort-icon { opacity: 1; }

/* ===== Estoque toolbar ===== */
.estoque-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}
.estoque-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    flex: 1;
    min-width: 200px;
    max-width: 340px;
    transition: all var(--transition);
}
.estoque-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66,165,245,.1); }
.estoque-search i { color: var(--text-muted); font-size: 13px; }
.estoque-search input { border: none; background: none; outline: none; font-size: 13.5px; width: 100%; color: var(--text); }
.estoque-search input::placeholder { color: var(--text-muted); }
.toolbar-sep { width: 1px; height: 28px; background: var(--border); margin: 0 4px; }
.results-count { font-size: 12.5px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
.per-page-sel { font-size: 12.5px; color: var(--text-light); display: flex; align-items: center; gap: 6px; }
.per-page-sel select { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 12.5px; outline: none; }

/* ===== Qty display in table ===== */
.qty-cell { display: flex; align-items: center; gap: 8px; }
.qty-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; min-width: 48px; max-width: 72px; }
.qty-bar-fill { height: 100%; border-radius: 3px; }
.qty-bar-fill.adequado { background: #10B981; }
.qty-bar-fill.atencao  { background: #F59E0B; }
.qty-bar-fill.critico  { background: #EF4444; }

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
}
.pag-info { color: var(--text-light); }
.pag-btns { display: flex; gap: 4px; }
.pag-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}
.pag-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--primary); }
.pag-btn.active { background: var(--primary); border-color: var(--primary); color: white; font-weight: 700; }
.pag-btn:disabled { opacity: .35; cursor: default; }
.pag-btn.pag-arrow { font-size: 11px; }

/* ===== Side Panel ===== */
.panel-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 300;
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}
.panel-overlay.open { opacity: 1; pointer-events: auto; }

.side-panel {
    position: fixed;
    top: 0; right: 0;
    width: 500px;
    height: 100vh;
    background: var(--white);
    z-index: 301;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0,0,0,.14);
}
.side-panel.open { transform: translateX(0); }

.panel-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    background: var(--white);
}
.panel-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.panel-sku { font-family: monospace; font-size: 13px; font-weight: 700; color: var(--secondary); }
.panel-close {
    background: none; border: none;
    color: var(--text-light); font-size: 18px;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: flex; align-items: center;
}
.panel-close:hover { background: var(--danger-light); color: var(--danger); }
.panel-nome { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.3; margin-bottom: 6px; }
.panel-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-light); }
.panel-meta strong { color: var(--text); }

.panel-body { flex: 1; overflow-y: auto; padding: 0; }
.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.panel-saldo-box {
    margin: 16px 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius);
    color: white;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.panel-saldo-item { }
.panel-saldo-label { font-size: 11px; opacity: .8; text-transform: uppercase; letter-spacing: .4px; }
.panel-saldo-val { font-size: 28px; font-weight: 700; line-height: 1.1; margin-top: 2px; }
.panel-saldo-sub { font-size: 12px; opacity: .7; }
.panel-saldo-item.right { text-align: right; }
.panel-saldo-bar-wrap { grid-column: span 2; }
.panel-saldo-bar { height: 6px; background: rgba(255,255,255,.2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.panel-saldo-bar-fill { height: 100%; border-radius: 3px; background: rgba(255,255,255,.85); transition: width .5s ease; }

.panel-obs {
    margin: 0 20px 14px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-light);
}

.panel-actions {
    display: flex;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

/* Panel tabs */
.panel-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-light);
    padding: 0 20px;
    gap: 0;
    flex-shrink: 0;
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 1;
}
.panel-tab {
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.panel-tab:hover { color: var(--text); }
.panel-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.panel-tab .tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--border-light);
    color: var(--text-muted);
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 1px 6px;
    min-width: 20px;
}
.panel-tab.active .tab-count { background: #DBEAFE; color: var(--primary); }

.panel-tab-body { padding: 4px 0 20px; }
.panel-tab-pane { display: none; }
.panel-tab-pane.active { display: block; }

.panel-mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.panel-mini-table th {
    background: var(--bg);
    padding: 8px 14px 8px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 1px solid var(--border-light);
}
.panel-mini-table td {
    padding: 10px 14px 10px 20px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
.panel-mini-table tbody tr:last-child td { border-bottom: none; }
.panel-mini-table tbody tr:hover td { background: #F8FAFF; }
.panel-empty-small {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: 13px;
}
.panel-empty-small i { display: block; font-size: 24px; margin-bottom: 8px; color: var(--border); }

/* ===== Row highlight on selection ===== */
tbody tr.row-selected td { background: #EFF6FF !important; }

/* ===== Table row clickable ===== */
tbody tr.row-clickable { cursor: pointer; }

/* ===== Responsive side panel ===== */
@media (max-width: 768px) {
    .side-panel { width: 100%; }
    .estoque-stat-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Period Navigation ===== */
.period-nav-bar {
    display: flex; align-items: center; gap: 6px;
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 6px 10px;
}
.period-btn {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px; color: var(--text-light);
    transition: all var(--transition); font-size: 11px; border: none; background: none;
    cursor: pointer; flex-shrink: 0;
}
.period-btn:hover { background: var(--bg); color: var(--text); }
.period-label { font-size: 14px; font-weight: 700; min-width: 172px; text-align: center; color: var(--text); }
.period-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.period-all { font-size: 12px; color: var(--text-muted); transition: color var(--transition); white-space: nowrap; }
.period-all:hover { color: var(--primary); }
.period-all.active { color: var(--primary); font-weight: 600; }

/* ===== Product Searchable Select ===== */
.prod-sel-wrap { display: flex; flex-direction: column; gap: 6px; }
.prod-sel-search {
    display: flex; align-items: center; gap: 8px;
    border: 1.5px solid var(--border); border-radius: var(--radius); padding: 8px 12px;
    transition: all var(--transition);
}
.prod-sel-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66,165,245,.1); }
.prod-sel-search i  { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.prod-sel-search input { border: none; outline: none; background: none; font-size: 13px; width: 100%; color: var(--text); }
select.prod-sel-list {
    border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: 12.5px; min-height: 128px; width: 100%; outline: none;
    background: var(--white); color: var(--text); padding: 4px;
}
select.prod-sel-list:focus { border-color: var(--accent); }
select.prod-sel-list option { padding: 6px 8px; }
.prod-info-box {
    background: var(--bg); border-radius: var(--radius-sm);
    padding: 8px 12px; font-size: 12.5px; color: var(--text-light);
    min-height: 34px; display: flex; align-items: center; gap: 8px;
}

/* ===== Entry/Exit table user cell ===== */
.user-cell { display: flex; align-items: center; gap: 6px; }
.user-av-sm {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--primary); color: white;
    font-size: 9px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.user-av-sm.sistema { background: var(--text-muted); }

/* ===== Stat band (for entradas/saidas/movs summary) ===== */
.stat-band {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin-bottom: 20px;
}
.stat-band-card {
    background: var(--white); border-radius: var(--radius);
    border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
    padding: 16px 20px; display: flex; flex-direction: column; gap: 4px;
}
.stat-band-val  { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-band-label{ font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.stat-band-sub  { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ===== Timeline ===== */
.tl-wrap { padding: 4px 28px 28px; }
.tl-empty { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.tl-empty i { font-size: 40px; color: var(--border); margin-bottom: 14px; display: block; }

.tl-day { margin-bottom: 28px; }
.tl-day-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
    position: sticky; top: var(--topbar-height); z-index: 2;
    background: var(--bg); padding: 6px 0;
}
.tl-day-date  { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
.tl-day-count { font-size: 11.5px; color: var(--text-muted); background: var(--border-light); border-radius: 10px; padding: 1px 7px; }
.tl-day-line  { flex: 1; height: 1px; background: var(--border-light); }

.tl-list {
    position: relative; padding-left: 30px;
    display: flex; flex-direction: column; gap: 8px;
}
.tl-list::before {
    content: ''; position: absolute;
    left: 9px; top: 10px; bottom: 10px;
    width: 2px; background: var(--border-light); border-radius: 1px;
}

.tl-item { display: flex; gap: 12px; align-items: flex-start; }
.tl-dot {
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 8px; color: white; flex-shrink: 0; margin-top: 3px;
    position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--bg);
}
.tl-dot.entrada { background: var(--success); }
.tl-dot.saida   { background: var(--warning); }

.tl-card {
    flex: 1; background: var(--white);
    border: 1px solid var(--border-light); border-radius: var(--radius);
    padding: 11px 16px; box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.tl-card:hover { box-shadow: var(--shadow); border-color: var(--border); }
.tl-card.entrada { border-left: 3px solid var(--success); }
.tl-card.saida   { border-left: 3px solid var(--warning); }

.tl-type-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 2px 7px; border-radius: 10px; flex-shrink: 0; }
.tl-type-badge.entrada { background: var(--success-light); color: #065F46; }
.tl-type-badge.saida   { background: var(--warning-light); color: #92400E; }

.tl-prod { display: flex; flex-direction: column; flex: 1; min-width: 160px; }
.tl-sku  { font-family: monospace; font-size: 11px; color: var(--text-muted); }
.tl-nome { font-size: 13px; font-weight: 600; color: var(--text); }

.tl-qty { font-size: 17px; font-weight: 800; white-space: nowrap; flex-shrink: 0; }
.tl-qty.entrada { color: var(--success); }
.tl-qty.saida   { color: var(--warning); }

.tl-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.tl-user { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.tl-obs  { font-size: 11px; color: var(--text-muted); font-style: italic; text-align: right; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Qty indicator in entradas/saidas tables */
.qty-positive { font-weight: 700; color: var(--success); }
.qty-negative { font-weight: 700; color: var(--warning); }

/* Period filter in toolbar */
.tl-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.tipo-filter { display: flex; gap: 4px; }
.tipo-btn {
    padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12.5px;
    border: 1.5px solid var(--border); background: var(--white);
    color: var(--text-light); cursor: pointer; transition: all var(--transition); font-weight: 500;
}
.tipo-btn:hover { border-color: var(--accent); color: var(--primary); }
.tipo-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ===== Report Cards — Fase 6 ===== */
.rpt-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 4px;
}
.rpt-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 24px 22px;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    transition: box-shadow var(--transition), border-color var(--transition);
}
.rpt-card:hover { box-shadow: var(--shadow); border-color: var(--border); }
.rpt-card-icon {
    width: 52px; height: 52px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.rpt-card-icon.blue   { background: #DBEAFE; color: var(--primary); }
.rpt-card-icon.green  { background: var(--success-light); color: var(--success); }
.rpt-card-icon.amber  { background: var(--warning-light); color: var(--warning); }
.rpt-card-icon.purple { background: #F3E8FF; color: #7C3AED; }
.rpt-card-icon.red    { background: var(--danger-light); color: var(--danger); }
.rpt-card-icon.cyan   { background: #E0F2FE; color: #0284C7; }

.rpt-card-body { flex: 1; }
.rpt-card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.rpt-card-desc  { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }
.rpt-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1100px) { .rpt-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .rpt-cards { grid-template-columns: 1fr; } }

/* ===== Dashboard — Fase 5 ===== */
.dash-filter-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--white); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); padding: 14px 20px; margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.dash-filter-label { font-size: 13px; font-weight: 600; color: var(--text-light); white-space: nowrap; }
.dash-filter-sep { width: 1px; height: 24px; background: var(--border-light); margin: 0 4px; }

.dash-period-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.dash-period-nav a {
    padding: 5px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 500;
    border: 1.5px solid var(--border); background: var(--white); color: var(--text-light);
    transition: all var(--transition);
}
.dash-period-nav a:hover { border-color: var(--accent); color: var(--primary); }
.dash-period-nav a.active { background: var(--primary); border-color: var(--primary); color: white; }

/* Stat cards — enhanced for dashboard */
.stat-card-v2 {
    background: var(--white); border-radius: var(--radius-lg);
    border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
    padding: 22px 20px; display: flex; flex-direction: column; gap: 2px;
    transition: box-shadow var(--transition), border-color var(--transition);
    text-decoration: none; position: relative; overflow: hidden;
}
.stat-card-v2:hover { box-shadow: var(--shadow); border-color: var(--border); }
.stat-card-v2::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card-v2.blue::before   { background: var(--primary); }
.stat-card-v2.green::before  { background: var(--success); }
.stat-card-v2.amber::before  { background: var(--warning); }
.stat-card-v2.red::before    { background: var(--danger); }

.stat-v2-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat-v2-icon {
    width: 40px; height: 40px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.stat-card-v2.blue  .stat-v2-icon { background: #DBEAFE; color: var(--primary); }
.stat-card-v2.green .stat-v2-icon { background: var(--success-light); color: var(--success); }
.stat-card-v2.amber .stat-v2-icon { background: var(--warning-light); color: var(--warning); }
.stat-card-v2.red   .stat-v2-icon { background: var(--danger-light); color: var(--danger); }

.stat-v2-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-v2-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.1; margin-top: 2px; }
.stat-v2-sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-v2-change {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11.5px; font-weight: 600; margin-top: 6px; padding: 2px 6px;
    border-radius: 6px;
}
.stat-v2-change.up   { background: var(--success-light); color: #065F46; }
.stat-v2-change.down { background: var(--danger-light);  color: #991B1B; }
.stat-v2-change.flat { background: var(--bg); color: var(--text-muted); }

/* Stats grid — 4 columns */
.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

/* Dashboard chart rows */
.dash-chart-full { margin-bottom: 16px; }
.dash-chart-full .chart-container  { height: 280px; }

.dash-charts-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.dash-charts-2 .chart-container { height: 260px; }

/* Dashboard bottom 2 columns */
.dash-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
}

/* Alert status in dashboard table */
.alert-badge-z { display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:700;background:#FEE2E2;color:#991B1B; }
.alert-badge-c { display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:700;background:#FEF3C7;color:#92400E; }

/* Chart no-data overlay */
.chart-no-data {
    display: none; align-items: center; justify-content: center;
    flex-direction: column; gap: 8px; height: 100%;
    color: var(--text-muted); font-size: 13px;
}
.chart-no-data i { font-size: 32px; color: var(--border); }

/* Responsive dashboard */
@media (max-width: 1100px) {
    .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .dash-charts-2 { grid-template-columns: 1fr; }
    .dash-bottom  { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .stats-grid-4 { grid-template-columns: 1fr; }
}

/* ===== Print ===== */
@media print {
    .sidebar, .topbar, .table-toolbar .btn, .table-actions, .toast-container, .period-nav-bar, .modal-overlay { display: none !important; }
    .main-wrapper { margin-left: 0; }
    .page-content { padding: 0; }
    .card, .table-card { box-shadow: none; border: 1px solid #ddd; }
    .tl-day-header { position: static; }
}

/* ═══════════════════════════════════════════
   FASE 7 — Usuários + Configurações
   ═══════════════════════════════════════════ */

/* ── Permissões info cards ── */
.perm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}
.perm-card {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--white);
}
.perm-card.admin { border-color: #BFDBFE; background: #EFF6FF; }
.perm-card.operador { border-color: #E5E7EB; background: #F9FAFB; }
.perm-icon {
    width: 42px; height: 42px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.perm-card.admin .perm-icon { background: #0D47A1; color: white; }
.perm-card.operador .perm-icon { background: #E5E7EB; color: #4B5563; }
.perm-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.perm-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 4px;
}
.perm-list li {
    font-size: 12.5px; color: var(--text-light);
    display: flex; align-items: center; gap: 7px;
}
.perm-list li .fa-check { color: #10B981; font-size: 10px; }
.perm-list li .fa-xmark { color: #9CA3AF; font-size: 10px; }

/* ── User avatar in table ── */
.u-av {
    width: 36px; height: 36px; border-radius: 50%;
    color: white; font-size: 14px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ── Nível badge ── */
.nivel-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.nivel-badge.admin { background: #EFF6FF; color: #0D47A1; border: 1px solid #BFDBFE; }
.nivel-badge.op    { background: #F9FAFB; color: #4B5563; border: 1px solid #E5E7EB; }

/* ── Status badge with dot ── */
.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.status-badge.ativo  { background: #D1FAE5; color: #065F46; }
.status-badge.inativo{ background: #FEE2E2; color: #991B1B; }
.status-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.status-badge.ativo  .status-dot { background: #10B981; }
.status-badge.inativo .status-dot { background: #EF4444; }

/* ── Nivel info box in modal ── */
.nivel-info {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    font-size: 12.5px; line-height: 1.5;
}
.nivel-info.admin { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.nivel-info.op    { background: #F9FAFB; color: #374151; border: 1px solid #E5E7EB; }
.nivel-info i { margin-top: 2px; flex-shrink: 0; }

/* ── Toggle button color ── */
.btn-toggle-user { color: var(--warning) !important; }
.btn-toggle-user:hover { background: var(--warning-light) !important; }

/* ═══ CONFIGURAÇÕES TABS ═══ */
.cfg-tabs {
    display: flex; gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.cfg-tab {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 16px; border-radius: 8px 8px 0 0;
    border: 1.5px solid transparent; border-bottom: none;
    font-size: 13px; font-weight: 600; cursor: pointer;
    background: none; color: var(--text-light);
    font-family: inherit; transition: all var(--transition);
    margin-bottom: -2px;
}
.cfg-tab:hover { background: var(--bg); color: var(--text); }
.cfg-tab.active {
    background: var(--white); color: var(--primary);
    border-color: var(--border); border-bottom-color: var(--white);
}
.cfg-tab i { font-size: 12px; }

/* ── Logo upload ── */
.logo-preview {
    width: 160px; height: 120px; margin: 0 auto;
    border: 2px dashed var(--border); border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); overflow: hidden;
}
.logo-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    color: var(--text-muted); font-size: 12px;
}
.logo-placeholder i { font-size: 28px; }

/* ── Lists (Categorias / Localizações) ── */
.lista-add-row {
    display: flex; gap: 10px; align-items: center;
    padding: 12px 16px;
    background: var(--bg); border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-light);
}
.lista-add-row input { flex: 1; }
.lista-items {
    display: flex; flex-direction: column; gap: 2px;
    margin-top: 8px;
}
.lista-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--white); transition: background var(--transition);
}
.lista-item:hover { background: var(--bg); }
.lista-item-nome { flex: 1; font-size: 13.5px; font-weight: 500; }
.lista-item-actions { display: flex; gap: 4px; }
.lista-btn-edit, .lista-btn-del {
    width: 30px; height: 30px; border-radius: 6px; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12px; transition: all var(--transition);
}
.lista-btn-edit { background: var(--bg); color: var(--primary); }
.lista-btn-edit:hover { background: #DBEAFE; }
.lista-btn-del  { background: var(--bg); color: var(--danger); }
.lista-btn-del:hover  { background: var(--danger-light); }
.lista-vazia {
    padding: 32px; text-align: center;
    color: var(--text-muted); font-size: 13px;
    border: 2px dashed var(--border); border-radius: var(--radius);
    display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.lista-vazia i { font-size: 24px; opacity: .5; }

/* ── Auditoria: modulo colors ── */
.audit-mod {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600;
}

@media (max-width: 768px) {
    .perm-grid { grid-template-columns: 1fr; }
    .cfg-tabs  { flex-wrap: wrap; }
}


/* ── Phase 8: Catalog table / form ── */
.cat-prod-form {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--bg); border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-light);
}
.catalog-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.catalog-table thead th {
    padding: 10px 12px; background: var(--bg);
    font-size: 11.5px; font-weight: 700; text-transform: uppercase;
    color: var(--text-muted); letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.catalog-table tbody tr { border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
.catalog-table tbody tr:hover { background: #F9FAFB; }
.catalog-table tbody td { padding: 10px 12px; }
.catalog-table tbody tr:last-child { border-bottom: none; }

/* Estoque table: wider columns for new fields */
#estoqueTable th:nth-child(3),
#estoqueTable td:nth-child(3) { width: 90px; }
#estoqueTable th:nth-child(4),
#estoqueTable td:nth-child(4) { width: 130px; }

/* Product select in modals */
.prod-select-box {
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--white); overflow: hidden;
}
.prod-select-search {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-bottom: 1px solid var(--border-light);
    background: var(--bg);
}
.prod-select-search input {
    border: none; background: transparent; outline: none;
    font-size: 13px; width: 100%; color: var(--text);
}
.prod-select-search i { color: var(--text-muted); font-size: 12px; }
.prod-select-list {
    width: 100%; border: none; padding: 4px;
    font-family: inherit; font-size: 13px;
    background: var(--white); outline: none; cursor: pointer;
    max-height: 160px; overflow-y: auto;
}
.prod-select-list option { padding: 6px 8px; }
.prod-select-info {
    padding: 8px 12px; background: #EFF6FF;
    font-size: 12px; color: var(--secondary);
    border-top: 1px solid var(--border-light);
    min-height: 34px; display: flex; align-items: center; gap: 6px;
}
