/* Portify Orders — small layer on top of Bootstrap 5 */

:root {
    --app-bg: #f5f6f8;
    --app-surface: #ffffff;
    --app-border: #e3e6ea;
    --app-muted: #6b7280;
    --app-text: #1f2937;
    --app-sidebar-width: 240px;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-color: var(--app-text);
    --bs-border-color: var(--app-border);
}

body {
    background: var(--app-bg);
    font-size: .925rem;
}

/* ------------------------------------------------------------ Shell / sidebar */
.app-sidebar {
    background: var(--app-surface);
    --bs-offcanvas-width: 270px;
}
.sidebar-brand {
    align-items: center;
    padding: 1.1rem 1.25rem;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--app-text);
    text-decoration: none;
    border-bottom: 1px solid var(--app-border);
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: .75rem;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .75rem;
    border-radius: .4rem;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
}
.sidebar-link i { font-size: 1.05rem; color: #9ca3af; }
.sidebar-link:hover { background: #f3f4f6; color: var(--app-text); }
.sidebar-link.active { background: #eef4ff; color: #1d4ed8; }
.sidebar-link.active i { color: #1d4ed8; }
.sidebar-user {
    padding: 1rem;
    border-top: 1px solid var(--app-border);
    min-width: 0;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--app-sidebar-width);
        border-right: 1px solid var(--app-border);
        overflow-y: auto;
        z-index: 1030;
    }
    .app-main { margin-left: var(--app-sidebar-width); }
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem 1rem;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    min-height: 52px;
}
.app-main { min-width: 0; }

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: .75rem;
    margin-bottom: 1rem;
}

.section-title {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--app-muted);
    font-weight: 600;
    margin-bottom: .6rem;
}

/* Login */
.login-card {
    width: 100%;
    max-width: 400px;
    border-color: var(--app-border);
}

/* ---------------------------------------------------------------- Filters */
.filter-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: .5rem;
    padding: .6rem;
    margin-bottom: 1rem;
}
@media (min-width: 576px) {
    .filter-card [data-search] { min-width: 200px; }
}
.filter-campaign { max-width: 220px; }
@media (max-width: 575.98px) {
    .filter-campaign { max-width: none; }
}

/* ---------------------------------------------------------- Summary cards */
.stat-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: .5rem;
    padding: .75rem .9rem;
    border-left-width: 3px;
    min-width: 0;
}
.stat-label {
    font-size: .76rem;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-weight: 500;
}
.stat-icon { color: #9ca3af; font-size: 1rem; }
.stat-value {
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: .2rem;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}
.stat-note { font-size: .76rem; color: var(--app-muted); }
.stat-neutral { border-left-color: #94a3b8; }
.stat-success { border-left-color: #22a06b; }
.stat-success .stat-value { color: #187a51; }
.stat-warning { border-left-color: #e0a10b; }
.stat-info    { border-left-color: #3b82f6; }
.stat-danger  { border-left-color: #dc3545; }
.stat-danger .stat-value { color: #b42318; }
.stat-highlight { background: #f6fbf8; }
.stat-highlight.stat-danger { background: #fef6f6; }
.stat-highlight .stat-value { font-size: 1.6rem; }

@media (max-width: 575.98px) {
    .stat-card { padding: .6rem .7rem; }
    .stat-value { font-size: 1.1rem; }
    .stat-highlight .stat-value { font-size: 1.35rem; }
}

/* ----------------------------------------------------------------- Tables */
.table-card {
    border-color: var(--app-border);
    overflow: hidden;
}
.data-table { font-size: .875rem; }
.data-table th,
.data-table td {
    white-space: nowrap;
    padding: .5rem .65rem;
    border-color: #edf0f2;
    font-variant-numeric: tabular-nums;
}
.data-table thead th {
    background: #f8f9fb;
    color: var(--app-muted);
    font-weight: 600;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--app-border);
}
.data-table tfoot th {
    background: #f8f9fb;
    font-weight: 600;
    border-top: 2px solid var(--app-border);
}
.data-table td.cell-name { max-width: 200px; }
.data-table td.cell-notes { max-width: 260px; }
.data-table .btn-sm { padding: .15rem .4rem; }

.report-table td,
.report-table th { padding: .55rem .9rem; border-color: #edf0f2; font-variant-numeric: tabular-nums; }
.report-table thead th {
    background: #f8f9fb; color: var(--app-muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .03em;
}
.report-table tfoot th { background: #f8f9fb; border-top: 2px solid var(--app-border); }
.row-profit td { background: #eefaf3; color: #187a51; }
.row-loss td { background: #fdf0f0; color: #b42318; }

.share-col { width: 40%; }
.share-bar { height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden; min-width: 60px; }
.share-bar span { display: block; height: 100%; background: #3b82f6; border-radius: 99px; }
.share-pct { width: 3.2rem; text-align: right; }

/* Status: select styled as a soft badge, and a plain badge */
.status-select {
    width: auto;
    min-width: 125px;
    font-size: .8rem;
    font-weight: 500;
    border-radius: 999px;
    padding-top: .15rem;
    padding-bottom: .15rem;
    cursor: pointer;
}
.status-badge,
.category-badge {
    display: inline-block;
    padding: .15rem .6rem;
    border-radius: 999px;
    border: 1px solid;
    font-size: .76rem;
    font-weight: 500;
}
.status-pending     { background-color: #fff7e0; border-color: #f3d27a; color: #8a5a00; }
.status-in_progress { background-color: #e8f1ff; border-color: #a9c8f7; color: #1d4ed8; }
.status-completed   { background-color: #e7f6ee; border-color: #9fd8b9; color: #187a51; }
.status-cancelled   { background-color: #f3f4f6; border-color: #d1d5db; color: #6b7280; }

.category-boosting { background: #eef4ff; border-color: #c7d7fb; color: #1d4ed8; }
.category-shimu    { background: #f5f0ff; border-color: #d9c8fb; color: #6d28d9; }
.category-sabik    { background: #fdf2f8; border-color: #f5c6de; color: #a3215f; }
.category-family   { background: #fff7e0; border-color: #f3d27a; color: #8a5a00; }
.category-other    { background: #f3f4f6; border-color: #d1d5db; color: #4b5563; }

.table-pager .pagination { margin: 0; }

/* Report tabs: horizontally scrollable on small screens */
.report-tabs {
    display: flex;
    gap: .25rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--app-border);
    scrollbar-width: none;
}
.report-tab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
    padding: .55rem .8rem;
    color: var(--app-muted);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.report-tab:hover { color: var(--app-text); }
.report-tab.active { color: #1d4ed8; border-bottom-color: #1d4ed8; }

/* ------------------------------------------------------------------ Modals */
.form-section-title {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--app-muted);
    font-weight: 600;
    margin-bottom: .75rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--app-border);
}
.profit-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .6rem .8rem;
    background: #f8f9fb;
    border: 1px dashed var(--app-border);
    border-radius: .375rem;
    font-size: .85rem;
}
.profit-preview strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.toast-container { z-index: 1090; }
