/* ===================================
   KIRO ERP - Theme System
   Odoo-Style Colors (Primary: #714B67, Teal: #00A09D)
   Dual Theme: Dark + Light
   =================================== */

/* ============ DARK THEME (Default) ============ */
:root,
[data-theme="dark"] {
    /* Primary - Odoo Purple/Mauve */
    --primary: #9b6b91;
    --primary-dark: #714B67;
    --primary-light: #b48dab;
    --primary-glow: rgba(155, 107, 145, 0.5);
    --primary-rgb: 155, 107, 145;

    /* Secondary - Odoo Teal */
    --secondary: #00A09D;
    --secondary-light: #26c6c2;

    /* Backgrounds */
    --bg-darkest: #0a0a14;
    --bg-darker: #0f0f1a;
    --bg-dark: #1a1a2e;
    --bg-card: #1e1e2f;
    --bg-card-hover: #252538;
    --bg-elevated: #2a2a3e;
    --bg-input: #1a1a2e;
    --bg-body: #0f0f1a;
    --bg-muted: #1a1a2e;

    /* Sidebar */
    --sidebar-width: 250px;
    --sidebar-collapsed: 68px;
    --sidebar-bg: #0f0f1a;
    --sidebar-bg-hover: #1e1e2f;
    --sidebar-bg-active: linear-gradient(135deg, #714B67 0%, #9b6b91 100%);
    --sidebar-text: #8b8b9c;
    --sidebar-text-active: #ffffff;
    --sidebar-section: #4a4a5e;
    --sidebar-border: #2a2a3e;

    /* Top bar */
    --topbar-bg: #0f0f1a;
    --topbar-border: #2a2a3e;

    /* Borders */
    --border-color: #2a2a3e;
    --border-light: #353548;

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #b8b8c8;
    --text-tertiary: #8b8b9c;
    --text-muted: #6b6b7e;

    /* Status colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --danger-light: rgba(239, 68, 68, 0.15);
    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.15);
    --info-light: rgba(6, 182, 212, 0.15);

    /* Page background */
    --bg-main: var(--bg-darker);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);

    /* Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Code */
    --code-bg: #2a2a3e;
    --code-color: #b48dab;

    /* Login background */
    --login-gradient: linear-gradient(135deg, #0a0a14 0%, #1a1a2e 50%, #0a0a14 100%);
}

/* ============ LIGHT THEME ============ */
[data-theme="light"] {
    /* Primary - Odoo Purple/Mauve */
    --primary: #714B67;
    --primary-dark: #5B3D54;
    --primary-light: #9b6b91;
    --primary-glow: rgba(113, 75, 103, 0.3);
    --primary-rgb: 113, 75, 103;

    /* Secondary - Odoo Teal */
    --secondary: #00A09D;
    --secondary-light: #26c6c2;

    /* Backgrounds */
    --bg-darkest: #f1f5f9;
    --bg-darker: #f8fafc;
    --bg-dark: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-elevated: #f1f5f9;
    --bg-input: #ffffff;
    --bg-body: #f8fafc;
    --bg-muted: #f1f5f9;

    /* Sidebar */
    --sidebar-bg: #ffffff;
    --sidebar-bg-hover: #f6f0f4;
    --sidebar-bg-active: linear-gradient(135deg, #714B67 0%, #9b6b91 100%);
    --sidebar-text: #64748b;
    --sidebar-text-active: #ffffff;
    --sidebar-section: #94a3b8;
    --sidebar-border: #e2e8f0;

    /* Top bar */
    --topbar-bg: #ffffff;
    --topbar-border: #e2e8f0;

    /* Borders */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;

    /* Status colors */
    --success: #059669;
    --success-bg: rgba(16, 185, 129, 0.1);
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #d97706;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger: #dc2626;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --danger-light: rgba(239, 68, 68, 0.1);
    --info: #0891b2;
    --info-bg: rgba(6, 182, 212, 0.1);
    --info-light: rgba(6, 182, 212, 0.1);

    /* Page background */
    --bg-main: #f8fafc;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
    --shadow-xl: 0 20px 50px rgba(15, 23, 42, 0.15);

    /* Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Code */
    --code-bg: #f6f0f4;
    --code-color: #714B67;

    /* Login background */
    --login-gradient: linear-gradient(135deg, #f6f0f4 0%, #ede4ea 50%, #f0e8ed 100%);
}

/* ============ BASE RESET ============ */
* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    padding-top: 64px;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============ TOP NAVBAR ============ */
.navbar {
    background: var(--topbar-bg) !important;
    border-bottom: 1px solid var(--topbar-border);
    height: 64px;
    padding: 0 1.5rem;
    z-index: 1030;
    transition: background 0.3s, border 0.3s;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary) !important;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand i {
    background: var(--sidebar-bg-active);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Theme toggle button */
.theme-toggle {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 12px;
    font-size: 16px;
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.theme-toggle .bi-sun-fill { display: none; }
.theme-toggle .bi-moon-fill { display: inline; }
[data-theme="light"] .theme-toggle .bi-sun-fill { display: inline; }
[data-theme="light"] .theme-toggle .bi-moon-fill { display: none; }

.nav-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.nav-user-info .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--sidebar-bg-active);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-user-info .user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.2;
}

.nav-user-info .user-role {
    font-size: 11px;
    color: var(--text-tertiary);
    display: block;
}

.btn-logout {
    background: var(--bg-elevated);
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-logout:hover {
    background: var(--danger-bg);
    color: var(--danger) !important;
    border-color: var(--danger);
}

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width, 250px);
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 12px;
    padding-bottom: 40px;
    z-index: 1020;
    border-right: 1px solid var(--border-color);
    transition: background 0.3s, border 0.3s;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-dark) var(--sidebar-bg);
}

.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 4px;
    border: 1px solid var(--sidebar-bg);
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 10px 14px;
    border-radius: var(--radius);
    margin: 2px 0;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-bg-hover);
    color: var(--text-primary);
}

.sidebar .nav-link.active {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-active) !important;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.sidebar .nav-link i {
    margin-right: 12px;
    font-size: 17px;
    width: 22px;
    text-align: center;
    color: var(--text-tertiary);
}

.sidebar .nav-link:hover i,
.sidebar .nav-link.active i {
    color: #fff;
}

[data-theme="light"] .sidebar .nav-link:hover i {
    color: var(--primary);
}

[data-theme="light"] .sidebar .nav-link:hover {
    color: var(--primary);
}

.sidebar .nav-link .bi-chevron-down {
    margin-left: auto;
    margin-right: 0;
    font-size: 11px;
    transition: transform 0.2s;
}

.sidebar .nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.sidebar .collapse .nav-link {
    padding: 7px 14px 7px 50px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.sidebar .collapse .nav-link::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-right: 10px;
    flex-shrink: 0;
}

.sidebar .collapse .nav-link:hover {
    background: var(--sidebar-bg-hover);
    color: var(--primary);
}

.sidebar .collapse .nav-link:hover::before {
    background: var(--primary);
}

.sidebar hr {
    margin: 14px 8px;
    border-color: var(--border-color);
}

.sidebar-section-title {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--sidebar-section);
    font-weight: 700;
    padding: 14px 14px 6px;
    letter-spacing: 0.08em;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-left: 250px;
    padding: 24px 32px;
    min-height: calc(100vh - 64px);
    background: var(--bg-main);
    transition: background 0.3s;
    overflow-y: auto;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
}

/* Global scrollbar styling */
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* ============ PAGE HEADER ============ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 13.5px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* ============ STAT CARDS (Odoo KPI Style) ============ */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--sidebar-bg-active);
    opacity: 0;
    transition: opacity 0.25s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before { opacity: 1; }

.stat-card .card-body {
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card .stat-info { flex: 1; }

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-card .stat-change {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-card .stat-change.positive { color: var(--success); }
.stat-card .stat-change.negative { color: var(--danger); }

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(155, 107, 145, 0.15);
    color: var(--primary-light);
}

.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.danger .stat-icon  { background: var(--danger-bg);  color: var(--danger); }
.stat-card.info .stat-icon    { background: var(--info-bg);    color: var(--info); }
.stat-card.secondary .stat-icon { background: rgba(0, 160, 157, 0.15); color: var(--secondary); }
.stat-card.teal .stat-icon    { background: rgba(0, 160, 157, 0.15); color: var(--secondary); }

/* ============ CARDS ============ */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
}

.card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 22px;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h5,
.card-header .card-title {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.card-body { padding: 22px; }

/* ============ BUTTONS (Odoo Style) ============ */
.btn {
    font-weight: 500;
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 13.5px;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary-dark);
    border: none;
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-secondary {
    background: var(--secondary);
    border: none;
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-light);
    color: white;
    transform: translateY(-1px);
}

.btn-success { background: var(--success); border: none; color: white; }
.btn-success:hover { background: #059669; color: white; }

.btn-danger { background: var(--danger); border: none; color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-warning { background: var(--warning); border: none; color: white !important; }
.btn-warning:hover { background: #d97706; color: white !important; }

.btn-info { background: var(--info); border: none; color: white !important; }
.btn-info:hover { background: #0891b2; color: white !important; }

.btn-outline-primary {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-outline-secondary {
    border: 1.5px solid var(--secondary);
    color: var(--secondary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}

.btn-outline-light {
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    background: transparent;
}

.btn-outline-light:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
}

/* ============ FORMS (Odoo Inline-Edit Style) ============ */
.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    padding: 9px 13px;
    font-size: 13.5px;
    transition: all 0.2s;
    background: var(--bg-input);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-input);
    color: var(--text-primary);
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:disabled,
.form-control[readonly] {
    background: var(--bg-muted);
    color: var(--text-tertiary);
}

.form-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.input-group-text {
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-color);
    color: var(--text-tertiary);
}

textarea.form-control { min-height: 90px; }

.form-check-label { color: var(--text-secondary); }

.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border-light);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Odoo-style editable fields */
.field-editable {
    border: 1px solid transparent;
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: all 0.2s;
    cursor: pointer;
}

.field-editable:hover {
    border-color: var(--border-color);
    background: var(--bg-input);
}

.field-editable:focus-within {
    border-color: var(--primary);
    background: var(--bg-input);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* ============ TABLES (Odoo List View Style) ============ */
.table {
    margin-bottom: 0;
    color: var(--text-secondary);
    background: transparent;
}

.table thead {
    background: var(--bg-darkest);
}

.table thead th {
    border: none;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-tertiary);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    white-space: nowrap;
    background: var(--bg-darkest);
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 13.5px;
    color: var(--text-secondary);
    background: var(--bg-card);
}

.table tbody tr:hover td {
    background: var(--bg-card-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table strong { color: var(--text-primary); }

.table-active td {
    background: rgba(113, 75, 103, 0.1) !important;
}

/* Odoo-style editable table cells */
.table-editable tbody td {
    cursor: pointer;
    position: relative;
}

.table-editable tbody td:hover {
    background: rgba(113, 75, 103, 0.05);
}

.table-editable tbody td input,
.table-editable tbody td select {
    border: none;
    background: transparent;
    width: 100%;
    padding: 4px 8px;
    font-size: 13.5px;
    color: var(--text-primary);
    outline: none;
}

.table-editable tbody td input:focus,
.table-editable tbody td select:focus {
    background: var(--bg-input);
    border: 1px solid var(--primary);
    border-radius: 4px;
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Odoo-style line items (PO, SO, Invoice) */
.line-items-table {
    width: 100%;
    border-collapse: collapse;
}

.line-items-table thead th {
    background: var(--bg-elevated);
    padding: 10px 12px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    border-bottom: 2px solid var(--border-color);
}

.line-items-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.line-items-table tbody td input[type="number"],
.line-items-table tbody td input[type="text"] {
    border: 1px solid transparent;
    background: transparent;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    width: 100%;
    font-size: 13px;
    color: var(--text-primary);
    text-align: right;
    transition: all 0.15s;
}

.line-items-table tbody td input:hover {
    border-color: var(--border-color);
    background: var(--bg-input);
}

.line-items-table tbody td input:focus {
    border-color: var(--primary);
    background: var(--bg-input);
    box-shadow: 0 0 0 2px var(--primary-glow);
    outline: none;
}

.line-items-table tfoot td {
    padding: 10px 12px;
    font-weight: 600;
    border-top: 2px solid var(--border-color);
    color: var(--text-primary);
}

.line-items-table .row-total {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-muted);
}

.line-items-table .add-line-btn {
    color: var(--secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.line-items-table .add-line-btn:hover {
    color: var(--secondary-light);
}

code {
    background: var(--code-bg);
    color: var(--code-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* ============ STATUS BADGES (Odoo Style) ============ */
.badge,
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-block;
}

.status-active,
.status-published,
.status-completed,
.status-paid,
.status-approved,
.status-received { background: var(--success-bg); color: var(--success); }

.status-inactive,
.status-archived,
.status-cancelled,
.status-rejected,
.status-lost { background: rgba(107, 114, 128, 0.2); color: var(--text-tertiary); }

.status-draft,
.status-pending,
.status-new { background: var(--warning-bg); color: var(--warning); }

.status-confirmed,
.status-sent,
.status-in_progress,
.status-partial { background: var(--info-bg); color: var(--info); }

.status-overdue,
.status-failed,
.status-expired { background: var(--danger-bg); color: var(--danger); }

/* Odoo-style status bar (breadcrumb progress) */
.status-bar {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 20px;
}

.status-bar .status-step {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    border: 1px solid var(--border-color);
    position: relative;
    cursor: default;
}

.status-bar .status-step:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.status-bar .status-step:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.status-bar .status-step.active {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
}

.status-bar .status-step.completed {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

/* ============ ALERTS ============ */
.alert {
    border: none;
    border-radius: var(--radius);
    padding: 13px 18px;
    font-size: 13.5px;
    border-left: 3px solid transparent;
}

.alert-success { background: var(--success-bg); color: var(--success); border-left-color: var(--success); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-left-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left-color: var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-left-color: var(--info); }

/* ============ TABS (Odoo Style) ============ */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
    gap: 4px;
}

.nav-tabs .nav-link {
    border: none;
    color: var(--text-tertiary);
    font-weight: 500;
    padding: 10px 18px;
    border-radius: 0;
    margin-bottom: -2px;
    background: transparent;
    font-size: 13.5px;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    background: transparent;
}

.nav-tabs .nav-link:hover:not(.active) {
    color: var(--primary-light);
    background: rgba(113, 75, 103, 0.05);
    border-bottom-color: transparent;
}

/* ============ POS LAYOUT ============ */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 16px;
    height: calc(100vh - 90px);
    margin: -24px -32px;
    padding: 16px;
    overflow: hidden;
}

.pos-products {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-dark) transparent;
}

.pos-products::-webkit-scrollbar { width: 6px; }
.pos-products::-webkit-scrollbar-track { background: transparent; }
.pos-products::-webkit-scrollbar-thumb { background: var(--primary-dark); border-radius: 3px; }

.pos-cart {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-dark) transparent;
}

.pos-cart::-webkit-scrollbar { width: 6px; }
.pos-cart::-webkit-scrollbar-track { background: transparent; }
.pos-cart::-webkit-scrollbar-thumb { background: var(--primary-dark); border-radius: 3px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.product-card {
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.product-card:hover {
    border-color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 160, 157, 0.3);
}

.product-card .product-img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-darkest);
    margin-bottom: 8px;
}

.product-card .product-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-card .product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--secondary);
}

/* ============ LOGIN PAGE ============ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--login-gradient);
    padding: 20px;
    padding-top: 20px !important;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(113, 75, 103, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    top: -300px;
    right: -200px;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 160, 157, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    bottom: -200px;
    left: -200px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 45px 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 10;
}

.login-logo { text-align: center; margin-bottom: 32px; }

.login-logo .logo-circle {
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    background: var(--sidebar-bg-active);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #fff;
    box-shadow: 0 10px 30px var(--primary-glow);
}

.login-logo h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.login-logo p {
    color: var(--text-tertiary);
    font-size: 13.5px;
    margin: 8px 0 0;
}

.login-card .form-control {
    padding: 11px 15px;
    font-size: 14px;
}

.login-card .input-group-text {
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-color);
    border-right: none;
    color: var(--text-tertiary);
    padding: 0 14px;
}

.login-card .input-group .form-control {
    border-left: none;
    padding-left: 0;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer small {
    color: var(--text-muted);
    font-size: 12px;
}

/* ============ MODAL ============ */
.modal-content {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    background: var(--bg-card);
    color: var(--text-secondary);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
}

.modal-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

.modal-body { padding: 22px; }

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

.btn-close {
    filter: invert(1) brightness(2);
    opacity: 0.6;
}

[data-theme="light"] .btn-close {
    filter: none;
    opacity: 0.5;
}

.btn-close:hover { opacity: 1; }

/* ============ PAGINATION ============ */
.pagination { gap: 4px; }

.pagination .page-link {
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin: 0;
    font-size: 13px;
    padding: 7px 12px;
}

.pagination .page-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.pagination .page-item.active .page-link {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
}

.pagination .page-item.disabled .page-link {
    background: var(--bg-muted);
    color: var(--text-muted);
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-state i {
    font-size: 56px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.empty-state h5 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease-out; }

/* ============ PERMISSION TREE ============ */
.perm-tree {
    background: var(--bg-darker);
    border-radius: var(--radius);
    padding: 0;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.perm-module {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.perm-module:last-child { border-bottom: none; }

.perm-module-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-elevated);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--border-color);
}

.perm-module-header:hover {
    background: var(--bg-card-hover);
}

.perm-module-header .module-toggle {
    margin-right: 10px;
    color: var(--text-tertiary);
    transition: transform 0.2s;
}

.perm-module.expanded .perm-module-header .module-toggle {
    transform: rotate(90deg);
}

.perm-module-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
    font-size: 14px;
}

.perm-module-count {
    background: var(--primary-dark);
    color: #fff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 12px;
}

.perm-module-content {
    display: none;
    padding: 8px 16px 12px 40px;
    background: var(--bg-card);
}

.perm-module.expanded .perm-module-content { display: block; }

.perm-feature {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
}

.perm-feature:last-child { border-bottom: none; }

.perm-feature-name {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 6px;
    text-transform: capitalize;
    display: flex;
    align-items: center;
    gap: 8px;
}

.perm-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.perm-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--bg-elevated);
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
    border: 1.5px solid transparent;
    color: var(--text-secondary);
}

.perm-checkbox:hover { background: var(--bg-card-hover); }
.perm-checkbox input[type="checkbox"] { margin: 0; cursor: pointer; }

.perm-checkbox:has(input:checked) {
    background: rgba(113, 75, 103, 0.2);
    border-color: var(--primary);
    color: var(--primary-light);
}

[data-theme="light"] .perm-checkbox:has(input:checked) {
    color: var(--primary);
}

.perm-action-view    { color: #60a5fa; }
.perm-action-create  { color: #34d399; }
.perm-action-edit    { color: #fbbf24; }
.perm-action-delete  { color: #f87171; }
.perm-action-approve { color: #c084fc; }
.perm-action-export  { color: #22d3ee; }
.perm-action-import  { color: #f472b6; }
.perm-action-print   { color: #94a3b8; }

.perm-toolbar {
    background: var(--bg-card);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.perm-toolbar .btn { padding: 5px 12px; font-size: 12px; }
.perm-search { flex: 1; min-width: 200px; }

/* ============ ODOO-STYLE FORM VIEW ============ */
.form-view {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.form-view-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-view-body {
    padding: 24px;
}

.form-view-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-elevated);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Odoo-style field groups */
.field-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
    margin-bottom: 20px;
}

.field-group.full-width {
    grid-template-columns: 1fr;
}

.field-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.field-row .field-label {
    min-width: 140px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-align: right;
}

.field-row .field-value {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* ============ ODOO-STYLE CHATTER / ACTIVITY ============ */
.chatter {
    border-top: 1px solid var(--border-color);
    padding: 20px 24px;
    background: var(--bg-elevated);
}

.chatter-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child { border-bottom: none; }

.activity-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-bg-active);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-content .activity-user {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.activity-content .activity-text {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 2px;
}

.activity-content .activity-time {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 4px;
}

/* ============ UTILITIES ============ */
.text-muted-2 { color: var(--text-tertiary) !important; }
.text-primary-color { color: var(--primary) !important; }
.text-secondary-color { color: var(--secondary) !important; }
.text-teal { color: var(--secondary) !important; }

.bg-soft-primary { background: rgba(113, 75, 103, 0.15); color: var(--primary-light); }
[data-theme="light"] .bg-soft-primary { color: var(--primary); }

.bg-soft-secondary { background: rgba(0, 160, 157, 0.15); color: var(--secondary); }
.bg-soft-success { background: var(--success-bg); color: var(--success); }
.bg-soft-danger  { background: var(--danger-bg);  color: var(--danger); }
.bg-soft-warning { background: var(--warning-bg); color: var(--warning); }
.bg-soft-info    { background: var(--info-bg);    color: var(--info); }

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

/* List group */
.list-group-item {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 18px;
    background: var(--bg-card);
    color: var(--text-secondary);
}

.list-group-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.list-group-item.active {
    background: rgba(113, 75, 103, 0.15);
    color: var(--text-primary);
    border-left: 3px solid var(--primary);
}

.list-group-flush { border: none; }

/* Bootstrap overrides */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 8px 16px;
}

.dropdown-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.dropdown-divider { border-color: var(--border-color); }

hr { border-color: var(--border-color); }

img { border-radius: var(--radius-sm); }

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-bg-active);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

/* ============ ODOO-STYLE KANBAN VIEW ============ */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
}

.kanban-column {
    min-width: 280px;
    max-width: 320px;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.kanban-column-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column-header .count {
    background: var(--primary-dark);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.kanban-column-body {
    padding: 12px;
    min-height: 200px;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    cursor: grab;
    transition: all 0.2s;
}

.kanban-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kanban-card:active { cursor: grabbing; }

.kanban-card .kanban-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.kanban-card .kanban-meta {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ============ ODOO-STYLE BREADCRUMB ============ */
.breadcrumb-odoo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.breadcrumb-odoo a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-odoo a:hover {
    text-decoration: underline;
}

.breadcrumb-odoo .separator {
    color: var(--text-muted);
}

.breadcrumb-odoo .current {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============ ODOO-STYLE SUMMARY TOTALS ============ */
.summary-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    padding: 16px 0;
}

.summary-totals .total-row {
    display: flex;
    gap: 24px;
    align-items: center;
    font-size: 14px;
}

.summary-totals .total-row .label {
    color: var(--text-tertiary);
    min-width: 120px;
    text-align: right;
}

.summary-totals .total-row .value {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 100px;
    text-align: right;
}

.summary-totals .total-row.grand-total {
    font-size: 18px;
    padding-top: 8px;
    border-top: 2px solid var(--border-color);
}

.summary-totals .total-row.grand-total .value {
    color: var(--primary);
    font-weight: 700;
}

/* ============ ODOO-STYLE NOTEBOOK (Tab Sections) ============ */
.notebook {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 20px;
}

.notebook .nav-tabs {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
}

.notebook .tab-content {
    padding: 20px;
    background: var(--bg-card);
}

/* ============ RESPONSIVE HELPERS ============ */
@media (max-width: 768px) {
    .field-group {
        grid-template-columns: 1fr;
    }
    
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .kanban-board {
        flex-direction: column;
    }
    
    .kanban-column {
        min-width: 100%;
        max-width: 100%;
    }
}

/* ============ PRINT STYLES ============ */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .theme-toggle,
    .page-header .btn { display: none !important; }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    body {
        padding-top: 0 !important;
        background: white !important;
        color: #000 !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    
    .table thead th {
        background: #f5f5f5 !important;
        color: #333 !important;
    }
    
    .table tbody td {
        background: white !important;
        color: #333 !important;
    }
}
