.noesia-swa-widgets {
    --widgets-bg: #ffffff;
    --widgets-border: rgba(15, 23, 42, 0.08);
    --widgets-border-strong: rgba(15, 23, 42, 0.14);
    --widgets-text: #111827;
    --widgets-muted: #6b7280;
    --widgets-soft: #f8fafc;
    --widgets-accent: #2563eb;
    --widgets-accent-soft: rgba(37, 99, 235, 0.12);
    --widgets-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.noesia-swa-widgets__topbar {
    margin: 0 0 18px;
}

.noesia-swa-widgets__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.noesia-swa-widgets__tab {
    border: 1px solid var(--widgets-border);
    background: var(--widgets-bg);
    color: var(--widgets-text);
    border-radius: 999px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.noesia-swa-widgets__tab:hover,
.noesia-swa-widgets__tab:focus {
    border-color: var(--widgets-accent);
    outline: none;
}

.noesia-swa-widgets__tab.is-active {
    background: var(--widgets-accent);
    color: #fff;
    border-color: var(--widgets-accent);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.noesia-swa-widgets__panel {
    display: none;
}

.noesia-swa-widgets__panel.is-active {
    display: block;
}

.noesia-swa-widgets__grid {
    display: grid;
    gap: 18px;
}

.noesia-swa-widgets__grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.noesia-swa-widgets__card {
    background: var(--widgets-bg);
    border: 1px solid var(--widgets-border);
    border-radius: 20px;
    box-shadow: var(--widgets-shadow);
    padding: 20px;
}

.noesia-swa-widgets__card--wide {
    grid-column: 1 / -1;
}

.noesia-swa-widgets__card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 18px;
}

.noesia-swa-widgets__card-head h3 {
    margin: 0 0 4px;
    color: var(--widgets-text);
    font-size: 17px;
}

.noesia-swa-widgets__card-head p,
.noesia-swa-widgets__meta,
.noesia-swa-widgets__status {
    margin: 0;
    color: var(--widgets-muted);
    font-size: 13px;
}

.noesia-swa-widgets__field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 0 0 16px;
}

.noesia-swa-widgets__field-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.noesia-swa-widgets__field-row span {
    font-size: 12px;
    color: var(--widgets-muted);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.noesia-swa-widgets__field-row input,
.noesia-swa-widgets__field-row select,
.noesia-swa-widgets__textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--widgets-border-strong);
    background: #fff;
    color: var(--widgets-text);
    min-height: 42px;
    padding: 10px 12px;
    box-sizing: border-box;
}

.noesia-swa-widgets__textarea {
    min-height: 160px;
    resize: vertical;
    margin: 0 0 12px;
}

.noesia-swa-widgets__button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 14px;
}

.noesia-swa-widgets__result {
    border: 1px solid var(--widgets-border);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 16px;
    padding: 16px;
    min-height: 58px;
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--widgets-text);
}

.noesia-swa-widgets__mini-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.noesia-swa-widgets__mini-stats > div {
    background: var(--widgets-soft);
    border: 1px solid var(--widgets-border);
    border-radius: 16px;
    padding: 14px;
}

.noesia-swa-widgets__mini-stats strong {
    display: block;
    font-size: 12px;
    color: var(--widgets-muted);
    margin-bottom: 6px;
}

.noesia-swa-widgets__mini-stats span {
    display: block;
    color: var(--widgets-text);
    font-size: 18px;
    font-weight: 700;
}

.noesia-swa-widgets__mini-stats-note {
    grid-column: 1 / -1;
}

.noesia-swa-widgets__mini-stats-wide {
    grid-column: 1 / -1;
}

.noesia-swa-widgets__mini-stats-note span,
.noesia-swa-widgets__mini-stats-wide span {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.noesia-swa-widgets__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.noesia-swa-widgets__chip {
    border: 1px solid var(--widgets-border);
    background: var(--widgets-soft);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--widgets-text);
    cursor: pointer;
}

.noesia-swa-widgets__chip:hover,
.noesia-swa-widgets__chip:focus {
    border-color: var(--widgets-accent);
    outline: none;
}

.noesia-swa-widgets__swatch {
    border-radius: 18px;
    min-height: 86px;
    border: 1px solid var(--widgets-border);
    background: #4f46e5;
}

.noesia-swa-widgets__image-wrap {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.noesia-swa-widgets__image-wrap img {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border: 1px solid var(--widgets-border);
    background: #fff;
    border-radius: 16px;
}

.noesia-swa-widgets__ruler {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
}

.noesia-swa-widgets__ruler-bar {
    --ruler-cm: 37.8px;
    --ruler-mm: 3.78px;
    position: fixed;
    border: 1px solid rgba(15,23,42,0.18);
    border-radius: 12px;
    background-color: rgba(255,255,255,0.96);
    border-color: rgba(15,23,42,0.25);
    box-shadow: 0 6px 18px rgba(15,23,42,0.12);
    pointer-events: auto;
    cursor: move;
    user-select: none;
    overflow: hidden;
}

.noesia-swa-widgets__ruler-bar--horizontal {
    top: 84px;
    left: 32px;
    width: 756px;
    height: 42px;
    background-image:
        repeating-linear-gradient(to right, rgba(15,23,42,0.16) 0, rgba(15,23,42,0.16) 1px, transparent 1px, transparent var(--ruler-mm)),
        repeating-linear-gradient(to right, rgba(15,23,42,0.58) 0, rgba(15,23,42,0.58) 2px, transparent 2px, transparent var(--ruler-cm));
    background-size: auto 14px, auto 100%;
    background-position: 0 100%, 0 0;
    background-repeat: repeat;
}

.noesia-swa-widgets__ruler-bar--vertical {
    top: 132px;
    left: 32px;
    width: 46px;
    height: 756px;
    background-image:
        repeating-linear-gradient(to bottom, rgba(15,23,42,0.16) 0, rgba(15,23,42,0.16) 1px, transparent 1px, transparent var(--ruler-mm)),
        repeating-linear-gradient(to bottom, rgba(15,23,42,0.58) 0, rgba(15,23,42,0.58) 2px, transparent 2px, transparent var(--ruler-cm));
    background-size: 14px auto, 100% auto;
    background-position: 100% 0, 0 0;
    background-repeat: repeat;
}

.noesia-swa-widgets__ruler-label {
    position: absolute;
    font-size: 11px;
    color: #111827;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: rgba(255,255,255,0.9);
    border-radius: 6px;
    padding: 1px 4px;
    line-height: 1.2;
}

.noesia-swa-widgets__ruler-label--x {
    top: 4px;
    transform: translateX(2px);
}

.noesia-swa-widgets__ruler-label--y {
    left: 4px;
    transform: translateY(2px);
}

.noesia-swa-widgets__status {
    min-height: 18px;
    margin-bottom: 12px;
}

@media (max-width: 1024px) {
    .noesia-swa-widgets__grid--two,
    .noesia-swa-widgets__image-wrap {
        grid-template-columns: 1fr;
    }
}
