:root {
    --app-sidebar-width: 260px;
    --app-ink: #172033;
    --app-muted: #64748b;
    --app-bg: #eef3f8;
    --app-surface: #ffffff;
    --app-line: #dce5ee;
    --app-primary: #315f94;
    --app-primary-strong: #1f426a;
    --app-accent: #c26b32;
    --app-success: #2d7f73;
    --app-warning: #b7791f;
    --app-danger: #bf3f47;
    --app-info: #4b6fb5;
}

body {
    background:
        radial-gradient(circle at top right, rgba(194, 107, 50, .12), transparent 270px),
        linear-gradient(180deg, rgba(49, 95, 148, .10), rgba(238, 243, 248, 0) 260px),
        var(--app-bg);
    color: var(--app-ink);
    font-size: .96rem;
}

.app-shell {
    min-height: 100vh;
}

.auth-main {
    min-height: 100vh;
}

.app-sidebar {
    width: var(--app-sidebar-width);
    min-width: var(--app-sidebar-width);
    max-width: var(--app-sidebar-width);
    flex: 0 0 var(--app-sidebar-width);
    background:
        linear-gradient(180deg, #123447 0%, #172033 58%, #111827 100%);
    box-shadow: 6px 0 24px rgba(15, 23, 42, .14);
    position: relative;
    z-index: 2;
}

.app-sidebar .nav-link {
    color: #d9e6ef;
    border-radius: .5rem;
    padding: .7rem .85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, .14);
}

.app-sidebar .nav-link.active {
    box-shadow: inset 3px 0 0 #f2b84b;
}

.app-sidebar .nav-link:hover {
    transform: translateX(2px);
}

.app-sidebar .fs-5 {
    letter-spacing: .2px;
}

.app-brand {
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

main {
    flex: 1 1 auto;
    min-width: 0;
}

h1,
h2,
h3,
h4,
h5 {
    color: #111827;
}

.page-heading {
    border-bottom: 1px solid rgba(203, 215, 227, .75);
    padding-bottom: 1.15rem;
}

.page-heading h1 {
    letter-spacing: 0;
}

.text-secondary {
    color: var(--app-muted) !important;
}

.card {
    border-radius: .75rem;
    border: 1px solid rgba(220, 229, 238, .78) !important;
}

.card.shadow-sm {
    box-shadow: 0 16px 34px rgba(15, 23, 42, .08) !important;
}

.card-header,
.card-footer {
    border-color: var(--app-line);
}

.card-header {
    color: #22324a;
}

.form-card {
    overflow: hidden;
}

.form-card .card-body {
    padding: 1.45rem;
}

.form-card .card-footer {
    background: #f8fafc !important;
    padding: 1rem 1.45rem;
}

.table {
    --bs-table-hover-bg: rgba(36, 107, 143, .055);
}

.table thead th {
    color: #334155;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .035rem;
    border-bottom-color: #cbd7e3;
}

.table tbody td {
    border-color: #e7edf4;
}

.btn {
    border-radius: .5rem;
    font-weight: 500;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-strong);
    --bs-btn-hover-border-color: var(--app-primary-strong);
    --bs-btn-active-bg: var(--app-primary-strong);
    --bs-btn-active-border-color: var(--app-primary-strong);
}

.btn-outline-primary {
    --bs-btn-color: var(--app-primary);
    --bs-btn-border-color: rgba(36, 107, 143, .45);
    --bs-btn-hover-bg: var(--app-primary);
    --bs-btn-hover-border-color: var(--app-primary);
}

.form-control,
.form-select {
    border-color: #cfd9e4;
    border-radius: .5rem;
    min-height: 2.85rem;
    background-color: #ffffff;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 .2rem rgba(194, 107, 50, .16);
}

.form-label {
    color: #26384f;
    font-size: .86rem;
    font-weight: 650;
    margin-bottom: .42rem;
}

.form-text {
    color: #748399;
    font-size: .82rem;
}

.form-section-title {
    color: #315f94;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .075rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.lookup-field {
    position: relative;
}

.lookup-field .searchable-control {
    padding-right: 5rem;
}

.lookup-icon {
    background: #eef3f8;
    border: 1px solid #d7e1ec;
    border-radius: 999px;
    color: #4a6078;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
    padding: .38rem .58rem;
    pointer-events: none;
    position: absolute;
    right: .62rem;
    text-transform: uppercase;
    top: 50%;
    transform: translateY(-50%);
}

.lookup-results {
    background: #fff;
    border: 1px solid #cfd9e4;
    border-radius: .6rem;
    box-shadow: 0 18px 34px rgba(15, 23, 42, .14);
    margin-top: .35rem;
    max-height: 18rem;
    overflow-y: auto;
    position: relative;
    width: 100%;
    z-index: 30;
}

.lookup-result-item {
    background: #fff;
    border: 0;
    border-bottom: 1px solid #edf2f7;
    color: #172033;
    display: block;
    padding: .72rem .9rem;
    text-align: left;
    width: 100%;
}

.lookup-result-item:hover,
.lookup-result-item:focus {
    background: #eef3f8;
}

.order-article-search {
    max-width: 22rem;
}

.order-article-selected {
    align-items: center;
    display: grid;
    gap: .5rem;
    grid-template-columns: minmax(7rem, auto) minmax(13rem, 1fr) minmax(12rem, 1fr) auto;
}

.order-article-code {
    color: #172033;
    font-weight: 800;
    white-space: nowrap;
}

.order-article-description {
    color: #24364f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lookup-empty {
    color: var(--app-muted);
    padding: .75rem .9rem;
}

.attachment-drop-hint {
    background: #f7fafc;
    border: 1px dashed #b8c7d9;
    border-radius: .55rem;
    color: var(--app-muted);
    font-size: .88rem;
    padding: .7rem .85rem;
}

.attachment-pending-list {
    display: grid;
    gap: .45rem;
}

.attachment-pending-item {
    align-items: center;
    background: #f8fbfd;
    border: 1px solid var(--app-line);
    border-radius: .5rem;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    padding: .5rem .65rem;
}

.attachment-pending-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-minutes {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.quick-minutes .btn {
    min-width: 3.25rem;
}

.badge {
    border-radius: 999px;
    font-weight: 600;
    padding: .42em .68em;
}

.text-bg-primary {
    background-color: #d7ecf4 !important;
    color: #164d66 !important;
}

.text-bg-secondary {
    background-color: #e7edf4 !important;
    color: #475569 !important;
}

.text-bg-light {
    background-color: #edf4f7 !important;
    color: #365365 !important;
}

.text-bg-danger {
    background-color: #fde2e4 !important;
    color: #9a2f36 !important;
}

.text-bg-success {
    background-color: #dff3ea !important;
    color: #1f684b !important;
}

.metric-card {
    overflow: hidden;
    position: relative;
}

.metric-link {
    color: inherit;
    display: block;
    height: 100%;
    text-decoration: none;
}

.metric-link .metric-card {
    transition: box-shadow .15s ease, transform .15s ease;
}

.metric-link:hover .metric-card {
    box-shadow: 0 20px 42px rgba(15, 23, 42, .15) !important;
    transform: translateY(-2px);
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: auto 1rem 1rem auto;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .24);
}

.metric-card .card-body {
    position: relative;
    z-index: 1;
}

.metric-card-blue {
    background: linear-gradient(135deg, #315f94, #4f82bd);
    color: #fff;
}

.metric-card-green {
    background: linear-gradient(135deg, #4b6fb5, #7a74c7);
    color: #fff;
}

.metric-card-gold {
    background: linear-gradient(135deg, #b7791f, #d88b43);
    color: #fff;
}

.metric-card .text-secondary,
.metric-card .small {
    color: rgba(255, 255, 255, .78) !important;
}

.section-title {
    color: #22324a;
    font-size: .82rem;
    letter-spacing: .045rem;
    text-transform: uppercase;
}

.soft-panel {
    background: linear-gradient(135deg, rgba(49, 95, 148, .09), rgba(194, 107, 50, .06));
    border: 1px solid rgba(49, 95, 148, .12);
    border-radius: .75rem;
}

.quote-lines-wrap {
    border: 1px solid #e7edf4;
    border-radius: .75rem;
}

.quote-total-box {
    background: #f8fafc;
    border: 1px solid #dce5ee;
    border-radius: .75rem;
    padding: .95rem 1rem;
}

.quote-total-box > div {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: .28rem 0;
}

.quote-total-main {
    border-top: 1px solid #dce5ee;
    color: #172033;
    font-size: 1.1rem;
    margin-top: .35rem;
    padding-top: .65rem !important;
}

.list-group-item {
    border-color: #e7edf4;
}

tr[data-row-href] {
    cursor: pointer;
}

tr[data-row-href]:focus-visible {
    outline: 2px solid var(--app-accent);
    outline-offset: -2px;
}

.user-panel {
    border-top: 1px solid rgba(255, 255, 255, .18);
}

.user-avatar,
.profile-avatar {
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 700;
}

.user-avatar {
    width: 38px;
    height: 38px;
    color: #5b3512;
    background: #fdecc8;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .14);
    flex: 0 0 auto;
}

.profile-avatar {
    width: 76px;
    height: 76px;
    color: #fff;
    background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
    font-size: 2rem;
    box-shadow: 0 12px 26px rgba(49, 95, 148, .28);
}

.min-w-0 {
    min-width: 0;
}

.status-dot {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    display: inline-block;
}

.login-card {
    margin-top: 8vh;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: 100%;
        min-width: 0;
        max-width: none;
        flex-basis: auto;
        box-shadow: none;
    }
}
