/* ===========================
   Délice & Parfum by Lilia
   Color Theme inspired by brand imagery
   Deep Crimson, Beige, Cream, Elegant Dark
   =========================== */

:root {
    /* Primary Palette - Inspired by the red/crimson branding images */
    --primary: #8B1A2B;
    --primary-dark: #6B1220;
    --primary-light: #A62D40;
    --primary-hover: #7A1625;
    
    /* Secondary - Beige/Cream from image backgrounds */
    --secondary: #D4A574;
    --secondary-light: #E8CCB0;
    --secondary-lighter: #F5EDE4;
    
    /* Backgrounds */
    --bg-main: #FDF8F4;
    --bg-card: #FFFFFF;
    --bg-sidebar: #8B1A2B;
    --bg-hover: #F7EDE6;
    
    /* Text */
    --text-primary: #2D1B14;
    --text-secondary: #6B5B54;
    --text-light: #9B8A82;
    --text-white: #FFFFFF;
    --text-on-primary: #FDF0E8;
    
    /* Brand Colors */
    --boticario: #004B87;
    --natura: #F47920;
    --eudora: #8E2574;
    --avon: #E4007C;
    
    /* Status */
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
    --info: #3498DB;
    
    /* Shadows & Borders */
    --shadow-sm: 0 1px 3px rgba(139, 26, 43, 0.08);
    --shadow-md: 0 4px 12px rgba(139, 26, 43, 0.1);
    --shadow-lg: 0 8px 24px rgba(139, 26, 43, 0.12);
    --border-color: #E8D5C8;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 65px;
    
    /* Transitions */
    --transition: all 0.3s ease;
}

/* ===========================
   Reset & Base
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
}

/* ===========================
   Scrollbar
   =========================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-lighter);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* ===========================
   Sidebar
   =========================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 10px;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-logo {
    width: 40px;
    height: 40px;
}

.brand-name {
    color: var(--text-white);
    font-size: 1.2rem;
    font-family: 'Playfair Display', serif;
    letter-spacing: 0.5px;
}

.brand-sub {
    color: var(--secondary-light);
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 2px;
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .brand-sub {
    display: none;
}

.sidebar-menu {
    list-style: none;
    padding: 16px 0;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: var(--transition);
    gap: 14px;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-white);
    border-left-color: var(--secondary);
}

.menu-item i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.sidebar.collapsed .menu-item span {
    display: none;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.brand-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-boticario { background: var(--boticario); }
.badge-natura { background: var(--natura); }
.badge-eudora { background: var(--eudora); }
.badge-avon { background: var(--avon); }

.sidebar.collapsed .sidebar-footer { display: none; }

/* ===========================
   Main Content
   =========================== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
}

/* ===========================
   Top Bar
   =========================== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.page-title {
    font-size: 1.4rem;
    color: var(--primary);
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--secondary-lighter);
    border-radius: 25px;
    padding: 8px 16px;
    gap: 8px;
}

.search-box i {
    color: var(--text-light);
    font-size: 0.9rem;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    width: 180px;
}

.search-box input::placeholder {
    color: var(--text-light);
}

.notifications {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.notifications:hover {
    background: var(--bg-hover);
}

.notifications i {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ===========================
   Sync Status Badge
   =========================== */
.sync-status-badge {
    padding: 8px;
    border-radius: var(--border-radius-sm);
    font-size: 1.05rem;
    cursor: default;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

.sync-status-badge[data-status="syncing"] {
    color: var(--warning);
}

.sync-status-badge[data-status="syncing"] i {
    animation: syncPulse 1.2s ease-in-out infinite;
}

.sync-status-badge[data-status="ok"] {
    color: var(--success);
}

.sync-status-badge[data-status="offline"] {
    color: var(--text-light);
}

.sync-status-badge[data-status="error"] {
    color: var(--danger);
    cursor: pointer;
    background: #FDEDEC;
    border-radius: var(--border-radius-sm);
}

.sync-status-badge[data-status="error"]:hover {
    background: #FADADD;
}

@keyframes syncPulse {
    0%, 100% { opacity: 1;   transform: translateY(0); }
    50%       { opacity: 0.5; transform: translateY(-2px); }
}

/* ===========================
   Page Container
   =========================== */
.page-container {
    padding: 24px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   Stats Grid
   =========================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Playfair Display', serif;
}

/* ===========================
   Dashboard Grid
   =========================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* ===========================
   Cards
   =========================== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--secondary-lighter) 0%, var(--bg-card) 100%);
}

.card-header h3 {
    font-size: 1.05rem;
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

/* ===========================
   Tables
   =========================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: var(--primary);
    color: var(--text-white);
    padding: 12px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    font-family: 'Poppins', sans-serif;
}

.table thead th:first-child {
    border-radius: var(--border-radius-sm) 0 0 0;
}

.table thead th:last-child {
    border-radius: 0 var(--border-radius-sm) 0 0;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table tbody td {
    padding: 11px 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 30px;
    font-style: italic;
}

/* ===========================
   Chart Bars
   =========================== */
.brand-chart {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-label {
    width: 80px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.chart-bar-bg {
    flex: 1;
    height: 28px;
    background: var(--secondary-lighter);
    border-radius: 14px;
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    border-radius: 14px;
    transition: width 0.8s ease;
    min-width: 0;
}

.chart-value {
    width: 80px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    flex-shrink: 0;
}

/* ===========================
   Alerts
   =========================== */
.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
}

.alert-item.warning {
    background: #FEF3E2;
    border-left: 4px solid var(--warning);
    color: #8A6D3B;
}

.alert-item.danger {
    background: #FDEDEC;
    border-left: 4px solid var(--danger);
    color: #922B21;
}

.alert-item i {
    font-size: 1.1rem;
}

/* ===========================
   Buttons
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--text-white);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #C0392B;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon.edit {
    background: var(--info);
    color: white;
}

.btn-icon.delete {
    background: var(--danger);
    color: white;
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* ===========================
   Forms
   =========================== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 26, 43, 0.1);
}

.form-input::placeholder {
    color: var(--text-light);
}

textarea.form-input {
    resize: vertical;
}

.form-row {
    display: flex;
    gap: 14px;
}

.form-row .form-group {
    flex: 1;
}

.input-with-btn {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.input-with-btn .form-select,
.input-with-btn .form-input {
    flex: 1;
}

/* ===========================
   Page Actions
   =========================== */
.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group .form-select {
    width: auto;
    min-width: 160px;
}

.filter-group .form-input {
    width: auto;
    min-width: 200px;
}

.filter-group .form-group {
    margin-bottom: 0;
}

.filter-group .form-group label {
    margin-bottom: 4px;
}

/* ===========================
   Sales Layout
   =========================== */
.sales-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
}

.sales-form-card {
    position: sticky;
    top: calc(var(--topbar-height) + 24px);
    align-self: start;
}

.cart-items {
    max-height: 250px;
    overflow-y: auto;
    margin: 12px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    font-size: 0.85rem;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.cart-item-brand {
    font-size: 0.72rem;
    color: var(--text-light);
}

.cart-item-price {
    font-weight: 600;
    color: var(--primary);
    min-width: 80px;
    text-align: right;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: var(--transition);
}

.cart-item-remove:hover {
    transform: scale(1.2);
}

.sale-summary {
    border-top: 2px solid var(--border-color);
    padding-top: 14px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9rem;
}

.total-row {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    border-top: 2px solid var(--primary);
    padding-top: 12px;
    margin: 10px 0;
    font-family: 'Playfair Display', serif;
}

/* ===========================
   Modals
   =========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 27, 20, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-lg {
    max-width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--text-white);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header h3 {
    font-size: 1.1rem;
    color: var(--text-white);
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.modal-close:hover {
    color: white;
    transform: scale(1.1);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--secondary-lighter);
}

/* ===========================
   Notification Panel
   =========================== */
.notification-panel {
    position: fixed;
    right: -360px;
    top: 0;
    width: 350px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 150;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.notification-panel.show {
    right: 0;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.notif-header h3 {
    color: var(--text-white);
    font-size: 1rem;
}

.notif-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.notif-item {
    padding: 12px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
    font-size: 0.82rem;
    border-left: 3px solid var(--primary);
    background: var(--secondary-lighter);
}

.notif-item .notif-time {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* ===========================
   Toasts
   =========================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    min-width: 280px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast i {
    font-size: 1.1rem;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.warning i { color: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===========================
   Status Badges
   =========================== */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-ok { background: #E8F8F0; color: var(--success); }
.status-low { background: #FEF3E2; color: var(--warning); }
.status-out { background: #FDEDEC; color: var(--danger); }

.status-paid { background: #E8F8F0; color: var(--success); }
.status-pending { background: #FEF3E2; color: var(--warning); }

.status-paid i,
.status-pending i {
    margin-right: 4px;
    font-size: 0.7rem;
}

/* Payment Status Toggle */
.payment-status-toggle {
    display: flex;
    gap: 10px;
}

.toggle-option {
    flex: 1;
    cursor: pointer;
}

.toggle-option input[type="radio"] {
    display: none;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    transition: var(--transition);
    text-align: center;
}

.toggle-label.paid {
    color: var(--text-secondary);
}

.toggle-label.pending {
    color: var(--text-secondary);
}

.toggle-option input[type="radio"]:checked + .toggle-label.paid {
    background: #E8F8F0;
    border-color: var(--success);
    color: var(--success);
}

.toggle-option input[type="radio"]:checked + .toggle-label.pending {
    background: #FEF3E2;
    border-color: var(--warning);
    color: #8A6D3B;
}

/* Fiado row highlight */
tr.row-fiado {
    background: #FFFBF0 !important;
    border-left: 3px solid var(--warning);
}

/* Pay button */
.btn-icon.pay {
    color: var(--success);
}

.btn-icon.pay:hover {
    background: #E8F8F0;
}

/* ===========================
   Brand Tag
   =========================== */
.brand-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: white;
}

.brand-tag.Boticário,
.brand-tag.boticario { background: var(--boticario); }
.brand-tag.Natura,
.brand-tag.natura { background: var(--natura); }
.brand-tag.Eudora,
.brand-tag.eudora { background: var(--eudora); }
.brand-tag.Avon,
.brand-tag.avon { background: var(--avon); }

/* ===========================
   Sale Detail
   =========================== */
.sale-detail-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.sale-detail-info .info-item {
    font-size: 0.85rem;
}

.sale-detail-info .info-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    display: block;
}

.sale-detail-total {
    text-align: right;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    padding-top: 12px;
    border-top: 2px solid var(--primary);
    margin-top: 12px;
    font-family: 'Playfair Display', serif;
}

/* ===========================
   Ranking List
   =========================== */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-pos {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    min-width: 32px;
    text-align: center;
    font-family: 'Playfair Display', serif;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-name {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--secondary-lighter);
    border-radius: 4px;
    overflow: hidden;
}

.ranking-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.ranking-value {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
}

/* ===========================
   Birthday Badges
   =========================== */
.birthday-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 6px;
}

.birthday-badge.today {
    background: #ffe0e6;
    color: var(--danger);
    animation: pulse-badge 1.5s infinite;
}

.birthday-badge.soon {
    background: #FEF3E2;
    color: var(--warning);
}

.birthday-badge.upcoming {
    background: #E8F0FE;
    color: var(--info);
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.alert-item.birthday {
    background: #ffe0e6;
    border-left-color: var(--danger);
}

.alert-item.info {
    background: #E8F0FE;
    border-left-color: var(--info);
}

/* ===========================
   Login Screen
   =========================== */
.login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 55%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.login-screen.hidden {
    display: none;
}

.login-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 40px 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    text-align: center;
    animation: loginSlideUp 0.4s ease;
}

@keyframes loginSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-logo-wrap {
    margin-bottom: 16px;
}

.login-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: 0 4px 16px rgba(139, 26, 43, 0.25);
}

.login-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 2px;
}

.login-sub {
    font-style: italic;
    color: var(--secondary);
    font-size: 0.95rem;
    margin-bottom: 18px;
}

.login-desc {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 24px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-light);
    font-size: 0.9rem;
    pointer-events: none;
}

.login-input {
    width: 100%;
    padding: 13px 46px 13px 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-main);
    outline: none;
    transition: var(--transition);
    letter-spacing: 0.15em;
}

.login-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 26, 43, 0.12);
}

.login-eye {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 0.95rem;
    padding: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.login-eye:hover {
    color: var(--primary);
}

.login-error {
    background: #FDEDEC;
    color: var(--danger);
    border-left: 4px solid var(--danger);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    font-size: 0.82rem;
    text-align: left;
    animation: loginShake 0.4s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes loginShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    40%       { transform: translateX(8px); }
    60%       { transform: translateX(-5px); }
    80%       { transform: translateX(5px); }
}

.login-footer-text {
    margin-top: 24px;
    font-size: 0.72rem;
    color: var(--text-light);
}

/* Firebase sync spinner (shown when already authenticated) */
.login-spinner {
    margin: 24px auto 8px;
    font-size: 2.4rem;
    color: var(--primary);
    text-align: center;
    animation: fadeIn 0.3s ease;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .login-card {
        padding: 32px 22px 24px;
        border-radius: 16px;
    }

    .login-logo {
        width: 80px;
        height: 80px;
    }

    .login-brand {
        font-size: 1.35rem;
    }
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    .sidebar,
    .topbar,
    .modal-footer,
    .modal-close,
    .page-actions,
    .toast-container,
    .notification-panel,
    .login-screen {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .modal-overlay {
        position: static;
        background: none;
        backdrop-filter: none;
    }
    
    .modal {
        box-shadow: none;
        border: none;
        max-width: 100%;
        width: 100%;
    }

    .modal-header {
        background: none;
        color: var(--text-primary);
        border-bottom: 2px solid var(--primary);
    }

    .modal-header h3 {
        color: var(--primary);
    }
}

/* ===========================
   Sidebar Overlay (Mobile)
   =========================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(45, 27, 20, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* ===========================
   Responsive Tables
   =========================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}

.table-responsive::-webkit-scrollbar {
    height: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 2px;
}

/* ===========================
   Responsive
   =========================== */

/* Tablets */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .sales-layout {
        grid-template-columns: 1fr;
    }
    
    .sales-form-card {
        position: static;
    }
}

/* Mobile */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    /* Sidebar */
    .sidebar {
        left: calc(var(--sidebar-width) * -1);
        box-shadow: none;
    }
    
    .sidebar.mobile-open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .main-content {
        margin-left: 0;
    }

    /* Topbar */
    .topbar {
        padding: 0 12px;
        gap: 10px;
        height: 56px;
    }

    .page-title {
        font-size: 1.15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .search-box {
        display: none;
    }

    .menu-toggle {
        font-size: 1.4rem;
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .notifications {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Page Container */
    .page-container {
        padding: 12px;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 12px;
        gap: 10px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        border-radius: 10px;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .stat-value {
        font-size: 1.15rem;
    }

    /* Cards */
    .card-header {
        padding: 12px 14px;
    }

    .card-header h3 {
        font-size: 0.95rem;
    }

    .card-body {
        padding: 12px;
    }

    /* Dashboard Grid */
    .dashboard-grid {
        gap: 16px;
        margin-bottom: 16px;
    }

    /* Page Actions */
    .page-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .filter-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-group .form-select,
    .filter-group .form-input {
        width: 100%;
        min-width: unset;
    }

    .filter-group .form-group {
        width: 100%;
    }

    .page-actions .btn {
        justify-content: center;
    }

    /* Forms */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-input,
    .form-select {
        padding: 12px 14px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .input-with-btn {
        flex-wrap: wrap;
    }

    .input-with-btn .form-select {
        min-width: 0;
    }
    
    /* Tables */
    .table thead th {
        padding: 10px 12px;
        font-size: 0.72rem;
        white-space: nowrap;
    }

    .table tbody td {
        padding: 10px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Buttons - Touch targets */
    .btn {
        padding: 12px 18px;
        font-size: 0.85rem;
        min-height: 44px;
    }

    .btn-sm {
        padding: 8px 14px;
        min-height: 40px;
    }

    .btn-icon {
        width: 38px;
        height: 38px;
    }

    /* Sales layout */
    .cart-items {
        max-height: 200px;
    }

    .cart-item {
        padding: 10px 12px;
        gap: 8px;
    }

    .total-row {
        font-size: 1.15rem;
    }

    .payment-status-toggle {
        flex-direction: column;
        gap: 8px;
    }

    /* Sale Detail */
    .sale-detail-info {
        grid-template-columns: 1fr;
    }

    /* Charts */
    .chart-bar-container {
        flex-wrap: wrap;
        gap: 6px;
    }

    .chart-label {
        width: 70px;
        font-size: 0.75rem;
    }

    .chart-value {
        width: 70px;
        font-size: 0.75rem;
    }

    /* Modals - Full screen on mobile */
    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        border-radius: 0;
        padding: 14px 16px;
    }

    .modal-body {
        padding: 16px;
        overflow-y: auto;
        flex: 1;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }

    .modal-overlay.show {
        align-items: stretch;
    }

    .modal-overlay.show .modal {
        display: flex;
        flex-direction: column;
    }

    /* Notification Panel - Full width */
    .notification-panel {
        width: 100%;
        right: -100%;
    }

    .notification-panel.show {
        right: 0;
    }

    /* Toast - Bottom center on mobile */
    .toast-container {
        bottom: 12px;
        right: 12px;
        left: 12px;
    }

    .toast {
        min-width: unset;
        width: 100%;
        padding: 12px 16px;
        font-size: 0.82rem;
    }

    /* Badges */
    .brand-badges {
        gap: 4px;
    }

    .badge {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    /* Ranking */
    .ranking-item {
        gap: 8px;
        padding: 8px 0;
    }

    .ranking-value {
        min-width: 70px;
        font-size: 0.75rem;
    }

    /* Alerts */
    .alert-item {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .stat-card {
        padding: 14px 12px;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }

    .topbar {
        gap: 8px;
    }

    .page-title {
        font-size: 1.05rem;
    }

    /* Stack chart labels vertically */
    .chart-bar-container {
        flex-direction: column;
        align-items: stretch;
    }

    .chart-label {
        width: 100%;
    }

    .chart-value {
        width: 100%;
        text-align: left;
    }

    .chart-bar-bg {
        height: 22px;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .stat-card:hover {
        transform: none;
    }

    .btn-primary:hover {
        transform: none;
    }

    .btn-icon:hover {
        transform: none;
    }

    .cart-item-remove:hover {
        transform: none;
    }

    .menu-item {
        padding: 16px 24px;
    }

    /* Tap highlight */
    .btn,
    .menu-item,
    .stat-card,
    .notifications {
        -webkit-tap-highlight-color: rgba(139, 26, 43, 0.1);
    }
}

/* Safe area for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .toast-container {
        bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .sidebar-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .modal-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}
