:root {
    --pp-teal: #0d9488;
    --pp-teal-dark: #0f766e;
    --pp-teal-soft: #f0fdfa;
    --pp-slate: #0f172a;
    --pp-canvas: #f8fafc;
    --pp-surface: #ffffff;
    --pp-border: #e2e8f0;
    --pp-muted: #64748b;
    --pp-text: #0f172a;
}

html.dark {
    --pp-canvas: #020617;
    --pp-surface: #0f172a;
    --pp-border: #1e293b;
    --pp-muted: #94a3b8;
    --pp-text: #f1f5f9;
    --pp-teal-soft: rgba(13, 148, 136, 0.16);
}

html, body {
    background-color: var(--pp-canvas);
    color: var(--pp-text);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .font-display {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: -0.02em;
}

.font-mono, .tabular-nums {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* App Shell Layout matching Google AI Studio Preview */
.erp-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--pp-canvas);
}

.erp-sidebar {
    width: 256px;
    flex-shrink: 0;
    background-color: var(--pp-surface);
    border-right: 1px solid var(--pp-border);
    display: none;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

@media (min-width: 992px) {
    .erp-sidebar {
        display: flex;
    }
}

.erp-sidebar-brand {
    height: 56px;
    padding: 0 20px;
    border-bottom: 1px solid var(--pp-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--pp-teal);
    color: #ffffff;
    flex-shrink: 0;
}

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

.erp-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #334155;
    text-decoration: none !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}

html.dark .erp-nav-link {
    color: #cbd5e1;
}

.erp-nav-link:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

html.dark .erp-nav-link:hover {
    background-color: #1e293b;
    color: #ffffff;
}

.erp-nav-link.active {
    background-color: var(--pp-teal);
    color: #ffffff !important;
    font-weight: 600;
}

.erp-nav-link-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.erp-nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.erp-sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--pp-border);
    font-size: 0.75rem;
}

.erp-workspace {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.erp-topbar {
    height: 56px;
    padding: 0 24px;
    background-color: var(--pp-surface);
    border-bottom: 1px solid var(--pp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}

.erp-topbar-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--pp-border);
    background-color: var(--pp-surface);
    color: var(--pp-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none !important;
}

.erp-topbar-btn:hover {
    background-color: #f1f5f9;
}

html.dark .erp-topbar-btn:hover {
    background-color: #1e293b;
}

.erp-main {
    flex: 1;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 16px 84px 16px;
}

@media (min-width: 768px) {
    .erp-main {
        padding: 24px 28px 36px 28px;
    }
}

/* Surfaces, Cards & Segmented Tabs */
.card, .kpi-card, .erp-card {
    background-color: var(--pp-surface);
    border: 1px solid var(--pp-border) !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03) !important;
}

.card-header {
    background-color: var(--pp-surface) !important;
    border-bottom: 1px solid var(--pp-border) !important;
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
    padding: 12px 18px;
}

html.dark .bg-white,
html.dark .bg-light {
    background-color: var(--pp-surface) !important;
    color: var(--pp-text) !important;
}

html.dark .table,
html.dark .form-control,
html.dark .custom-select {
    color: var(--pp-text);
    background-color: var(--pp-surface);
    border-color: var(--pp-border);
}

html.dark .thead-light th {
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: var(--pp-border) !important;
}

html.dark .table td,
html.dark .table th {
    border-color: var(--pp-border);
}

html.dark .text-muted {
    color: #94a3b8 !important;
}

.erp-segmented {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background-color: rgba(226, 232, 240, 0.72);
    border-radius: 10px;
}

html.dark .erp-segmented {
    background-color: rgba(30, 41, 59, 0.9);
}

.erp-seg-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 7px;
    color: #475569;
    text-decoration: none !important;
    border: none;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

html.dark .erp-seg-btn {
    color: #cbd5e1;
}

.erp-seg-btn:hover {
    color: #0f172a;
}

.erp-seg-btn.active {
    background-color: var(--pp-surface);
    color: var(--pp-text);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Buttons */
.btn-teal {
    background-color: #0d9488;
    border-color: #0d9488;
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 8px;
}

.btn-teal:hover,
.btn-teal:focus {
    background-color: #0f766e;
    border-color: #0f766e;
    color: #ffffff !important;
}

.btn-erp-outline {
    background-color: var(--pp-surface);
    border: 1px solid var(--pp-border);
    color: var(--pp-text);
    font-weight: 500;
    border-radius: 8px;
}

.btn-erp-outline:hover {
    background-color: #f8fafc;
    color: var(--pp-text);
}

html.dark .btn-erp-outline:hover {
    background-color: #1e293b;
}

.text-teal {
    color: #0d9488 !important;
}

.bg-teal-soft {
    background-color: var(--pp-teal-soft);
}

.btn-touch {
    min-height: 40px;
    font-weight: 600;
    border-radius: 8px;
}

.shift-btn {
    border: 2px solid var(--pp-border);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--pp-surface);
    color: var(--pp-text);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
}

.shift-btn.active {
    border-color: #0d9488;
    background: var(--pp-teal-soft);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

/* Mobile Slide-over Drawer */
.erp-mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
}

.erp-mobile-drawer.open {
    display: flex;
}

.erp-mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
}

.erp-mobile-panel {
    position: relative;
    z-index: 1;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background: var(--pp-surface);
    border-right: 1px solid var(--pp-border);
    display: flex;
    flex-direction: column;
}

.mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    height: 62px;
    background: var(--pp-surface);
    border-top: 1px solid var(--pp-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 4px;
}

.mobile-bottom-nav a {
    color: var(--pp-muted);
    font-size: 0.68rem;
    font-weight: 500;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mobile-bottom-nav a.active {
    color: #0d9488;
    font-weight: 600;
}

/* Split Auth Screen */
.auth-split {
    min-height: 100vh;
    display: flex;
    flex-wrap: wrap;
    background-color: var(--pp-canvas);
}

.auth-hero-pane {
    position: relative;
    background-color: #0f172a;
    color: #ffffff;
    overflow: hidden;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
}

@media (min-width: 992px) {
    .auth-hero-pane {
        display: flex;
        width: 50%;
    }
    .auth-form-pane {
        width: 50% !important;
    }
}

.auth-form-pane {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.auth-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.42;
}

.auth-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.72) 0%, rgba(2, 6, 23, 0.45) 50%, rgba(2, 6, 23, 0.92) 100%);
}

@media print {
    body {
        background: #ffffff !important;
        color: #0f172a !important;
    }
    .erp-sidebar, .erp-topbar, .mobile-bottom-nav, .d-print-none {
        display: none !important;
    }
    .erp-main {
        padding: 0 !important;
        max-width: 100% !important;
    }
    .card {
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
    }
}
