﻿/* ===========================================================================
   EchoQuote design system: shared base
   Design tokens, app shell (sidebar + layout) and components reused by every
   module. Module-specific styles live in wwwroot/css/custom/:
   company, dashboard, quotation, purchaseOrder, user, userGroup
   =========================================================================== */

:root {
    --navy: #1E1B3E;
    --navy-d: #14122C;
    --navy-m: #2C2856;
    --navy-l: #413C72;
    --lime: #A9CF38;
    --lime-d: #8CB223;
    --lime-ink: #5F7D0F;
    --lime-soft: #F3F8E3;
    --amber: #E09B2D;
    --amber-ink: #8A5A08;
    --amber-soft: #FDF3E1;
    --red: #C4453D;
    --red-soft: #FBECEB;
    --bg: #F5F5F8;
    --card: #FFFFFF;
    --line: #E5E5EE;
    --line-s: #EFEFF5;
    --ink: #1E1B3E;
    --mut: #6C6E85;
    --faint: #9698AC;
    --sh: 0 1px 2px rgba(20,18,44,.05), 0 6px 16px -6px rgba(20,18,44,.09);
    --r: 12px;
    --rs: 8px;
}

/* ---------- base ---------- */
* {
    box-sizing: border-box
}

html, body {
    margin: 0
}

body {
    background-color: #F4F7FB;
    background-image: radial-gradient(circle at 10% 20%, rgba(162,210,255,.15), transparent 40%), radial-gradient(circle at 90% 80%, rgba(182,249,201,.18), transparent 40%);
    background-attachment: fixed;
    color: var(--ink);
    font-family: "Plus Jakarta Sans",system-ui,sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums
}

h1, h2, h3 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -.02em
}

h1 {
    font-size: 23px
}

h2 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -.01em
}

h3 {
    font-size: 13px
}

button, select, input {
    font-family: inherit;
    font-size: 13px
}

button {
    cursor: pointer;
    border-radius: var(--rs)
}

a {
    color: inherit
}

.mono {
    font-family: "IBM Plex Mono",monospace
}

:focus-visible {
    outline: 2px solid var(--lime-d);
    outline-offset: 2px;
    border-radius: 4px
}

@media (prefers-reduced-motion:reduce) {
    * {
        transition: none !important;
        animation: none !important
    }
}

/* ---------- shell ---------- */
.app {
    display: flex;
    min-height: 100vh
}

/* ---------- shell: sidebar (floating glass card) ---------- */
.side {
    width: 240px;
    flex: none;
    margin: 16px 0 16px 16px;
    height: calc(100vh - 32px);
    position: sticky;
    top: 16px;
    z-index: 10;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 24px 20px;
    background: rgba(255,255,255,.85);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 24px;
    box-shadow: 0 8px 24px -8px rgba(30,27,62,.10);
    color: var(--mut)
}

    /* soft glow behind the nav */
    .side::before {
        content: "";
        position: absolute;
        top: 10%;
        left: -20%;
        width: 140%;
        height: 80%;
        background: radial-gradient(circle, rgba(169,207,56,.18) 0%, transparent 70%);
        z-index: -1;
        border-radius: 50%;
        filter: blur(40px);
        pointer-events: none
    }

.side-scroll {
    overflow-y: auto;
    flex: 1;
    margin: 0 -20px;
    padding: 0 20px;
    /* thin scrollbar, invisible until the pointer is over the sidebar */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent
}

.side:hover .side-scroll {
    scrollbar-color: rgba(30,27,62,.30) transparent
}

/* fallback for older browsers without the standard scrollbar properties */
@supports not (scrollbar-width: thin) {
    .side-scroll::-webkit-scrollbar {
        width: 6px
    }

    .side-scroll::-webkit-scrollbar-track {
        background: transparent
    }

    .side-scroll::-webkit-scrollbar-thumb {
        background: transparent;
        border-radius: 6px
    }

    .side:hover .side-scroll::-webkit-scrollbar-thumb {
        background: rgba(30,27,62,.30)
    }
}

.logo {
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-decoration: none
}

    .logo .brand {
        font-size: 20px;
        font-weight: 800;
        letter-spacing: -.045em;
        color: var(--ink);
        line-height: 1.1
    }

        .logo .brand i {
            font-style: normal;
            position: relative
        }

            .logo .brand i::after {
                content: "";
                position: absolute;
                top: -3px;
                right: -7px;
                width: 5px;
                height: 5px;
                border-radius: 50%;
                background: var(--lime)
            }

    .logo .sub {
        font-size: 9.5px;
        letter-spacing: .2em;
        text-transform: uppercase;
        color: var(--faint);
        margin-top: 3px
    }

.grp {
    font-size: 9.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--faint);
    padding: 0 8px 7px
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px
}

    .nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 14px;
        border-radius: 12px;
        color: var(--mut);
        text-decoration: none;
        font-size: 12px;
        font-weight: 500;
        transition: background .3s cubic-bezier(.175,.885,.32,1.275), color .3s, transform .3s cubic-bezier(.175,.885,.32,1.275), box-shadow .3s
    }

        .nav a svg {
            width: 18px;
            height: 18px;
            flex: none
        }

        .nav a:hover {
            background: rgba(255,255,255,.8);
            color: var(--ink);
            transform: translateX(4px)
        }

        .nav a.on {
            background: var(--navy);
            color: #fff;
            box-shadow: 0 6px 12px rgba(30,27,62,.20)
        }

        .nav + .grp {
            margin-top: 18px
        }

    .nav .toggle {
        cursor: pointer;
        justify-content: flex-start
    }

        .nav .toggle .chev {
            margin-left: auto;
            width: 12px;
            height: 12px;
            transition: transform .15s
        }

        .nav .toggle.open .chev {
            transform: rotate(90deg)
        }

.sub {
    display: none;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0 6px 22px;
    padding-left: 12px;
    border-left: 1px solid var(--line)
}

    .sub.open {
        display: flex
    }

    .sub a {
        display: block;
        padding: 8px 12px;
        border-radius: 10px;
        color: var(--mut);
        font-size: 11.5px
    }

        .sub a:hover {
            background: rgba(255,255,255,.8);
            color: var(--ink)
        }

        .sub a.on {
            background: rgba(30,27,62,.08);
            color: var(--ink);
            font-weight: 600;
            box-shadow: none
        }

.nav .ct {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    background: var(--line-s);
    padding: 1px 7px;
    border-radius: 9px;
    color: var(--mut)
}

.nav a.on .ct {
    background: var(--lime);
    color: var(--navy)
}

/* ---------- sidebar: profile card ---------- */
.who {
    margin-top: auto
}

.who-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,.6);
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 16px
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex: none;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--navy-l), var(--navy));
    color: #fff;
    font-weight: 700;
    font-size: 13px
}

.who-info {
    min-width: 0
}

    .who-info h4 {
        margin: 0;
        font-size: 13px;
        font-weight: 600;
        color: var(--ink);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

    .who-info p {
        margin: 0;
        font-size: 11.5px;
        color: var(--mut);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

.who-btn {
    width: 100%;
    margin-top: 10px
}

.main {
    flex: 1;
    min-width: 0;
    padding: 24px 30px 24px;
    display: flex;
    flex-direction: column
}

.main-footer {
    margin-top: auto;
    padding-top: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--faint)
}

    .main-footer .footer-brand {
        color: var(--mut);
        font-weight: 600
    }

.menubtn {
    display: none
}

.hamb {
    display: none;
    position: fixed;
    left: 14px;
    top: 14px;
    z-index: 15
}

/* ---------- page header + cards + layout ---------- */
.bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px
}

    .bar p {
        margin: 4px 0 0;
        color: var(--mut);
        font-size: 13.5px
    }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--sh)
}

.ch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line-s)
}

    .ch .note {
        font-size: 11.5px;
        color: var(--faint);
        font-weight: 500
    }

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0
}

.split {
    display: grid;
    grid-template-columns: 1fr 356px;
    gap: 16px;
    align-items: start
}

/* sticky summary / about card beside a form */
.lad {
    position: sticky;
    top: 24px
}

/* ---------- messages ---------- */
.empty {
    padding: 40px 18px;
    text-align: center;
    color: var(--mut);
    font-size: 13px
}

    .empty b {
        display: block;
        color: var(--ink);
        font-weight: 600;
        margin-bottom: 3px
    }

.hide {
    display: none !important
}

.warn {
    background: var(--amber-soft);
    border-left: 3px solid var(--amber);
    padding: 12px 15px;
    margin: 16px 18px;
    font-size: 12.5px;
    color: var(--amber-ink)
}

    .warn b {
        font-weight: 700
    }

.lbl {
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--faint);
    font-weight: 700
}

/* ---------- forms ---------- */
.fg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 18px
}

.f {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0
}

    .f.w {
        grid-column: 1/-1
    }

    .f label {
        font-size: 11px;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: var(--faint);
        font-weight: 600
    }

    .f input, .f select, .f textarea {
        border: 1px solid var(--line);
        border-radius: var(--rs);
        padding: 9px 11px;
        background: #fff;
        width: 100%;
        color: var(--ink);
        transition: border-color .15s,box-shadow .15s
    }

        .f input:hover, .f select:hover, .f textarea:hover {
            border-color: #CFCFDE
        }

        .f input:focus, .f select:focus, .f textarea:focus {
            border-color: var(--navy);
            box-shadow: 0 0 0 3px rgba(30,27,62,.07);
            outline: 0
        }

        .f input:disabled {
            background: var(--bg);
            color: var(--mut)
        }

        .f input:read-only {
            background: var(--bg);
            color: var(--mut)
        }

    .f .hint {
        font-size: 11.5px;
        color: var(--faint)
    }

.err {
    font-size: 12px;
    color: var(--red);
    font-weight: 500;
    display: none
}

    .err.on {
        display: block
    }

.acts {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    padding: 15px 18px;
    border-top: 1px solid var(--line-s)
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--rs);
    background: #fff;
    color: var(--ink);
    padding: 8px 14px;
    font-weight: 600;
    font-size: 13px;
    box-shadow: var(--sh);
    text-decoration: none;
    line-height: 1.3;
    transition: border-color .15s,background .15s
}

    .btn:hover {
        border-color: #CFCFDE;
        background: #FCFCFE;
        text-decoration: none
    }

.btn-p {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff
}

    .btn-p:hover {
        background: var(--navy-m);
        border-color: var(--navy-m)
    }

.btn-d {
    background: var(--red);
    border-color: var(--red);
    color: #fff
}

    .btn-d:hover {
        background: #A93A33;
        border-color: #A93A33
    }

.btn-w {
    background: var(--amber);
    border-color: var(--amber);
    color: #fff
}

    .btn-w:hover {
        background: #C4830E;
        border-color: #C4830E
    }

.btn-s {
    padding: 4px 10px;
    font-size: 12px;
    box-shadow: none
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed
}

/* ---------- tables ---------- */
table {
    width: 100%;
    border-collapse: collapse
}

th {
    text-align: left;
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--faint);
    font-weight: 700;
    padding: 11px 18px;
    border-bottom: 1px solid var(--line-s);
    white-space: nowrap
}

td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--line-s);
    vertical-align: top
}

tbody tr:last-child td {
    border-bottom: 0
}

.r {
    text-align: right
}

th.sortable {
    cursor: pointer;
    user-select: none
}

    th.sortable:hover {
        color: var(--ink)
    }

    th.sortable::after {
        content: "";
        display: inline-block;
        width: 0;
        height: 0;
        margin-left: 5px;
        vertical-align: 2px;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        opacity: .3
    }

    th.sortable.asc::after {
        border-bottom: 5px solid currentColor;
        opacity: 1
    }

    th.sortable.desc::after {
        border-top: 5px solid currentColor;
        opacity: 1
    }

/* ---------- list toolbar + pagination ---------- */
.filt {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line-s);
    background: #FCFCFD
}

    .filt select, .filt input {
        border: 1px solid var(--line);
        border-radius: var(--rs);
        padding: 7px 10px;
        background: #fff
    }

.pgn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--line-s);
    font-size: 12.5px;
    color: var(--mut)
}

    .pgn .btn {
        padding: 6px 11px
    }

    .pgn select {
        border: 1px solid var(--line);
        border-radius: var(--rs);
        padding: 5px 8px;
        background: #fff
    }

/* ---------- status chips (quotation + purchase order lists) ---------- */
.chip {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    white-space: nowrap
}

.c-dr {
    background: var(--line-s);
    color: var(--mut)
}

.c-pn {
    background: var(--amber-soft);
    color: var(--amber-ink)
}

.c-po {
    background: #e0edff;
    color: #1d4ed8;
}

.c-ap {
    background: var(--lime-soft);
    color: var(--lime-ink)
}

.c-rj {
    background: var(--red-soft);
    color: var(--red)
}

/* ---------- line items table (quotation + purchase order forms) ---------- */
.items th, .items td {
    padding: 9px 11px;
    font-size: 13px
}

    .items th:first-child, .items td:first-child {
        padding-left: 18px
    }

.items input, .items select {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 8px;
    width: 100%;
    background: var(--bg);
    color: var(--ink);
    font-size: 13px
}

    .items input:hover, .items select:hover {
        border-color: var(--line)
    }

    .items input:focus, .items select:focus {
        border-color: var(--navy);
        background: #fff;
        outline: 0
    }

    .items input.n {
        text-align: right
    }

/* ---------- live preview ladder rows (quotation + purchase order) ---------- */
.lr {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 9px 18px;
    font-size: 13px
}

    .lr span {
        color: var(--mut)
    }

    .lr b {
        font-weight: 600;
        letter-spacing: -.01em
    }

.ltot {
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: baseline
}

    .ltot b {
        font-size: 21px;
        font-weight: 800;
        letter-spacing: -.03em
    }

/* ---------- checklist (user groups + group permissions) ---------- */
.chklist {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--rs)
}

.chkrow {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13.5px;
    color: var(--ink);
    border-bottom: 1px solid var(--line-s);
    cursor: pointer
}

    .chkrow:last-child {
        border-bottom: 0
    }

    .chkrow:hover {
        background: var(--bg)
    }

    .chkrow input {
        width: 15px;
        height: 15px;
        accent-color: var(--navy);
        flex: none;
        margin: 0
    }

/* ---------- modal ---------- */
.modal-ov {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20,18,44,.45);
    z-index: 30;
    align-items: center;
    justify-content: center;
    padding: 20px
}

    .modal-ov.open {
        display: flex
    }

.modal-card {
    background: var(--card);
    border-radius: var(--r);
    box-shadow: 0 20px 60px rgba(20,18,44,.35);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto
}

    .modal-card .ch {
        position: sticky;
        top: 0;
        background: var(--card);
        z-index: 1
    }

.modal-close {
    border: 0;
    background: none;
    color: var(--faint);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    flex: none
}

    .modal-close:hover {
        background: var(--line-s);
        color: var(--ink)
    }

/* ---------- responsive ---------- */
@media(max-width:1080px) {
    .split {
        grid-template-columns: 1fr
    }

    .lad {
        position: static
    }
}

@media(max-width:860px) {
    .side {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        margin: 0;
        height: auto;
        border-radius: 0 24px 24px 0;
        background: rgba(255,255,255,.97);
        z-index: 20;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 0 0 rgba(0,0,0,0)
    }

        .side.open {
            transform: translateX(0);
            box-shadow: 14px 0 32px rgba(30,27,62,.18)
        }

    .scrim {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(20,18,44,.4);
        z-index: 19
    }

        .scrim.on {
            display: block
        }

    .main {
        padding: 18px;
        padding-top: 64px
    }

    .hamb {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border: 1px solid var(--line);
        background: #fff;
        border-radius: var(--rs);
        box-shadow: var(--sh)
    }

    .menubtn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border: 1px solid var(--line);
        background: #fff;
        color: var(--ink);
        border-radius: var(--rs)
    }

    .fg {
        grid-template-columns: 1fr
    }
}

/* ---------- print ---------- */
@media print {
    .side, .acts, .bar, .noprint {
        display: none !important
    }

    .main {
        padding: 0
    }
}
