.form-field {
    display: grid;
    gap: 6px;
}

.form-field span {
    font-size: 14px;
    font-weight: 600;
}

.form-field input {
    width: 100%;
    min-height: var(--control-height);
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    font: inherit;
}

.toolbar {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: var(--grid-gap);
    max-width: 100%;
    margin-bottom: var(--grid-gap);
}

.crud-form {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: var(--grid-gap);
    max-width: 100%;
    margin-bottom: var(--section-gap);
    padding: var(--card-padding-compact);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.receive-secondary-workflow {
    display: grid;
    flex: 1 0 100%;
    gap: var(--grid-gap);
    min-width: 0;
    margin-top: 2px;
    padding-top: var(--grid-gap);
    border-top: 1px solid var(--border);
}

.receive-secondary-workflow__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--grid-gap);
    min-width: 0;
}

.receive-secondary-workflow__copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.receive-secondary-workflow__title {
    color: var(--text);
    font-size: 14px;
    line-height: 1.3;
}

.receive-secondary-workflow__help {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.receive-secondary-workflow__header .button {
    flex: 0 0 auto;
}

.receive-new-product {
    display: flex;
    align-items: end;
    flex: 1 0 100%;
    flex-wrap: wrap;
    gap: var(--grid-gap);
    margin-top: 2px;
    padding-top: var(--grid-gap);
    border-top: 1px solid var(--border);
}

.receive-new-product[hidden] {
    display: none;
}

.receive-total {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--control-height);
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--bg);
    color: var(--text);
}

.receive-total span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.receive-total strong {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.crud-status {
    min-height: 20px;
    color: var(--muted);
    font-size: 14px;
}

.status-message {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.status-message__text {
    min-width: 0;
}

.status-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 1px solid currentColor;
    border-radius: 999px;
    color: var(--info);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
}

.field-error .status-help {
    color: var(--danger);
}

.status-help:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.status-tooltip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 20;
    display: none;
    width: min(360px, calc(100vw - 32px));
    max-width: max-content;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--text);
    color: var(--panel);
    box-shadow: var(--shadow-hover);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    text-transform: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

.status-tooltip::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 100%;
    border: 6px solid transparent;
    border-top-color: var(--text);
}

.status-tooltip__item {
    display: block;
}

.status-tooltip__item + .status-tooltip__item {
    margin-top: 6px;
}

.status-help:hover .status-tooltip,
.status-help:focus .status-tooltip,
.status-help:focus-within .status-tooltip {
    display: block;
    transform-origin: bottom right;
    animation: motion-dropdown-in var(--motion-base) var(--motion-ease) both;
}

.toast-region {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1200;
    display: grid;
    gap: 10px;
    width: min(420px, calc(100vw - 36px));
    pointer-events: none;
}

.toast-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    border-radius: var(--radius-card);
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow-hover);
    overflow-wrap: anywhere;
    pointer-events: auto;
    animation: motion-dropdown-in var(--motion-base) var(--motion-ease) both;
}

.toast-message--error {
    border-left-color: var(--danger);
}

.toast-message--success {
    border-left-color: var(--success);
}

.toast-message__content {
    flex: 1 1 auto;
    min-width: 0;
}

.toast-message__text {
    margin: 0;
    font-weight: 650;
    line-height: 1.4;
}

.toast-message__details {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
}

.toast-message__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    margin: -5px -6px 0 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-button);
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.toast-message__close:hover,
.toast-message__close:focus-visible {
    background: var(--bg);
    color: var(--text);
}

.toast-message--leaving {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--motion-fast) ease, transform var(--motion-fast) ease;
    pointer-events: none;
}

.search-field {
    display: grid;
    gap: 6px;
    flex: 1 1 240px;
    min-width: min(100%, 260px);
}

.write-off-page .search-field[hidden] {
    display: none;
}

.search-field-small {
    flex-basis: 150px;
    min-width: 150px;
}

.search-field span,
.checkbox-field span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.search-field input,
.search-field select,
.search-field textarea {
    width: 100%;
    min-width: 0;
    min-height: var(--control-height);
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--panel);
    font: inherit;
}

.search-field textarea {
    resize: vertical;
}

.field-help {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.workflow-hint {
    display: grid;
    gap: 10px;
    margin-bottom: var(--section-gap);
    padding: var(--card-padding-compact);
    border: 1px solid var(--border);
    border-left: 4px solid var(--module-border, var(--info));
    border-radius: var(--radius-input);
    background: var(--bg);
}

[data-accounting-retry][hidden] {
    display: none;
}

.workflow-hint__title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
}

.workflow-hint__title .lucide-icon {
    width: 18px;
    height: 18px;
    color: var(--module-text, var(--info));
}

.workflow-hint__steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.workflow-hint__steps li {
    min-width: min(100%, 190px);
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--panel);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.workflow-hint__note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.search-field select.is-invalid,
.search-field input.is-invalid,
.search-field textarea.is-invalid,
.write-off-page .data-table input.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.employees-note-field {
    flex-basis: 320px;
}

.employee-warehouse-picker {
    display: grid;
    gap: 8px;
    flex: 1 1 280px;
    min-width: min(100%, 280px);
    margin: 0;
    padding: 0;
    border: 0;
}

.employee-warehouse-picker[hidden] {
    display: none;
}

.employee-warehouse-picker legend {
    padding: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.employee-warehouse-picker__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    min-height: var(--control-height);
    max-height: 132px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--panel);
}

.employee-warehouse-picker__option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
}

.employee-warehouse-picker__option span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-warehouse-picker__option:has(input:checked) {
    border-color: var(--page-module-border, var(--accent));
    background: var(--page-module-bg, #ECFDF5);
    color: var(--page-module-text, var(--accent-strong));
}

.employee-warehouse-picker__option input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
}

.employee-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: var(--section-gap);
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.employee-tabs__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 14px;
    border-radius: 9px;
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}

.employee-tabs__item:hover,
.employee-tabs__item:focus,
.employee-tabs__item.is-active {
    background: var(--page-module-bg, var(--bg));
    color: var(--page-module-text, var(--accent-strong));
}

.employee-tabs__item.is-active {
    box-shadow: inset 0 0 0 1px var(--page-module-border, var(--border));
}

[data-employees-panel][hidden],
[data-schedule-swap-field][hidden],
[data-schedule-warehouse-field][hidden],
.schedule-legend[hidden] {
    display: none;
}

.employee-schedule-toolbar {
    align-items: end;
}

.employee-schedule-toolbar .crud-status {
    flex-basis: 100%;
    overflow-wrap: anywhere;
}

.employee-schedule-toolbar > .field-help {
    flex-basis: 100%;
    margin: 0;
}

.schedule-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-bottom: var(--section-gap);
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--panel);
}

.schedule-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 24px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.schedule-legend__swatch {
    width: 22px;
    height: 18px;
    border: 1px solid rgba(15, 23, 42, 0.24);
    border-radius: 4px;
}

.schedule-legend__swatch-button {
    appearance: none;
    padding: 0;
    cursor: pointer;
}

.schedule-legend__swatch-button:hover,
.schedule-legend__swatch-button:focus {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

.sales-confirm-dialog.schedule-color-dialog {
    width: min(520px, calc(100% - 32px));
}

.schedule-color-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, minmax(72px, 84px));
    gap: 10px;
    align-items: end;
}

.schedule-color-grid .search-field,
.schedule-color-grid .search-field-small {
    width: auto;
    min-width: 0;
}

.schedule-color-grid .search-field input {
    width: 100%;
    min-width: 0;
}

.schedule-color-grid input[type="color"] {
    height: var(--control-height);
    padding: 3px;
}

.schedule-color-preview {
    min-height: 54px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: #C9C9C9;
}

.schedule-color-dialog .crud-status {
    margin: 0;
}

.schedule-board {
    display: grid;
    gap: var(--section-gap);
}

.schedule-month {
    min-width: 0;
}

.schedule-month__title {
    margin: 0 0 10px;
    font-size: 18px;
    line-height: 1.2;
}

.schedule-table-wrap {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.schedule-table {
    min-width: 1180px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 12px;
}

.schedule-table th,
.schedule-table td {
    width: 34px;
    height: 26px;
    padding: 0;
    border-right: 1px solid #9CA3AF;
    border-bottom: 1px solid #9CA3AF;
    background: var(--panel);
    text-align: center;
    vertical-align: middle;
}

.schedule-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #D9D9D9;
    color: #111827;
    font-weight: 700;
}

.schedule-table thead tr:nth-child(2) th {
    top: 26px;
    font-weight: 600;
}

.schedule-table thead th.is-weekend {
    color: #374151;
}

.schedule-table thead th.is-today,
.schedule-table td.is-today {
    box-shadow: inset 0 0 0 2px var(--accent);
}

.schedule-table__sticky {
    position: sticky;
    left: 0;
    z-index: 5;
    width: 116px;
    min-width: 116px;
    max-width: 116px;
    border-left: 1px solid #9CA3AF;
}

.schedule-table thead .schedule-table__sticky {
    z-index: 7;
}

.schedule-table__month,
.schedule-table__weekday-heading,
.schedule-table__employee {
    background: #CFCFCF;
}

.schedule-table__employee {
    padding: 0 8px;
    color: #111827;
    font-weight: 700;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schedule-table tr.is-inactive .schedule-table__employee,
.schedule-table tr.is-inactive .schedule-cell-button {
    color: #6B7280;
}

.schedule-cell-button {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 26px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #111827;
    font: inherit;
    font-weight: 800;
    line-height: 26px;
    cursor: pointer;
}

.schedule-cell-button:hover,
.schedule-cell-button:focus {
    outline: 2px solid var(--text);
    outline-offset: -2px;
}

.schedule-cell-button.is-filled {
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.34);
}

.schedule-coverage {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
}

.schedule-coverage__ok,
.schedule-coverage__item {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-badge);
    background: var(--panel);
    font-size: 13px;
    font-weight: 700;
}

.schedule-coverage__ok {
    border-color: #86EFAC;
    color: #166534;
}

.schedule-coverage__item {
    border-color: #FDBA74;
    color: #9A3412;
}

.work-schedule-page {
    min-width: 0;
}

.work-schedule-panel {
    display: grid;
    gap: var(--section-gap);
}

.work-schedule-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: var(--grid-gap);
}

.work-schedule-header h2,
.empty-state-block h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

.work-schedule-header p,
.empty-state-block p {
    margin: 6px 0 0;
    color: var(--muted);
}

.work-schedule-page .schedule-legend {
    margin-bottom: 0;
}

.work-schedule-page .schedule-cell-display {
    cursor: default;
}

.work-schedule-page .schedule-cell-display:hover,
.work-schedule-page .schedule-cell-display:focus {
    outline: none;
}

.empty-state-block {
    display: grid;
    gap: 6px;
    padding: var(--card-padding-compact);
    border: 1px dashed var(--border);
    border-radius: var(--radius-card);
    background: var(--bg);
}

.forbidden-page .empty-state-block {
    max-width: 720px;
}

.notification-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--panel);
}

.notification-item--unread {
    border-color: #93C5FD;
    background: #EFF6FF;
}

.notification-item div {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.notification-item span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: var(--radius-badge);
    background: var(--danger);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.notification-badge[hidden] {
    display: none;
}

.buyer-search-field {
    flex-basis: 320px;
    min-width: min(100%, 320px);
}

.buyer-picker {
    position: relative;
    display: grid;
    gap: 6px;
    min-width: 0;
}

.buyer-picker__input--selected {
    border-color: var(--accent);
}

.buyer-picker__selection {
    min-height: 18px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.buyer-picker__results[hidden] {
    display: none;
}

.buyer-picker__results {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    display: grid;
    gap: 2px;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-hover);
    transform-origin: top center;
}

.buyer-picker__option {
    display: grid;
    gap: 3px;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.buyer-picker__option:hover,
.buyer-picker__option:focus,
.buyer-picker__option.is-active {
    background: var(--bg);
    color: var(--accent-strong);
    outline: none;
}

.buyer-picker__option-main,
.buyer-picker__option-meta {
    min-width: 0;
    overflow-wrap: anywhere;
}

.buyer-picker__option-main {
    font-weight: 600;
}

.buyer-picker__option-meta,
.buyer-picker__empty {
    color: var(--muted);
    font-size: 13px;
}

.buyer-picker__empty {
    padding: 8px 10px;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: var(--control-height);
}

.warehouse-filter {
    display: grid;
    flex: 1 1 360px;
    gap: 6px;
    min-width: min(100%, 360px);
    margin: 0;
    padding: 0;
    border: 0;
}

.warehouse-filter legend {
    padding: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.warehouse-filter__options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 6px 12px;
    max-height: 150px;
    min-height: var(--control-height);
    overflow: auto;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--panel);
}

.warehouse-filter .checkbox-field {
    min-height: 26px;
}

.warehouse-filter input {
    flex: 0 0 auto;
}

.field-error {
    color: var(--danger);
}

.flash-message {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--success);
    border-radius: var(--radius-input);
    background: var(--panel);
    color: var(--accent-strong);
}

.auth-page {
    min-height: 100vh;
    background-color: #0F172A;
    background-image: url("../img/login-background.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: var(--page-padding-compact);
}

.auth-panel {
    width: min(100%, 390px);
    padding: var(--card-padding);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: var(--radius-card);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
}

.auth-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
    color: var(--accent-strong);
    font-size: 22px;
    font-weight: 700;
}

.auth-brand__logo {
    display: block;
    width: min(100%, 214px);
    max-height: 118px;
    object-fit: contain;
}

.auth-panel h1 {
    margin: 0 0 18px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
}

.auth-form {
    display: grid;
    gap: var(--grid-gap);
}

.definition-list {
    display: grid;
    gap: var(--grid-gap);
    margin: 0;
}

.definition-list div {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: var(--grid-gap);
}

.definition-list dt {
    color: var(--muted);
    font-weight: 600;
}

.definition-list dd {
    margin: 0;
}

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.table-pagination__status {
    margin-right: auto;
}
