:root {
    --wb-bg: #0b1220;
    --wb-card: #111827;
    --wb-muted: #94a3b8;
    --wb-text: #e5e7eb;
    --wb-primary: #2563eb;
    --wb-primary-600: #1d4ed8;
    --wb-ring: #60a5fa;
    --wb-chip-bg: #0b2a69;
}

* {
    box-sizing: border-box
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--wb-bg);
    color: var(--wb-text);
    font: 16px/1.45 "Inter", system-ui, Segoe UI, Roboto, sans-serif
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(11, 18, 32, .9);
    backdrop-filter: saturate(1.1) blur(10px);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, .06)
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700
}

.brand a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.language-selector {
    display: inline-flex;
    align-items: center;
}

.language-menu {
    position: relative;
    display: inline-flex;
}

.org-lang-group {
    display: none;
    align-items: center;
    gap: 8px;
}

.login-view .org-lang-group {
    display: inline-flex;
}

.language-selector-nav {
    display: inline-flex;
}

.flag-select {
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .04);
    color: #e2e8f0;
    border-radius: 999px;
    font-size: 16px;
    line-height: 1;
    padding: 6px 10px;
    min-width: 52px;
    height: 34px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.language-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    background: #0b1220;
    box-shadow: 0 14px 28px rgba(0, 0, 0, .35);
    z-index: 120;
}

.language-menu.open .language-menu-panel {
    display: flex;
}

.language-option {
    width: 40px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.language-option:hover,
.language-option.active {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .1);
}

.flag-icon {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .14);
    display: inline-block;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.flag-et {
    background-image: url("flags/et.svg");
}

.flag-en {
    background-image: url("flags/en.svg");
}

.flag-ru {
    background-image: url("flags/ru.svg");
}

.flag-pl {
    background-image: url("flags/pl.svg");
}

.brand .product {
    opacity: .9;
    font-weight: 600;
    display: none;
}

@media (min-width: 640px) {
    .brand .product {
        display: inline;
    }
}

.logo {
    height: 22px;
    width: auto;
    display: block;
    border: none
}

.topnav .logout-form {
    margin: 0;
}

/* Logout button styles */
.topnav .logout-btn {
    color: white;
    border: 0;
    background: transparent;
    text-decoration: none;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.topnav .logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.topnav .logout-btn::before {
    content: '→';
    font-size: 18px;
    transform: rotate(180deg);
    display: inline-block;
}

.topnav .logout-text {
    display: none;
}

.container {
    max-width: 1440px;
    margin: 24px auto;
    padding: 0 12px
}

.container.narrow {
    max-width: 560px
}

.topnav {
    display: flex;
    align-items: center;
    gap: 10px
}

.menu-toggle {
    display: none;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .04);
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 40px;
    height: 36px;
}

.menu-backdrop {
    display: none;
    border: 0;
    padding: 0;
}

.menu-close {
    display: none;
}

.burger-icon {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 16px;
}

.burger-icon span {
    display: block;
    height: 2px;
    width: 16px;
    border-radius: 999px;
    background: #e2e8f0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.tab-link {
    color: var(--wb-muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid transparent;
}

.tab-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .06);
}

.tab-link.active {
    color: #fff;
    background: rgba(37, 99, 235, .2);
    border-color: rgba(37, 99, 235, .35);
}

@media (max-width: 768px) {
    html,
    body {
        overflow-x: hidden;
    }

    .topbar {
        display: grid;
        grid-template-columns: 1fr auto auto;
        grid-template-areas: "brand chip toggle";
        align-items: center;
        gap: 0 10px;
    }

    .topbar.menu-open {
        gap: 8px 10px;
    }

    .brand {
        grid-area: brand;
        justify-content: flex-start;
        gap: 8px;
    }

    .language-selector select {
        min-width: 48px;
        padding: 6px 8px;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        grid-area: toggle;
    }

    .org-chip-inline {
        display: inline-flex;
        justify-self: start;
        white-space: nowrap;
    }

    .org-lang-group {
        display: inline-flex;
        grid-area: chip;
        justify-self: start;
    }

    .language-selector-nav {
        display: none;
    }

    .org-chip-menu {
        display: none;
    }

    .topnav {
        position: fixed;
        top: 0;
        right: 0;
        width: min(340px, 86vw);
        height: 100dvh;
        z-index: 101;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 72px 12px 12px;
        background: #0b1220;
        border-left: 1px solid rgba(255, 255, 255, .08);
        box-shadow: -20px 0 42px rgba(0, 0, 0, .45);
        transform: translateX(100%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform .22s ease, opacity .18s ease;
    }

    .menu-close {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, .2);
        background: rgba(255, 255, 255, .06);
        color: #e2e8f0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        font-weight: 700;
        cursor: pointer;
    }

    .topnav.open {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .tab-link {
        width: 100%;
    }

    .org-chip {
        width: fit-content;
    }

    .topnav .logout-btn {
        width: 100%;
        height: 40px;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, .2);
        background: rgba(255, 255, 255, .06);
        justify-content: flex-start;
        padding: 8px 12px;
        font-size: 14px;
        font-weight: 600;
    }

    .topnav .logout-btn::before {
        content: none;
    }

    .topnav .logout-text {
        display: inline;
    }

    .topnav .logout-form {
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, .12);
    }

    .topbar {
        position: relative;
        z-index: 102;
    }

    .menu-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 100;
        background: rgba(2, 6, 23, .55);
    }

    .menu-backdrop.open {
        display: block;
    }

    body.mobile-menu-open {
        overflow: hidden;
    }
}

.org-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.org-switch-form {
    margin: 0;
}

.org-switch-btn {
    --org-color: var(--wb-primary);
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: transparent;
    color: var(--wb-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.org-switch-btn:hover,
.org-switch-btn:focus-visible {
    color: var(--wb-text);
    border-color: var(--org-color);
}

.org-switch-btn.active {
    padding: 8px 18px;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    background: var(--org-color);
    border-color: var(--org-color);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .08);
    cursor: default;
}

@media (max-width: 768px) {
    .org-switch-btn.active {
        font-size: 16px;
        padding: 6px 12px;
    }
}

.org-chip {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(37, 99, 235, .12);
    color: #dbeafe;
    border: 1px solid rgba(37, 99, 235, .35)
}

.card {
    background: var(--wb-card);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .28)
}

.section-title {
    margin: 0;
    font-size: 18px
}

.grid {
    display: grid
}

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

@media (min-width: 1024px) {
    .cols-2 {
        grid-template-columns: 1fr 1fr;
    }
    
    /* Make the form take full width on larger screens */
    #send-form {
        grid-column: 1 / -1;
    }
}

.col-span-2 {
    grid-column: 1 / -1;
}

.gap-sm {
    gap: 12px
}

.row {
    display: flex;
    gap: 12px
}

.between {
    justify-content: space-between
}

.center {
    align-items: center
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px
}

label > span, legend {
    display: block;
    font-size: 12px;
    color: var(--wb-muted);
}

input, select {
    width: 100%;
    padding: 9px 16px;
    border-radius: 10px;
    background: #0f172a;
    color: var(--wb-text);
    border: 1px solid rgba(255, 255, 255, .1);
    outline: none;
    font-size: 18px;
    height: 50px;
    font-weight: 500;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select {
    appearance: none;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='m3 5 4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 14px;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-row > span {
    display: inline;
    font-size: 14px;
    color: var(--wb-text);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    padding: 0;
    border-radius: 4px;
    accent-color: var(--wb-accent);
    background: transparent;
}

textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    background: #0f172a;
    color: var(--wb-text);
    border: 1px solid rgba(255, 255, 255, .1);
    outline: none;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 500;
    resize: vertical;
}

textarea:focus {
    border-color: var(--wb-ring);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .25);
}

input:focus, select:focus {
    border-color: var(--wb-ring);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .25);
}

/* Form layout */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.form-group {
    flex: 1;
    min-width: 0;
    position: relative;
}

.form-label {
    display: block;
    font-size: 12px;
    color: var(--wb-muted);
    margin-bottom: 6px;
}

/* Side toggle buttons */
.side-toggle {
    margin-top: 4px;
}

.radio-group {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px;
    border-radius: 10px;
}

.radio-btn {
    flex: 1;
    position: relative;
    text-align: center;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 8px;
    background: transparent;
    transition: background-color 0.2s, color 0.2s;
    font-size: 14px;
    font-weight: 500;
    color: var(--wb-muted);
}

.radio-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-btn span {
    position: relative;
    z-index: 1;
}

.radio-btn input[type="radio"]:checked + span {
    color: white;
}

.radio-btn input[type="radio"]:checked {
    background: var(--wb-primary);
}

.radio-btn:has(input[type="radio"]:checked) {
    background: var(--wb-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.radio-btn.active {
    background: var(--wb-primary);
    color: white;
}

.radio-btn.small {
    padding: 6px 12px;
    min-width: 36px;
}

#weight-source-modal .radio-group,
#op-weight-source-modal .radio-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: 8px;
}

#weight-source-modal .radio-btn,
#op-weight-source-modal .radio-btn {
    min-width: 160px;
}

#weight-source-modal .radio-btn span,
#op-weight-source-modal .radio-btn span {
    white-space: nowrap;
}

.hide-mobile {
    display: none;
}

@media (min-width: 1024px) {
    .hide-mobile {
        display: flex;
    }
}

@media (min-width: 768px) {
    .form-row {
        flex-direction: row;
        align-items: flex-end;
        gap: 16px;
    }
    
    .side-toggle {
        margin-top: 0;
        min-width: 180px;
    }
    
    .radio-group {
        height: 50px;
        align-items: center;
    }

    .org-chip-inline {
        display: none;
    }
}

.btn {
    padding: 10px 14px;
    border-radius: 12px;
    border: 0;
    cursor: pointer;
    font-weight: 600
}

.btn.primary {
    background: var(--wb-primary);
    color: white;
    box-shadow: 0 6px 16px rgba(37, 99, 235, .35)
}

.btn.primary:hover {
    background: var(--wb-primary-600)
}

/* Weighing row: this weight is already taken (button still re-weighs) */
.btn.primary.is-done {
    background: #059669;
    box-shadow: none;
}

.btn.primary.is-done:hover {
    background: #047857;
}

.btn.boom-state-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.boom-state-icon {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 20px;
    height: 14px;
    color: #ef4444;
    transform: translateY(1px);
}

.is-boom-open .boom-state-icon {
    color: #22c55e;
}

.boom-state-icon::before {
    content: "";
    position: absolute;
    left: 1px;
    bottom: 1px;
    width: 4px;
    height: 10px;
    border-radius: 2px;
    background: currentColor;
}

.boom-state-arm {
    position: absolute;
    left: 4px;
    bottom: 9px;
    width: 15px;
    height: 4px;
    border-radius: 999px;
    background: currentColor;
    transform-origin: 0 50%;
    transition: transform .2s ease;
}

.is-boom-closed .boom-state-arm {
    transform: rotate(0deg);
}

.is-boom-open .boom-state-arm {
    transform: rotate(-52deg);
}

.btn:active {
    transform: translateY(1px)
}

.btn.full {
    width: 100%
}

.radio {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 2px 0;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.radio:has(input:checked) {
    background: rgba(37, 99, 235, 0.2);
}

.radio input[type="radio"] {
    width: auto;
    margin: 0;
    padding: 0;
    height: auto;
}

.muted {
    color: var(--wb-muted);

    &.small-center {
        font-size: .75rem;
        line-height: 1rem;
        text-align: center;

        a {
            text-decoration: none;
            color: var(--wb-primary);

            &:hover {
                opacity: .8;
            }
        }
    }
}

figure {
    margin: 0
}

figcaption {
    font-size: 12px;
    color: var(--wb-muted);
    margin-bottom: 6px
}

img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    cursor: pointer;
    transition: opacity 0.2s;
}

img:hover {
    opacity: 0.9;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: zoom-out;
}

.modal-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: default;
}

.modal-caption {
    margin-top: 1rem;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

#cam-modal {
    z-index: 1200;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
}

.frame {
    background: #0f172a;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .06)
}

.camera-image-shell {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #0b1220;
}

.camera-image-shell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity .2s ease;
}

.camera-image-shell:not([data-camera-image-state="loaded"]) img {
    opacity: 0;
}

.camera-image-status {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--wb-muted);
    font-size: 13px;
    pointer-events: none;
}

.camera-image-shell[data-camera-image-state="loaded"] .camera-image-status {
    display: none;
}

.camera-image-spinner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .14);
    border-top-color: #60a5fa;
    animation: spin .9s linear infinite;
}

.camera-image-shell[data-camera-image-state="error"] .camera-image-spinner {
    display: none;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px
}

.switch input {
    display: none
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #334155;
    border-radius: 28px;
    transition: .2s
}

.slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .2s
}

.switch input:checked + .slider {
    background: var(--wb-primary)
}

.switch input:checked + .slider:before {
    transform: translateX(20px)
}

@media (max-width: 720px) {
    .cols-2 {
        grid-template-columns: 1fr
    }

    .device-dashboard-grid.has-event-log {
        grid-template-columns: 1fr;
    }

    .pagination-bar {
        flex-wrap: wrap;
    }
}

.camera-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.device-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.device-dashboard-grid.has-event-log {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    align-items: start;
}

.device-dashboard-grid.has-event-log.is-event-log-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.device-dashboard-grid.is-event-log-hidden .device-event-log {
    display: none;
}

.device-event-log-tab {
    display: none;
    justify-self: end;
    align-self: start;
}

.device-dashboard-grid.is-event-log-hidden .device-event-log-tab {
    display: inline-flex;
}

.device-event-log {
    min-width: 0;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    padding: 12px;
}

.section-title.compact {
    font-size: 1rem;
    margin: 0;
}

.device-event-list {
    display: grid;
    gap: 8px;
    min-height: 280px;
}

.device-event-item {
    display: grid;
    gap: 6px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.32);
    border: 1px solid rgba(255, 255, 255, .07);
}

.device-event-item-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.device-event-title {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.device-event-meta {
    display: grid;
    gap: 2px;
    justify-items: end;
    text-align: right;
}

.device-event-time,
.device-event-side {
    white-space: nowrap;
    font-size: 0.78rem;
    color: var(--wb-muted);
}

.device-event-side {
    color: #e2e8f0;
    font-weight: 700;
}

.device-event-data {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    color: #dbe7f5;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}

@media (max-width: 720px) {
    .device-dashboard-grid.has-event-log {
        grid-template-columns: 1fr;
    }
}

.gate-overlay-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.gate-overlay-grid .btn.full { grid-column: span 2; }
.gate-overlay-grid .btn.left { grid-column: 1; }
.gate-overlay-grid .btn.right { grid-column: 2; }

.btn.small {
    padding: 0.5rem;
    font-size: 0.85rem;
}

.inline-master-action {
    width: auto;
    min-height: 34px;
    align-self: flex-start;
}

.master-autocomplete-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 25;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .35);
    overflow: hidden;
}

.master-autocomplete-option {
    width: 100%;
    padding: 10px 14px;
    border: 0;
    background: transparent;
    color: var(--wb-text);
    text-align: left;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
}

.master-autocomplete-option:hover,
.master-autocomplete-option:focus-visible,
.master-autocomplete-option[aria-selected="true"] {
    background: rgba(255, 255, 255, .08);
    outline: none;
}

.master-autocomplete-option.add-new {
    color: #bfdbfe;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.weight-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    gap: 16px;
}

.weight-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.weight-grid > .weight-card {
    margin-bottom: 0;
}

.weight-scale-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.weight-scale-left {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-content: start;
    min-width: 0;
}

.weight-scale-left > .weight-card {
    margin-bottom: 0;
}

.weight-manual-entry-host:empty {
    display: none;
}

.weight-scale-left:not(:has(> .weight-manual-entry-host:not(:empty))) {
    display: flex;
    flex-direction: column;
}

.weight-scale-left:not(:has(> .weight-manual-entry-host:not(:empty))) > .weight-card {
    flex: 1 1 auto;
}

.weight-manual-entry-host:not(:empty) {
    min-width: 0;
}

.weight-manual-entry-host .weighings-manual-entry {
    margin: 0;
}

.weight-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.weight-camera-preview {
    min-width: 0;
    padding: 12px;
    margin-bottom: 0;
}

.weight-camera-preview.is-hidden {
    display: none;
}

.weight-camera-preview-header {
    margin-bottom: 8px;
    color: var(--wb-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.weight-camera-image-button {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    background: #0f172a;
    cursor: zoom-in;
}

.weight-camera-image-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    border-radius: 9px;
}

.weight-camera-toggle.active {
    background: #0f766e;
}

.weight-scale-actions {
    margin-top: 12px;
}

.weight-label {
    font-size: 12px;
    color: var(--wb-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.weight-display {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: white;
}

.weight-display .unit {
    font-size: 1.5rem;
    color: var(--wb-muted);
    margin-left: 4px;
}

.weight-timestamp {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.weight-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.stability-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #334155;
}

.stability-dot.stable { background: #10b981; } /* Green */
.stability-dot.unstable { background: #ef4444; } /* Red */

.weight-error-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #ef4444;
    font-weight: 700;
    z-index: 5;
}

.error-icon { font-size: 1.5rem; }

.light-control-group {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-group {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.btn-group .btn {
    flex: 1;
    background: #334155;
    color: white;
}

.btn.red { background: #ef4444 !important; }
.btn.green { background: #10b981 !important; }

.btn.red:hover { background: #dc2626 !important; }
.btn.green:hover { background: #059669 !important; }

.alert {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.alert.error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.mb-5 {
    margin-bottom: 0.5rem;
}

.mb-10 {
    margin-bottom: 1rem;
}

.weighing-table-wrap {
    margin-top: 0.5rem;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 12px;
}

.weighing-table-wrap.menu-open {
    overflow: visible;
}

.weighing-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
    background: rgba(15, 23, 42, 0.45);
}

.weighing-table th,
.weighing-table td {
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

.weighing-table th {
    color: var(--wb-muted);
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: #111827;
    z-index: 1;
}

.sort-btn {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.sort-btn.active {
    color: #fff;
}

.weighing-table td {
    color: var(--wb-text);
}

.weighing-table th.weight-column,
.weighing-table td.weight-column .cell-main {
    white-space: nowrap;
}

/* Desktop: the table fits the card instead of scrolling sideways (dates may wrap onto two lines). */
@media (min-width: 901px) {
    .weighing-table {
        min-width: 0;
    }

    .weighing-table th,
    .weighing-table td {
        padding: 8px 9px;
    }
}

/* Waybill reason on hover: opens to the left and wraps, so the table edge does not clip it
   and the row keeps its height */
.debug-id-tooltip.waybill-tooltip {
    left: auto;
    right: calc(100% + 8px);
    top: -4px;
    width: 260px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.weighing-reference-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.weighing-notes-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #93c5fd;
    cursor: help;
}

.weighing-notes-icon {
    display: block;
    width: 16px;
    height: 16px;
}

.weighing-notes-tooltip {
    left: auto;
    right: 0;
    white-space: pre-wrap;
    width: max-content;
    max-width: min(420px, calc(100vw - 32px));
    text-align: left;
}

.weighing-workspace {
    padding: 18px;
}

.weighing-header {
    margin-bottom: 14px;
}

.weighing-header .section-title {
    margin-bottom: 4px;
}

.weighing-header p {
    margin: 0;
}

.data-subnav {
    display: flex;
    gap: 8px;
    margin: 10px 0 14px 0;
    flex-wrap: wrap;
}

.weighing-master-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.weighing-master-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    padding: 12px;
}

.weighing-master-card h3 {
    margin: 0 0 10px 0;
    font-size: 15px;
}

.weighing-master-form {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.weighing-master-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 10px;
}

.weighing-master-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 300px;
}

.weighing-master-table th,
.weighing-master-table td {
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    padding: 8px 10px;
    font-size: 13px;
    text-align: left;
    vertical-align: top;
}

.break-all {
    word-break: break-all;
}

.qr-thumb-btn {
    width: 34px;
    height: 34px;
    padding: 2px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, .45);
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.qr-thumb-btn:hover {
    border-color: rgba(96, 165, 250, .8);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, .25);
}

.qr-thumb-img {
    width: 26px;
    height: 26px;
    display: block;
    border-radius: 4px;
}

.copy-toast-btn {
    position: relative;
}

.copy-toast-btn::after {
    content: attr(data-copy-toast);
    position: absolute;
    left: 50%;
    top: -30px;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.96);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.copy-toast-btn.show-copy-toast::after {
    opacity: 1;
}

.operation-details-row > td {
    background: rgba(15, 23, 42, 0.45);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.operation-conflict-row > td {
    background: rgba(245, 158, 11, .07);
}

.operation-conflict-row > td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}

.operation-conflict-warning-row > td {
    padding: 7px 12px;
    background: rgba(245, 158, 11, .11);
    box-shadow: inset 3px 0 0 #f59e0b;
}

.operation-conflict-warning {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #fbbf24;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
}

.operation-conflict-warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 10px;
    line-height: 1;
}

.operation-details-panel {
    padding: 10px 4px 4px;
}

.operation-toggle-btn {
    width: auto;
    min-width: 44px;
    padding: 0 8px;
    gap: 6px;
    font-size: 13px;
}

.operation-toggle-caret {
    line-height: 1;
}

.operation-toggle-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .25);
    color: #e2e8f0;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.weighing-master-table th {
    color: var(--wb-muted);
    background: rgba(17, 24, 39, 0.85);
    white-space: nowrap;
}

.inline-table-select {
    min-width: 120px;
    height: 42px;
    padding: 10px 14px;
    font-size: 15px;
}

.weighing-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.weighing-entry {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    padding: 12px;
}

.weighing-entry h3 {
    margin: 0 0 10px 0;
    font-size: 15px;
}

.weighing-entry p {
    margin: 10px 0 0 0;
}

.weighing-log {
    min-width: 0;
}

.weighing-filter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.whitelist-filter-form {
    display: grid;
    grid-template-columns: minmax(132px, 148px);
    align-items: end;
    gap: 10px;
    margin-bottom: 10px;
}

.whitelist-table {
    min-width: 760px;
}

.whitelist-status {
    min-height: 20px;
}

.whitelist-status.is-error,
.form-error {
    color: #fca5a5;
}

.whitelist-date-picker-wrap {
    position: relative;
}

.whitelist-date-picker-calendar {
    right: auto;
    z-index: 1300;
    box-sizing: border-box;
    min-width: min(336px, calc(100vw - 24px));
}

.whitelist-date-picker-calendar.open {
    z-index: 1300;
}

.form-error {
    min-height: 20px;
    font-size: 13px;
}

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

.weighings-manual-entry.is-hidden {
    display: none;
}

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

.weighing-filter-secondary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.weighing-filter-secondary.is-hidden {
    display: none;
}

.weighing-advanced-filters-toggle {
    width: 40px;
    height: 40px;
    color: #dbe7f5;
}

.weighing-advanced-filters-toggle svg {
    transition: transform 0.18s ease;
}

.weighing-advanced-filters-toggle.is-open svg {
    transform: rotate(180deg);
}

.icon-action-btn.mobile-filters-toggle {
    display: none;
    flex: 0 0 auto;
}

.weighing-filter-date-group {
    min-width: 0;
}

.weighing-filter-date-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-width: 0;
}

.weighing-filter-date-fields {
    min-width: 0;
    width: max-content;
    min-width: 336px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    background: #132033;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.32);
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
}

.weighing-filter-date-fields.is-hidden {
    display: none;
}

.weighing-filter-date-row .form-group {
    margin: 0;
}

.weighing-filter-date-mode-group {
    width: 112px;
    flex: 0 0 112px;
}

.weighing-filter-bar.desktop-compact input,
.weighing-filter-bar.desktop-compact select {
    height: 40px;
    font-size: 15px;
}

.weighing-filter-secondary input,
.weighing-filter-secondary select {
    height: 40px;
    font-size: 15px;
}

.filter-input-clear-wrap {
    position: relative;
}

.filter-input-clear-wrap input {
    width: 100%;
    padding-right: 34px;
}

.filter-input-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(148, 163, 184, .2);
    color: #cbd5e1;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
}

.filter-input-clear-wrap.has-value .filter-input-clear {
    display: inline-flex;
}

.filter-input-clear:hover {
    background: rgba(148, 163, 184, .35);
    color: #f8fafc;
}

.weighing-filter-bar.desktop-compact {
    align-items: end;
}

.weighing-filter-bar.desktop-compact .btn.small,
.weighing-filter-bar.desktop-compact .btn {
    height: 40px;
}

.weighing-filter-bar input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 1;
    filter: invert(1) brightness(1.4) contrast(1.2);
    cursor: pointer;
}

.weighing-filter-bar .actions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    justify-content: flex-end;
    min-width: max-content;
}

.weighing-filter-presets {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
}

.weighing-filter-presets .btn.small,
#weighing-custom-date-toggle {
    padding-left: 10px;
    padding-right: 10px;
    font-size: 13px;
    white-space: nowrap;
}

#weighing-custom-date-toggle {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.weighing-filter-presets .btn.active {
    background: #0f766e;
    border-color: rgba(45, 212, 191, .45);
    color: #ecfeff;
}

.weighing-custom-date-wrap {
    position: relative;
    flex: 0 1 auto;
}

#weighing-custom-date-toggle {
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.weighing-date-range-picker-input {
    position: absolute;
    inset: 0 auto auto 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.weighing-filter-date-fields .flatpickr-calendar {
    border: 0;
    box-shadow: none;
    background: transparent;
    color: #e5eef8;
}

.weighing-filter-date-fields .flatpickr-innerContainer,
.weighing-filter-date-fields .flatpickr-rContainer,
.weighing-filter-date-fields .flatpickr-days,
.weighing-filter-date-fields .dayContainer,
.weighing-filter-date-fields .flatpickr-weekdays,
.weighing-filter-date-fields .flatpickr-weekdaycontainer {
    min-width: 0;
    max-width: 100%;
}

.weighing-filter-date-fields .flatpickr-months {
    align-items: center;
    margin-bottom: 4px;
}

.weighing-filter-date-fields .flatpickr-months .flatpickr-month,
.weighing-filter-date-fields .flatpickr-weekdays,
.weighing-filter-date-fields span.flatpickr-weekday {
    background: transparent;
    color: #dbe7f5;
}

.weighing-filter-date-fields .flatpickr-current-month {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.weighing-filter-date-fields .flatpickr-current-month .flatpickr-monthDropdown-months,
.weighing-filter-date-fields .flatpickr-current-month input.cur-year {
    color: #f8fbff;
}

.weighing-filter-date-fields .flatpickr-current-month .flatpickr-monthDropdown-months {
    margin-right: 6px;
    padding-right: 14px;
    border: 0;
    background: transparent;
    font-size: 14px;
    box-shadow: none;
}

.weighing-filter-date-fields .flatpickr-current-month .numInputWrapper {
    position: relative;
    width: 6ch;
    min-width: 6ch;
    padding-right: 16px;
}

.weighing-filter-date-fields .flatpickr-current-month input.cur-year {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 14px;
    box-shadow: none;
}

.weighing-filter-date-fields .flatpickr-current-month .numInputWrapper span.arrowUp,
.weighing-filter-date-fields .flatpickr-current-month .numInputWrapper span.arrowDown {
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    right: 1px;
    width: 14px;
    height: 10px;
    cursor: pointer;
    pointer-events: auto;
    z-index: 2;
}

.weighing-filter-date-fields .flatpickr-current-month .numInputWrapper span.arrowUp {
    border-bottom: 6px solid #dbe7f5;
    top: 4px;
}

.weighing-filter-date-fields .flatpickr-current-month .numInputWrapper span.arrowDown {
    border-top: 6px solid #dbe7f5;
    top: auto;
    bottom: 4px;
}

.weighing-filter-date-fields span.flatpickr-weekday {
    font-size: 12px;
}

.weighing-filter-date-fields .flatpickr-day {
    color: #dbe7f5;
    border-radius: 10px;
}

.weighing-filter-date-fields .flatpickr-day.prevMonthDay,
.weighing-filter-date-fields .flatpickr-day.nextMonthDay {
    visibility: hidden;
    pointer-events: none;
}

.weighing-filter-date-fields .flatpickr-day:hover,
.weighing-filter-date-fields .flatpickr-day:focus {
    background: rgba(45, 212, 191, 0.14);
    border-color: rgba(45, 212, 191, 0.14);
}

.weighing-filter-date-fields .flatpickr-day.selected,
.weighing-filter-date-fields .flatpickr-day.startRange,
.weighing-filter-date-fields .flatpickr-day.endRange {
    background: #0f766e;
    border-color: #0f766e;
    color: #ecfeff;
}

.weighing-filter-date-fields .flatpickr-day.inRange {
    background: rgba(45, 212, 191, 0.18);
    border-color: rgba(45, 212, 191, 0.12);
    color: #ecfeff;
    box-shadow: none;
}

.weighing-filter-date-fields .flatpickr-day.today {
    border-color: rgba(45, 212, 191, 0.45);
}

.weighing-filter-date-fields .flatpickr-prev-month,
.weighing-filter-date-fields .flatpickr-next-month {
    fill: #dbe7f5;
}

.whitelist-date-picker-calendar.flatpickr-calendar {
    border: 1px solid rgba(255, 255, 255, .12);
    background: #132033;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.32);
    color: #e5eef8;
}

.whitelist-date-picker-calendar.flatpickr-calendar::before,
.whitelist-date-picker-calendar.flatpickr-calendar::after {
    display: none;
}

.whitelist-date-picker-calendar .flatpickr-current-month .numInputWrapper {
    width: 5ch;
    min-width: 5ch;
    padding-right: 0;
}

.whitelist-date-picker-calendar .flatpickr-current-month .numInputWrapper span {
    display: none;
}

.whitelist-date-picker-calendar .flatpickr-day {
    border-radius: 999px;
}

.whitelist-date-picker-calendar .flatpickr-day.selected,
.whitelist-date-picker-calendar .flatpickr-day.selected:hover,
.whitelist-date-picker-calendar .flatpickr-day.selected:focus {
    background: #0f766e;
    border-color: #2dd4bf;
    color: #ecfeff;
}

.whitelist-date-picker-calendar .flatpickr-day.flatpickr-disabled,
.whitelist-date-picker-calendar .flatpickr-day.flatpickr-disabled:hover,
.whitelist-date-picker-calendar .flatpickr-day.flatpickr-disabled:focus {
    background: transparent;
    border-color: transparent;
    color: rgba(219, 231, 245, 0.28);
    cursor: not-allowed;
}

@media (min-width: 1280px) {
    .weighing-filter-bar.desktop-compact {
        grid-template-columns:
            minmax(132px, 148px)
            minmax(132px, 148px)
            minmax(132px, 148px)
            minmax(164px, 180px)
            minmax(0, 1fr)
            auto;
    }

    .weighing-filter-bar.operation-filter-bar.desktop-compact {
        grid-template-columns:
            minmax(88px, 0.8fr)
            minmax(116px, 1fr)
            minmax(145px, 1.2fr)
            minmax(132px, 1fr)
            minmax(132px, 1fr)
            minmax(130px, 0.95fr)
            auto;
    }

    .operation-filter-bar .actions {
        justify-content: flex-end;
        min-width: max-content;
    }
}

.weighing-pagination {
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.icon-action-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, .45);
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.icon-action-btn:hover {
    background: rgba(148, 163, 184, .16);
    color: #fff;
}

.icon-action-btn.weighing-advanced-filters-toggle {
    width: 40px;
    height: 40px;
    color: #dbe7f5;
}

.weighing-status-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.needs-weighing-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.needs-weighing-indicator {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .45);
    cursor: help;
}

.needs-weighing-indicator.is-true {
    color: #86efac;
    background: rgba(34, 197, 94, .14);
    border-color: rgba(74, 222, 128, .5);
}

.needs-weighing-indicator.is-false {
    color: #fca5a5;
    background: rgba(239, 68, 68, .14);
    border-color: rgba(248, 113, 113, .55);
}

.needs-weighing-wrap:hover .debug-id-tooltip {
    display: inline-block;
}

.weighing-actions-row {
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.weighing-row-menu {
    position: relative;
}

.weighing-row-menu-toggle {
    font-size: 18px;
}

.weighing-row-menu-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 168px;
    width: max-content;
    max-width: calc(100vw - 24px);
    display: none;
    flex-direction: column;
    padding: 6px;
    border: 1px solid rgba(148, 163, 184, .3);
    border-radius: 10px;
    background: #0f172a;
    box-shadow: 0 14px 24px rgba(2, 6, 23, .4);
    z-index: 5;
}

.weighing-row-menu.open .weighing-row-menu-panel {
    display: flex;
    z-index: 1200;
}

.weighing-row-menu.open-upward .weighing-row-menu-panel {
    top: auto;
    bottom: calc(100% + 6px);
}

.weighing-row-menu.fixed-menu .weighing-row-menu-panel {
    position: fixed;
    top: var(--menu-top, auto);
    right: auto;
    bottom: auto;
    left: var(--menu-left, auto);
    z-index: 60;
}

.weighing-row-menu-item {
    width: 100%;
    display: block;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #e5e7eb;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    font: inherit;
}

.weighing-row-menu-item:hover {
    background: rgba(148, 163, 184, .14);
}

.weighing-row-menu-item.danger {
    color: #fca5a5;
}

.weighing-row-menu-item.danger:hover {
    background: rgba(239, 68, 68, .16);
    color: #fecaca;
}

.operation-select-checkbox {
    width: 15px;
    height: 15px;
    margin: 0;
    vertical-align: middle;
    cursor: pointer;
    accent-color: #3b82f6;
    opacity: .9;
}

.operation-select-checkbox:hover {
    opacity: 1;
}

.operation-select-checkbox:focus-visible {
    outline: 2px solid rgba(96, 165, 250, .65);
    outline-offset: 2px;
    border-radius: 3px;
}

.excel-export-btn {
    color: #22c55e;
    border-color: rgba(34, 197, 94, .65);
    background: rgba(34, 197, 94, .08);
}

.excel-export-btn:hover {
    color: #dcfce7;
    border-color: rgba(34, 197, 94, .95);
    background: rgba(34, 197, 94, .22);
}

.pdf-export-btn {
    color: #f87171;
    border-color: rgba(248, 113, 113, .65);
    background: rgba(239, 68, 68, .08);
}

.pdf-export-btn:hover {
    color: #fee2e2;
    border-color: rgba(248, 113, 113, .95);
    background: rgba(239, 68, 68, .22);
}

.export-report-toolbar .weighing-row-menu-panel {
    min-width: 220px;
}

.operation-toast-root {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1200;
    pointer-events: none;
}

.operation-toast {
    max-width: min(420px, calc(100vw - 32px));
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(248, 113, 113, .55);
    background: rgba(127, 29, 29, .92);
    color: #fee2e2;
    box-shadow: 0 10px 24px rgba(2, 6, 23, .42);
    transform: translateY(-8px);
    opacity: 0;
    transition: transform .2s ease, opacity .2s ease;
    font-size: 13px;
    line-height: 1.35;
}

.operation-toast.success {
    border-color: rgba(34, 197, 94, .55);
    background: rgba(20, 83, 45, .92);
    color: #dcfce7;
}

.operation-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.pdf-download-btn {
    color: #f87171;
    border-color: rgba(248, 113, 113, .65);
    background: rgba(248, 113, 113, .08);
    text-decoration: none;
}

.pdf-download-btn:hover {
    color: #fee2e2;
    border-color: rgba(248, 113, 113, .95);
    background: rgba(248, 113, 113, .22);
}

.cell-main {
    font-weight: 600;
}

.weighing-history-weight-trigger {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}

.weighing-history-weight-trigger:hover,
.weighing-history-weight-trigger:focus-visible {
    color: #93c5fd;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.weighing-history-weight-trigger:focus-visible {
    outline: 2px solid rgba(96, 165, 250, .75);
    outline-offset: 3px;
    border-radius: 3px;
}

.weighing-source-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 5px;
    vertical-align: -2px;
    color: var(--wb-muted);
    cursor: help;
}

.weighing-source-icon-scale {
    color: #60a5fa;
}

.weighing-source-icon-manual {
    color: #fbbf24;
}

.weighing-history-image-wrap {
    margin-left: 6px;
    vertical-align: middle;
}

.weighing-history-image-btn {
    width: 24px;
    height: 24px;
    padding: 4px;
    color: #93c5fd;
}

.weighing-history-image-btn svg {
    display: block;
    width: 15px;
    height: 15px;
}

.weighing-history-image-wrap .debug-id-tooltip {
    left: auto;
    right: 0;
    z-index: 5;
}

.cell-meta {
    display: block;
    color: var(--wb-muted);
    font-size: 12px;
    margin-top: 2px;
}

.weighing-deduction-preview {
    color: #f87171;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 2px;
}

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

.debug-id-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.debug-id-badge {
    font-size: 11px;
    line-height: 1;
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, .45);
    border-radius: 999px;
    padding: 2px 6px;
    cursor: help;
}

.debug-id-tooltip {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 4;
    display: none;
    max-width: 420px;
    white-space: nowrap;
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.debug-id-wrap:hover .debug-id-tooltip {
    display: inline-block;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
}

.status-dot.status-pending {
    background: #fbbf24;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, .2);
}

.status-dot.status-ready {
    background: #34d399;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, .2);
}

.weighing-direction-group {
    border: 0;
    padding: 0;
    margin: 0;
}

.segmented-choice {
    display: inline-flex;
    gap: 4px;
}

.segmented-choice label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    cursor: pointer;
}

/* The global `input` rule (100% width, 50px height, border, background) must not apply to these radios. */
.segmented-choice input[type="radio"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    accent-color: var(--wb-primary);
}

.segmented-choice input[type="radio"]:focus {
    box-shadow: none;
}

/* keyboard focus is shown on the whole choice instead */
.segmented-choice label:has(input:focus-visible) {
    outline: 2px solid var(--wb-ring);
    outline-offset: 2px;
}

.segmented-choice label:has(input:checked) {
    border-color: var(--wb-primary);
    background: rgba(37, 99, 235, .18);
}

.customer-waybiller-block {
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    padding: 10px 12px;
    display: grid;
    gap: 8px;
}

/* display:grid above would otherwise override the hidden attribute used to switch kinds / fields */
.customer-waybiller-block[hidden],
.customer-waybiller-block [hidden] {
    display: none !important;
}

.customer-waybiller-block legend {
    padding: 0 6px;
    font-weight: 600;
}

/* Weighing form: only the origin/destination box gets a frame, not the wrapper around it */
#weighing-cust-waybiller-block {
    border: 0;
    padding: 0;
}

#weighing-cust-waybiller-block > legend {
    display: none;
}

.compact-weighing-price-field {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
}

.compact-weighing-price-field.is-estimated #weighing-price-total {
    opacity: .7;
    font-style: italic;
}

.weighing-special-price-toggle {
    gap: 8px;
    cursor: pointer;
}

.waybill-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    color: #fff;
    background: #64748b;
}

.waybill-badge.waybill-sent { background: #059669; }
.waybill-badge.waybill-failed { background: #dc2626; }
.waybill-badge.waybill-cancelled { background: #475569; text-decoration: line-through; }
.waybill-badge.waybill-changed { outline: 2px solid #f59e0b; }

.btn {
    background: #334155;
    color: white;
}

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

.weighing-modal-content {
    width: min(780px, 100%);
    max-height: min(100%, calc(100dvh - 40px));
    background: #111827;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    padding: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.weighing-history-modal-content {
    width: min(900px, 100%);
}

.weighing-datetime-modal {
    z-index: 1100;
    cursor: default;
}

.weighing-datetime-modal-content {
    width: min(340px, 100%);
    align-items: stretch;
}

.weighing-datetime-modal-subtitle {
    margin: 0 0 10px;
}

.weighing-datetime-picker-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.weighing-datetime-picker-input,
.weighing-datetime-native-picker {
    width: 100%;
    height: 42px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    background: #0f172a;
    color: var(--wb-text);
    font-size: 15px;
}

.weighing-datetime-picker-input:focus,
.weighing-datetime-native-picker:focus {
    border-color: rgba(45, 212, 191, .7);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, .14);
}

.weighing-datetime-picker-wrap .flatpickr-calendar {
    align-self: center;
    width: 100%;
    max-width: 390px;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.32);
    background: #132033;
    color: #e5eef8;
}

.weighing-datetime-picker-wrap .flatpickr-calendar::before,
.weighing-datetime-picker-wrap .flatpickr-calendar::after {
    display: none;
}

.weighing-datetime-picker-wrap .flatpickr-innerContainer,
.weighing-datetime-picker-wrap .flatpickr-rContainer,
.weighing-datetime-picker-wrap .flatpickr-days,
.weighing-datetime-picker-wrap .dayContainer,
.weighing-datetime-picker-wrap .flatpickr-weekdays,
.weighing-datetime-picker-wrap .flatpickr-weekdaycontainer {
    min-width: 0;
    max-width: 100%;
}

.weighing-datetime-picker-wrap .flatpickr-months {
    align-items: center;
    margin-bottom: 4px;
}

.weighing-datetime-picker-wrap .flatpickr-months .flatpickr-month,
.weighing-datetime-picker-wrap .flatpickr-weekdays,
.weighing-datetime-picker-wrap span.flatpickr-weekday {
    background: transparent;
    color: #dbe7f5;
}

.weighing-datetime-picker-wrap .flatpickr-current-month {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.weighing-datetime-picker-wrap .flatpickr-current-month .flatpickr-monthDropdown-months,
.weighing-datetime-picker-wrap .flatpickr-current-month input.cur-year {
    height: auto;
    color: #f8fbff;
}

.weighing-datetime-picker-wrap .flatpickr-current-month .flatpickr-monthDropdown-months {
    width: auto;
    margin-right: 6px;
    padding: 0 14px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 14px;
    box-shadow: none;
}

.weighing-datetime-picker-wrap .flatpickr-current-month .numInputWrapper {
    position: relative;
    width: 6ch;
    min-width: 6ch;
    padding-right: 16px;
}

.weighing-datetime-picker-wrap .flatpickr-current-month input.cur-year {
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 14px;
    box-shadow: none;
}

.weighing-datetime-picker-wrap span.flatpickr-weekday {
    font-size: 12px;
}

.weighing-datetime-picker-wrap .flatpickr-day {
    color: #dbe7f5;
    border-radius: 10px;
}

.weighing-datetime-picker-wrap .flatpickr-day.prevMonthDay,
.weighing-datetime-picker-wrap .flatpickr-day.nextMonthDay {
    visibility: hidden;
    pointer-events: none;
}

.weighing-datetime-picker-wrap .flatpickr-day:hover,
.weighing-datetime-picker-wrap .flatpickr-day:focus {
    background: rgba(45, 212, 191, 0.14);
    border-color: rgba(45, 212, 191, 0.14);
}

.weighing-datetime-picker-wrap .flatpickr-day.selected,
.weighing-datetime-picker-wrap .flatpickr-day.startRange,
.weighing-datetime-picker-wrap .flatpickr-day.endRange {
    background: #0f766e;
    border-color: #0f766e;
    color: #ecfeff;
}

.weighing-datetime-picker-wrap .flatpickr-day.today {
    border-color: rgba(45, 212, 191, 0.45);
}

.weighing-datetime-picker-wrap .flatpickr-prev-month,
.weighing-datetime-picker-wrap .flatpickr-next-month {
    fill: #dbe7f5;
}

.weighing-datetime-picker-wrap .flatpickr-time {
    border-top: 1px solid rgba(255, 255, 255, .1);
    color: #dbe7f5;
    background: transparent;
}

.weighing-datetime-picker-wrap .flatpickr-time input,
.weighing-datetime-picker-wrap .flatpickr-time .flatpickr-time-separator,
.weighing-datetime-picker-wrap .flatpickr-time .flatpickr-am-pm {
    height: auto;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #f8fbff;
    font-size: 14px;
    box-shadow: none;
}

.weighing-datetime-picker-wrap .flatpickr-time input:focus,
.weighing-datetime-picker-wrap .flatpickr-time .flatpickr-am-pm:focus {
    background: rgba(45, 212, 191, .12);
}

.weighing-datetime-picker-wrap .flatpickr-time .numInputWrapper span.arrowUp {
    border-bottom-color: #dbe7f5;
}

.weighing-datetime-picker-wrap .flatpickr-time .numInputWrapper span.arrowDown {
    border-top-color: #dbe7f5;
}

.weighing-datetime-picker-wrap .flatpickr-time .numInputWrapper span {
    width: 18px;
    opacity: 1;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, .1);
    border-radius: 0;
    background: rgba(148, 163, 184, .08);
    cursor: pointer;
    transition: background-color .15s ease;
}

.weighing-datetime-picker-wrap .flatpickr-time .numInputWrapper span:hover {
    background: rgba(45, 212, 191, .22);
}

.weighing-datetime-picker-wrap .flatpickr-time .numInputWrapper span.arrowUp::after {
    border-bottom-color: #dbe7f5;
}

.weighing-datetime-picker-wrap .flatpickr-time .numInputWrapper span.arrowDown::after {
    border-top-color: #dbe7f5;
}

.weighing-datetime-modal-actions {
    justify-content: flex-end;
    margin-top: 14px;
}

.weighing-history-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
}

.weighing-history-body {
    width: 100%;
    min-width: 0;
}

.weighing-history-context {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    width: 100%;
    box-sizing: border-box;
    gap: 0;
    margin-bottom: 12px;
    padding: 10px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    background: rgba(15, 23, 42, .45);
}

.weighing-history-context-item {
    flex: 1 1 0;
    min-width: 145px;
    padding: 0 12px;
    border-right: 1px solid rgba(255, 255, 255, .08);
}

.weighing-history-context-item:first-child {
    padding-left: 0;
}

.weighing-history-context-item:last-child {
    padding-right: 0;
    border-right: 0;
}

.weighing-history-context-label {
    display: block;
    overflow: hidden;
    color: var(--wb-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weighing-history-context-item > strong {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weighing-history-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: rgba(15, 23, 42, .45);
}

.weighing-history-table th,
.weighing-history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

.weighing-history-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--wb-muted);
    font-weight: 600;
    white-space: nowrap;
    background: #111827;
}

.weighing-history-table td {
    color: var(--wb-text);
}

.weighing-history-table tbody tr:last-child td {
    border-bottom: 0;
}

.weighing-history-table tbody tr.is-current td {
    background: rgba(37, 99, 235, .1);
}

.weighing-history-table-weight {
    white-space: nowrap;
}

.weighing-history-table-weight > strong {
    font-size: 16px;
}

.weighing-history-table-datetime {
    white-space: nowrap;
}

.weighing-history-current {
    display: inline-block;
    margin-left: 7px;
    padding: 2px 7px;
    border-radius: 999px;
    color: #bfdbfe;
    background: rgba(59, 130, 246, .2);
    font-size: 11px;
    font-weight: 700;
}

.compact-weighing-form {
    display: grid;
    gap: 12px;
}

.compact-weighing-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.compact-weighing-left,
.compact-weighing-right {
    display: grid;
    gap: 12px;
}

.compact-weighing-section-divider {
    height: 1px;
    background: rgba(255, 255, 255, .08);
    margin: 2px 0;
}

.compact-weighing-scale-card {
    padding: 0;
    background: transparent;
}

.compact-weighing-scale-inner {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 12px;
    padding: 10px 12px 12px;
    background: linear-gradient(180deg, rgba(24, 33, 51, .96), rgba(20, 28, 43, .96));
}

.compact-weighing-scale-error {
    border-radius: 12px;
}

.compact-weighing-scale-top,
.compact-weighing-scale-bottom {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.compact-weighing-scale-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.compact-weighing-scale-tab {
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .04);
    color: #cbd5e1;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.compact-weighing-scale-tab.active {
    background: rgba(37, 99, 235, .18);
    border-color: rgba(96, 165, 250, .3);
    color: #eff6ff;
}

.compact-weighing-scale-name {
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: 12px;
}

.compact-weighing-scale-display {
    font-size: 22px;
    margin-top: 2px;
    align-items: baseline;
}

.compact-weighing-scale-display #weighing-active-value {
    line-height: 1;
    font-size: 1.9em;
    font-weight: 800;
}

.compact-weighing-scale-display .unit {
    font-size: .9em;
    color: #cbd5e1;
}

.compact-weighing-scale-timestamp {
    display: grid;
    justify-items: end;
    gap: 2px;
    text-align: right;
    margin-top: 6px;
}

.compact-weighing-scale-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.compact-weighing-scale-dates {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin-top: 6px;
    min-width: 0;
}

.compact-weighing-mass-stack {
    display: grid;
    gap: 0;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 12px;
    background: rgba(15, 23, 42, .32);
    overflow: hidden;
}

.compact-weighing-mass-field {
    margin: 0;
    padding: 10px 12px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.compact-weighing-mass-field:last-child {
    border-bottom: none;
}

.compact-weighing-mass-row {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.compact-weighing-mass-row > label {
    margin: 0;
}

.compact-weighing-datetime-editor {
    grid-column: 2;
}

.compact-weighing-scale-date-entry {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    white-space: nowrap;
}

.compact-weighing-scale-date-entry > .muted.small {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    line-height: 1.2;
}

.compact-weighing-scale-date-entry > .needs-weighing-wrap {
    flex: 0 0 auto;
}

.compact-weighing-scale-date-entry .debug-id-tooltip {
    left: auto;
    right: 0;
    z-index: 1201;
}

.compact-weighing-datetime-edit {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--wb-muted);
}

.compact-weighing-datetime-edit:hover {
    background: rgba(148, 163, 184, .16);
    color: #fff;
}

.compact-weighing-datetime-editor {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.compact-weighing-inline-input {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 170px;
}

.compact-weighing-inline-input input {
    margin-bottom: 0;
}

.compact-weighing-inline-input input[type="number"] {
    min-width: 0;
}

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

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

.compact-weighing-inline-input span {
    color: var(--wb-muted);
    font-weight: 700;
}

.compact-weighing-inline-actions {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.compact-weighing-net-field {
    background: rgba(37, 99, 235, .08);
}

.compact-weighing-net-panel {
    display: grid;
    gap: 4px;
}

.compact-weighing-mass-row-net {
    align-items: start;
}

.compact-weighing-net-caption {
    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;
    color: #fb923c;
}

.compact-weighing-net-caption.is-hidden {
    display: none;
}

.compact-weighing-net-value {
    font-size: 28px;
    line-height: 1.1;
    font-weight: 800;
    color: #60a5fa;
    margin-bottom: 4px;
}

.compact-weighing-net-formula {
    font-size: 12px;
    line-height: 1.35;
    color: #94a3b8;
}

.compact-weighing-net-field.is-estimated {
    background: rgba(249, 115, 22, .08);
}

.compact-weighing-net-field.is-estimated .compact-weighing-net-panel {
    padding: 10px 12px;
    border: 1px dashed rgba(251, 146, 60, .45);
    border-radius: 10px;
    background: rgba(255, 255, 255, .02);
}

.compact-weighing-net-field.is-estimated .compact-weighing-net-value {
    color: #fb923c;
    margin-bottom: 0;
}

.weighing-progress-content {
    width: min(420px, 100%);
    background: #111827;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .15);
    border-top-color: #60a5fa;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (min-width: 1200px) {
    .weighing-filter-bar {
        grid-template-columns:
            repeat(3, minmax(128px, 148px))
            minmax(164px, 180px)
            minmax(0, 1fr)
            auto;
        align-items: end;
    }

    .weighing-filter-secondary {
        grid-template-columns: repeat(6, minmax(128px, 148px));
        justify-content: start;
    }
}

@media (min-width: 900px) {
    .weighing-master-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 900px) {
    .weight-grid {
        grid-template-columns: 1fr 1fr;
    }

    .weight-grid.single-scale {
        grid-template-columns: 1fr;
    }

    .weight-scale-group:has(.weight-camera-preview:not(.is-hidden)) {
        grid-template-columns: minmax(0, 1fr) minmax(440px, 580px);
    }

    .weight-grid > .weight-scale-group:has(.weight-camera-preview:not(.is-hidden)) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .icon-action-btn.mobile-filters-toggle {
        display: inline-flex;
    }

    .mobile-collapsible-filters.is-mobile-collapsed {
        display: none;
    }

    #weighing-filter-form #weighing-advanced-filters-toggle {
        display: none;
    }

    #weighing-filter-form:not(.is-mobile-collapsed) #weighing-advanced-filters {
        display: grid;
    }

    #weighing-modal,
    #weighing-history-modal,
    .weighing-datetime-modal {
        align-items: flex-start;
        overflow-y: auto;
        padding: 8px;
        cursor: default;
    }

    .weighing-modal-content {
        width: 100%;
        max-height: calc(100dvh - 16px);
        margin: 0;
        padding: 10px;
    }

    #weighing-modal .compact-weighing-form,
    #weighing-modal .compact-weighing-layout,
    #weighing-modal .compact-weighing-left,
    #weighing-modal .compact-weighing-right {
        gap: 10px;
    }

    #weighing-modal .compact-weighing-inline-input {
        max-width: none;
    }

    #weighing-modal .compact-weighing-scale-inner {
        padding: 10px;
    }

    #weighing-modal .compact-weighing-scale-display {
        font-size: 20px;
    }

    #weighing-history-modal .weighing-history-modal-content {
        max-height: calc(100dvh - 16px);
        padding: 10px;
    }

    #weighing-history-modal .weighing-history-modal-content > .row,
    .weighing-datetime-modal .weighing-datetime-modal-content > .row {
        gap: 8px;
    }

    #weighing-history-modal .weighing-history-modal-content > .row h3,
    .weighing-datetime-modal .weighing-datetime-modal-content > .row h3 {
        min-width: 0;
        font-size: 18px;
        line-height: 1.25;
    }

    #weighing-history-modal .weighing-history-context {
        margin-bottom: 8px;
        padding: 8px;
    }

    #weighing-history-modal .weighing-history-context-item {
        min-width: 132px;
        padding: 0 8px;
    }

    #weighing-history-modal .weighing-history-table th,
    #weighing-history-modal .weighing-history-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    #weighing-history-modal .weighing-history-table {
        min-width: 650px;
    }

    .weighing-datetime-modal-content {
        width: min(366px, calc(100vw - 16px));
        max-height: calc(100dvh - 16px);
        padding: 12px;
    }

    .weighing-datetime-picker-wrap .flatpickr-calendar {
        width: min(340px, 100%);
        max-width: 100%;
    }

    .weighing-filter-bar {
        grid-template-columns: 1fr;
    }

    .weighing-filter-secondary {
        grid-template-columns: 1fr;
    }

    .weighing-filter-date-row {
        flex-direction: column;
        align-items: stretch;
    }

    .weighing-filter-date-fields {
        position: static;
        width: auto;
        min-width: 0;
        grid-template-columns: 1fr;
    }

    .weighing-filter-date-mode-group {
        width: auto;
        flex: 0 0 auto;
    }

    .weighing-filter-presets {
        flex-wrap: wrap;
    }

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

    .compact-weighing-layout {
        grid-template-columns: 1fr;
    }

    .compact-weighing-scale-bottom {
        align-items: end;
    }

    .compact-weighing-scale-actions,
    .compact-weighing-scale-dates {
        grid-template-columns: 1fr;
    }

    .compact-weighing-mass-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .compact-weighing-datetime-editor {
        grid-column: 1;
    }

    .compact-weighing-row-meta {
        text-align: left;
    }
}

/* Third-party id (e.g. Pistrik) under the document number: short, full value in title, click copies */
button.partner-ref {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    cursor: copy;
    text-align: left;
    max-width: 150px;
    overflow-wrap: anywhere;  /* full 36-char id wraps instead of widening the table */
}

button.partner-ref.copied {
    color: #6ee7b7;
}

/* Käsimüük + maksemeetod under the price, one under the other (the column is too narrow for both) */
.weighing-cash-sale-row {
    display: grid;
    gap: 8px;
}

#weighing-payment-method-group[hidden] {
    display: none;
}

.compact-weighing-scale-tabs[hidden] {
    display: none;
}
