:root {
    color-scheme: light;
    --ink: #172922;
    --heading: #10261b;
    --subtle: #52655b;
    --green: #087a4b;
    --green-dark: #075135;
    --green-light: #e3f4e9;
    --background: #eff4f0;
    --line: #dce7df;
    --white: #fff;
    --focus: #167eac;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    color: var(--ink);
    background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
a { color: var(--green-dark); text-decoration: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--heading); }
h1 { font-size: clamp(2rem, 4.1vw, 3rem); line-height: 1.05; letter-spacing: -.048em; }
h2 { font-size: 1.25rem; line-height: 1.3; letter-spacing: -.02em; }
h3 { font-size: 1.05rem; line-height: 1.35; }
p { line-height: 1.55; }
small { font-size: .82rem; color: var(--subtle); }
.muted { color: var(--subtle); }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.attention { color: #854714; }
.text-link, .back-link { font-weight: 650; }
.text-link:hover, .back-link:hover { text-decoration: underline; }
.back-link { display: inline-block; margin-bottom: 1.2rem; }
.source-ref { display: inline-block; margin-top: .5rem; font-size: .875rem; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 235px minmax(0, 1fr); }
.sidebar {
    position: sticky; top: 0; height: 100dvh; padding: 1.55rem 1.05rem 1.2rem;
    display: flex; flex-direction: column; background: var(--white); border-right: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; width: fit-content; color: var(--heading); font-size: 1.16rem; font-weight: 790; letter-spacing: -.035em; }
.brand b { color: var(--green); }
.brand img { object-fit: contain; display: block; }
.sidebar .brand { margin: .15rem .45rem 2.6rem; }
.nav { display: grid; gap: .4rem; }
.nav a {
    min-height: 45px; display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem;
    border-radius: 10px; color: #42574c; font-weight: 650; font-size: .95rem;
}
.nav a:hover, .profile:hover { background: #f0f6f2; }
.nav a.current, .profile.current { background: var(--green-light); color: var(--green-dark); }
.nav-icon { position: relative; display: inline-block; flex: 0 0 15px; inline-size: 15px; block-size: 15px; }
.orders-icon { border: 1.5px solid currentColor; border-radius: 3px; }
.orders-icon::before, .orders-icon::after { content: ""; position: absolute; width: 7px; height: 1.5px; background: currentColor; left: 2.5px; top: 3px; }
.orders-icon::after { top: 7px; }
.table-icon { border: 1.5px solid currentColor; border-radius: 3px; }
.table-icon::before { content: ""; position: absolute; top: 4px; inset-inline: 0; height: 1.5px; background: currentColor; }
.table-icon::after { content: ""; position: absolute; top: 4px; bottom: 0; left: 4px; width: 1.5px; background: currentColor; }
.bell-icon { border: 1.5px solid currentColor; border-bottom-width: 2px; border-radius: 8px 8px 3px 3px; block-size: 12px; }
.bell-icon::after { position: absolute; content: ""; width: 4px; height: 2px; bottom: -5px; left: 4px; border-radius: 2px; background: currentColor; }
.count { margin-inline-start: auto; background: var(--green); color: white; border-radius: 20px; padding: .06rem .4rem; font-size: .76rem; }
.sidebar-footer { margin-top: auto; padding-top: .65rem; border-top: 1px solid var(--line); }
.profile { display: flex; align-items: center; gap: .65rem; padding: .55rem; border-radius: 10px; min-width: 0; }
.profile strong { display: block; font-size: .92rem; }
.profile small { display: block; margin-top: .18rem; }
.avatar { flex: 0 0 auto; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; background: #e4f2e9; color: var(--green-dark); font-weight: 750; }
.profile-large { padding: 0; }
.profile-large .avatar { width: 3.3rem; height: 3.3rem; }
.profile-large:hover { background: transparent; }
.logout { margin: .65rem .55rem 0; }
.main { width: 100%; max-width: 1500px; margin-inline: auto; padding: clamp(1rem, 3.45vw, 3.6rem); min-width: 0; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.6rem; }
.page-heading p:not(.section-label) { margin-top: .5rem; }
.section-label { color: var(--green-dark); margin-bottom: .55rem; font-size: .9rem; font-weight: 720; }
.panel { border: 1px solid var(--line); border-radius: 15px; background: var(--white); min-width: 0; }
.panel-heading, .section-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .65rem; }
.panel-heading { padding: 1.25rem 1.35rem .8rem; }
.panel-heading .muted, .section-heading .muted { font-size: .875rem; }
.section { padding: clamp(1rem, 2vw, 1.4rem); }
.section > p, .section > .stack, .section > .form-grid { margin-top: .75rem; }
.stack { display: grid; align-content: start; gap: 1rem; min-width: 0; }
.stack.compact { gap: .68rem; }
.stack > .btn, .compact > .btn { justify-self: start; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .38rem; min-height: 42px;
    padding: .53rem .9rem; border-radius: 9px; border: 1px solid #cbdad1; background: white;
    color: var(--green-dark); font-weight: 680; font-size: .9rem; line-height: 1.3; white-space: normal;
}
.btn:hover { background: #f0f7f2; border-color: #acc8b7; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: white; border-color: var(--green); }
.btn-primary:hover { background: #09643f; border-color: #09643f; }
.btn-small { min-height: 36px; padding: .42rem .68rem; font-size: .875rem; }
.btn-danger { color: #962d32; border-color: #e4c2c3; }
.btn-danger:hover { background: #fdf1f2; border-color: #c78b8f; }
.text-btn { background: transparent; padding: 0; border: 0; color: var(--green-dark); font-size: .885rem; font-weight: 650; text-align: left; }
.text-btn:hover { text-decoration: underline; }

label { display: grid; gap: .36rem; color: #33493e; font-size: .875rem; font-weight: 660; min-width: 0; }
input:not([type='checkbox']), textarea, select {
    width: 100%; min-width: 0; padding: .57rem .7rem; border-radius: 8px; border: 1px solid #cddbd2;
    background: white; color: var(--ink); min-height: 42px; font-size: 1rem; font-weight: 430;
}
input::placeholder, textarea::placeholder { color: #627469; }
textarea { resize: vertical; }
.select { display: block; position: relative; min-width: 0; }
.select select { appearance: none; padding-inline-end: 2.5rem; text-overflow: ellipsis; }
.select::after, .catalog-toggle::after {
    content: ""; position: absolute; pointer-events: none;
    right: 1.05rem; top: 50%; width: .46rem; height: .46rem;
    border: solid #3f6654; border-width: 0 1.7px 1.7px 0; transform: translateY(-68%) rotate(45deg);
}
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.metric { border: 1px solid var(--line); border-radius: 13px; background: white; padding: .95rem 1.12rem; display: grid; gap: .44rem; color: var(--heading); }
.metric:hover { border-color: #9abfac; }
.metric span { font-size: .875rem; font-weight: 690; }
.metric strong { font-size: 2rem; line-height: 1; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.tone-green { background: #e7f5ec; border-color: #d1e9db; }
.tone-blue { background: #e9f2f7; border-color: #d9e9f1; }
.tone-amber { background: #faf1df; border-color: #efe4cc; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; gap: .75rem; padding: .25rem 1.35rem 1.15rem; }
.filters.team-filters { grid-template-columns: repeat(auto-fit, minmax(182px, 1fr)); }
.filters > .btn { justify-self: start; }
.filters > .actions { grid-column: 1 / -1; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { vertical-align: middle; padding: .8rem 1.1rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
th { background: #f5f8f6; color: #3d5548; font-size: .84rem; font-weight: 700; padding-block: .64rem; }
td { font-size: .94rem; line-height: 1.35; }
td small { display: block; margin-top: .23rem; }
#order-table { scroll-margin-top: 1rem; }
.column-sort { display: inline-flex; align-items: center; gap: .4rem; min-height: 32px; color: inherit; line-height: 1.25; }
.column-sort:hover { color: var(--green-dark); text-decoration: underline; }
.sort-arrow {
    display: grid; flex: none; place-items: center; width: 1.2rem; height: 1.2rem;
    border-radius: 4px; background: #e7efe9; color: var(--green-dark); font-size: 1rem; line-height: 1;
}
th[aria-sort] .sort-arrow { background: var(--green-dark); color: var(--white); }
.orders-table tr:hover td { background: #f8fbf9; }
.order-link { font-weight: 760; color: var(--green-dark); }
.order-link:hover { text-decoration: underline; }
.order-item-name > span { font-weight: 650; }
.date-value { white-space: nowrap; overflow-wrap: normal; }
.badge { display: inline-flex; align-items: center; min-height: 28px; max-width: 100%; border-radius: 6px; padding: .25rem .49rem; font-size: .83rem; line-height: 1.2; font-weight: 690; }
.badge-green { color: #115632; background: #ddf3e5; }
.badge-gray { color: #3f5348; background: #eaf0ec; }
.badge-blue { color: #1e536f; background: #e3f0f8; }
.badge-amber { color: #75420f; background: #f9ebd3; }
.page-heading > .badge { font-size: .94rem; padding: .42rem .62rem; }
.empty { text-align: center; padding: 2.35rem 1rem; border-top: 1px solid var(--line); }
.empty p { margin: .32rem 0 .7rem; color: var(--subtle); }
.pagination { min-height: 61px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; padding: .55rem 1.1rem; gap: .75rem; font-size: .875rem; color: var(--subtle); }
.notice { padding: .75rem 1rem; border-radius: 9px; margin-bottom: 1rem; background: var(--green-light); color: var(--green-dark); border: 1px solid #cae5d4; }
.notice-error { background: #fcebed; color: #842d37; border-color: #efccd1; }
.notice-warning { background: #fbf1db; color: #6f4218; border-color: #ead9b7; }
.notice-info { background: #e8f2fa; color: #174c67; border-color: #d1e6f4; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(235px, 320px); gap: 1rem; }
.detail-grid > .panel { align-self: start; }
.order-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1rem; }
.order-summary > div { min-width: 0; padding: .95rem; border-inline-end: 1px solid var(--line); overflow-wrap: anywhere; }
.order-summary > div:last-child { border-inline-end: 0; }
.order-summary span, .order-summary strong, .order-summary small { display: block; }
.order-summary span { font-size: .875rem; color: var(--subtle); margin-bottom: .42rem; }
.order-summary small { margin-top: .25rem; }
.clarify .stack { margin-top: .65rem; }
.clarify p { margin-top: .35rem; }
.line-item { padding-block: 1rem; border-top: 1px solid var(--line); margin-top: .85rem; }
.line-item:last-child { padding-bottom: 0; }
.line-heading, .batch-heading, .inline-form { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.line-heading { justify-content: space-between; }
.line-heading p { font-size: .875rem; }
.line-item > .preserve { margin-top: .6rem; font-size: .9rem; }
.amount { color: var(--green-dark); font-size: .875rem; font-weight: 700; }
.batch { border: 1px solid #e3ece6; background: #f7faf8; padding: .65rem .7rem; margin-top: .6rem; border-radius: 9px; }
.batch-heading strong, .batch-heading > span:last-child { font-size: .875rem; }
.batch-heading > span:not(.badge) { color: var(--subtle); }
.batch-actions { margin-top: .4rem; }
.action-details { border-top: 1px solid var(--line); padding: .52rem 0; font-size: .9rem; }
.section > .action-details { margin-top: .7rem; }
.action-details summary { font-weight: 660; color: var(--green-dark); }
.action-details.cancel summary { color: #973c40; }
.action-details[open] > form, .action-details[open] > p { margin-top: .66rem; }
.inline-form { align-items: end; margin-top: .7rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; align-items: start; }
.order-fields { grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 2fr); }
.order-fields input[readonly] { background: #f5f8f6; }
.order-fields small { font-weight: 430; }
.check-option { display: flex; align-items: flex-start; gap: .52rem; padding: .3rem 0; cursor: pointer; }
.check-option input { width: 1rem; height: 1rem; accent-color: var(--green); }
.check-option small { display: block; margin-top: .14rem; font-weight: 430; }
.timeline { margin: .85rem 0 0; padding: 0; list-style: none; }
.timeline li { border-inline-start: 1px solid #cfe3d6; position: relative; padding: .1rem 0 .9rem 1rem; overflow-wrap: anywhere; }
.timeline li::before { content: ""; position: absolute; width: 8px; height: 8px; background: #178454; border: 1px solid white; border-radius: 50%; left: -4.5px; top: .32rem; }
.timeline time, .timeline strong, .timeline small { display: block; }
.timeline time { color: var(--subtle); font-size: .81rem; margin-bottom: .18rem; }
.timeline strong { font-size: .92rem; }
.timeline p { font-size: .88rem; margin-top: .26rem; }
.timeline small { margin-top: .32rem; }
.item-fields { border: 1px solid var(--line); padding: .85rem; border-radius: 9px; min-width: 0; }
.item-fields legend { padding: 0 .4rem; color: var(--green-dark); font-size: .93rem; font-weight: 750; }
.item-remove { display: block; margin: 0 0 .64rem auto; }
.item-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) repeat(2, minmax(0, 1.2fr)) minmax(0, 1fr) 105px; gap: .62rem; margin-bottom: .7rem; }
.catalog-field { position: relative; min-width: 0; }
.catalog-field input[data-catalog] { padding-inline-end: 2.65rem; }
.catalog-toggle { position: absolute; right: 0; bottom: 0; width: 42px; height: 42px; border: 0; border-radius: 0 8px 8px 0; background: transparent; }
.catalog-toggle:hover { background: var(--green-light); }
.catalog-results { position: absolute; z-index: 2; top: calc(100% + 4px); left: 0; width: max(100%, min(25rem, calc(100vw - 4rem))); max-height: 270px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 8px 24px #10261b1a; }
.catalog-results button { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: white; text-align: left; padding: .5rem .7rem; overflow-wrap: anywhere; }
.catalog-results button small { display: block; margin-top: .18rem; }
.catalog-results button[data-catalog-more] { font-weight: 650; color: var(--green-dark); }
.catalog-results button:hover, .catalog-results button:focus-visible { background: var(--green-light); }
.catalog-status { padding: .55rem .7rem; color: var(--subtle); }
.form-actions { margin-top: .2rem; }
.notification-list { margin: 0; padding: 0; list-style: none; }
.notification-list li + li { border-top: 1px solid var(--line); }
.notification { width: 100%; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .7rem; border: 0; background: none; color: var(--ink); text-align: left; padding: 1rem 1.25rem; }
.notification strong, .notification small { display: block; }
.notification time { color: var(--subtle); font-size: .87rem; }
.notification.unread { background: #eef8f1; box-shadow: inset 3px 0 var(--green); }
.notification:hover { background: #e3f3e9; }
.contacts { display: grid; grid-template-columns: 1fr 1.5fr; gap: .75rem; margin: 1rem 0 0; }
.contacts dt { color: var(--subtle); }
.contacts dd { margin: 0; overflow-wrap: anywhere; }
.delivery-log { margin-top: 1rem; }
.table-scroll { overflow: auto; border-top: 1px solid var(--line); }
.journal-table { min-width: 1100px; }
.journal-table td, .journal-table th { padding: .5rem .65rem; min-width: 78px; max-width: 320px; font-size: .875rem; }
.journal-table td:nth-child(2) { min-width: 155px; }
.journal-table td details { margin-top: .3rem; }
.journal-table .fill-00b050 { background: #00b050; color: #0c2718; }
.journal-table .fill-38761d { background: #38761d; color: white; }
.journal-table .fill-00ff00 { background: #00ff00; }
.journal-table .fill-ffffff { background: white; }
.journal-table .fill-9dc3e6 { background: #9dc3e6; }
.journal-table .fill-99ccff { background: #99ccff; }
.journal-table .fill-ff0000 { background: #ff0000; color: #180000; }
.journal-table .fill-ffff00 { background: #ffff00; }
.journal-table .fill-bfbfbf { background: #bfbfbf; }
.journal-table .fill-ff00ff { background: #ff00ff; color: #180018; }
.journal-table .fill-ff9900 { background: #ff9900; }
.journal-table .fill-00b0f0 { background: #00b0f0; }
.journal-table .fill-a5a5a5 { background: #a5a5a5; }
.journal-table .fill-d9d9d9 { background: #d9d9d9; }
.journal-table .fill-ff33cc { background: #ff33cc; }
.journal-table .fill-cccccc { background: #cccccc; }
.journal-table .fill-d8d8d8 { background: #d8d8d8; }
.journal-table .fill-cfe2f3 { background: #cfe2f3; }
.journal-table .fill-efefef { background: #efefef; }
.journal-table .fill-c9daf8 { background: #c9daf8; }

.guest-main { min-height: 100dvh; display: grid; align-content: center; padding: clamp(1rem, 4vw, 3rem); }
.login-shell {
    width: min(100%, 975px); min-height: 530px; display: grid; grid-template-columns: 1.1fr 1fr; margin: auto;
    border: 1px solid var(--line); border-radius: 25px; overflow: hidden; background: white; box-shadow: 0 20px 55px #284f3620;
}
.login-brand {
    display: grid; grid-template-rows: auto 1fr; gap: 2rem; padding: clamp(1.35rem, 4.1vw, 3.4rem);
    background: radial-gradient(ellipse at bottom right, #13634c, transparent 65%), #0b3023;
    color: #e0f4e8;
}
.login-brand .brand { color: white; font-size: 1.3rem; }
.login-brand .brand b { color: #8adcb3; }
.brand-mark { border-radius: 11px; padding: .35rem .42rem; background: white; }
.login-heading { align-self: center; }
.login-heading h1 { color: white; font-size: clamp(2.2rem, 4.45vw, 3.9rem); }
.login-heading p { margin-top: 1.1rem; max-width: 20rem; }
.login-content { align-self: center; padding: clamp(1.35rem, 4vw, 3rem); }
.login-content h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.login-content p { margin: .6rem 0 1.05rem; }
.login-content .btn-primary { justify-self: stretch; }
.login-content .notice { margin-top: .7rem; }
.login-reset { margin-top: .8rem; }
.provider-list, .demo-switch { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: 1rem; }
.provider-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.demo-switch > span { display: block; color: var(--subtle); font-size: .875rem; margin-bottom: .45rem; }
.error-page { width: min(100%, 600px); margin: auto; }
.error-page .btn { margin-top: 1rem; }

@media (max-width: 1050px) {
    .workspace { grid-template-columns: 200px minmax(0, 1fr); }
    .main { padding: 1.6rem; }
    .orders-table th, .orders-table td { padding-inline: .65rem; }
    .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .detail-grid > .stack:nth-child(2) { grid-template-columns: 1fr 1fr; }
    .item-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 730px) {
    .order-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .order-comment { grid-column: 1 / -1; }
    .workspace { display: block; }
    .sidebar { position: static; height: auto; padding: .7rem 1rem; border: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: .45rem; }
    .sidebar .brand { margin: 0; }
    .sidebar .brand img { width: 35px; height: 26px; }
    .nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: .3rem; }
    .nav a { min-height: 36px; padding: .42rem .55rem; gap: .4rem; font-size: .875rem; }
    .sidebar-footer { grid-column: 2; grid-row: 1; border: 0; padding: 0; display: flex; align-items: center; gap: .5rem; }
    .sidebar-footer .profile { padding: .25rem; }
    .sidebar-footer .profile > span:last-child { display: none; }
    .sidebar-footer .avatar { width: 2rem; height: 2rem; font-size: .875rem; }
    .logout { margin: 0; }
    .main { padding: 1.05rem; }
    .page-heading { align-items: flex-start; flex-wrap: wrap; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
    .filters, .filters.team-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: .8rem; }
    .panel-heading { padding-inline: .8rem; }
    .orders-table, .orders-table tbody, .orders-table tr, .orders-table td { display: block; width: 100%; }
    .orders-table tr { border-top: 1px solid var(--line); padding: .6rem .8rem; }
    .orders-table thead { display: block; background: #f5f8f6; }
    .orders-table thead tr { display: flex; flex-wrap: wrap; gap: .15rem .8rem; padding-block: .4rem; }
    .orders-table th { display: block; padding: 0; border: 0; background: transparent; }
    .orders-table td { border: 0; padding: .22rem 0; }
    .orders-table td:not(:first-child) { display: grid; grid-template-columns: 7.8rem minmax(0, 1fr); gap: .18rem .45rem; justify-items: start; }
    .orders-table td:not(:first-child)::before { content: attr(data-label); color: var(--subtle); font-size: .84rem; }
    .orders-table td:not(:first-child) small { grid-column: 2; }
    .order-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .order-summary > div:nth-child(2) { border-inline-end: 0; }
    .order-summary > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
    .detail-grid > .stack:nth-child(2) { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; min-height: 0; }
    .login-brand { gap: 1rem; }
    .login-heading h1 { max-width: 12ch; }
    .login-heading p { margin-top: .65rem; }
}

@media (max-width: 380px) {
    .filters, .filters.team-filters, .form-grid, .item-grid { grid-template-columns: 1fr; }
    .main { padding: .8rem; }
}
