@import url("./supplypilot-ui.css");

:root {
    --ink: #17211b;
    --muted: #6c766f;
    --paper: #f4efe5;
    --panel: #fffaf0;
    --line: #e0d6c5;
    --green: #1f6f4a;
    --green-dark: #164832;
    --amber: #cc8a2f;
    --shadow: 0 24px 70px rgba(54, 42, 24, 0.14);
    --font-family-base: "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-size-xs: 13px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 20px;
    --font-size-xl: 36px;
    --text-size: var(--font-size-base);
    --line-height-body: 1.7;
    --line-height-table: 1.55;
    --line-height-control: 1;
    --font-weight-medium: 600;
    --font-weight-bold: 700;
    --font-weight-strong: 800;
    --font-weight-heavy: 900;
    --radius-pill: 999px;
    --radius-field: 14px;
    --radius-card: 28px;
    --radius-card-sm: 24px;
    --surface-border: rgba(224, 214, 197, 0.88);
    --surface-bg: rgba(255, 250, 240, 0.82);
    --surface-bg-soft: rgba(255, 250, 240, 0.72);
    --control-height-md: 44px;
    --control-height-sm: 32px;
    --control-padding-md: 18px;
    --control-padding-sm: 12px;
    --card-padding: 32px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-body);
    background:
        radial-gradient(circle at top left, rgba(204, 138, 47, 0.18), transparent 34rem),
        linear-gradient(135deg, #eee4d2 0%, #f7f3eb 48%, #e8f0e6 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

[hidden] {
    display: none !important;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 28px 22px;
    background: rgba(23, 33, 27, 0.94);
    color: #f9f4ea;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
}

.brand-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 16px;
    background: var(--amber);
    color: #17110b;
    font-weight: var(--font-weight-strong);
    letter-spacing: -0.04em;
}

.brand-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-strong);
}

.brand-subtitle {
    margin-top: 4px;
    color: rgba(249, 244, 234, 0.62);
    font-size: var(--font-size-xs);
}

.nav-list {
    display: grid;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    border-radius: 14px;
    color: rgba(249, 244, 234, 0.72);
    transition: 160ms ease;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(249, 244, 234, 0.1);
    color: #fff;
}

.nav-item.active {
    box-shadow: inset 3px 0 0 var(--amber);
}

.nav-group {
    display: grid;
    gap: 8px;
}

.nav-group summary {
    cursor: pointer;
    list-style: none;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-parent {
    padding: 0;
}

.nav-parent-link {
    flex: 1;
    padding: 13px 0 13px 14px;
}

.nav-chevron {
    display: inline-grid;
    width: 44px;
    min-height: var(--control-height-md);
    place-items: center;
    color: rgba(249, 244, 234, 0.5);
    font-size: 16px;
    transition: transform 160ms ease;
}

.nav-group[open] .nav-chevron {
    transform: rotate(180deg);
}

.sub-nav-list {
    display: grid;
    gap: 6px;
    margin: 0 0 6px 18px;
    padding-left: 14px;
    border-left: 1px solid rgba(249, 244, 234, 0.18);
}

.sub-nav-item {
    padding: 9px 12px;
    border-radius: 12px;
    color: rgba(249, 244, 234, 0.62);
    font-size: 15px;
    font-weight: var(--font-weight-bold);
    transition: 160ms ease;
}

.sub-nav-item:hover,
.sub-nav-item.active {
    background: rgba(249, 244, 234, 0.08);
    color: #fff;
}

.sub-nav-item.active {
    color: #ffd89a;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    color: rgba(249, 244, 234, 0.7);
    font-size: var(--font-size-sm);
}

.main-panel {
    min-width: 0;
    padding: 34px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.eyebrow,
.section-label {
    margin: 0 0 8px;
    color: var(--green);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-strong);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(30px, 5vw, 48px);
    font-weight: var(--font-weight-heavy);
    line-height: 1.08;
    letter-spacing: -0.05em;
}

h2 {
    margin-bottom: 12px;
    font-size: clamp(24px, 3vw, 38px);
    font-weight: var(--font-weight-heavy);
    line-height: 1.12;
    letter-spacing: -0.04em;
}

h3 {
    margin-bottom: 10px;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-strong);
    line-height: 1.25;
}

.topbar-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: flex-end;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.topbar-actions .secondary-button {
    min-height: 38px;
    padding-inline: 16px;
}

.muted,
.module-card p,
.empty-card p {
    color: var(--muted);
    line-height: var(--line-height-body);
}

.account-menu {
    position: relative;
    flex: 0 0 auto;
}

.account-menu summary {
    list-style: none;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: rgba(255, 250, 240, 0.68);
    color: var(--green-dark);
    font-weight: var(--font-weight-bold);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.user-pill:hover {
    border-color: rgba(31, 111, 74, 0.34);
    background: rgba(255, 255, 255, 0.86);
}

.account-menu[open] .user-pill {
    border-color: rgba(31, 111, 74, 0.42);
    background: rgba(255, 255, 255, 0.94);
}

.account-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 30;
    display: grid;
    min-width: 150px;
    padding: 8px;
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    background: rgba(255, 250, 240, 0.98);
    box-shadow: var(--shadow);
}

.account-menu-panel a,
.account-menu-panel button {
    display: flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-weight: var(--font-weight-strong);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.account-menu-panel a:hover,
.account-menu-panel button:hover {
    background: rgba(31, 111, 74, 0.09);
    color: var(--green-dark);
}

.hero-card,
.workflow-card,
.empty-card,
.toolbar-card,
.table-card,
.form-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: var(--card-padding);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-card);
    background: var(--surface-bg);
    box-shadow: var(--shadow);
}

.hero-card.compact {
    display: block;
}

.primary-button,
.secondary-button,
.table-link,
.danger-link,
.module-card a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-strong);
    line-height: var(--line-height-control);
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.primary-button,
.secondary-button,
.module-card a {
    min-height: var(--control-height-md);
    padding: 0 var(--control-padding-md);
    border-radius: var(--radius-pill);
}

.primary-button,
.module-card a {
    border: 1px solid transparent;
    background: var(--green);
    color: white;
}

.stats-grid,
.module-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.stat-card,
.module-card {
    padding: 22px;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-card-sm);
    background: var(--surface-bg-soft);
}

.stat-card span {
    display: block;
    margin-bottom: 12px;
    color: var(--muted);
    font-weight: var(--font-weight-bold);
}

.stat-card strong {
    font-size: var(--font-size-xl);
    letter-spacing: -0.04em;
}

.stat-card-link {
    display: block;
    transition: 160ms ease;
}

.stat-card-link:hover {
    border-color: rgba(31, 111, 74, 0.4);
    background: rgba(255, 250, 240, 0.92);
    transform: translateY(-2px);
}

.workflow-card {
    display: block;
    margin-top: 20px;
}

.timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.timeline-item {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.42);
    color: var(--muted);
    font-weight: var(--font-weight-bold);
}

.timeline-item.done {
    border-color: transparent;
    background: var(--green);
    color: white;
}

.module-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.inventory-module-grid .module-card:nth-of-type(4) {
    grid-column-start: 1;
}

.module-card {
    display: flex;
    min-height: 230px;
    flex-direction: column;
    justify-content: space-between;
}

.module-count {
    color: var(--green-dark);
    font-size: 42px;
    font-weight: var(--font-weight-heavy);
    letter-spacing: -0.06em;
}

.count-with-label {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.count-with-label small {
    font-size: 18px;
    font-weight: var(--font-weight-strong);
    letter-spacing: 0;
}

.empty-card {
    display: block;
    margin-top: 20px;
}

.toolbar-card {
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.toolbar-card > div:first-child {
    flex: 1 1 320px;
    min-width: 0;
}

.toolbar-card-stack {
    display: block;
}

.toolbar-card-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 24px;
}

.toolbar-card-title {
    flex: 1 1 220px;
    min-width: 0;
}

.toolbar-flow {
    display: flex;
    flex: 2 1 300px;
    justify-content: flex-start;
    min-width: 0;
}

.toolbar-flow .timeline {
    justify-content: flex-start;
}

.table-card,
.form-card {
    display: block;
    margin-top: 20px;
    width: 100%;
    box-sizing: border-box;
}

.active-work-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.table-card {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 18px;
    scrollbar-gutter: stable;
}

.table-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
    scrollbar-gutter: stable;
}

.table-card > .section-head,
.table-card > .empty-state,
.table-card > .table-scroll,
.table-card > .sales-analysis-filter,
.table-card > .sales-chart-panel {
    width: 100%;
}

.table-card > .data-table,
.table-scroll > .data-table {
    width: max-content;
    min-width: 100%;
}

.table-card::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar {
    height: 12px;
}

.table-card::-webkit-scrollbar-track,
.table-scroll::-webkit-scrollbar-track {
    border-radius: var(--radius-pill);
    background: rgba(224, 214, 197, 0.55);
}

.table-card::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb {
    border-radius: var(--radius-pill);
    background: rgba(31, 111, 74, 0.46);
}

.data-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.table-card > .data-table.data-table--fit,
.table-scroll > .data-table.data-table--fit,
.data-table.data-table--fit {
    width: 100%;
    min-width: max-content;
}

.data-table-col--8 {
    width: 8%;
}

.data-table-col--9 {
    width: 9%;
}

.data-table-col--10 {
    width: 10%;
}

.data-table-col--11 {
    width: 11%;
}

.data-table-col--12 {
    width: 12%;
}

.data-table-col--13 {
    width: 13%;
}

.data-table-col--14 {
    width: 14%;
}

.data-table-col--18 {
    width: 18%;
}

.data-table-col--25 {
    width: 25%;
}

.data-table-col--28 {
    width: 28%;
}

.data-table-col--29 {
    width: 29%;
}

.data-table th,
.data-table td {
    padding: 15px 14px;
    border-bottom: 1px solid var(--line);
    font-size: var(--font-size-base);
    line-height: var(--line-height-table);
    text-align: left;
    vertical-align: middle;
}

.data-table.data-table--top-aligned tbody > tr > td {
    vertical-align: top !important;
}

.data-table.data-table--top-aligned .po-number-list {
    align-items: start;
}

.data-table th {
    color: var(--green-dark);
    font-weight: var(--font-weight-strong);
    letter-spacing: 0;
    white-space: nowrap;
}

.data-table th:last-child,
.data-table td:last-child {
    width: 160px;
}

.table-card > .data-table.data-table--fit th,
.table-card > .data-table.data-table--fit td,
.table-scroll > .data-table.data-table--fit th,
.table-scroll > .data-table.data-table--fit td {
    width: auto;
    min-width: 0;
}

.data-table td {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.data-table td.table-cell-wrap {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.data-table .number-cell,
.data-table .money-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table .number-cell .form-control,
.data-table .money-cell .form-control {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table-card > .data-table.data-table--fit .row-actions,
.table-scroll > .data-table.data-table--fit .row-actions {
    min-width: 0;
}

.table-qty-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.table-qty-line-name {
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.table-qty-line .number-cell {
    flex: 0 0 auto;
    min-width: 72px;
}

.po-number-list {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 5px 8px;
    align-items: center;
    width: max-content;
    max-width: 100%;
}

.po-number-item {
    display: inline-block;
    white-space: nowrap;
}

.quantity-detail-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: help;
    color: var(--green-dark);
    font-weight: var(--font-weight-medium);
}

.quantity-detail-trigger > span:first-child {
    border-bottom: 1px dotted rgba(31, 111, 74, 0.58);
}

.quantity-detail-icon {
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 1px solid rgba(31, 111, 74, 0.32);
    border-radius: var(--radius-pill);
    background: rgba(31, 111, 74, 0.12);
    color: var(--green);
    font-size: 13px;
    font-weight: var(--font-weight-heavy);
    line-height: 1;
    box-shadow: 0 0 0 3px rgba(31, 111, 74, 0.06);
}

.master-product-table th:nth-child(1),
.master-product-table td:nth-child(1) {
    width: 120px;
}

.master-product-table {
    width: 100%;
    min-width: 1040px;
}

.master-product-table th:nth-child(2),
.master-product-table td:nth-child(2) {
    width: 320px;
}

.master-product-table th:nth-child(3),
.master-product-table td:nth-child(3) {
    width: 210px;
}

.master-product-table th:nth-child(4),
.master-product-table td:nth-child(4) {
    width: 150px;
}

.master-product-table th:nth-child(5),
.master-product-table td:nth-child(5),
.master-product-table th:last-child,
.master-product-table td:last-child {
    width: 100px;
}

.table-cell-wrap > div + div {
    margin-top: 4px;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.clickable-table tbody tr {
    cursor: pointer;
    transition: 140ms ease;
}

.clickable-table tbody tr:hover {
    background: rgba(31, 111, 74, 0.07);
}

.dashboard-work-table th:last-child,
.dashboard-work-table td:last-child {
    width: auto;
}

.dashboard-procurement-table th:nth-child(1),
.dashboard-procurement-table td:nth-child(1) {
    width: 110px;
}

.dashboard-procurement-table th:nth-child(3),
.dashboard-procurement-table td:nth-child(3) {
    width: 90px;
}

.dashboard-warning-table th:nth-child(1),
.dashboard-warning-table td:nth-child(1) {
    width: 90px;
}

.dashboard-warning-table th:nth-child(2),
.dashboard-warning-table td:nth-child(2) {
    width: 120px;
}

.dashboard-warning-table th:nth-child(4),
.dashboard-warning-table td:nth-child(4) {
    width: 220px;
}

.dashboard-transport-table th:nth-child(1),
.dashboard-transport-table td:nth-child(1) {
    width: 100px;
}

.dashboard-transport-table th:nth-child(2),
.dashboard-transport-table td:nth-child(2) {
    width: 120px;
}

.dashboard-transport-table th:nth-child(3),
.dashboard-transport-table td:nth-child(3) {
    width: 190px;
}

.dashboard-transport-table th:nth-child(4),
.dashboard-transport-table td:nth-child(4) {
    width: auto;
}

.dashboard-transport-table th:nth-child(5),
.dashboard-transport-table td:nth-child(5) {
    width: 150px;
}

.dashboard-number-cell {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    column-gap: 6px;
    width: 100%;
    max-width: 100%;
}

.dashboard-number-cell .warning-slot {
    display: inline-flex;
    width: 18px;
    align-items: center;
    justify-content: center;
}

.dashboard-number-cell .warning-slot:empty {
    visibility: hidden;
}

.dashboard-number-cell .warning-marker {
    transform: none;
}

.dashboard-number-cell > span:last-child {
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.purchase-order-table th:nth-child(1),
.purchase-order-table td:nth-child(1) {
    width: 130px;
}

.purchase-order-table th:nth-child(3),
.purchase-order-table td:nth-child(3) {
    width: 90px;
}

.purchase-order-table th:nth-child(4),
.purchase-order-table td:nth-child(4) {
    width: 130px;
}

.purchase-order-table th:last-child,
.purchase-order-table td:last-child {
    width: 100px;
    text-align: right;
}

.purchase-order-table .row-actions {
    justify-content: flex-end;
    min-width: 0;
}

.purchase-archive-table {
    min-width: 1180px;
}

.purchase-archive-table th.purchase-archive-number-col,
.purchase-archive-table td.purchase-archive-number-col {
    width: 120px;
}

.purchase-archive-table th.purchase-archive-supplier-col,
.purchase-archive-table td.purchase-archive-supplier-col {
    width: 230px;
}

.purchase-archive-table th.purchase-archive-content-col,
.purchase-archive-table td.purchase-archive-content-col {
    width: auto;
}

.purchase-archive-table th.purchase-archive-amount-col,
.purchase-archive-table td.purchase-archive-amount-col {
    width: 120px;
    text-align: right;
}

.purchase-archive-table th.purchase-archive-date-col,
.purchase-archive-table td.purchase-archive-date-col {
    width: 150px;
}

.purchase-archive-table th.purchase-archive-action-col,
.purchase-archive-table td.purchase-archive-action-col {
    width: 120px;
}

.product-line-grid {
    display: grid;
    width: 100%;
    min-width: max-content;
    align-items: center;
    gap: 8px 18px;
}

.product-line-grid--purchase {
    grid-template-columns: max-content minmax(260px, 1fr) max-content;
}

.product-line-grid--purchase.product-line-grid--with-money {
    grid-template-columns: max-content minmax(260px, 1fr) max-content max-content;
}

.product-line-grid--shipment {
    grid-template-columns: minmax(280px, 1fr) max-content;
}

.product-line-grid__row {
    display: contents;
}

.line-type-badge {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 0 9px;
    border-radius: var(--radius-pill);
    background: rgba(31, 111, 74, 0.11);
    color: var(--green-dark);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-strong);
    white-space: nowrap;
}

.line-type-badge--gift {
    background: rgba(213, 139, 37, 0.14);
    color: #7a4a0a;
}

.product-line-grid__name {
    min-width: max-content;
    justify-self: start;
    white-space: nowrap;
}

.product-line-grid__name--strong {
    font-weight: var(--font-weight-strong);
}

.product-line-grid__qty,
.product-line-grid__money {
    justify-self: end;
    min-width: 72px;
    white-space: nowrap;
    text-align: right;
}

.product-line-grid__money,
.product-line-grid--purchase .product-line-grid__qty {
    color: var(--muted);
}

.product-line-grid--purchase .product-line-grid__qty {
    min-width: 96px;
}

.product-line-grid__money {
    min-width: 76px;
}

.product-line-grid__empty {
    white-space: nowrap;
}

.purchase-summary-table {
    min-width: 1120px;
}

.purchase-summary-table th:nth-child(1),
.purchase-summary-table td:nth-child(1) {
    width: 130px;
}

.purchase-summary-table th:nth-child(2),
.purchase-summary-table td:nth-child(2) {
    width: auto;
}

.purchase-summary-table th:nth-child(3),
.purchase-summary-table td:nth-child(3),
.purchase-summary-table th:nth-child(4),
.purchase-summary-table td:nth-child(4),
.purchase-summary-table th:nth-child(5),
.purchase-summary-table td:nth-child(5),
.purchase-summary-table th:nth-child(6),
.purchase-summary-table td:nth-child(6),
.purchase-summary-table th:nth-child(7),
.purchase-summary-table td:nth-child(7),
.purchase-summary-table th:nth-child(8),
.purchase-summary-table td:nth-child(8) {
    width: 120px;
    text-align: right;
}

.purchase-summary-detail-table {
    min-width: 1280px;
}

.purchase-summary-detail-table th:nth-child(1),
.purchase-summary-detail-table td:nth-child(1) {
    width: 120px;
}

.purchase-summary-detail-table th:nth-child(2),
.purchase-summary-detail-table td:nth-child(2) {
    width: 210px;
}

.purchase-summary-detail-table th:nth-child(3),
.purchase-summary-detail-table td:nth-child(3) {
    width: auto;
}

.purchase-summary-detail-table th:nth-child(4),
.purchase-summary-detail-table td:nth-child(4) {
    width: 90px;
}

.purchase-summary-detail-table th:nth-child(5),
.purchase-summary-detail-table td:nth-child(5),
.purchase-summary-detail-table th:nth-child(6),
.purchase-summary-detail-table td:nth-child(6),
.purchase-summary-detail-table th:nth-child(7),
.purchase-summary-detail-table td:nth-child(7) {
    width: 110px;
    text-align: right;
}

.purchase-summary-detail-table th:nth-child(8),
.purchase-summary-detail-table td:nth-child(8) {
    width: 120px;
}

.purchase-summary-detail-table th:nth-child(9),
.purchase-summary-detail-table td:nth-child(9) {
    width: 95px;
}

.purchase-summary-detail-table th:last-child,
.purchase-summary-detail-table td:last-child {
    width: 90px;
    text-align: right;
}

.purchase-summary-detail-table .row-actions {
    justify-content: flex-end;
    min-width: 0;
}

.settlement-order-table th:nth-child(1),
.settlement-order-table td:nth-child(1) {
    width: 110px;
}

.settlement-order-table th:nth-child(2),
.settlement-order-table td:nth-child(2) {
    width: 100px;
}

.settlement-order-table th:nth-child(3),
.settlement-order-table td:nth-child(3) {
    width: 125px;
}

.settlement-order-table th:nth-child(4),
.settlement-order-table td:nth-child(4) {
    width: 65px;
}

.settlement-order-table th:nth-child(5),
.settlement-order-table td:nth-child(5) {
    width: 90px;
}

.settlement-order-table th:nth-child(6),
.settlement-order-table td:nth-child(6) {
    width: 110px;
}

.settlement-order-table th:nth-child(7),
.settlement-order-table td:nth-child(7) {
    width: 110px;
}

.settlement-order-table th:nth-child(8),
.settlement-order-table td:nth-child(8) {
    width: 140px;
}

.settlement-order-table th:last-child,
.settlement-order-table td:last-child {
    width: 170px;
    text-align: right;
}

.settlement-line-table th:last-child,
.settlement-line-table td:last-child {
    width: 150px;
    overflow: visible;
    text-align: right;
    white-space: nowrap;
}

.settlement-summary-table th:nth-child(1),
.settlement-summary-table td:nth-child(1),
.settlement-line-table th:nth-child(1),
.settlement-line-table td:nth-child(1) {
    width: 130px;
}

.settlement-line-table th:nth-child(4),
.settlement-line-table td:nth-child(4),
.settlement-line-table th:nth-child(5),
.settlement-line-table td:nth-child(5),
.settlement-line-table th:nth-child(6),
.settlement-line-table td:nth-child(6) {
    width: 130px;
}

.settlement-line-table th:last-child,
.settlement-line-table td:last-child {
    width: 180px;
    overflow: visible;
    text-align: right;
    white-space: nowrap;
}

.settlement-order-table .row-actions,
.settlement-line-table .row-actions {
    justify-content: flex-end;
    min-width: 0;
    white-space: nowrap;
}

.transport-ready-table th:last-child,
.transport-ready-table td:last-child {
    text-align: right;
}

.transport-ready-table th:nth-child(1),
.transport-ready-table td:nth-child(1) {
    white-space: nowrap;
}

.transport-ready-table th:nth-child(3),
.transport-ready-table td:nth-child(3) {
    white-space: nowrap;
}

.transport-ready-table td:nth-child(4) {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.shipment-table .shipment-po-cell {
    white-space: normal;
}

.shipment-table .shipment-product-cell {
    min-width: 0;
}

.transport-ready-table .row-actions,
.shipment-table .row-actions {
    justify-content: flex-end;
    min-width: 0;
}

.shipment-processing-table th:nth-child(1),
.shipment-processing-table td:nth-child(1) {
    white-space: nowrap;
}

.shipment-processing-table th:nth-child(2),
.shipment-processing-table td:nth-child(2) {
    white-space: normal;
}

.shipment-processing-table th:last-child,
.shipment-processing-table td:last-child {
    text-align: right;
}

.shipment-archive-table th:nth-child(1),
.shipment-archive-table td:nth-child(1) {
    white-space: nowrap;
}

.shipment-archive-table th:nth-child(2),
.shipment-archive-table td:nth-child(2) {
    white-space: normal;
}

.shipment-archive-table th:last-child,
.shipment-archive-table td:last-child {
    overflow: visible;
    text-align: right;
}

.shipment-note-cell {
    color: var(--muted);
    line-height: var(--line-height-body);
}

.inventory-product-summary-table th:nth-child(1),
.inventory-product-summary-table td:nth-child(1) {
    width: 120px;
}

.inventory-product-summary-table th:nth-child(2),
.inventory-product-summary-table td:nth-child(2) {
    width: 210px;
}

.inventory-product-summary-table th:nth-child(3),
.inventory-product-summary-table td:nth-child(3) {
    width: 85px;
}

.inventory-warehouse-summary-table th:nth-child(1),
.inventory-warehouse-summary-table td:nth-child(1) {
    width: 150px;
}

.inventory-warehouse-summary-table th:nth-child(2),
.inventory-warehouse-summary-table td:nth-child(2),
.inventory-warehouse-summary-table th:nth-child(3),
.inventory-warehouse-summary-table td:nth-child(3),
.inventory-warehouse-summary-table th:nth-child(4),
.inventory-warehouse-summary-table td:nth-child(4),
.inventory-warehouse-summary-table th:nth-child(5),
.inventory-warehouse-summary-table td:nth-child(5),
.inventory-warehouse-summary-table th:nth-child(6),
.inventory-warehouse-summary-table td:nth-child(6) {
    width: 95px;
}

.inventory-warehouse-product-table th:nth-child(1),
.inventory-warehouse-product-table td:nth-child(1) {
    width: 130px;
}

.inventory-warehouse-product-table th:nth-child(2),
.inventory-warehouse-product-table td:nth-child(2) {
    width: 260px;
}

.inventory-warehouse-product-table th:nth-child(3),
.inventory-warehouse-product-table td:nth-child(3),
.inventory-warehouse-product-table th:nth-child(4),
.inventory-warehouse-product-table td:nth-child(4),
.inventory-warehouse-product-table th:nth-child(5),
.inventory-warehouse-product-table td:nth-child(5),
.inventory-warehouse-product-table th:nth-child(6),
.inventory-warehouse-product-table td:nth-child(6) {
    width: 120px;
}

.inventory-movement-table {
    min-width: 1440px;
}

.inventory-movement-table th:nth-child(1),
.inventory-movement-table td:nth-child(1) {
    width: 150px;
}

.inventory-movement-table th:nth-child(2),
.inventory-movement-table td:nth-child(2) {
    width: 130px;
}

.inventory-movement-table th:nth-child(3),
.inventory-movement-table td:nth-child(3) {
    width: 120px;
}

.inventory-movement-table th:nth-child(4),
.inventory-movement-table td:nth-child(4) {
    width: 220px;
}

.inventory-movement-table th:nth-child(5),
.inventory-movement-table td:nth-child(5) {
    width: 140px;
}

.inventory-movement-table th:nth-child(6),
.inventory-movement-table td:nth-child(6),
.inventory-movement-table th:nth-child(7),
.inventory-movement-table td:nth-child(7),
.inventory-movement-table th:nth-child(8),
.inventory-movement-table td:nth-child(8) {
    width: 110px;
}

.inventory-movement-table th:nth-child(9),
.inventory-movement-table td:nth-child(9) {
    width: 170px;
}

.inventory-movement-table th:nth-child(10),
.inventory-movement-table td:nth-child(10) {
    width: 240px;
}

.inventory-transfer-order-table {
    min-width: 1180px;
}

.inventory-transfer-order-table th:nth-child(1),
.inventory-transfer-order-table td:nth-child(1),
.inventory-transfer-order-table th:nth-child(2),
.inventory-transfer-order-table td:nth-child(2) {
    width: 150px;
}

.inventory-transfer-order-table th:nth-child(3),
.inventory-transfer-order-table td:nth-child(3),
.inventory-transfer-order-table th:nth-child(4),
.inventory-transfer-order-table td:nth-child(4),
.inventory-transfer-order-table th:nth-child(6),
.inventory-transfer-order-table td:nth-child(6),
.inventory-transfer-order-table th:last-child,
.inventory-transfer-order-table td:last-child {
    width: 120px;
}

.inventory-transfer-line-table {
    min-width: 1080px;
}

.inventory-transfer-line-table th:nth-child(1),
.inventory-transfer-line-table td:nth-child(1),
.inventory-transfer-line-table th:nth-child(4),
.inventory-transfer-line-table td:nth-child(4),
.inventory-transfer-line-table th:nth-child(5),
.inventory-transfer-line-table td:nth-child(5),
.inventory-transfer-line-table th:nth-child(6),
.inventory-transfer-line-table td:nth-child(6),
.inventory-transfer-line-table th:last-child,
.inventory-transfer-line-table td:last-child {
    width: 130px;
}

.stacked-list {
    display: grid;
    gap: 4px;
}

.reconciliation-date-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 420px));
    gap: 14px;
}

.stock-reconciliation-table {
    min-width: 980px;
}

.stock-reconciliation-table th:nth-child(1),
.stock-reconciliation-table td:nth-child(1) {
    width: 130px;
}

.stock-reconciliation-table th:nth-child(3),
.stock-reconciliation-table td:nth-child(3),
.stock-reconciliation-table th:nth-child(4),
.stock-reconciliation-table td:nth-child(4),
.stock-reconciliation-table th:nth-child(5),
.stock-reconciliation-table td:nth-child(5),
.stock-reconciliation-table th:nth-child(6),
.stock-reconciliation-table td:nth-child(6) {
    width: 120px;
}

.stock-reconciliation-table th:nth-child(7),
.stock-reconciliation-table td:nth-child(7) {
    width: 220px;
}

.stock-reconciliation-table .reconciliation-input-cell {
    overflow: visible;
    white-space: normal;
}

.stock-reconciliation-table .form-control {
    min-height: 38px;
    padding: 8px 10px;
}

.stock-reconciliation-history-table {
    min-width: 1220px;
}

.stock-reconciliation-history-table th:last-child,
.stock-reconciliation-history-table td:last-child {
    width: 110px;
    text-align: right;
}

.attachment-table th:nth-child(1),
.attachment-table td:nth-child(1) {
    width: 150px;
}

.attachment-table th:nth-child(3),
.attachment-table td:nth-child(3) {
    width: 160px;
}

.attachment-table th:last-child,
.attachment-table td:last-child {
    width: 150px;
    text-align: right;
    overflow: visible;
    white-space: nowrap;
}

.attachment-table .row-actions {
    justify-content: flex-end;
    min-width: 128px;
    gap: 8px;
}

.receipt-shipment-table {
    min-width: 1120px;
}

.receipt-shipment-table th:nth-child(1),
.receipt-shipment-table td:nth-child(1),
.receipt-shipment-table th:nth-child(2),
.receipt-shipment-table td:nth-child(2) {
    width: 120px;
    white-space: nowrap;
}

.receipt-shipment-table th:nth-child(3),
.receipt-shipment-table td:nth-child(3),
.receipt-shipment-table th:nth-child(4),
.receipt-shipment-table td:nth-child(4) {
    width: 140px;
    white-space: nowrap;
}

.receipt-shipment-table th:last-child,
.receipt-shipment-table td:last-child {
    width: 210px;
    text-align: right;
}

.receipt-shipment-table .row-actions {
    justify-content: flex-end;
    min-width: 0;
    flex-wrap: wrap;
}

.receipt-product-list {
    display: grid;
    gap: 4px;
    line-height: 1.7;
}

.shipment-defective-table {
    min-width: 900px;
}

.shipment-defective-table th:nth-child(1),
.shipment-defective-table td:nth-child(1),
.shipment-defective-table th:nth-child(3),
.shipment-defective-table td:nth-child(3),
.shipment-defective-table th:nth-child(4),
.shipment-defective-table td:nth-child(4) {
    width: 140px;
    white-space: nowrap;
}

.shipment-defective-table th:last-child,
.shipment-defective-table td:last-child {
    width: 180px;
}

.sales-record-table th:nth-child(1),
.sales-record-table td:nth-child(1) {
    width: 330px;
    white-space: nowrap;
}

.sales-record-table th:nth-child(2),
.sales-record-table td:nth-child(2) {
    width: 120px;
    white-space: nowrap;
}

.sales-record-table th:nth-child(3),
.sales-record-table td:nth-child(3) {
    width: 100px;
    white-space: nowrap;
}

.sales-record-table th:nth-child(4),
.sales-record-table td:nth-child(4),
.sales-record-table th:nth-child(5),
.sales-record-table td:nth-child(5) {
    width: 120px;
    white-space: nowrap;
}

.sales-record-table th:nth-child(6),
.sales-record-table td:nth-child(6) {
    width: auto;
}

.sales-record-table th:last-child,
.sales-record-table td:last-child {
    width: 170px;
    text-align: right;
}

.sales-record-table .row-actions {
    justify-content: flex-end;
    min-width: 0;
}

.sales-analysis-section {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    overflow-x: visible;
}

.sales-analysis-filter {
    display: block;
}

.sales-analysis-filter-grid {
    display: grid;
    grid-template-columns: minmax(150px, 0.28fr) minmax(0, 1fr) minmax(260px, 0.55fr) auto;
    gap: 18px;
    align-items: start;
}

.sales-filter-panel {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.sales-filter-panel > label {
    color: var(--green-dark);
    font-weight: var(--font-weight-strong);
}

.sales-filter-period-panel .form-control {
    min-height: 44px;
}

.sales-filter-options {
    display: grid;
    max-height: 190px;
    overflow-y: auto;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-field);
    background: rgba(255, 255, 255, 0.42);
}

.check-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 10px;
    color: var(--ink);
    cursor: pointer;
}

.check-option:hover {
    background: rgba(31, 111, 74, 0.08);
}

.check-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--green);
}

.check-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sales-filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: flex-end;
    min-height: 72px;
}

.sales-chart-panel {
    display: grid;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 16px 16px 12px;
    overflow: hidden;
    border: 1px solid rgba(224, 214, 197, 0.84);
    border-radius: var(--radius-card-sm);
    background: rgba(255, 255, 255, 0.34);
}

.sales-chart {
    display: block;
    width: 100%;
    height: auto;
    min-height: 260px;
}

.sales-chart-axis {
    stroke: rgba(23, 33, 27, 0.38);
    stroke-width: 1.5;
}

.sales-chart-grid-line {
    stroke: rgba(224, 214, 197, 0.88);
    stroke-width: 1;
}

.sales-chart-line {
    fill: none;
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.sales-chart-point {
    stroke: var(--panel);
    stroke-width: 2;
}

.sales-chart-x-label,
.sales-chart-y-label {
    fill: var(--muted);
    font-size: 12px;
}

.sales-chart-x-label {
    text-anchor: middle;
}

.sales-chart-y-label {
    dominant-baseline: middle;
}

.sales-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.sales-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 360px;
    color: var(--muted);
    font-size: var(--font-size-sm);
}

.sales-chart-legend-color {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-pill);
}

.sales-analysis-table-scroll {
    width: 100%;
    max-width: 100%;
    margin-top: 4px;
    overflow-x: auto;
}

.sales-analysis-table {
    width: 100%;
    min-width: 980px;
    table-layout: auto;
}

.sales-analysis-table th:nth-child(1),
.sales-analysis-table td:nth-child(1) {
    width: 320px;
    min-width: 300px;
}

.sales-analysis-table th:nth-child(2),
.sales-analysis-table td:nth-child(2) {
    width: 150px;
    min-width: 130px;
    white-space: nowrap;
}

.sales-analysis-table th.number-cell,
.sales-analysis-table td.number-cell {
    width: 112px;
    min-width: 104px;
}

.sales-analysis-table th:nth-last-child(3),
.sales-analysis-table td:nth-last-child(3),
.sales-analysis-table th:nth-last-child(2),
.sales-analysis-table td:nth-last-child(2),
.sales-analysis-table th:last-child,
.sales-analysis-table td:last-child {
    width: 116px;
    min-width: 112px;
    white-space: nowrap;
}

.table-link {
    border: 1px solid transparent;
    color: var(--green);
    font-weight: var(--font-weight-strong);
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    min-width: 240px;
}

.table-link,
.danger-link {
    min-height: var(--control-height-sm);
    padding: 0 var(--control-padding-sm);
    border-radius: var(--radius-pill);
}

.table-link {
    background: rgba(31, 111, 74, 0.1);
}

.table-primary-link {
    border-color: transparent;
    background: var(--green);
    color: white;
}

.danger-link {
    padding: 0;
    padding-inline: var(--control-padding-sm);
    border: 1px solid rgba(159, 44, 36, 0.35);
    background: rgba(159, 44, 36, 0.06);
    color: #9f2c24;
    cursor: pointer;
}

.message-list {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.message {
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(31, 111, 74, 0.12);
    color: var(--green-dark);
    font-weight: var(--font-weight-bold);
}

.message.error {
    background: rgba(159, 44, 36, 0.12);
    color: #7d211b;
}

.message.warning {
    background: rgba(213, 139, 37, 0.14);
    color: #7a4a0a;
}

.warning-card {
    border-color: rgba(213, 139, 37, 0.34);
}

.warning-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 10px;
    border: 1px solid rgba(213, 139, 37, 0.32);
    border-radius: var(--radius-pill);
    background: rgba(213, 139, 37, 0.13);
    color: #7a4a0a;
    font-weight: var(--font-weight-strong);
    white-space: nowrap;
}

.warning-cell {
    position: relative;
    display: inline-block;
    max-width: 100%;
    min-height: 20px;
    padding-left: 24px;
    vertical-align: middle;
    white-space: nowrap;
}

.warning-cell .warning-marker {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.warning-marker {
    position: relative;
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 15px solid #d58b25;
    color: #fff;
    font-size: 0;
    line-height: 1;
    cursor: help;
    transform: translateY(-1px);
}

.warning-marker::after {
    content: "!";
    position: absolute;
    left: -3px;
    top: 3px;
    font-size: 10px;
    font-weight: var(--font-weight-heavy);
}

.form-control.readonly-input,
.form-control:disabled.readonly-input {
    color: var(--muted);
    background: rgba(238, 231, 213, 0.72);
    border-color: rgba(197, 184, 152, 0.62);
    cursor: not-allowed;
    opacity: 1;
}

.empty-state {
    padding: 28px;
    text-align: center;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 20px;
}

.export-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 18px;
}

.export-field-wide {
    grid-column: 1 / -1;
}

.choice-grid ul {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.choice-grid.compact ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-grid label {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.42);
    color: var(--ink);
    font-weight: var(--font-weight-bold);
}

.choice-grid input {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
}

.export-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.export-option-panel {
    display: grid;
    align-content: start;
    gap: 16px;
    min-width: 0;
}

.sales-entry-form-grid {
    grid-template-columns: minmax(360px, 0.95fr) minmax(320px, 1fr);
    column-gap: 26px;
}

.sales-entry-field-week_start_date {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.sales-entry-field-warehouse {
    grid-column: 2;
    grid-row: 1;
}

.sales-entry-field-notes {
    grid-column: 2;
    grid-row: 2;
}

.sales-entry-field-notes textarea.form-control {
    min-height: 136px;
}

.account-settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.account-card {
    min-width: 0;
}

.account-summary {
    display: grid;
    gap: 14px;
    margin: 0 0 24px;
}

.account-summary div {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.account-summary dt {
    color: var(--green-dark);
    font-weight: var(--font-weight-strong);
}

.account-summary dd {
    margin: 0;
    min-width: 0;
}

.permission-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.permission-chip-list-compact {
    gap: 6px;
}

.permission-module-list {
    display: grid;
    gap: 10px;
}

.permission-module-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.permission-module-name {
    color: var(--text);
    font-weight: var(--font-weight-strong);
}

.permission-chip {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid rgba(31, 111, 74, 0.22);
    border-radius: var(--radius-pill);
    background: rgba(31, 111, 74, 0.09);
    color: var(--green-dark);
    font-weight: var(--font-weight-strong);
}

.permission-chip-danger {
    border-color: rgba(173, 75, 50, 0.28);
    background: rgba(173, 75, 50, 0.11);
    color: #8f3b25;
}

.account-form-grid {
    grid-template-columns: 1fr;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    align-items: center;
    padding: 34px;
    background:
        radial-gradient(circle at 20% 10%, rgba(213, 139, 37, 0.18), transparent 34%),
        var(--paper);
}

.auth-card {
    display: block;
    width: min(100%, 560px);
    margin: 0 auto;
}

.auth-card h1 {
    margin-bottom: 28px;
}

.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
    width: 100%;
    height: 52px;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-field);
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    font: inherit;
    line-height: 52px;
}

.auth-card input:focus {
    border-color: var(--green);
    box-shadow: inset 0 0 0 2px rgba(31, 111, 74, 0.18);
    outline: 0;
}

.auth-secondary-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.auth-secondary-row a {
    color: var(--green);
    font-weight: var(--font-weight-strong);
    text-decoration: none;
}

.auth-secondary-row a:hover {
    color: var(--green-dark);
}

.auth-actions {
    justify-content: flex-end;
}

.filter-grid {
    grid-template-columns: minmax(260px, 420px);
}

.archive-filter-grid {
    grid-template-columns: minmax(200px, 1fr) minmax(240px, 1.3fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr) auto;
}

.transport-archive-filter-grid {
    grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) auto;
}

.sales-record-filter-grid {
    grid-template-columns: minmax(220px, 320px) auto;
}

.sales-record-filter-grid .archive-filter-actions {
    align-self: end;
}

.transport-archive-filter-grid .archive-filter-actions {
    align-self: end;
}

.archive-filter-actions .button-row {
    align-items: center;
}

.shipment-line-form-grid {
    align-items: start;
    column-gap: 24px;
    row-gap: 8px;
}

.shipment-line-help {
    grid-column: 1 / -1;
}

.shipment-picker-form {
    display: grid;
    gap: 18px;
}

.shipment-picker-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
    gap: 18px;
    align-items: stretch;
}

.shipment-picker-panel {
    display: grid;
    min-width: 0;
    grid-template-rows: auto minmax(220px, 1fr) auto;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-field);
    background: rgba(255, 255, 255, 0.32);
}

.shipment-picker-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.shipment-picker-panel-head h4,
.shipment-pending-section h4 {
    margin: 0;
    color: var(--green-dark);
    font-size: var(--font-size-base);
}

.shipment-picker-panel-head span {
    color: var(--muted);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-strong);
}

.shipment-order-list,
.shipment-product-list {
    display: grid;
    align-content: start;
    gap: 10px;
    max-height: 360px;
    overflow: auto;
    padding-right: 4px;
}

.shipment-order-option,
.shipment-product-option {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 5px;
    padding: 12px 14px;
    border: 1px solid rgba(224, 214, 197, 0.9);
    border-radius: 12px;
    background: rgba(255, 250, 240, 0.72);
    color: var(--ink);
    text-align: left;
}

.shipment-order-option {
    cursor: pointer;
}

.shipment-order-option.active,
.shipment-order-option:hover,
.shipment-product-option:has(input:checked) {
    border-color: rgba(31, 111, 74, 0.5);
    background: rgba(31, 111, 74, 0.1);
}

.shipment-order-option span,
.shipment-product-option span {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.shipment-order-option strong,
.shipment-product-option strong,
.shipment-order-option small,
.shipment-product-option small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shipment-order-option small,
.shipment-product-option small {
    color: var(--muted);
    font-size: var(--font-size-xs);
}

.shipment-order-option em,
.shipment-product-option em {
    color: var(--green-dark);
    font-style: normal;
    font-weight: var(--font-weight-strong);
}

.shipment-product-option {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    cursor: pointer;
}

.shipment-product-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
}

.shipment-product-empty {
    display: grid;
    min-height: 220px;
    place-items: center;
    padding: 18px;
    border: 1px dashed rgba(108, 118, 111, 0.42);
    border-radius: 12px;
    color: var(--muted);
    text-align: center;
}

.shipment-pending-section {
    display: grid;
    gap: 12px;
}

.shipment-pending-table-wrap {
    overflow-x: auto;
}

.shipment-pending-table {
    min-width: 1260px;
}

.shipment-pending-table th:nth-child(1),
.shipment-pending-table td:nth-child(1) {
    width: 7%;
}

.shipment-pending-table th:nth-child(2),
.shipment-pending-table td:nth-child(2) {
    width: 13%;
}

.shipment-pending-table th:nth-child(3),
.shipment-pending-table td:nth-child(3) {
    width: 10%;
}

.shipment-pending-table th:nth-child(4),
.shipment-pending-table td:nth-child(4) {
    width: 13%;
}

.shipment-pending-table th:nth-child(5),
.shipment-pending-table td:nth-child(5) {
    width: 9%;
}

.shipment-pending-table th:nth-child(6),
.shipment-pending-table td:nth-child(6),
.shipment-pending-table th:nth-child(7),
.shipment-pending-table td:nth-child(7) {
    width: 11%;
}

.shipment-pending-table th:last-child,
.shipment-pending-table td:last-child {
    width: 7%;
    text-align: right;
}

.form-field {
    display: grid;
    align-self: start;
    align-content: start;
    gap: 8px;
}

.form-field[hidden] {
    display: none !important;
}

.form-field label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 26px;
    color: var(--green-dark);
    font-weight: var(--font-weight-strong);
    line-height: 1.25;
}

.help-icon {
    position: relative;
    display: inline-grid;
    width: 19px;
    height: 19px;
    place-items: center;
    border-radius: var(--radius-pill);
    background: rgba(31, 111, 74, 0.12);
    color: var(--green);
    cursor: help;
    font-size: 12px;
    font-weight: var(--font-weight-heavy);
}

.help-icon::after {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    z-index: 5;
    width: min(360px, 72vw);
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fffaf0;
    box-shadow: 0 14px 40px rgba(54, 42, 24, 0.18);
    color: var(--ink);
    content: attr(aria-label);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    line-height: 1.6;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 6px);
    transition: 140ms ease;
}

.help-icon:hover::after,
.help-icon:focus::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.form-control {
    width: 100%;
    height: 52px;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-field);
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    font: inherit;
    line-height: 52px;
}

input[type="number"].form-control {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"].form-control::-webkit-inner-spin-button,
input[type="number"].form-control::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

textarea.form-control {
    height: auto;
    min-height: 112px;
    padding: 12px 16px;
    line-height: 1.5;
    resize: vertical;
}

.form-control:focus {
    border-color: var(--green);
    box-shadow: inset 0 0 0 2px rgba(31, 111, 74, 0.18);
    outline: 0;
}

.date-input-shell {
    position: relative;
    display: block;
}

.date-input-shell .form-control,
.week-input-shell .form-control {
    padding-right: 48px;
}

.week-input-shell {
    position: relative;
    display: block;
}

.date-picker-button,
.week-picker-button {
    position: absolute;
    top: 50%;
    right: 10px;
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: rgba(31, 111, 74, 0.1);
    color: var(--green-dark);
    cursor: pointer;
    transform: translateY(-50%);
}

.date-picker-button:hover,
.week-picker-button:hover {
    background: rgba(31, 111, 74, 0.16);
}

.date-picker-button svg,
.week-picker-button svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.date-input-native {
    position: absolute;
    right: 12px;
    bottom: 8px;
    width: 1px;
    height: 1px;
    border: 0;
    opacity: 0.01;
    pointer-events: none;
}

.form-control.has-error {
    border-color: #9f2c24;
    box-shadow: 0 0 0 4px rgba(159, 44, 36, 0.1);
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.help-text {
    margin: 0;
    color: var(--muted);
    font-size: var(--font-size-xs);
}

.help-text-placeholder {
    visibility: hidden;
}

.sales-period-preview {
    display: grid;
    gap: 7px;
    max-width: 100%;
    padding: 10px;
    overflow-x: hidden;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.06);
}

.sales-period-preview-title {
    color: var(--green-dark);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    white-space: nowrap;
}

.sales-period-days {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 5px;
    min-width: 0;
}

.sales-period-day {
    position: relative;
    display: grid;
    min-height: 62px;
    padding: 6px 4px;
    overflow: hidden;
    place-items: center;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    isolation: isolate;
}

.sales-period-day.start {
    background: rgba(255, 255, 255, 0.72);
}

.sales-period-day.end {
    background: rgba(255, 255, 255, 0.72);
}

.sales-period-day.middle {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.sales-period-day span,
.sales-period-day strong,
.sales-period-day small {
    position: relative;
    z-index: 1;
}

.sales-period-day span,
.sales-period-day small {
    font-size: 10px;
    line-height: 1.2;
}

.sales-period-day strong {
    font-size: 16px;
    line-height: 1;
}

.sales-period-day.start::before,
.sales-week-day.selected-start::before,
.sales-period-day.end::before,
.sales-week-day.selected-end::before {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #2563eb;
    content: "";
}

.sales-period-day.start::before,
.sales-week-day.selected-start::before {
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.sales-period-day.end::before,
.sales-week-day.selected-end::before {
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.sales-week-picker {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    width: min(360px, calc(100vw - 32px));
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fffaf0;
    box-shadow: 0 18px 50px rgba(54, 42, 24, 0.2);
}

.sales-week-picker-header {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.sales-week-picker-header strong {
    color: var(--ink);
    font-weight: var(--font-weight-bold);
    text-align: center;
}

.sales-week-picker-nav {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: rgba(31, 111, 74, 0.1);
    color: var(--green-dark);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.sales-week-picker-nav:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

.sales-week-picker-grid {
    display: grid;
    grid-template-columns: 40px repeat(7, minmax(0, 1fr));
    gap: 3px;
}

.sales-week-picker-grid-label {
    display: grid;
    height: 24px;
    place-items: center;
    color: var(--green-dark);
    font-size: 12px;
    font-weight: var(--font-weight-bold);
}

.sales-week-number,
.sales-week-day {
    position: relative;
    display: grid;
    height: 34px;
    place-items: center;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    line-height: 1;
    isolation: isolate;
}

.sales-week-number {
    color: var(--green-dark);
    font-weight: var(--font-weight-bold);
}

.sales-week-number:hover,
.sales-week-day:hover {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.1);
}

.sales-week-number.hover-week {
    background: rgba(37, 99, 235, 0.09);
}

.sales-week-number:focus,
.sales-week-day:focus {
    outline: 0;
}

.sales-week-number:focus-visible,
.sales-week-day:focus-visible {
    border-color: rgba(31, 111, 74, 0.58);
    box-shadow: 0 0 0 2px rgba(31, 111, 74, 0.16);
}

.sales-week-day.outside-month {
    color: rgba(7, 27, 31, 0.38);
}

.sales-week-day.hover-middle {
    border-color: rgba(37, 99, 235, 0.28);
    background: rgba(37, 99, 235, 0.14);
}

.sales-week-day.hover-start,
.sales-week-day.hover-end {
    border-color: rgba(37, 99, 235, 0.28);
    background: rgba(255, 255, 255, 0.72);
}

.sales-week-day.hover-start::before,
.sales-week-day.hover-end::before {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(37, 99, 235, 0.2);
    content: "";
}

.sales-week-day.hover-start::before {
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.sales-week-day.hover-end::before {
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.sales-week-day.selected-middle {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.sales-week-day.selected-start,
.sales-week-day.selected-end {
    border-color: rgba(37, 99, 235, 0.48);
}

.sales-week-day.selected-start,
.sales-week-day.selected-end,
.sales-period-day.start,
.sales-period-day.end {
    color: var(--ink);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.sales-week-day:disabled,
.sales-week-number:disabled {
    cursor: not-allowed;
    opacity: 0.34;
}

.field-errors,
.form-errors {
    color: #9f2c24;
    font-size: var(--font-size-sm);
}

.field-errors ul,
.form-errors ul {
    margin: 0;
    padding-left: 18px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}

.delete-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.delete-form-actions .danger-link {
    min-height: var(--control-height-md);
    padding-inline: var(--control-padding-md);
}

.danger-zone-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-color: rgba(159, 44, 36, 0.26);
    background: rgba(255, 250, 240, 0.66);
}

.danger-zone-card .delete-form-actions {
    margin-top: 0;
}

.form-actions-start {
    justify-content: flex-start;
}

.action-date-field {
    max-width: 420px;
    margin-bottom: 18px;
}

.editable-table .form-control {
    min-height: 38px;
}

.secondary-button {
    min-height: var(--control-height-md);
    padding: 0 var(--control-padding-md);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.46);
    color: var(--green-dark);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    max-width: 100%;
}

.button-row form {
    display: inline-flex;
    max-width: 100%;
}

.toolbar-actions-stack {
    display: grid;
    flex: 1 1 220px;
    gap: 12px;
    justify-items: end;
    min-width: 0;
    max-width: 100%;
}

.button-row .primary-button,
.button-row .secondary-button,
.button-row .danger-link {
    min-height: var(--control-height-md);
    padding-inline: var(--control-padding-md);
    font-weight: var(--font-weight-strong);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.detail-card {
    padding: 22px;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-card-sm);
    background: var(--surface-bg-soft);
}

.detail-card span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-weight: var(--font-weight-bold);
}

.detail-card strong {
    font-size: var(--font-size-lg);
}

.detail-card-wide {
    grid-column: 1 / -1;
}

.detail-card-note {
    display: block;
    color: var(--ink);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-body);
    white-space: normal;
}

.detail-card-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.detail-card-form .form-control {
    min-height: var(--control-height-sm);
}

.detail-card-form .table-link {
    border: 0;
}

.section-head {
    margin-bottom: 16px;
}

.compact-section-head {
    margin-bottom: 10px;
}

.card-inner-form {
    margin-bottom: 0;
}

.section-divider {
    margin: 26px 0 18px;
    border-top: 1px solid var(--line);
}

.section-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.quick-list {
    display: grid;
    gap: 10px;
}

.quick-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(224, 214, 197, 0.86);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.38);
    transition: 160ms ease;
}

.quick-row:hover {
    border-color: rgba(31, 111, 74, 0.36);
    background: rgba(31, 111, 74, 0.07);
}

.quick-row span {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.quick-row strong,
.quick-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-row small {
    color: var(--muted);
    font-size: var(--font-size-xs);
}

.quick-row em {
    color: var(--green-dark);
    font-style: normal;
    font-weight: var(--font-weight-strong);
    white-space: nowrap;
}

.empty-state.compact {
    padding: 18px;
}

.ai-stats-grid {
    margin-bottom: 0;
}

.ai-draft-list {
    display: grid;
    gap: 20px;
}

.ai-draft-card {
    overflow-x: visible;
}

.ai-draft-field {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.ai-draft-field label {
    color: var(--green-dark);
    font-weight: var(--font-weight-strong);
}

.ai-copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.ai-draft-body {
    min-height: 260px;
    line-height: 1.55;
}

.ai-draft-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.inline-status-form {
    display: grid;
    grid-template-columns: minmax(240px, 420px) auto;
    align-items: end;
    gap: 14px;
}

.inline-status-field {
    display: grid;
    gap: 8px;
}

.inline-status-field label {
    color: var(--green-dark);
    font-weight: var(--font-weight-strong);
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-grid,
    .module-grid,
    .detail-grid,
    .active-work-grid,
    .account-settings-grid,
    .export-section-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar-card-main {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar-card,
    .toolbar-card > div:first-child,
    .toolbar-actions-stack,
    .toolbar-actions-stack .button-row {
        align-items: flex-start;
        justify-items: start;
        justify-content: flex-start;
        width: 100%;
    }

    .toolbar-flow {
        justify-content: flex-start;
        flex-basis: auto;
        min-width: 0;
        width: 100%;
    }

    .toolbar-flow .timeline {
        justify-content: flex-start;
    }

    .sales-analysis-filter-grid {
        grid-template-columns: 1fr;
    }

    .sales-filter-actions {
        justify-content: flex-start;
        min-height: 0;
    }

    .shipment-picker-grid {
        grid-template-columns: 1fr;
    }

    .inventory-module-grid .module-card:nth-of-type(4) {
        grid-column-start: auto;
    }

    .table-card {
        overflow-x: auto;
    }
}

@media (max-width: 620px) {
    .main-panel {
        padding: 22px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .button-row .primary-button,
    .button-row .secondary-button,
    .button-row .danger-link {
        flex: 1 1 auto;
        min-width: min(100%, 150px);
        white-space: normal;
    }

    .topbar-right,
    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .topbar-actions .secondary-button {
        flex: 1 1 auto;
        min-width: min(100%, 150px);
        white-space: normal;
    }

    .ai-copy-row {
        grid-template-columns: 1fr;
    }

    .ai-draft-actions {
        justify-content: stretch;
    }

    .ai-draft-actions form {
        width: 100%;
    }

    .ai-draft-actions .secondary-button,
    .ai-copy-row .secondary-button {
        width: 100%;
    }

    .nav-list,
    .stats-grid,
    .module-grid,
    .detail-grid,
    .form-grid,
    .export-form-grid,
    .export-section-grid,
    .choice-grid ul,
    .choice-grid.compact ul,
    .active-work-grid,
    .account-settings-grid,
    .inline-status-form {
        grid-template-columns: 1fr;
    }

    .sales-entry-field-week_start_date,
    .sales-entry-field-warehouse,
    .sales-entry-field-notes {
        grid-column: 1;
        grid-row: auto;
    }

    .account-summary div {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .shipment-picker-panel {
        padding: 12px;
    }

    .shipment-order-list,
    .shipment-product-list {
        max-height: 300px;
    }

    .shipment-product-option {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .shipment-product-option em {
        grid-column: 2;
    }
}
