
:root {
    color-scheme: light dark;

    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-alt: #f0f1f3;
    --text: #151515;
    --muted: #666b73;
    --border: #dedfe3;
    --accent: #d6a500;
    --accent-text: #171717;
    --danger: #b42318;
    --success: #187443;
    --shadow: 0 4px 18px rgba(0,0,0,.035);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #101114;
        --surface: #1c1e22;
        --surface-alt: #292c31;
        --text: #f4f4f5;
        --muted: #a4a7ae;
        --border: #373a40;
        --accent: #facc15;
        --accent-text: #111111;
        --danger: #f87171;
        --success: #4ade80;
        --shadow: 0 4px 18px rgba(0,0,0,.12);
    }
}

/* ERP UI modernization: shared desktop sidebar and mobile drawer. */
body.erp-page { padding: 0 0 24px 276px; }
.erp-sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 252px; display: flex; flex-direction: column; background: #151515; color: #f7f7f7; border-right: 1px solid #292929; }
.erp-sidebar-brand { display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 16px 17px; border-bottom: 1px solid #2b2b2b; }
.erp-logo, .erp-account-link, .erp-mobile-brand { color: inherit; text-decoration: none; }
.erp-logo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.erp-logo strong { display: block; font-size: 12px; letter-spacing: .13em; white-space: nowrap; }
.erp-logo small, .erp-account-link small { display: block; margin-top: 4px; color: #999; font-size: 10px; letter-spacing: .08em; }
.erp-logo-mark { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 35px; width: 35px; height: 35px; border-radius: 10px; background: var(--accent); color: #171717; font-size: 12px; font-weight: 950; }
.erp-sidebar-scroll { flex: 1; overflow: auto; padding: 17px 10px; }
.erp-nav-search { display: flex; gap: 6px; padding: 12px 12px 3px; }
.erp-nav-search input { min-width: 0; width: 100%; min-height: 35px; padding: 7px 9px; border: 1px solid #444; border-radius: 8px; background: #242424; color: #fff; font: inherit; font-size: 12px; }
.erp-nav-search input::placeholder { color: #999; }
.erp-nav-search button { width: 35px; min-width: 35px; border: 0; border-radius: 8px; background: var(--accent); color: #171717; font-size: 18px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.erp-nav-group { margin-bottom: 18px; }
.erp-nav-group h2 { margin: 0 10px 7px; color: #7f7f7f; font-size: 10px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.erp-nav-item { display: flex; align-items: center; gap: 9px; min-height: 37px; padding: 8px 10px; border-radius: 9px; color: #c9c9c9; font-size: 13px; font-weight: 650; text-decoration: none; }
.erp-nav-item:hover, .erp-nav-item:focus-visible { color: #fff; background: #252525; outline: 0; }
.erp-nav-item.is-active { color: #171717; background: var(--accent); }
.erp-nav-dot { width: 5px; height: 5px; border-radius: 99px; background: currentColor; opacity: .55; }
.erp-sidebar-footer { padding: 12px; border-top: 1px solid #2b2b2b; }
.erp-account-link { display: flex; align-items: center; gap: 9px; padding: 9px; border-radius: 10px; background: #202020; }
.erp-account-link:hover { background: #2b2b2b; }
.erp-account-link strong { display: block; font-size: 12px; }
.erp-account-avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #343434; color: var(--accent); font-size: 12px; font-weight: 900; }
.erp-sidebar-close, .erp-mobile-topbar { display: none; }
.erp-sidebar-backdrop { display: none; }
.erp-global-search { display: flex; align-items: center; gap: 8px; margin: -5px 0 22px; }
.erp-global-search input { width: min(100%, 560px); min-height: 42px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.erp-global-search button { min-height: 42px; padding: 0 15px; border: 0; border-radius: 10px; background: var(--text); color: var(--surface); font: inherit; font-weight: 800; cursor: pointer; }
.erp-breadcrumbs { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.erp-breadcrumbs a { color: inherit; }
.erp-status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 7px; background: var(--surface-alt); color: var(--text); font-size: 11px; font-weight: 800; white-space: nowrap; }
.erp-status.ok { color: var(--success); }
.erp-status.warn { color: #956d00; background: #fff4cc; }
.erp-status.danger { color: var(--danger); background: #fde8e7; }
.erp-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.erp-table { width: 100%; border-collapse: collapse; min-width: 680px; font-size: 13px; }
.erp-table th, .erp-table td { padding: 12px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.erp-table th { color: var(--muted); background: var(--surface-alt); font-size: 11px; letter-spacing: .03em; text-transform: uppercase; }
.erp-table tr:last-child td { border-bottom: 0; }
.erp-table a { color: inherit; font-weight: 750; }
.erp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.erp-toolbar form { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 600px; }
.erp-toolbar input, .erp-toolbar select { min-height: 42px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; }
.erp-toolbar input { flex: 1 1 240px; }
.erp-pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; color: var(--muted); font-size: 13px; }
.erp-pagination a, .erp-pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; }
.erp-pagination .current { background: var(--text); color: var(--surface); }
.search-results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.search-results-list { display: grid; gap: 7px; }
.search-result { display: grid; gap: 4px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); text-decoration: none; }
.search-result:hover, .search-result:focus-visible { border-color: var(--accent); outline: 0; }
.search-result span { color: var(--muted); font-size: 12px; }
@media (max-width: 880px) {
    body.erp-page { padding-left: 0; padding-top: 58px; }
    .erp-sidebar { transform: translateX(-105%); width: min(300px, 88vw); transition: transform .18s ease; box-shadow: 12px 0 35px #0005; }
    .erp-sidebar.is-open { transform: translateX(0); }
    .erp-sidebar-close { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: #292929; color: #fff; font-size: 22px; cursor: pointer; }
    .erp-mobile-topbar { position: fixed; z-index: 30; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; height: 58px; padding: 0 14px; background: #151515; color: #fff; box-shadow: 0 2px 12px #0002; }
    .erp-mobile-brand { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .1em; }
    .erp-mobile-brand .erp-logo-mark { width: 30px; height: 30px; flex-basis: 30px; border-radius: 8px; }
    .erp-menu-toggle { min-height: 36px; padding: 0 12px; border: 1px solid #555; border-radius: 8px; background: transparent; color: #fff; font: inherit; font-size: 12px; font-weight: 800; }
    .erp-sidebar-backdrop:not([hidden]) { display: block; position: fixed; z-index: 35; inset: 0; background: #0008; }
    body.erp-menu-open { overflow: hidden; }
}
@media (max-width: 560px) {
    .erp-container { padding: 16px 12px 26px; }
    .erp-header { align-items: flex-start; }
    .erp-title { font-size: 28px; }
    .erp-global-search { align-items: stretch; }
    .erp-global-search input { width: 100%; }
    .erp-global-search button { flex: 0 0 auto; }
    .search-results-grid { grid-template-columns: 1fr; }
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body.erp-page {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont,
        "Segoe UI", Arial, sans-serif;
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.erp-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 35px;
}

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

.erp-brand {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--accent);
}

.erp-title {
    margin: 5px 0;
    font-size: clamp(27px, 5vw, 38px);
    font-weight: 850;
    letter-spacing: -.8px;
}

.erp-subtitle {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.erp-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.erp-card {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.erp-card-title {
    font-size: 15px;
    font-weight: 750;
    margin: 0 0 14px;
}

.erp-kpi-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}

.erp-kpi-value {
    font-size: clamp(24px, 5vw, 34px);
    font-weight: 850;
    letter-spacing: -.6px;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.erp-kpi-unit {
    font-size: 12px;
    color: var(--muted);
    margin-top: 5px;
}

.erp-section {
    margin-top: 24px;
}

.erp-section-title {
    font-size: 19px;
    font-weight: 800;
    margin: 0 0 12px;
}

.erp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.erp-row:last-child {
    border-bottom: 0;
}

.erp-muted {
    color: var(--muted);
}

.erp-pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.erp-btn {
    display: inline-block;
    padding: 13px 16px;
    border: 0;
    border-radius: 11px;
    background: var(--accent);
    color: var(--accent-text);
    text-decoration: none;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.erp-btn-secondary {
    background: var(--surface-alt);
    color: var(--text);
}

.erp-nav {
    position: fixed;
    z-index: 1000;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}

.erp-nav-inner {
    max-width: 850px;
    margin: auto;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
}

.erp-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 52px;
    padding: 7px 2px;
    color: var(--muted);
    text-decoration: none;
    border-radius: 11px;
    font-size: 10px;
    font-weight: 650;
}

.erp-nav-link svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.erp-nav-link.active {
    background: var(--surface-alt);
    color: var(--text);
}

.erp-nav-link.active svg {
    stroke: var(--accent);
}

.erp-more-menu {
    position: fixed;
    z-index: 999;
    left: 12px;
    right: 12px;
    bottom: calc(85px + env(safe-area-inset-bottom));
    max-width: 500px;
    margin: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 8px 35px rgba(0,0,0,.18);
}

.erp-more-menu[hidden] {
    display: none;
}

.erp-more-menu a {
    display: block;
    padding: 13px;
    border-radius: 9px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}

.erp-more-menu a:active {
    background: var(--surface-alt);
}

.erp-more-menu button {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    background: var(--surface-alt);
    color: var(--text);
    border: 0;
    border-radius: 9px;
    font-weight: 700;
}

@media (min-width: 750px) {
    .erp-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 360px) {
    .erp-card {
        padding: 13px;
    }

    .erp-nav-link {
        font-size: 9px;
    }
}
