:root {
    color-scheme: light;
    --accent: #ff5a00;
    --accent-dark: #df4f00;
    --text: #111111;
    --muted: #636363;
    --line: #dedede;
    --panel: #ffffff;
    --page: #f4f5f6;
    --chip: #f1f3f5;
    --ok: #177245;
    --info: #235789;
    --checkbox-blue: #0a84ff;
    --danger: #b42318;
    --danger-soft: #fff3f0;
    --danger-line: #f0c6bf;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--page);
}

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

.nav-toggle {
    position: fixed;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 68px;
    background: var(--accent);
    color: #000000;
    box-shadow: 0 1px 0 rgb(0 0 0 / 12%);
}

.brand {
    min-width: 0;
    color: #000000;
    text-align: center;
    text-decoration: none;
    font-size: 31px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
}

.icon-link,
.profile-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    min-height: 58px;
    color: #000000;
    text-decoration: none;
}

.menu-button {
    cursor: pointer;
    font-size: 38px;
    font-weight: 700;
    line-height: 1;
}

.profile-button {
    justify-self: end;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
}

.notice-top-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-height: 58px;
    color: #000000;
    text-decoration: none;
}

.notice-top-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 2px solid #000000;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

.notice-top-count {
    position: absolute;
    top: 10px;
    right: 1px;
    min-width: 19px;
    height: 19px;
    border-radius: 10px;
    padding: 2px 5px;
    background: #ffffff;
    color: #000000;
    font-size: 12px;
    font-weight: 800;
    line-height: 15px;
    text-align: center;
}

.refresh-button {
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
}

.person-icon {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 38px;
}

.person-icon::before,
.person-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: #000000;
}

.person-icon::before {
    top: 1px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.person-icon::after {
    bottom: 1px;
    width: 35px;
    height: 13px;
    border-radius: 18px 18px 0 0;
}

.side-nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(84vw, 320px);
    padding: max(16px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
    box-shadow: 8px 0 22px rgb(0 0 0 / 18%);
    transform: translateX(-105%);
    transition: transform 160ms ease;
}

.side-nav-title {
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 15px;
}

.side-nav a,
.menu-logout {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    font: inherit;
    font-size: 19px;
}

.menu-logout {
    cursor: pointer;
}

.nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    background: rgb(0 0 0 / 30%);
}

.nav-toggle:checked ~ .side-nav {
    transform: translateX(0);
}

.nav-toggle:checked ~ .nav-backdrop {
    display: block;
}

body.nav-open {
    overflow: hidden;
}

.notice-banner {
    position: sticky;
    top: 68px;
    z-index: 25;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f0c6bf;
    padding: 9px 14px;
    background: #fff3f0;
    color: #4b1b16;
    font-size: 14px;
    line-height: 1.25;
}

.notice-banner-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.notice-banner-title,
.notice-banner-comment {
    min-width: 0;
    overflow-wrap: anywhere;
}

.notice-banner-comment {
    font-size: 13px;
    color: #6b332c;
}

.notice-banner a {
    min-height: 34px;
    border-radius: 7px;
    padding: 8px 12px;
    background: var(--accent);
    color: #000000;
    text-decoration: none;
    font-weight: 800;
    line-height: 18px;
    white-space: nowrap;
}

.page {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 16px 12px 92px;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.order-head {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 10px;
    margin-bottom: 12px;
}

.order-head h1 {
    min-width: 0;
}

.order-head-comment {
    grid-column: 2 / 4;
    min-width: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.order-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.order-icon-form {
    margin: 0;
}

.order-info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0;
    background: #ffffff;
    color: var(--text);
    font-size: 22px;
    font-weight: 800;
    font-style: italic;
    line-height: 1;
    text-decoration: none;
}

.order-edit-button {
    font-size: 24px;
    font-style: normal;
}

.order-danger-button {
    border-color: #f1c5bd;
    background: #fff7f5;
    color: #b42318;
    font-size: 26px;
    font-style: normal;
}

.order-info-button[aria-expanded="true"] {
    border-color: var(--accent);
    background: var(--accent);
}

.order-info-static {
    pointer-events: none;
}

.section-head h1,
.order-head h1,
.login-panel h1,
.profile-panel h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
}

.counter {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    box-sizing: border-box;
    padding-inline: 8px;
    border-radius: 7px;
    background: var(--accent);
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
}

.order-summary-badge {
    align-items: center;
    gap: 1px;
}

.order-summary-badge-count {
    line-height: 1;
}

.order-summary-badge-suffix {
    font-size: 0.8em;
    line-height: 1;
    transform: translateY(-0.34em);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
}

.tab-form {
    margin: 0;
}

.tab {
    display: inline-flex;
    flex: 0 0 auto;
    align-self: center;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding-block: 7px;
    padding-inline: 10px;
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}

.tab-button {
    cursor: pointer;
}

.tab.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
}

.order-filter-row {
    margin-left: auto;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: max-content;
    white-space: nowrap;
}

.order-filter-label {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    min-height: 44px;
    width: max-content;
    max-width: 100%;
}

.order-filter-text {
    flex: 0 0 auto;
    white-space: nowrap;
}

.order-filter-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    display: inline-block;
    position: relative;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    flex: 0 0 30px;
    border: 2px solid #9ca3af;
    border-radius: 6px;
    margin: 0;
    background: #ffffff;
    cursor: pointer;
}

.order-filter-label input[type="checkbox"]:checked {
    border-color: var(--accent);
    background: var(--accent);
}

.order-filter-label input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 3px;
    width: 9px;
    height: 16px;
    border: solid #ffffff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.order-grid {
    display: grid;
    gap: 8px;
}

.order-card,
.empty-state,
.login-panel,
.profile-panel,
.form-panel,
.order-summary,
.item-row,
.user-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
}

.order-card {
    display: grid;
    gap: 10px;
    min-height: 0;
    padding: 14px;
    color: var(--text);
    text-decoration: none;
}

.order-card.is-cancelled {
    border-color: var(--danger-line);
    background: var(--danger-soft);
}

.order-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.order-number {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
}

.order-progress {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    min-width: 56px;
    min-height: 36px;
    border-radius: 7px;
    padding: 7px 9px;
    background: var(--chip);
    color: var(--muted);
    line-height: 1;
}

.order-progress strong {
    color: var(--ok);
    font-size: 22px;
}

.order-progress span {
    font-size: 14px;
}

.stock-order-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 92px;
    min-height: 36px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 6px 9px;
    font-size: 25px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
    white-space: nowrap;
}

.stock-order-indicator.stock-ok {
    border-color: #b9dfc7;
    background: #ecf8f0;
    color: #167044;
}

.stock-order-indicator.stock-short {
    border-color: #f1b8b4;
    background: #fff1f0;
    color: #b42318;
}

.order-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.meta-pill {
    min-height: 26px;
    border: 1px solid #d7dee8;
    border-radius: 6px;
    padding: 5px 8px;
    background: #f5f8fb;
    color: var(--info);
    font-size: 13px;
    line-height: 1.1;
}

.status-pill {
    border-color: #d8e7dc;
    background: #f2f8f4;
    color: var(--ok);
}

.order-list-finance-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 7px;
    min-width: 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.order-list-finance-label,
.order-list-finance-bracket {
    flex: 0 0 auto;
    color: var(--muted);
}

.order-list-finance-details {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    min-width: 0;
    max-width: 100%;
}

.order-list-finance-separator {
    flex: 0 0 auto;
    margin-inline: 4px;
    color: var(--muted);
}

.order-list-finance-amount {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    font-weight: 800;
}

.order-items-approved-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    max-width: 100%;
    border-radius: 4px;
    padding-inline: 2px;
    color: inherit;
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.order-items-approved-link:hover {
    text-decoration-thickness: 2px;
}

.order-items-approved-link:focus-visible {
    outline: 3px solid var(--checkbox-blue);
    outline-offset: 2px;
    text-decoration-thickness: 2px;
}

.order-comment {
    display: -webkit-box;
    overflow: hidden;
    color: #252525;
    font-size: 18px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.empty-state,
.login-panel,
.profile-panel,
.form-panel {
    padding: 22px;
}

.manual-form-panel {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
    padding: 14px;
    max-width: 100%;
}

.manual-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.order-info-total-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.order-info-total-row span,
.order-info-total-row strong {
    min-width: 0;
}

.order-info-total-value {
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    text-align: right;
    overflow-wrap: anywhere;
}

.manual-form-grid label,
.photo-inputs label {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.manual-form-grid input,
.manual-form-grid select,
.manual-form-grid textarea,
.photo-inputs input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 9px 10px;
    background: #ffffff;
    color: var(--text);
    font-size: 16px;
    font-weight: 400;
}

.order-info-grid input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
}

.manual-form-grid textarea {
    min-height: 86px;
    resize: vertical;
}

.item-color-help {
    margin: 10px 0 0;
    color: var(--danger);
    font-size: 14px;
    font-weight: 700;
}

.sheet-consumption-panel {
    padding-bottom: 18px;
}

.sheet-consumption-list {
    display: grid;
    gap: 14px;
}

.sheet-consumption-block {
    display: grid;
    gap: 12px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 12px;
    background: #ffffff;
}

.sheet-consumption-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.sheet-consumption-grid label,
.sheet-quantity-field {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.sheet-consumption-grid select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 9px 10px;
    background: #ffffff;
    color: var(--text);
    font-size: 16px;
    font-weight: 400;
}

.sheet-quantity-field {
    display: grid;
    gap: 7px;
}

.sheet-quantity-stepper {
    display: grid;
    grid-template-columns: 1fr minmax(70px, 1fr) 1fr;
    align-items: stretch;
    width: min(100%, 480px);
    min-height: 62px;
    overflow: hidden;
    border-radius: 2px;
    background: var(--accent);
}

.sheet-quantity-stepper button,
.sheet-quantity-stepper input {
    min-width: 0;
    min-height: 62px;
    border: 0;
    border-radius: 0;
    background: var(--accent);
    color: #ffffff;
    text-align: center;
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
}

.sheet-quantity-stepper button {
    padding: 0;
}

.sheet-quantity-stepper input {
    width: 100%;
    padding: 0 6px;
    appearance: textfield;
    -moz-appearance: textfield;
}

.sheet-quantity-stepper input::-webkit-outer-spin-button,
.sheet-quantity-stepper input::-webkit-inner-spin-button {
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

.sheet-quantity-stepper button:active {
    background: var(--accent-dark);
    transform: none;
}

.sheet-add-button {
    width: 100%;
    margin-top: 14px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
}

.photo-inputs {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    max-width: 100%;
}

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

.empty-state {
    color: var(--muted);
    font-size: 18px;
}

.notice-panel,
.cancelled-alert {
    border: 1px solid var(--danger-line);
    border-radius: 8px;
    background: var(--danger-soft);
    color: var(--danger);
}

.notice-panel {
    display: grid;
    gap: 8px;
    margin: 0 0 12px;
    padding: 12px;
}

.notice-panel h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

.notice-list {
    display: grid;
    gap: 6px;
}

.notice-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    border-radius: 7px;
    padding: 8px;
    background: #ffffff;
    color: inherit;
    text-decoration: none;
}

.notice-row strong,
.notice-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.cancelled-alert {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
    padding: 12px;
}

.cancelled-alert strong {
    font-size: 18px;
    line-height: 1.2;
}

.cancelled-alert span {
    color: #682016;
    font-size: 15px;
    line-height: 1.35;
}

.stack {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

label {
    display: grid;
    gap: 8px;
    font-size: 16px;
}

.form-field {
    display: grid;
    gap: 8px;
    min-width: 0;
    font-size: 16px;
}

.stack input,
.stack select,
.stack textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #ffffff;
}

.stack textarea {
    min-height: 92px;
    resize: vertical;
}

.stack label {
    min-width: 0;
}

.stack input[type="file"] {
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 8px 12px;
}

.current-file-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    font-size: 15px;
}

.current-file-wrap a {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.current-file-clear {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.current-file-clear input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    display: inline-block;
    position: relative;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 2px solid #b8c0cc;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.current-file-clear input[type="checkbox"]:checked {
    border-color: var(--checkbox-blue);
    background: var(--checkbox-blue);
}

.current-file-clear input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 3px;
    width: 9px;
    height: 16px;
    border: solid #ffffff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.stack small {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.25;
}

.form-context-note {
    margin: 0;
    padding: 10px 12px;
    border-left: 3px solid var(--info);
    border-radius: 0 6px 6px 0;
    background: color-mix(in srgb, var(--info) 8%, transparent);
    color: var(--text);
    font-size: 14px;
    line-height: 1.35;
}

.form-context-note p {
    margin: 0;
}

.form-context-note p + p {
    margin-top: 4px;
}

.form-context-note span {
    color: var(--muted);
}

.errorlist {
    margin: 0;
    padding: 0;
    color: #b42318;
    list-style: none;
    font-size: 14px;
}

button {
    min-height: 48px;
    border: 0;
    border-radius: 6px;
    padding: 0 16px;
    background: var(--accent);
    color: #000000;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

button:active,
.tab:active,
.order-card:active {
    transform: translateY(1px);
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-height: 40px;
    color: #000000;
    text-decoration: none;
    font-size: 32px;
    line-height: 1;
}

.order-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
}

.order-summary[hidden] {
    display: none;
}

.order-summary div {
    display: grid;
    align-content: start;
    gap: 3px;
    min-height: 52px;
    border-radius: 7px;
    background: var(--chip);
    padding: 8px 10px;
}

.order-summary span {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-summary strong {
    min-width: 0;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.manual-items-list:not(:empty) {
    margin-bottom: 12px;
}

.order-items-total {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, auto);
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
    padding: 10px 12px;
}

.order-items-total-label,
.order-items-total-paid,
.order-items-total-value {
    min-width: 0;
    font-size: 18px;
    line-height: 1.2;
}

.order-items-total-label {
    grid-column: 1;
    font-weight: 700;
}

.order-items-total-paid {
    grid-column: 2;
    overflow-wrap: anywhere;
    text-align: center;
    font-weight: 700;
}

.order-items-total-value {
    grid-column: 3;
    overflow-wrap: anywhere;
    text-align: right;
}

.order-finance-block,
.finance-summary-panel {
    display: grid;
    gap: 10px;
    margin: 0 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: var(--panel);
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
}

.order-finance-grid,
.finance-summary-grid {
    display: grid;
    gap: 7px;
    margin: 0;
}

.order-finance-row,
.finance-summary-grid div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: baseline;
    min-width: 0;
}

.order-finance-row span,
.finance-summary-grid dt {
    min-width: 0;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.order-finance-row strong,
.finance-summary-grid dd {
    min-width: 0;
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    text-align: right;
    overflow-wrap: anywhere;
}

.order-finance-row-accent {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding-block: 9px;
}

.order-finance-row-accent span,
.order-finance-row-accent strong {
    color: var(--text);
}

.order-finance-actions {
    display: grid;
    gap: 8px;
}

.order-finance-history {
    display: grid;
    gap: 6px;
    min-width: 0;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.order-finance-history strong {
    color: var(--text);
    font-size: 14px;
}

.order-finance-history ol {
    display: grid;
    gap: 5px;
    margin: 0;
    padding-left: 18px;
}

.order-finance-history li {
    min-width: 0;
    overflow-wrap: anywhere;
}

.finance-adjustment-form {
    margin-top: 12px;
}

.finance-payment-form {
    margin-top: 12px;
}

.finance-payment-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
}

.finance-payment-form .manual-action-bar {
    position: static;
    margin: 12px 0 0;
    padding: 0;
    max-width: 100%;
    background: transparent;
}

.item-row {
    display: grid;
    grid-template-columns: 58px clamp(136px, 36vw, 152px) minmax(0, 1fr);
    align-items: stretch;
    min-height: 136px;
    overflow: hidden;
}

.manual-items-list .manual-item-row {
    grid-template-columns: 58px clamp(160px, 43vw, 220px) minmax(0, 1fr);
    min-height: 164px;
}

.item-row.is-done {
    border-color: #cfe4d5;
}

.item-row.is-saving {
    opacity: 0.76;
}

.item-state-cell {
    display: grid;
    grid-template-rows: auto 1fr;
    align-items: start;
    justify-items: center;
    border-right: 1px solid var(--line);
    background: #fafafa;
    padding: 14px 8px 12px;
}

.item-index {
    color: var(--muted);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.item-row.is-done .item-state-cell {
    background: #edf8f1;
}

.item-row.is-done .item-index {
    color: var(--ok);
}

.manual-item-row .item-state-cell {
    grid-template-rows: auto auto;
    align-content: center;
    gap: 8px;
}

.manual-item-row .item-thumb-cell {
    padding: 4px;
}

.item-admin-actions {
    display: grid;
    gap: 6px;
}

.item-admin-form {
    margin: 0;
}

.item-admin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0;
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
    font-size: 21px;
    font-weight: 700;
    line-height: 1;
}

.item-admin-danger {
    border-color: #f1c5bd;
    background: #fff7f5;
    color: #b42318;
    font-size: 24px;
}

.item-thumb-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: #ffffff;
}

.item-image-button {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    border: 0;
    border-radius: 7px;
    padding: 0;
    background: transparent;
    overflow: hidden;
}

.item-image-button:active {
    transform: none;
}

.item-thumb-cell img {
    display: block;
    width: 100%;
    height: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 7px;
    background: #f5f5f5;
    object-fit: cover;
}

.item-info {
    display: grid;
    grid-template-rows: repeat(4, minmax(0, 1fr));
    min-width: 0;
    border-left: 1px solid var(--line);
    padding: 0;
}

.manual-item-info {
    grid-template-rows: repeat(5, minmax(0, 1fr));
}

.item-info-line {
    display: flex;
    align-items: center;
    min-width: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
    color: #1c1c1c;
    font-size: 19px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.manual-item-info .item-info-line {
    padding: 6px 10px;
    font-size: 18px;
}

.manual-price-line {
    font-size: 16px;
    line-height: 1.05;
}

.item-size-line {
    gap: 4px;
    white-space: nowrap;
}

.length-warning-icon {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.stock-item-line {
    gap: 16px;
    white-space: nowrap;
}

.stock-item-indicator {
    flex: 0 0 auto;
    font-weight: 800;
    letter-spacing: 0;
}

.stock-item-indicator.stock-ok {
    color: #167044;
}

.stock-item-indicator.stock-short {
    color: #b42318;
}

.stock-item-required {
    color: #1c1c1c;
}

.item-info-line:last-child {
    border-bottom: 0;
}

.check-cell {
    display: flex;
    align-items: start;
    justify-content: center;
    width: 100%;
    margin-top: 22px;
}

.check-cell input {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.check-cell span {
    position: relative;
    display: block;
    width: 36px;
    height: 36px;
    border: 3px solid #777777;
    border-radius: 7px;
    background: #ffffff;
}

.check-cell input:checked + span {
    border-color: var(--accent);
    background: var(--accent);
}

.check-cell input:disabled + span {
    cursor: default;
    opacity: 0.72;
}

.check-cell input:checked:disabled + span {
    opacity: 1;
}

.check-cell input:checked + span::after {
    content: "";
    position: absolute;
    left: 10px;
    top: 3px;
    width: 9px;
    height: 18px;
    border: solid #ffffff;
    border-width: 0 4px 4px 0;
    transform: rotate(45deg);
}

.image-viewer-open {
    overflow: hidden;
}

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    background: #080808;
}

.image-viewer[hidden] {
    display: none;
}

.image-viewer-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    user-select: none;
}

.image-viewer-stage img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    transform-origin: center center;
    will-change: transform;
    touch-action: none;
    user-select: none;
}

.image-viewer-close {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    min-height: 46px;
    border: 1px solid rgb(255 255 255 / 26%);
    border-radius: 50%;
    padding: 0;
    background: rgb(0 0 0 / 62%);
    color: #ffffff;
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
}

.action-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: grid;
    gap: 8px;
    margin: 16px -12px -92px;
    padding: 12px 12px max(18px, env(safe-area-inset-bottom));
    background: linear-gradient(rgb(244 245 246 / 0%), var(--page) 28%);
    max-width: calc(100% + 24px);
}

.action-form {
    margin: 0;
}

.action-bar button {
    width: 100%;
    max-width: 100%;
    min-height: 58px;
    background: var(--accent);
    font-size: 20px;
}

.action-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 58px;
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    background: var(--accent);
    color: var(--text);
    text-align: center;
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
}

.manual-action-bar {
    margin-bottom: -14px;
}

.draft-status {
    min-height: 18px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.draft-status[data-state="saved"] {
    color: #167044;
}

.draft-status[data-state="error"] {
    color: #b42318;
}

.action-note {
    margin-top: 12px;
    border: 1px solid #d7dee8;
    border-radius: 7px;
    padding: 10px 12px;
    background: #f5f8fb;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
}

.profile-panel {
    display: grid;
    gap: 20px;
}

.profile-notifications {
    display: grid;
    gap: 10px;
}

.profile-settings,
.profile-settings form {
    display: grid;
    gap: 10px;
}

.profile-settings h2,
.profile-notifications h2 {
    margin: 0;
    font-size: 19px;
    line-height: 1.2;
}

.profile-settings label {
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
}

.profile-settings select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 12px;
    background: #ffffff;
    color: var(--text);
}

.field-errors {
    display: grid;
    gap: 4px;
    color: #b42318;
    font-size: 14px;
}

.profile-notifications p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.35;
}

.period-control {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
    overflow: hidden;
}

.period-control form {
    margin: 0;
}

.period-control select {
    width: 100%;
    min-height: 44px;
    border: 0;
    padding: 0 12px;
    background: #ffffff;
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stats-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    background: #f8f8f8;
}

.stats-grid strong,
.stats-grid span {
    display: block;
}

.stats-grid strong {
    font-size: 34px;
    line-height: 1;
}

.stats-grid span {
    margin-top: 8px;
    color: var(--muted);
    font-size: 15px;
}

.wide-button {
    width: 100%;
}

.secondary-button {
    border-color: #d7dee8;
    background: #f5f8fb;
    color: var(--info);
}

.small-action {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border-radius: 7px;
    padding: 7px 12px;
    background: var(--accent);
    color: #000000;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.message {
    border: 1px solid #d8e7dc;
    border-radius: 7px;
    padding: 10px 12px;
    background: #f2f8f4;
    color: var(--ok);
}

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

.stock-dashboard {
    display: grid;
    gap: 8px;
}

.stock-dashboard-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
}

.stock-dashboard-link strong {
    min-width: 0;
    font-size: 20px;
    line-height: 1.15;
}

.stock-dashboard-link span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 34px;
    border-radius: 7px;
    background: var(--chip);
    color: var(--muted);
    font-weight: 700;
}

.stock-tabs {
    margin-bottom: 12px;
}

.stock-filter-panel {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: var(--panel);
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
}

.stock-filter-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}

.stock-filter-form label {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stock-filter-form select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 9px;
    background: #ffffff;
    color: var(--text);
}

.stock-filter-form input[type="text"],
.stock-filter-form input[type="number"],
.stock-filter-form input[type="date"],
.stock-filter-form input[type="datetime-local"] {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 9px;
    background: #ffffff;
    color: var(--text);
}

.stock-filter-form button,
.stock-reset-link {
    min-height: 42px;
}

.stock-check-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}

.stock-check-field input {
    width: 20px;
    min-height: 20px;
}

.stock-reset-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.movement-filter-panel summary {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 12px;
    background: #ffffff;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    line-height: 1.1;
    list-style: none;
}

.movement-filter-panel summary::-webkit-details-marker {
    display: none;
}

.movement-filter-panel[open] summary {
    margin-bottom: 12px;
    border-color: var(--accent);
    background: var(--accent);
}

.movement-filter-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.stock-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 72px;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: var(--panel);
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
}

.stock-row.is-inactive {
    opacity: 0.68;
}

.stock-row-main {
    display: grid;
    gap: 4px;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
}

.stock-row-main:first-child {
    grid-column: 1 / 3;
}

.stock-row-main strong,
.stock-row-main span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-row-main strong {
    font-size: 18px;
    line-height: 1.2;
}

.stock-row-main span {
    color: var(--muted);
    font-size: 14px;
}

.stock-swatch-link {
    display: inline-flex;
    width: 48px;
    min-height: 48px;
    color: inherit;
    text-decoration: none;
}

.stock-swatch {
    display: block;
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f5f5f5;
}

.stock-swatch-tile {
    background-position: center;
    background-repeat: repeat;
    background-size: auto;
}

.stock-swatch-placeholder {
    background:
        linear-gradient(135deg, transparent 48%, #d9d9d9 49%, #d9d9d9 51%, transparent 52%),
        #f5f5f5;
}

.stock-materials-note {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-left: 3px solid var(--info);
    background: color-mix(in srgb, var(--info) 8%, transparent);
    font-size: 14px;
    color: var(--text);
}

.stock-row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.stock-row-actions form {
    margin: 0;
}

.stock-disable-button {
    min-height: 34px;
    border: 1px solid #f1c5bd;
    border-radius: 7px;
    padding: 6px 9px;
    background: #fff7f5;
    color: var(--danger);
    font-size: 13px;
}

.stock-delete-link {
    min-height: 34px;
    border: 1px solid #f1c5bd;
    border-radius: 7px;
    padding: 7px 9px;
    background: #fff7f5;
    color: var(--danger);
    font-size: 13px;
    text-decoration: none;
}

.danger-button {
    background: var(--danger);
}

.usage-list {
    margin: 0;
    padding-left: 20px;
}

.stock-badge {
    min-height: 28px;
    border-radius: 6px;
    padding: 6px 8px;
    background: var(--chip);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.2;
}

.sheet-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: start;
}

.sheet-row .stock-row-main:first-child {
    grid-column: auto;
}

.sheet-row-quantity {
    display: grid;
    justify-items: end;
    min-width: 78px;
}

.sheet-row-quantity strong {
    font-size: 24px;
    line-height: 1;
}

.sheet-row-quantity span,
.sheet-row-prices span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.2;
}

.sheet-row-prices {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    min-width: 0;
}

.product-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

.product-row-main {
    overflow: hidden;
}

.product-row-quantity {
    min-width: 64px;
    max-width: 35vw;
    overflow: hidden;
    text-align: right;
}

.product-row-quantity strong,
.product-row-quantity span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-row .stock-row-main:first-child,
.product-search-row .stock-row-main:first-child {
    grid-column: auto;
}

.product-row-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    min-width: 0;
}

.product-row-meta span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.2;
}

.product-row .stock-row-actions {
    grid-column: 1 / -1;
}

.product-search-row {
    grid-template-columns: minmax(0, 1fr) auto;
    color: var(--text);
    text-decoration: none;
}

.sheet-balance-panel {
    display: grid;
    justify-items: center;
    gap: 4px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px 12px;
    background: var(--panel);
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
}

.sheet-balance-panel.is-inactive {
    opacity: 0.68;
}

.sheet-balance-panel span,
.sheet-balance-panel small {
    min-width: 0;
    color: var(--muted);
    text-align: center;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.sheet-balance-panel span {
    font-size: 15px;
    font-weight: 700;
}

.sheet-balance-panel strong {
    font-size: 44px;
    line-height: 1;
}

.sheet-balance-panel.compact strong {
    font-size: 36px;
}

.sheet-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.sheet-detail-grid div {
    display: grid;
    align-content: start;
    gap: 4px;
    min-height: 58px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: var(--panel);
}

.sheet-detail-grid span {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sheet-detail-grid strong {
    min-width: 0;
    font-size: 15px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.stock-detail-disable-form {
    margin: 0 0 14px;
}

.stock-detail-actions {
    display: grid;
    gap: 8px;
    margin: 0 0 14px;
}

.stock-detail-actions form {
    margin: 0;
}

.stock-detail-actions button {
    width: 100%;
}

.stock-detail-disable-form .stock-disable-button {
    width: 100%;
}

.stock-subhead {
    margin-top: 14px;
}

.stock-subhead h1 {
    font-size: 22px;
}

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

.movement-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: var(--panel);
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
}

.movement-row-head {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.movement-row-head strong,
.movement-row-head span,
.movement-row-note span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.movement-row-head strong {
    font-size: 17px;
}

.movement-row-head span,
.movement-row-note {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.3;
}

.movement-row-numbers {
    display: grid;
    justify-items: end;
    gap: 3px;
    white-space: nowrap;
}

.movement-row-numbers span {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.movement-row-numbers small {
    color: var(--muted);
    font-size: 13px;
}

.movement-row-note {
    grid-column: 1 / -1;
    display: grid;
    gap: 3px;
}

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

.movement-card {
    display: grid;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: var(--panel);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 1px 3px rgb(0 0 0 / 7%);
}

.movement-card:hover,
.movement-card:focus,
.movement-card:visited {
    color: inherit;
    text-decoration: none;
}

.movement-card:active {
    transform: translateY(1px);
}

.movement-card-top,
.movement-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.movement-type-badge {
    min-width: 0;
    border-radius: 6px;
    padding: 5px 8px;
    background: #f5f8fb;
    color: var(--info);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.movement-card time {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
}

.movement-card-title {
    min-width: 0;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.movement-card-subtitle {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.movement-card-balance,
.movement-card-numbers {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.movement-card-delta {
    flex: 0 0 auto;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.movement-card-balance small,
.movement-card-numbers small {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.movement-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    min-width: 0;
}

.movement-card-meta span {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.movement-detail-grid a {
    color: inherit;
}

.movement-card-delta.is-positive,
.is-positive {
    color: var(--ok);
}

.movement-card-delta.is-negative,
.is-negative {
    color: var(--danger);
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 72px;
    padding: 14px;
}

.user-row strong,
.user-row span {
    display: block;
}

.user-row strong {
    font-size: 18px;
}

.user-row span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.user-flags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.user-flags span {
    min-height: 26px;
    border-radius: 6px;
    padding: 5px 8px;
    background: var(--chip);
    color: var(--text);
    font-size: 13px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.pagination span:not(.disabled) {
    min-width: 96px;
    color: var(--muted);
    font-weight: 400;
}

.pagination .disabled {
    color: #b3b3b3;
}

@media (min-width: 680px) {
    .order-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .manual-form-grid,
    .order-info-grid,
    .sheet-consumption-grid {
        grid-template-columns: 1fr;
    }

    .manual-form-grid input,
    .manual-form-grid select,
    .manual-form-grid textarea,
    .photo-inputs input,
    .sheet-consumption-grid select,
    .sheet-quantity-stepper input {
        font-size: 16px;
    }

    .manual-form-panel,
    .manual-form-grid,
    .manual-form-grid label,
    .photo-inputs,
    .photo-inputs label,
    .sheet-consumption-block,
    .sheet-consumption-grid,
    .sheet-consumption-grid label,
    .sheet-quantity-field,
    .sheet-quantity-stepper {
        max-width: 100%;
        min-width: 0;
    }

    .manual-action-bar {
        max-width: calc(100% + 24px);
    }
}

@media (max-width: 420px) {
    .brand {
        font-size: 28px;
    }

    .page {
        padding-inline: 10px;
    }

    .order-card {
        padding: 13px;
    }

    .order-number {
        font-size: 34px;
    }

    .stock-order-indicator {
        min-width: 82px;
        min-height: 34px;
        padding-inline: 7px;
        font-size: 22px;
    }

    .item-row {
        grid-template-columns: 54px clamp(126px, 35vw, 142px) minmax(0, 1fr);
        min-height: 128px;
    }

    .manual-items-list .manual-item-row {
        grid-template-columns: 54px clamp(148px, 43vw, 166px) minmax(0, 1fr);
        min-height: 154px;
    }

    .item-state-cell {
        padding: 13px 7px 10px;
    }

    .item-thumb-cell {
        padding: 7px;
    }

    .item-info-line {
        padding: 7px 10px;
        font-size: 18px;
    }

    .manual-item-info .item-info-line {
        padding: 5px 9px;
        font-size: 17px;
    }

    .manual-price-line {
        font-size: 15px;
    }

    .order-items-total {
        gap: 8px;
        padding-inline: 10px;
    }

    .order-items-total-label,
    .order-items-total-paid,
    .order-items-total-value {
        font-size: 16px;
    }

    .order-finance-row strong,
    .finance-summary-grid dd {
        font-size: 17px;
    }

    .profile-button,
    .icon-link {
        width: 54px;
    }

    .action-bar {
        margin-inline: -10px;
        padding-inline: 10px;
    }

    .manual-form-panel {
        padding: 12px;
    }

    .sheet-consumption-grid {
        grid-template-columns: 1fr;
    }

    .sheet-quantity-stepper {
        width: 100%;
    }

    .manual-action-bar {
        margin-bottom: -12px;
    }

    .order-info-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-height: 650px) {
    .action-bar {
        position: static;
        margin: 16px 0 0;
        padding: 0;
        background: transparent;
    }
}

@media (max-width: 360px) {
    .topbar {
        grid-template-columns: 58px minmax(0, 1fr) auto;
    }

    .brand {
        font-size: 25px;
    }

    .tab {
        font-size: 13px;
        padding-inline: 8px;
    }

    .section-head h1,
    .order-head h1,
    .login-panel h1,
    .profile-panel h1 {
        font-size: 25px;
    }

    .order-summary {
        grid-template-columns: 1fr;
    }

    .order-items-total {
        grid-template-columns: auto minmax(0, 1fr) minmax(0, auto);
        gap: 6px;
    }

    .order-items-total-label,
    .order-items-total-paid,
    .order-items-total-value {
        font-size: 15px;
    }

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

    .sheet-consumption-grid {
        grid-template-columns: 1fr;
    }

    .stock-filter-form,
    .sheet-detail-grid {
        grid-template-columns: 1fr;
    }

    .item-row {
        grid-template-columns: 50px 124px minmax(0, 1fr);
    }

    .manual-items-list .manual-item-row {
        grid-template-columns: 50px 142px minmax(0, 1fr);
        min-height: 148px;
    }

    .item-info-line {
        padding-inline: 9px;
        font-size: 17px;
    }

    .manual-item-info .item-info-line {
        padding-inline: 8px;
        font-size: 16px;
    }

    .stock-order-indicator {
        min-width: 76px;
        font-size: 20px;
    }

    .stock-item-line {
        gap: 10px;
    }

    .manual-price-line {
        font-size: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stock-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .stock-row-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .stock-row-actions form,
    .stock-disable-button {
        width: 100%;
    }

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

    .sheet-row-prices {
        grid-column: 1 / -1;
    }

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

    .movement-row-numbers {
        justify-items: start;
    }

    .movement-card-top,
    .movement-card-head,
    .movement-card-balance,
    .movement-card-numbers {
        display: grid;
        justify-content: stretch;
    }

    .movement-card time {
        white-space: normal;
    }
}

/* Cashflow Summary */
.cashflow-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.cashflow-summary-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 16px;
    gap: 8px;
}

.cashflow-summary-label {
    font-size: 13px;
    color: var(--muted);
}

.cashflow-summary-value {
    font-size: 18px;
    font-weight: 800;
}

.cashflow-breakdown-table {
    margin-bottom: 24px;
}

.cashflow-breakdown-table h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.cashflow-breakdown-table table {
    width: 100%;
    border-collapse: collapse;
}

.cashflow-breakdown-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.cashflow-breakdown-table tr:last-child td {
    border-bottom: none;
}
