.camera-roi-editor {
    display: grid;
    gap: 1rem;
}

.camera-roi-editor-trigger {
    cursor: pointer;
}

.camera-roi-editor__toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
}

.camera-roi-editor__modes,
.camera-roi-editor__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.camera-roi-editor__button {
    align-items: center;
    background: #fff;
    border: 1px solid #d8dde3;
    border-radius: 0.55rem;
    color: #313a49;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.875rem;
    font-weight: 600;
    min-height: 2.25rem;
    padding: 0.45rem 0.75rem;
}

.camera-roi-editor__button:hover,
.camera-roi-editor__button.is-active {
    border-color: #ff4f12;
    color: #d83b00;
}

.camera-roi-editor__button.is-active {
    background: #fff1eb;
}

.camera-roi-editor__viewport {
    display: flex;
    justify-content: center;
    overflow: auto;
    width: 100%;
}

.camera-roi-editor__stage {
    cursor: crosshair;
    display: inline-block;
    line-height: 0;
    max-width: 100%;
    position: relative;
    touch-action: none;
    user-select: none;
}

.camera-roi-editor__image {
    border-radius: 0.75rem;
    display: block;
    height: auto;
    max-height: 65vh;
    max-width: 100%;
    object-fit: contain;
    pointer-events: none;
    width: auto;
}

.camera-roi-editor__roi {
    border: 3px solid;
    box-sizing: border-box;
    box-shadow: 0 0 0 1px rgb(255 255 255 / 90%), 0 2px 10px rgb(0 0 0 / 28%);
    cursor: move;
    line-height: normal;
    position: absolute;
}

.camera-roi-editor__roi.is-inactive {
    cursor: default;
    opacity: 0.55;
    pointer-events: none;
}

.camera-roi-editor__roi.is-plate {
    border-color: #7be255;
}

.camera-roi-editor__roi.is-transport {
    border-color: #8b5cf6;
}

.camera-roi-editor__label {
    border-radius: 0.3rem;
    color: #101828;
    font-size: 0.75rem;
    font-weight: 800;
    left: 0.25rem;
    line-height: 1;
    padding: 0.25rem 0.4rem;
    position: absolute;
    top: 0.25rem;
}

.camera-roi-editor__roi.is-plate .camera-roi-editor__label {
    background: #7be255;
}

.camera-roi-editor__roi.is-transport .camera-roi-editor__label {
    background: #a78bfa;
}

.camera-roi-editor__handle {
    background: #fff;
    border: 2px solid currentColor;
    border-radius: 999px;
    height: 0.85rem;
    padding: 0;
    position: absolute;
    transform: translate(-50%, -50%);
    width: 0.85rem;
}

.camera-roi-editor__handle.is-nw { cursor: nwse-resize; left: 0; top: 0; }
.camera-roi-editor__handle.is-n { cursor: ns-resize; left: 50%; top: 0; }
.camera-roi-editor__handle.is-ne { cursor: nesw-resize; left: 100%; top: 0; }
.camera-roi-editor__handle.is-e { cursor: ew-resize; left: 100%; top: 50%; }
.camera-roi-editor__handle.is-se { cursor: nwse-resize; left: 100%; top: 100%; }
.camera-roi-editor__handle.is-s { cursor: ns-resize; left: 50%; top: 100%; }
.camera-roi-editor__handle.is-sw { cursor: nesw-resize; left: 0; top: 100%; }
.camera-roi-editor__handle.is-w { cursor: ew-resize; left: 0; top: 50%; }

.camera-roi-editor__coordinates {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.camera-roi-editor__coordinate label {
    color: #5d6571;
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.camera-roi-editor__coordinate input {
    background: #fff;
    border: 1px solid #d8dde3;
    border-radius: 0.55rem;
    color: #101828;
    font-size: 0.875rem;
    padding: 0.55rem 0.65rem;
    width: 100%;
}

.camera-roi-editor__hint,
.camera-roi-editor__warning {
    border-radius: 0.6rem;
    font-size: 0.85rem;
    line-height: 1.45;
    padding: 0.7rem 0.85rem;
}

.camera-roi-editor__hint {
    background: #f3f5f7;
    color: #5d6571;
}

.camera-roi-editor__warning {
    background: #fff6df;
    color: #7a5200;
}

.camera-roi-editor__snapshot-time {
    color: #727a85;
    font-size: 0.8rem;
}

.dark .camera-roi-editor__button,
.dark .camera-roi-editor__coordinate input {
    background: #171b22;
    border-color: #3c424c;
    color: #f8f8f8;
}

.dark .camera-roi-editor__button.is-active {
    background: #462011;
    border-color: #ff7140;
    color: #ffb397;
}

.dark .camera-roi-editor__hint {
    background: #252a33;
    color: #c9ced5;
}

.dark .camera-roi-editor__warning {
    background: #3d3217;
    color: #ffe4a0;
}

@media (max-width: 640px) {
    .camera-roi-editor__coordinates {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
