:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #17202a;
    background: #f5f6f8;
    line-height: 1.5;
}

* { box-sizing: border-box; }

body { margin: 0; }

a { color: #2457c5; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 40px 0 64px;
}

.container.narrow { width: min(820px, calc(100% - 32px)); }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 40px); }
h2 { font-size: 20px; }

.eyebrow {
    margin-bottom: 4px;
    color: #68707c;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.back-link { display: inline-block; margin-bottom: 8px; }

.card {
    background: white;
    border: 1px solid #e3e6eb;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 3px 14px rgb(20 30 50 / 4%);
}

.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    border-bottom: 1px solid #eceef2;
    text-align: left;
    white-space: nowrap;
}

th {
    background: #fafbfc;
    color: #626b78;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

tbody tr:last-child td { border-bottom: 0; }
.numeric { text-align: right; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.button:hover { text-decoration: none; }
.button.primary { color: white; background: #2457c5; }
.button.secondary { color: #26313f; background: #eef0f3; }
.button:disabled { opacity: .5; cursor: not-allowed; }

.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef0f3;
    font-size: 12px;
    font-weight: 700;
}

.badge.accent { background: #e9efff; color: #244fa9; }
.badge.warning { background: #fff4d6; color: #755600; }
.badge.large { padding: 7px 12px; }

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.details {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 16px;
    margin: 0;
}
.details dt { color: #6b7480; }
.details dd { margin: 0; font-weight: 550; }

.money { font-size: 34px; font-weight: 750; margin-bottom: 8px; }
.muted, .hint { color: #727b87; }

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 9px;
}
.notice.success { background: #eaf8ef; color: #216139; }
.notice.warning { background: #fff5da; color: #6e5400; }
.notice.error { background: #fdecec; color: #8c2828; }
.notice p:last-child { margin-bottom: 0; }

.form { padding: 26px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}
.form label { display: flex; flex-direction: column; gap: 7px; font-weight: 600; }
.form label.full-width { grid-column: 1 / -1; }

input, select, textarea {
    width: 100%;
    border: 1px solid #cfd4dc;
    border-radius: 8px;
    padding: 10px 11px;
    background: white;
    color: inherit;
    font: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid #bdd0ff;
    border-color: #5d83df;
}

textarea { resize: vertical; }
.hint { font-size: 12px; font-weight: 400; }
.field-error { color: #a83232; font-size: 12px; font-weight: 500; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid #eceef2;
}

.table-card-actions {
    margin-top: 0;
    padding: 18px 20px 20px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 0;
}

.section-heading h2,
.section-heading h3 {
    margin-bottom: 0;
}

.card:not(.table-card) > .section-heading {
    padding: 0;
    margin-bottom: 18px;
}

.embedded-form {
    padding: 0;
    margin-top: 18px;
}

.subsection-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.subsection-heading .hint {
    text-align: right;
}


.nested-card {
    margin-top: 18px;
    background: #fafbfc;
    box-shadow: none;
}

.nested-card > .section-heading {
    padding: 0;
    margin-bottom: 16px;
}

.nested-card > .form {
    padding: 0;
}

.nested-card > .notice:last-child {
    margin-bottom: 0;
}

@media (max-width: 720px) {
    .container { padding-top: 24px; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .two-columns, .form-grid { grid-template-columns: 1fr; }
    .form label.full-width { grid-column: auto; }
    .details { grid-template-columns: 1fr; gap: 2px; }
    .details dd { margin-bottom: 10px; }
    .subsection-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
    .subsection-heading .hint { text-align: left; }
}

.admin-nav {
    background: #ffffff;
    border-bottom: 1px solid #e3e6eb;
}

.admin-nav-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 58px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.brand {
    margin-right: 28px;
    flex: 0 0 auto;
    white-space: nowrap;
    color: #17202a;
    font-weight: 800;
    letter-spacing: -.02em;
}

.brand:hover { text-decoration: none; }

.nav-links {
    flex: 0 1 auto;
    min-width: 0;
    overflow-x: auto;
    display: flex;
    align-items: stretch;
    gap: 4px;
    min-height: 58px;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: #5e6875;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: #17202a;
    text-decoration: none;
}

.nav-links a.active {
    color: #2457c5;
    border-bottom-color: #2457c5;
}

/* The panel is outside the scrolling links and out of normal document flow. */
.nav-more { flex: 0 0 auto; align-self: stretch; position: relative; }
.nav-more > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 58px;
    padding: 0 10px;
    color: #5e6875;
    font-size: 14px;
    font-weight: 650;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    list-style: none;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover { color: #17202a; }
.nav-more[open] > summary { color: #2457c5; border-bottom-color: #2457c5; }
.nav-more[open] > summary > span { transform: rotate(180deg); }
.nav-more.active > summary { color: #2457c5; border-bottom-color: #2457c5; }
.nav-more > summary:focus-visible, .nav-more-panel > a:focus-visible {
    outline: 2px solid #5d83df;
    outline-offset: -2px;
}
.nav-more-panel {
    position: absolute;
    z-index: 100;
    top: calc(100% + 6px);
    right: 0;
    width: 260px;
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid #e3e6eb;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgb(20 30 50 / 16%);
}
.nav-more:not([open]) > .nav-more-panel { display: none; }
.nav-more-panel > a {
    display: block;
    padding: 10px 12px;
    border-radius: 7px;
    color: #5e6875;
    font-size: 14px;
    font-weight: 650;
}
.nav-more-panel > a:hover { background: #f5f6f8; color: #17202a; text-decoration: none; }
.nav-more-panel > a.active { background: #e9efff; color: #2457c5; }

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

.spaced { margin-top: 18px; }
.empty-inline { padding: 8px 20px 22px; color: #727b87; }
.wrap { white-space: pre-wrap; }
.block { display: block; }
.code { margin-top: 6px; margin-bottom: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.badge.success-badge { background: #eaf8ef; color: #216139; }
.badge.danger-badge { background: #fdecec; color: #8c2828; }

.checkbox-label {
    flex-direction: row !important;
    align-items: center;
    gap: 10px !important;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

@media (max-width: 720px) {
    .admin-nav-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0 8px;
        padding-top: 12px;
    }

    .admin-nav-inner > .brand { grid-column: 1 / -1; }
    .nav-links { width: 100%; overflow-x: auto; }
    .nav-more { grid-column: 2; grid-row: 2; position: static; }

    .nav-links a {
        white-space: nowrap;
    }

    .button-row {
        width: 100%;
    }
}

.form-section {
    padding: 4px 0 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid #eceef2;
}

.form-section:last-of-type {
    margin-bottom: 0;
    border-bottom: 0;
}

.form-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.form-section-heading h2,
.form-section-heading p {
    margin-bottom: 0;
}

.form-section-heading > .muted {
    max-width: 360px;
    font-size: 13px;
}

.form-details > summary {
    color: #596372;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.form-section > .form-details > summary {
    font-size: 14px;
}

.form-details[open] > summary {
    margin-bottom: 14px;
}

.form-details > .form-grid {
    margin-top: 14px;
}

.choice-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.choice-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px !important;
    padding: 14px;
    border: 1px solid #d7dce4;
    border-radius: 10px;
    cursor: pointer;
    background: #fafbfc;
}

.choice-card:has(input:checked) {
    border-color: #5d83df;
    background: #f2f6ff;
}

.choice-card input {
    width: auto;
    margin: 3px 0 0;
}

.choice-card span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.choice-card small {
    color: #727b87;
    font-weight: 400;
}

[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .choice-row {
        grid-template-columns: 1fr;
    }

    .form-section-heading {
        flex-direction: column;
        gap: 6px;
    }
}

.order-items-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 4px;
}

.button.compact {
    min-height: 36px;
    padding: 0 12px;
    font-size: 14px;
}

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

.order-item-card {
    padding: 16px;
    border: 1px solid #dde2e9;
    border-radius: 10px;
    background: #fafbfc;
}

.order-item-card .form-grid {
    gap: 14px;
}

.order-item-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.text-button {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.text-button.danger {
    color: #a83232;
}

@media (max-width: 720px) {
    .order-items-heading {
        align-items: stretch;
        flex-direction: column;
    }
}

.device-assignment-cell {
    min-width: 320px;
}

.device-assignment-summary {
    margin-bottom: 8px;
    font-weight: 650;
}

.device-assignment-list {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

.device-assignment-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.device-assignment-row form {
    margin: 0;
}

.device-assignment-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.device-assignment-form select {
    min-width: 220px;
}

@media (max-width: 720px) {
    .device-assignment-cell {
        min-width: 260px;
    }

    .device-assignment-form {
        align-items: stretch;
        flex-direction: column;
    }
}


.delivery-address-block,
.cdek-address-block {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eceef2;
}

.compact-inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.compact-inline-form input {
    flex: 1 1 360px;
}

.compact-inline-form .muted {
    flex: 1 1 auto;
    margin: 0;
}

@media (max-width: 720px) {
    .compact-inline-form {
        align-items: stretch;
        flex-direction: column;
    }
}


.address-autocomplete {
    position: relative;
    width: 100%;
    min-width: 0;
}

.address-autocomplete > input[type="text"] {
    width: 100%;
}

.address-autocomplete.disabled {
    opacity: 0.7;
}

.address-suggestions {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    overflow: hidden;
    border: 1px solid #d9dde5;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(20, 28, 45, 0.14);
}

.address-suggestion {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid #eceef2;
    background: #fff;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.address-suggestion:last-child {
    border-bottom: 0;
}

.address-suggestion:hover,
.address-suggestion:focus {
    background: #f4f6f9;
    outline: none;
}

.address-edit-form .address-autocomplete {
    flex: 1 1 520px;
}

.warning-text {
    color: #8a5a00;
}

@media (max-width: 720px) {
    .address-autocomplete,
    .address-edit-form .address-autocomplete {
        width: 100%;
        flex-basis: auto;
    }
}


.dashboard-subtitle {
    margin: 8px 0 0;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.dashboard-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 128px;
    padding: 18px;
    border: 1px solid #e3e6eb;
    border-radius: 14px;
    background: #fff;
    color: inherit;
    box-shadow: 0 3px 14px rgb(20 30 50 / 4%);
}

.dashboard-metric:hover {
    border-color: #c8d2e3;
    text-decoration: none;
}

.dashboard-metric.warning {
    border-color: #ead79e;
    background: #fffaf0;
}

.dashboard-metric.danger {
    border-color: #efbaba;
    background: #fff5f5;
}

.dashboard-metric-value {
    font-size: 30px;
    font-weight: 780;
    line-height: 1.1;
}

.dashboard-metric-label {
    font-weight: 700;
}

.dashboard-metric small {
    margin-top: auto;
    color: #727b87;
}

.dashboard-status-list {
    display: grid;
}

.dashboard-status-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid #eceef2;
    color: inherit;
}

.dashboard-status-list a:first-child {
    padding-top: 0;
}

.dashboard-status-list a:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.dashboard-status-list a:hover {
    color: #2457c5;
    text-decoration: none;
}

.dashboard-status-list strong {
    min-width: 34px;
    text-align: right;
    font-size: 18px;
}

.dashboard-action-list {
    display: grid;
}

.dashboard-action {
    display: grid;
    grid-template-columns: 5px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 66px;
    padding: 10px 18px 10px 0;
    border-top: 1px solid #eceef2;
    color: inherit;
}

.dashboard-action:hover {
    background: #fafbfc;
    text-decoration: none;
}

.dashboard-action-indicator {
    width: 5px;
    align-self: stretch;
    background: #bdc5d0;
}

.dashboard-action.warning .dashboard-action-indicator {
    background: #d8a522;
}

.dashboard-action.danger .dashboard-action-indicator {
    background: #c74848;
}

.dashboard-action-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.dashboard-action-content small {
    overflow: hidden;
    color: #727b87;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-action-arrow {
    color: #8a929e;
    font-size: 20px;
}

.filter-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.filter-presets a {
    padding: 7px 11px;
    border: 1px solid #d9dde5;
    border-radius: 999px;
    background: #fff;
    color: #596372;
    font-size: 14px;
    font-weight: 650;
}

.filter-presets a:hover,
.filter-presets a.active {
    border-color: #9eb4e7;
    background: #eef3ff;
    color: #2457c5;
    text-decoration: none;
}

.filter-card {
    margin-bottom: 14px;
    padding: 16px;
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
    align-items: end;
    gap: 12px;
}

.filter-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #5e6875;
    font-size: 12px;
    font-weight: 700;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
}

.list-summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0 2px 12px;
    font-size: 13px;
}

@media (max-width: 960px) {
    .dashboard-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .filter-search {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .dashboard-metrics,
    .filter-form {
        grid-template-columns: 1fr;
    }

    .filter-search {
        grid-column: auto;
    }

    .dashboard-action-content small {
        white-space: normal;
    }

    .list-summary {
        flex-direction: column;
        gap: 4px;
    }
}


.quality-subtitle {
    margin: 8px 0 0;
}

.quality-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.quality-filter-form {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr));
    align-items: end;
    gap: 12px;
}

.quality-filter-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #5e6875;
    font-size: 12px;
    font-weight: 700;
}

.quality-filter-search {
    grid-column: span 2;
}

.quality-case-table td {
    vertical-align: top;
}

.quality-problem-cell {
    min-width: 280px;
    max-width: 420px;
    white-space: normal;
}

.quality-problem,
.quality-root-cause {
    margin-top: 7px;
    white-space: pre-wrap;
}

.quality-root-cause {
    color: #555f6d;
    font-size: 13px;
}

@media (max-width: 1080px) {
    .quality-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 720px) {
    .quality-metrics,
    .quality-filter-form {
        grid-template-columns: 1fr;
    }

    .quality-filter-search {
        grid-column: auto;
    }
}


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

.inventory-compact-form label,
.inventory-bom-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #5e6875;
    font-size: 12px;
    font-weight: 700;
}

.inventory-compact-form .full-width,
.inventory-bom-form .full-width {
    grid-column: 1 / -1;
}

.inventory-compact-form .form-actions,
.inventory-bom-form .form-actions {
    grid-column: 1 / -1;
    margin-top: 4px;
    padding-top: 12px;
}

.inventory-adjust-form {
    display: grid;
    grid-template-columns: minmax(110px, .8fr) minmax(90px, .6fr) minmax(150px, 1fr) auto;
    gap: 7px;
    min-width: 520px;
}

.inventory-adjust-form input,
.inventory-adjust-form select {
    min-width: 0;
}

@media (max-width: 720px) {
    .inventory-compact-form,
    .inventory-bom-form {
        grid-template-columns: 1fr;
    }

    .inventory-compact-form .full-width,
    .inventory-bom-form .full-width,
    .inventory-compact-form .form-actions,
    .inventory-bom-form .form-actions {
        grid-column: auto;
    }
}

.diagnosis-results {
    margin-top: 22px;
}

.diagnosis-results > .hint {
    margin-bottom: 12px;
}

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

.diagnosis-result-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 12px 0;
    border-top: 1px solid #eceef2;
}

.diagnosis-result-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.diagnosis-comment {
    grid-column: 1 / -1;
    min-width: 0;
}

.diagnosis-comment summary {
    display: inline-block;
    color: #596372;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.diagnosis-comment input {
    display: block;
    width: 100%;
    min-width: 0;
    margin-top: 8px;
    box-sizing: border-box;
}

.diagnosis-result-form .button {
    max-width: 100%;
}

.diagnosis-confirmed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
    padding: 14px 0 2px;
    border-top: 1px solid #eceef2;
}

@media (max-width: 860px) {
    .diagnosis-result-form {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .diagnosis-result-form .button {
        width: 100%;
    }

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

.delivery-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.delivery-method-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid #e3e6eb;
    border-radius: 12px;
    background: #fff;
}

.delivery-method-card > h3 {
    margin-top: 0;
    margin-bottom: 6px;
}

.delivery-method-card > .hint {
    margin-bottom: 14px;
}

.delivery-method-card .form {
    margin-top: 0;
}

.pickup-search-form {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px dashed #d8dde5;
    border-radius: 10px;
    background: #fafbfc;
}

.pickup-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.pickup-search-row .address-autocomplete {
    min-width: 0;
}

.pickup-search-row .button {
    white-space: nowrap;
}

.delivery-api-block {
    margin: 14px 0 18px;
}

.delivery-api-form {
    display: grid;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e3e6eb;
    border-radius: 12px;
    background: #fafbfc;
}

.delivery-api-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.delivery-api-primary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    min-width: 0;
}

.delivery-api-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, .65fr);
    gap: 10px;
    min-width: 0;
}

.delivery-api-primary label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    color: #5e6875;
    font-size: 12px;
    font-weight: 700;
}

.delivery-api-primary input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.delivery-api-advanced summary {
    color: #596372;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.delivery-api-advanced .form-grid {
    margin-top: 10px;
}

.compact-row {
    gap: 8px;
    margin-top: 5px;
}

@media (max-width: 900px) {
    .delivery-methods {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .pickup-search-row,
    .delivery-api-primary,
    .delivery-api-fields {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .delivery-api-primary .button {
        width: 100%;
    }
}


.weekly-sales-section {
    margin-bottom: 18px;
}

.weekly-sales-heading {
    padding: 0 2px 10px;
}

.weekly-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.weekly-chart-card {
    min-width: 0;
    padding: 18px;
}

.weekly-chart-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.weekly-chart-card-heading h3 {
    margin: 0 0 4px;
}

.weekly-chart-scroll {
    overflow-x: auto;
    padding-bottom: 4px;
}

.weekly-chart {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(70px, 1fr);
    gap: 8px;
    min-width: max(100%, calc(var(--weeks) * 78px));
    padding: 8px 2px 0;
}

.weekly-chart-column {
    display: grid;
    grid-template-rows: 28px 190px 42px;
    gap: 6px;
    min-width: 0;
    padding: 4px 3px 0;
    border-radius: 8px;
}

.weekly-chart-column.current {
    background: #f6f8fc;
}

.weekly-chart-value {
    overflow: hidden;
    color: #4f5967;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weekly-chart-money {
    font-size: 11px;
}

.weekly-chart-bar-area {
    display: flex;
    align-items: flex-end;
    min-height: 0;
    border-bottom: 1px solid #dce1e8;
    background:
        linear-gradient(to top, transparent 24%, #eef1f5 25%, transparent 26%),
        linear-gradient(to top, transparent 49%, #eef1f5 50%, transparent 51%),
        linear-gradient(to top, transparent 74%, #eef1f5 75%, transparent 76%);
}

.weekly-chart-bar {
    width: 100%;
    border-radius: 6px 6px 2px 2px;
    background: #4f78d1;
    transition: height 120ms ease;
}

.weekly-chart-bar.amount {
    background: #447c62;
}

.weekly-chart-bar.zero {
    height: 2px !important;
    background: #dfe4eb;
}

.weekly-chart-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    color: #657080;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}

.weekly-chart-label small {
    color: #2457c5;
    font-weight: 700;
}

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

/* Preserve context after same-page form submissions. Feedback becomes a floating toast
   only when the page is being restored after a form submit, so normal page notices
   keep their existing in-flow presentation. */
.page-feedback-stack {
    position: fixed;
    z-index: 500;
    top: 16px;
    right: 20px;
    display: grid;
    gap: 10px;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.page-feedback-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    border: 1px solid rgb(23 32 42 / 8%);
    box-shadow: 0 12px 34px rgb(20 30 50 / 18%);
    pointer-events: auto;
    transition: opacity 160ms ease, transform 160ms ease;
}

.page-feedback-toast.leaving {
    opacity: 0;
    transform: translateY(-6px);
}

.page-feedback-toast-content {
    flex: 1 1 auto;
    min-width: 0;
}

.page-feedback-close {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    margin: -3px -4px -3px 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: currentColor;
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: .65;
}

.page-feedback-close:hover,
.page-feedback-close:focus-visible {
    background: rgb(0 0 0 / 6%);
    opacity: 1;
    outline: none;
}

@media (max-width: 720px) {
    .page-feedback-stack {
        top: 10px;
        right: 10px;
        width: calc(100vw - 20px);
    }
}
