﻿/* Evokes Business Software — application styles.
   Built on the tokens in tokens.css. No raw hex below this line: if a value is
   missing from the token set, add it there rather than inventing one here.

   Bootstrap's own classes are mapped onto the tokens as well, so a view written
   with .btn, .table or .badge gets the house style without being rewritten. */

/* ---------------------------------------------------------------- base */

html {
    -webkit-text-size-adjust: 100%;
}

body.erp-body,
body.erp-anonymous-body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 23px;
}

h1, h2, h3, h4, h5, h6,
.erp-title {
    letter-spacing: -0.02em;
    font-weight: 650;
    color: var(--ink);
}

h1, .erp-title { font-size: 24px; line-height: 30px; }
h2 { font-size: 19px; line-height: 26px; }
h3 { font-size: 16px; line-height: 24px; }

.erp-micro,
.erp-table thead th,
.erp-nav-group-label {
    font-size: 12px;
    line-height: 16px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.erp-muted { color: var(--muted); }
.erp-dim { font-size: 13px; color: var(--dim); }

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

/* One focus treatment everywhere, and it has to be visible on the keyboard. */
:focus-visible,
.form-control:focus,
.form-select:focus,
.btn:focus-visible,
.erp-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: none;
}

/* ---------------------------------------------------------- dark chrome */

.erp-topbar {
    height: 56px;
    /* No overflow clipping: the company, branch, product and account menus hang below the bar. */
    min-height: 56px;
    padding: 0 16px;
    background: var(--chrome);
    border-bottom: 1px solid var(--chrome-line);
    color: var(--chrome-ink);
    display: flex;
    align-items: center;
    gap: 12px;
}

.erp-topbar a { color: var(--chrome-ink); }

.erp-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
}

.erp-lockup img { height: 24px; width: auto; display: block; }

.erp-lockup-divider {
    width: 1px;
    height: 20px;
    background: var(--chrome-line);
}

.erp-product-name {
    font-size: 13.5px;
    color: var(--chrome-muted);
    white-space: nowrap;
}

/* Context chips: organisation, branch, account. */
.erp-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--chrome-line);
    border-radius: var(--r-control);
    background: transparent;
    color: var(--chrome-ink);
    font-size: 13.5px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--t-fast);
    max-width: 240px;
}

.erp-chip:hover { background: var(--chrome-2); }

.erp-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-chip-tile {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 4px;
    background: var(--chrome-2);
    border: 1px solid var(--chrome-line);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--chrome-ink);
}

.erp-chip-chevron { color: var(--chrome-muted); font-size: 11px; }

.erp-icon-button {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--chrome-line);
    border-radius: var(--r-control);
    background: transparent;
    color: var(--chrome-ink);
    position: relative;
    transition: background var(--t-fast);
}

.erp-icon-button:hover { background: var(--chrome-2); }

.erp-topbar-search {
    flex: 1 1 auto;
    max-width: 420px;
}

.erp-topbar-search .form-control {
    height: 36px;
    background: var(--chrome-2);
    border: 1px solid var(--chrome-line);
    color: var(--chrome-ink);
    border-radius: var(--r-control);
    font-size: 13.5px;
}

.erp-topbar-search .form-control::placeholder { color: var(--chrome-muted); }

.erp-count-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    background: var(--accent);
    color: var(--chrome-ink);
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

/* The suite switcher and the account menu are dark, like the bar they hang from. */
.erp-chrome-menu {
    background: var(--chrome-2);
    border: 1px solid var(--chrome-line);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-2);
    color: var(--chrome-ink);
    padding: 8px;
    min-width: 260px;
}

.erp-chrome-menu .dropdown-item {
    color: var(--chrome-ink);
    border-radius: var(--r-control);
    padding: 8px 10px;
    font-size: 14px;
}

.erp-chrome-menu .dropdown-item:hover,
.erp-chrome-menu .dropdown-item:focus {
    background: rgba(255, 255, 255, .06);
    color: var(--chrome-ink);
}

.erp-chrome-menu .dropdown-divider { border-color: var(--chrome-line); }

.erp-menu-identity {
    padding: 8px 10px 12px;
    border-bottom: 1px solid var(--chrome-line);
    margin-bottom: 8px;
}

.erp-menu-identity-name { font-size: 14px; font-weight: 650; }
.erp-menu-identity-email { font-size: 13px; color: var(--chrome-muted); word-break: break-all; }

.erp-product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.erp-product-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--chrome-line);
    border-radius: var(--r-control);
    font-size: 13.5px;
    color: var(--chrome-ink);
}

.erp-product-tile img { width: 22px; height: 22px; }

.erp-product-tile.is-unavailable { opacity: .55; }
.erp-product-tile.is-unavailable .erp-product-plan {
    display: block;
    font-size: 12px;
    color: var(--chrome-muted);
}

/* ------------------------------------------------------ shell and layout */

.erp-shell {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - 56px);
}

.erp-sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    min-height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
}

.erp-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 24px 32px 56px;
}

/* ------------------------------------------------------------ navigation */

.erp-nav { padding: 12px 12px 24px; }

.erp-nav-context {
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    background: var(--surface-2);
}

.erp-nav-context-org {
    font-size: 14px;
    font-weight: 650;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-nav-context-branch { font-size: 13px; color: var(--muted); }

.erp-nav-group-label {
    color: var(--dim);
    margin: 20px 0 4px;
    padding: 0 12px;
}

.erp-nav-group-toggle { margin-top: 4px; font-weight: 550; }

.erp-nav-item,
.erp-nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 0;
    border-radius: var(--r-card);
    background: transparent;
    color: var(--ink);
    font-size: 15px;
    text-align: left;
    text-decoration: none;
    position: relative;
    transition: background var(--t-fast);
}

.erp-nav-item:hover,
.erp-nav-group-toggle:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.erp-nav-item .bi,
.erp-nav-group-toggle .bi {
    font-size: 16px;
    color: var(--muted);
    flex: 0 0 16px;
}

/* Active item: brass tint and a bar on the left edge. Never a filled block. */
.erp-nav-item.is-active {
    background: var(--accent-tint);
    color: var(--ink);
    font-weight: 550;
}

.erp-nav-item.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.erp-nav-item.is-active .bi { color: var(--accent-strong); }

.erp-nav-label { flex: 1 1 auto; min-width: 0; }

.erp-nav-chevron {
    font-size: 11px;
    color: var(--dim);
    transition: transform var(--t-fast);
}

.erp-nav-group-toggle[aria-expanded="true"] .erp-nav-chevron { transform: rotate(90deg); }

.erp-nav-children { padding-left: 12px; }

.erp-nav-children .erp-nav-item { font-size: 14px; min-height: 40px; }

/* --------------------------------------------------------- page structure */

.erp-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
    font-size: 13.5px;
    color: var(--muted);
}

.erp-breadcrumb li { display: flex; align-items: center; gap: 6px; }
.erp-breadcrumb li + li::before { content: "/"; color: var(--line-strong); }
.erp-breadcrumb a { color: var(--muted); }
.erp-breadcrumb a:hover { color: var(--ink); }
.erp-breadcrumb .is-current { color: var(--ink); }

.erp-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.erp-page-header h1 { margin: 0; }

.erp-page-context {
    margin: -8px 0 20px;
    font-size: 15px;
    color: var(--muted);
    max-width: 72ch;
}

/* Page metadata and the context line belong under the title, not floating at the right of the
   header: context has one place on the screen, and for the organisation that place is the top
   bar (UI specification 6). */
.erp-page-header > span,
.erp-page-header > .erp-page-subtitle {
    flex: 1 0 100%;
    order: 9;
    font-size: 15px !important;
    line-height: 23px;
    color: var(--muted);
    max-width: 72ch;
}

.erp-page-header > span.font-monospace { font-family: var(--mono); font-size: 14px !important; }

.erp-page-header > .erp-density { order: 5; margin-left: auto; }

/* The anonymous screens place their own padding; a nested card body must not double it. */
.erp-login-card > .card-body { padding: 0 !important; }

/* ----------------------------------------------------------------- cards */

.erp-card,
.card.erp-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-1);
    margin-bottom: 20px;
}

.erp-card > .card-header,
.erp-card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.erp-card > .card-body { padding: 24px; }

.erp-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding: 16px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    margin-bottom: 20px;
}

/* ---------------------------------------------------------------- tables */

.erp-table,
.table.erp-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    line-height: 20px;
}

.erp-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-2);
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding: 10px 16px;
    white-space: nowrap;
    text-align: left;
}

.erp-table tbody td {
    padding: 12px 16px;
    height: 44px;
    border-bottom: 1px solid var(--line);
    background: transparent;
    vertical-align: middle;
}

.erp-table tbody tr:last-child td { border-bottom: 0; }
.erp-table tbody tr:hover td { background: var(--surface-2); }

.erp-table tbody tr.is-selected td { background: var(--accent-tint); }
.erp-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* Figures read as a column: right aligned, one glyph width per digit. */
.erp-table .num,
.erp-table td.num,
.erp-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.erp-table .erp-actions,
.erp-table th.erp-actions {
    text-align: right;
    white-space: nowrap;
    position: sticky;
    right: 0;
    background: var(--surface);
}

.erp-table tbody tr:hover .erp-actions { background: var(--surface-2); }

/* A row-selection column: as narrow as its checkbox, which keeps a 44px touch target through
   its cell padding. */
.erp-table .erp-select {
    width: 2.5rem;
    text-align: center;
}

/* Screens written before the actions column had a class of its own still get the pinned
   treatment, so the controls stay reachable when a wide table scrolls. */
.erp-table tbody td:last-child.text-end,
.erp-table thead th:last-child.text-end {
    position: sticky;
    right: 0;
    background: var(--surface);
    white-space: nowrap;
}

.erp-table thead th:last-child.text-end { background: var(--surface-2); }
.erp-table tbody tr:hover td:last-child.text-end { background: var(--surface-2); }

.erp-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    background: var(--surface);
}

.erp-card > .table-responsive,
.erp-card > .erp-table-scroll {
    border: 0;
    border-radius: 0 0 var(--r-card) var(--r-card);
}

/* Compact density, remembered per user by erp.js. */
[data-density="compact"] .erp-table tbody td { height: 36px; padding: 7px 16px; }
[data-density="compact"] .erp-table thead th { padding: 7px 16px; }

.erp-density {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-size: 13.5px;
    color: var(--muted);
}

/* An empty cell says so with an em dash, never a blank. */
.erp-empty-cell::after { content: "—"; color: var(--dim); }

.erp-table-empty,
.erp-empty-state {
    padding: 40px 24px;
    text-align: center;
    color: var(--muted);
}

.erp-empty-state h2 { font-size: 16px; margin-bottom: 8px; }

.erp-skeleton-row td { height: 44px; }

.erp-skeleton-bar {
    display: block;
    height: 10px;
    border-radius: var(--r-pill);
    background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2));
    background-size: 200% 100%;
    animation: erp-skeleton 1.2s linear infinite;
}

@keyframes erp-skeleton {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ---------------------------------------------------------------- buttons */

.btn {
    --bs-btn-border-radius: var(--r-control);
    height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: var(--r-control);
    font-size: 14px;
    font-weight: 550;
    line-height: 1;
    transition: background var(--t-fast), border-color var(--t-fast);
}

.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; }

.btn-primary,
.btn-primary:disabled {
    background: var(--primary);
    border: 0;
    color: var(--primary-ink);
}

.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus-visible {
    background: var(--primary-hover);
    color: var(--primary-ink);
}

.btn-secondary,
.btn-outline-secondary,
.btn-outline-primary,
.btn-light {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    color: var(--ink);
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-light:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn-link,
.erp-btn-quiet {
    background: transparent;
    border: 0;
    color: var(--accent-strong);
    text-decoration: none;
    padding: 0 8px;
}

.btn-link:hover, .erp-btn-quiet:hover { color: var(--accent-strong); text-decoration: underline; }

.btn-danger,
.btn-outline-danger {
    background: var(--danger);
    border: 0;
    color: var(--surface);
}

.btn-danger:hover, .btn-outline-danger:hover { background: var(--danger); filter: brightness(.92); color: var(--surface); }

.btn:disabled, .btn.disabled { opacity: .5; }

/* ------------------------------------------------------ segmented control */

.erp-segmented {
    display: inline-flex;
    padding: 2px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-control);
    background: var(--surface);
}

.erp-segmented > button,
.erp-segmented > .erp-segment {
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 550;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background var(--t-fast);
}

.erp-segmented > button:hover:not([aria-pressed="true"]):not(:disabled) { background: var(--surface-2); }

.erp-segmented > button[aria-pressed="true"],
.erp-segmented > .erp-segment.is-selected {
    background: var(--primary);
    color: var(--primary-ink);
}

.erp-segmented > button:disabled { opacity: .45; }

/* ----------------------------------------------------------------- badges */

.erp-status,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    font-size: 12px;
    line-height: 16px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.erp-status-enabled, .erp-status-ok, .badge.text-bg-success {
    background: var(--ok-bg) !important;
    color: var(--ok) !important;
}

.erp-status-readonly, .erp-status-info, .badge.text-bg-info, .badge.text-bg-primary {
    background: var(--info-bg) !important;
    color: var(--info) !important;
}

.erp-status-pending, .erp-status-warn, .badge.text-bg-warning {
    background: var(--warn-bg) !important;
    color: var(--warn) !important;
}

.erp-status-failed, .erp-status-danger, .badge.text-bg-danger {
    background: var(--danger-bg) !important;
    color: var(--danger) !important;
}

.erp-status-disabled, .erp-status-neutral, .badge.text-bg-light, .badge.text-bg-secondary {
    background: var(--neutral-bg) !important;
    color: var(--neutral) !important;
}

.erp-readonly-badge {
    background: var(--info-bg);
    color: var(--info);
    border-radius: var(--r-pill);
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
}

/* Dependency and plain descriptive chips on the work surface. */
.erp-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 550;
    text-transform: none;
    letter-spacing: 0;
}

.erp-tag.is-met { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.erp-tag.is-unmet { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

/* --------------------------------------------------------------- callouts */

.erp-callout,
.alert {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 0;
    border-left: 3px solid var(--info);
    border-radius: var(--r-card);
    background: var(--info-bg);
    color: var(--ink);
    font-size: 15px;
}

.erp-callout .bi, .alert .bi { font-size: 18px; line-height: 23px; }

.erp-callout-info, .alert-info, .alert-primary { border-left-color: var(--info); background: var(--info-bg); }
.erp-callout-warning, .alert-warning { border-left-color: var(--warn); background: var(--warn-bg); }
.erp-callout-danger, .alert-danger { border-left-color: var(--danger); background: var(--danger-bg); }
.erp-callout-success, .alert-success { border-left-color: var(--ok); background: var(--ok-bg); }
.erp-callout-neutral, .alert-secondary, .alert-light { border-left-color: var(--neutral); background: var(--neutral-bg); }

/* ------------------------------------------------------------------ forms */

.form-label, .erp-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 550;
    color: var(--ink);
}

.erp-required::after { content: " *"; color: var(--danger); }

.form-control, .form-select {
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-control);
    background: var(--surface);
    color: var(--ink);
    font-size: 15px;
}

textarea.form-control { height: auto; padding: 10px 12px; }

.form-control-sm, .form-select-sm { height: 36px; font-size: 14px; }

.form-control::placeholder { color: var(--dim); }

.form-text, .erp-help { font-size: 13px; color: var(--dim); }

.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); }

.invalid-feedback, .field-validation-error, .text-danger {
    font-size: 13px;
    color: var(--danger) !important;
}

.validation-summary-errors {
    border-left: 3px solid var(--danger);
    background: var(--danger-bg);
    border-radius: var(--r-card);
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 14px;
}

.validation-summary-errors ul { margin: 0; padding-left: 20px; }

.erp-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* --------------------------------------------------------------- dialogs */

.modal-content {
    border: 0;
    border-radius: var(--r-modal);
    box-shadow: var(--shadow-2);
    background: var(--surface);
}

.modal-dialog { max-width: 520px; }

.modal-header {
    border-bottom: 1px solid var(--line);
    padding: 20px 24px 16px;
}

.modal-title { font-size: 19px; line-height: 26px; font-weight: 650; letter-spacing: -0.02em; }
.modal-body { padding: 20px 24px; font-size: 15px; }

.modal-footer {
    border-top: 1px solid var(--line);
    padding: 16px 24px;
    gap: 8px;
}

/* ---------------------------------------------------------------- toasts */

.erp-toast-container {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.erp-toast {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 320px;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: var(--r-card);
    border-left: 3px solid var(--ok);
    background: var(--surface);
    box-shadow: var(--shadow-2);
    font-size: 14px;
    color: var(--ink);
}

.erp-toast.is-error { border-left-color: var(--danger); }
.erp-toast .btn-close { margin-left: auto; }

/* -------------------------------------------------- permission matrix */

.erp-permission-matrix { font-size: 13.5px; }
.erp-matrix-scroll { overflow: auto; max-height: 70vh; }

.erp-permission-matrix thead th { text-align: center; }
.erp-permission-matrix td { text-align: center; }

.erp-resource-col {
    position: sticky;
    left: 0;
    background: var(--surface);
    text-align: left !important;
    min-width: 260px;
    z-index: 1;
}

/* -------------------------------------------------------- sign-in scene */

/* The one place the application borrows the dark chrome: it belongs to the
   shell, and the glass emblem needs a dark ground to read at all. */
.erp-login-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 16px;
    background: var(--chrome);
}

.erp-login-card {
    width: 100%;
    max-width: 420px;
    padding: 32px;
    border-radius: var(--r-modal);
    background: var(--surface);
    box-shadow: var(--shadow-2);
}

.erp-login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.erp-login-brand img { height: 28px; }
.erp-login-brand span { font-size: 13.5px; color: var(--muted); }

.erp-anonymous { min-height: 100vh; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 992px) {
    .erp-sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform var(--t-base);
        box-shadow: var(--shadow-2);
    }

    .erp-sidebar.is-open { transform: translateX(0); }

    .erp-content { padding: 20px 16px 40px; }

    .erp-topbar-search { display: none; }

    /* The organisation and branch are named at the top of the navigation panel on a small
       screen, so the chips come out of the bar rather than pushing it off the side. */
    .erp-context-chip { display: none; }

    .btn { height: 48px; }
    .btn-sm { height: 40px; }
}

@media (max-width: 576px) {
    .erp-chip { max-width: 150px; }
    .erp-product-name, .erp-lockup-divider { display: none; }
}

/* Nothing scrolls the page sideways: a wide table scrolls inside its own box. */
html, body { overflow-x: hidden; }

@media print {
    .erp-topbar, .erp-sidebar, .erp-toast-container, .erp-actions { display: none !important; }
    .erp-content { padding: 0; }
    .erp-card { box-shadow: none; }
}

/* ---------------------------------------------------------------------------------------------
   Employee profile: tabs, the detail grid and the reporting tree (SRS 6.5)
   --------------------------------------------------------------------------------------------- */

/* Tabs across a record's sections. The active tab carries the brass bar that the navigation
   uses, so "where I am" reads the same way everywhere. */
.erp-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    margin-bottom: 16px;
}

.erp-tab {
    flex: 0 0 auto;
    padding: 10px 14px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 550;
    border-bottom: 3px solid transparent;
    transition: color var(--t-fast), border-color var(--t-fast);
}

.erp-tab:hover {
    color: var(--ink);
    background: var(--surface-2);
}

.erp-tab.is-active {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

/* A record's fields as label and value pairs. One column on a phone, two on a wide screen. */
.erp-detail-grid {
    display: grid;
    grid-template-columns: minmax(140px, 180px) 1fr;
    gap: 8px 16px;
    margin: 0;
}

.erp-detail-grid dt {
    color: var(--muted);
    font-weight: 550;
    font-size: 13px;
}

.erp-detail-grid dd {
    margin: 0;
    color: var(--ink);
}

@media (max-width: 576px) {
    .erp-detail-grid {
        grid-template-columns: 1fr;
        gap: 2px 0;
    }

    .erp-detail-grid dd {
        margin-bottom: 10px;
    }
}

/* The reporting structure. Indentation plus a connecting rule, because a tree drawn with colour
   alone tells a person nothing about depth. */
.erp-org-tree,
.erp-org-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.erp-org-children {
    margin-left: 20px;
    padding-left: 16px;
    border-left: 1px solid var(--line);
}

.erp-org-node {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 10px;
    margin: 4px 0;
    border: 1px solid var(--line);
    border-radius: var(--r-control);
    background: var(--surface);
}

.erp-org-node:hover {
    background: var(--surface-2);
}

/* ---------------------------------------------------------------------------
   Insights charts (REP-002)
   Drawn as SVG on the server, so they print and export exactly as they read
   on screen. The colours come from the tokens, so a chart never introduces a
   palette of its own.
   --------------------------------------------------------------------------- */
.erp-chart {
  width: 100%;
  height: auto;
  overflow: visible;
}

.erp-chart-bar {
  fill: var(--pulse);
}

.erp-chart-axis {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.erp-chart-value {
  fill: var(--ink);
  font-family: var(--font);
  font-size: 11px;
}

.erp-chart-label {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 11px;
}

/* ---------------------------------------------------------------------------
   Layout helpers
   These replace the inline style attributes the views used to carry. A content
   security policy that allows inline styles allows an injected one too, so the
   rule is the same as for scripts: no style attribute in any view (P-13).
   --------------------------------------------------------------------------- */

.erp-right { text-align: right; }

.erp-w-2  { width: 2rem; }
.erp-w-5  { width: 5rem; }
.erp-w-6  { width: 6rem; }
.erp-w-7  { width: 7rem; }
.erp-w-8  { width: 8rem; }
.erp-w-9  { width: 9rem; }
.erp-w-10 { width: 10rem; }
.erp-w-16 { width: 16rem; }

.erp-minw-10 { min-width: 10rem; }
.erp-minw-12 { min-width: 12rem; }
.erp-minw-14 { min-width: 14rem; }
.erp-minw-16 { min-width: 16rem; }
.erp-minw-18 { min-width: 18rem; }
.erp-minw-20 { min-width: 20rem; }

.erp-maxw-32 { max-width: 32rem; }
.erp-maxw-40 { max-width: 40rem; }

.erp-space-1 { margin-top: 8px; }
.erp-space-2 { margin-top: 12px; }
.erp-space-3 { margin-top: 40px; }
.erp-space-4 { margin-top: 48px; }

/* Tree depth in a statement or a chart of accounts, capped: past the sixth level
   the indent stops growing rather than pushing the figures off the page. */
.erp-indent-0 { padding-left: 0.75rem; }
.erp-indent-1 { padding-left: 2rem; }
.erp-indent-2 { padding-left: 3.25rem; }
.erp-indent-3 { padding-left: 4.5rem; }
.erp-indent-4 { padding-left: 5.75rem; }
.erp-indent-5 { padding-left: 7rem; }
.erp-indent-6 { padding-left: 8.25rem; }

.erp-wrap-pre { white-space: pre-wrap; }

.erp-dim { color: var(--dim); }
.erp-ink-ok { color: var(--ok); }
.erp-ink-danger { color: var(--danger); }
.erp-chrome-muted { color: var(--chrome-muted); }

.erp-product-plan-note {
  display: block;
  font-size: 12px;
  color: var(--chrome-muted);
}

/* The signature block at the foot of a printed document. */
.erp-signature {
  width: 33%;
  border-top: 1px solid var(--line-strong);
  text-align: center;
}

/* ---------------------------------------------------------------------------
   Light and dark
   The button sits in the top bar and names the theme it will switch to. The two
   icons are both in the markup and the theme decides which one shows, so the
   button needs no script to keep itself in step.
   --------------------------------------------------------------------------- */

.erp-theme-toggle .bi-sun,
.erp-theme-toggle .bi-moon-stars { display: none; }

/* Light now, so the button offers dark. */
.erp-theme-toggle .bi-moon-stars { display: inline-block; }

:root[data-theme="dark"] .erp-theme-toggle .bi-moon-stars { display: none; }
:root[data-theme="dark"] .erp-theme-toggle .bi-sun { display: inline-block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .erp-theme-toggle .bi-moon-stars { display: none; }
  :root:not([data-theme="light"]) .erp-theme-toggle .bi-sun { display: inline-block; }
}

/* The theme control is screen furniture: the print rules above already hide the
   top bar it sits in, and this covers it wherever else it is placed. */
@media print {
  .erp-theme-toggle { display: none !important; }
}

/* Compass: compact quantity and container pickers inside table rows. */
.erp-input-qty { max-width: 7rem; }
.erp-input-pick { max-width: 9rem; }

/* ---- Tasks: My Tasks (task-manager plan §6.2) ------------------------------------------ */
.erp-task-counts { display: flex; flex-wrap: wrap; gap: 12px; }
.erp-task-count {
    display: flex; flex-direction: column; min-width: 120px; padding: 10px 14px;
    border: 1px solid var(--bs-border-color); border-radius: 8px; background: var(--bs-body-bg);
}
.erp-task-count-value { font-size: 24px; font-weight: 600; line-height: 1.1; }
.erp-task-count-label { font-size: 12px; color: var(--bs-secondary-color); }
.erp-task-count.is-alert .erp-task-count-value { color: var(--bs-danger); }
.erp-task-more > summary { list-style: none; }
.erp-task-more > summary::-webkit-details-marker { display: none; }
.erp-task-more[open] { flex-basis: 100%; }
@media (max-width: 575.98px) {
    .erp-task-count { flex: 1 1 calc(50% - 12px); min-width: 0; }
    .erp-task-cards .btn { min-height: 36px; }
}

/* ---------------------------------------------------------------------------
   Team tasks trend (task-manager plan T4): two series side by side, created
   in the quiet line colour and completed in the accent.
   --------------------------------------------------------------------------- */
.erp-chart-bar-alt {
  fill: var(--line-strong);
}

.erp-chart-key {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
  background: var(--pulse);
  vertical-align: middle;
}

.erp-chart-key-alt {
  background: var(--line-strong);
}

/* ---- CRM ---------------------------------------------------------------------------------- */
.erp-crm-column { width: 17rem; }
.erp-crm-drop { min-height: 6rem; }
.erp-crm-column.is-target { outline: 2px dashed var(--bs-primary); }
.erp-crm-card { cursor: grab; }
.erp-crm-card.is-dragging { opacity: .5; }

/* Executive dashboard: KPI tone and the server-drawn trend chart. */
.erp-kpi-good { color: var(--bs-success-text-emphasis, #146c43); }
.erp-kpi-bad { color: var(--bs-danger-text-emphasis, #b02a37); }
.erp-chart { width: 100%; height: auto; max-height: 220px; }
.erp-chart-revenue { fill: #3b7dd8; background-color: #3b7dd8; }
.erp-chart-expense { fill: #c98a2b; background-color: #c98a2b; }
.erp-chart-label { font-size: 10px; fill: var(--bs-secondary-color, #6c757d); }
.erp-chart-key { display: inline-block; width: .75rem; height: .75rem; vertical-align: middle; border-radius: 2px; }

/* Budget grid and consolidation worksheet: wide numeric tables. */
.erp-budget-grid input.form-control { min-width: 6.5rem; text-align: right; }
.erp-worksheet td.num, .erp-worksheet th.num { white-space: nowrap; }
.erp-worksheet tr.erp-total td { font-weight: 600; border-top: 2px solid var(--bs-border-color, #dee2e6); }
.erp-variance-bad { color: var(--bs-danger-text-emphasis, #b02a37); }
.erp-variance-good { color: var(--bs-success-text-emphasis, #146c43); }

/* Barcode scanning on stock screens (erp-scan.js). */
.erp-scan-box { max-width: 22rem; }
tr.erp-scan-hit > td { background-color: rgba(25, 135, 84, .15); transition: background-color .2s; }

/* Free text kept as typed (descriptions, notes). */
.erp-pre-wrap { white-space: pre-wrap; }

/* The AI assistant: the launcher in the shell, the off-canvas panel and the stored transcript. */
.erp-assistant-launcher { white-space: nowrap; }
.erp-assistant-panel { width: 26rem; max-width: 100%; }
.erp-assistant-head-actions { display: flex; align-items: center; gap: .25rem; }
.erp-assistant-body { display: flex; flex-direction: column; gap: .75rem; height: 100%; }
.erp-assistant-thread { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: .65rem; }
.erp-assistant-intro { font-size: .85rem; color: var(--bs-secondary-color, #6c757d); }
.erp-assistant-intro ul { margin: .4rem 0 .4rem 1.1rem; padding: 0; }
.erp-assistant-ask { flex: 0 0 auto; }
.erp-assistant-turn { border-radius: .5rem; padding: .5rem .65rem; font-size: .9rem; }
.erp-assistant-turn.is-user { background-color: var(--bs-tertiary-bg, #f8f9fa); }
.erp-assistant-turn.is-assistant { border: 1px solid var(--bs-border-color, #dee2e6); }
.erp-assistant-turn.is-pending { opacity: .6; }
.erp-assistant-turn.is-error { border-color: var(--bs-danger-border-subtle, #f1aeb5); }
.erp-assistant-turn-who { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color, #6c757d); }
.erp-assistant-turn-body { white-space: pre-wrap; }
.erp-assistant-turn-tools { margin-top: .35rem; font-size: .75rem; color: var(--bs-secondary-color, #6c757d); }

.erp-chat-transcript { display: flex; flex-direction: column; gap: .75rem; max-width: 52rem; }
.erp-chat-turn { border-radius: .5rem; padding: .65rem .85rem; }
.erp-chat-turn.is-user { background-color: var(--bs-tertiary-bg, #f8f9fa); }
.erp-chat-turn.is-assistant { border: 1px solid var(--bs-border-color, #dee2e6); }
.erp-chat-turn-head { display: flex; justify-content: space-between; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color, #6c757d); }
.erp-chat-turn-body { white-space: pre-wrap; margin-top: .3rem; }
.erp-chat-turn-tools { margin-top: .45rem; font-size: .78rem; color: var(--bs-secondary-color, #6c757d); display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
