:root {
    --primary: #1e1b4b;
    --primary-light: #312e81;
    --primary-lighter: #4338ca;
    --accent: #f97316;
    --accent-light: #fb923c;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #eab308;
    --bg-main: #f1f0fb;
    --bg-card: #ffffff;
    --text-primary: #1e1b4b;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --sidebar-width: 260px;
}

* { font-family: 'Inter', 'Poppins', sans-serif; }

body {
    background: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Sidebar */
.sidebar-wrapper {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 1040;
}

.sidebar {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

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

.brand-icon {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.brand-text { display: flex; flex-direction: column; }
.brand-title { color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.brand-subtitle { color: rgba(255,255,255,0.6); font-size: 0.7rem; }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-item.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(249,115,22,0.3);
}

.nav-item i { font-size: 1.1rem; width: 20px; text-align: center; }

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 12px 14px;
}

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

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

.user-avatar { font-size: 2rem; color: rgba(255,255,255,0.7); }
.user-details { flex: 1; display: flex; flex-direction: column; }
.user-name { color: #fff; font-size: 0.82rem; font-weight: 600; }
.user-role { color: rgba(255,255,255,0.5); font-size: 0.7rem; text-transform: capitalize; }

.btn-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-logout:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* Main Content */
.main-wrapper {
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: 100vh;
    padding-bottom: 40px;
}

.main-content { max-width: 1400px; margin: 0 auto; }

/* Mobile Header */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    z-index: 1050;
    padding: 0;
    box-shadow: var(--shadow-md);
}

.mobile-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.mobile-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon-sm { color: var(--accent); font-size: 1.4rem; }
.mobile-brand-title { color: #fff; font-weight: 700; font-size: 0.95rem; }
.mobile-brand-sub { color: rgba(255,255,255,0.6); font-size: 0.65rem; }

.btn-mobile-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.1rem;
    padding: 6px;
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 12px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    z-index: 1050;
    border-top: 1px solid var(--border);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.bottom-nav-item i { font-size: 1.25rem; }

.bottom-nav-item.active {
    color: var(--primary);
    background: rgba(30,27,75,0.08);
}

.bottom-nav-item.active i { color: var(--accent); }

@media (max-width: 991px) {
    .main-wrapper { margin-left: 0; padding: 16px; padding-top: 72px; padding-bottom: 80px; }
}

/* Cards */
.card-app {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

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

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

.card-header-app h5, .card-header-app h6 {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.card-body-app { padding: 20px; }

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

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

.summary-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.3rem;
}

.summary-card .icon.primary { background: rgba(30,27,75,0.1); color: var(--primary); }
.summary-card .icon.accent { background: rgba(249,115,22,0.1); color: var(--accent); }
.summary-card .icon.success { background: rgba(34,197,94,0.1); color: var(--success); }
.summary-card .icon.info { background: rgba(59,130,246,0.1); color: #3b82f6; }

.summary-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.summary-card .label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 4px;
}

/* Buttons */
.btn-app {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-app-primary { background: var(--primary); color: #fff; }
.btn-app-primary:hover { background: var(--primary-light); color: #fff; box-shadow: 0 4px 12px rgba(30,27,75,0.3); }
.btn-app-accent { background: var(--accent); color: #fff; }
.btn-app-accent:hover { background: var(--accent-light); color: #fff; box-shadow: 0 4px 12px rgba(249,115,22,0.3); }
.btn-app-success { background: var(--success); color: #fff; }
.btn-app-success:hover { background: #16a34a; color: #fff; }
.btn-app-danger { background: var(--danger); color: #fff; }
.btn-app-danger:hover { background: #dc2626; color: #fff; }
.btn-app-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-app-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(30,27,75,0.04); }
.btn-app-sm { padding: 5px 12px; font-size: 0.78rem; }

/* Form Controls */
.form-control-app, .form-select-app {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.88rem;
    color: var(--text-primary);
    background: #fff;
    transition: all 0.2s;
    width: 100%;
}

.form-control-app:focus, .form-select-app:focus {
    border-color: var(--primary-lighter);
    box-shadow: 0 0 0 3px rgba(67,56,202,0.1);
    outline: none;
}

.form-label-app {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: block;
}

/* Tables */
.table-app {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-app thead th {
    background: var(--bg-main);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
}

.table-app tbody td {
    padding: 12px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table-app tbody tr:hover { background: rgba(30,27,75,0.02); }

/* Colour Cards */
.colour-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s;
}

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

.colour-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.colour-info { flex: 1; min-width: 0; }
.colour-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 2px; }
.colour-code { font-size: 0.75rem; color: var(--text-secondary); }
.colour-actions { display: flex; gap: 6px; }

/* Badges */
.badge-app {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-block;
}

.badge-active { background: rgba(34,197,94,0.1); color: #16a34a; }
.badge-inactive { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge-draft { background: rgba(234,179,8,0.1); color: #a16207; }

/* Section Titles */
.section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* Entry Form */
.entry-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.entry-summary-item {
    text-align: center;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: rgba(30,27,75,0.04);
}

.entry-summary-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.entry-summary-item .label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Modals */
.modal-content { border-radius: var(--radius-lg); border: none; box-shadow: var(--shadow-md); }
.modal-header { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--border); padding: 12px 20px; }

/* Pagination */
.pagination-app .page-link {
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    margin: 0 2px;
}

.pagination-app .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
}

/* Responsive */
@media (max-width: 767px) {
    .summary-cards { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .summary-card { padding: 12px 8px; }
    .summary-card .value { font-size: 1.1rem; }
    .summary-card .icon { width: 36px; height: 36px; font-size: 1rem; }
    .entry-summary { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .table-responsive { font-size: 0.82rem; }
}

@media (max-width: 575px) {
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .entry-summary { grid-template-columns: 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Tabs */
.nav-tabs-app {
    border-bottom: 2px solid var(--border);
    display: flex;
    gap: 4px;
}

.nav-tab-app {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.nav-tab-app:hover { color: var(--primary); background: rgba(30,27,75,0.04); }
.nav-tab-app.active { color: var(--primary); border-bottom-color: var(--accent); background: rgba(249,115,22,0.04); }

/* Print */
@media print {
    .sidebar-wrapper, .mobile-header, .mobile-bottom-nav, .no-print, .btn-app, .alert { display: none !important; }
    .main-wrapper { margin: 0; padding: 0; }
    .main-content { max-width: 100%; }
    body { background: #fff; }
}

/* Spinner */
.spinner-app {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 40px;
    border-radius: 30px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* Action Buttons Row */
.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* Tab Content */
.tab-content-app { display: none; }
.tab-content-app.active { display: block; }

/* Connection Card */
.connection-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-connected { background: var(--success); }
.status-disconnected { background: var(--danger); }
.status-syncing { background: var(--warning); animation: pulse 1.5s infinite; }
.status-failed { background: var(--danger); }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
