:root {
    --sm-primary: #111827;
    --sm-accent: #f97316;
    --sm-accent-soft: rgba(249, 115, 22, 0.12);
    --sm-border: #d7dde5;
    --sm-bg: #f5f7fb;
    --sm-surface: #ffffff;
    --sm-text: #1f2937;
    --sm-muted: #6b7280;
    --sm-radius: 18px;
}

html, body {
    background: var(--sm-bg);
    color: var(--sm-text);
    min-height: 100%;
}

body.sm-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sm-header {
    background: linear-gradient(135deg, var(--sm-primary), #1f2937);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sm-header .uk-navbar-container {
    background: transparent;
}

.sm-user-pill {
    margin-right: 12px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    font-size: 12px;
    letter-spacing: .04em;
}

.sm-main {
    padding-top: 28px;
    padding-bottom: 32px;
}

.sm-card,
.uk-card.sm-card {
    background: var(--sm-surface);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.sm-card + .sm-card {
    margin-top: 20px;
}

.sm-section-title {
    margin: 0 0 6px;
    font-size: 1.15rem;
    font-weight: 700;
}

.sm-muted {
    color: var(--sm-muted);
}

.sm-grid-gap {
    gap: 16px;
}

.sm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.sm-login-wrap {
    max-width: 460px;
    margin: 8vh auto;
}

.sm-frame-preview {
    border: 1px dashed var(--sm-border);
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 130px;
    min-height: 90px;
}

.sm-frame-preview img {
    max-width: 100%;
    max-height: 120px;
}

.sm-editor-layout {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) 320px;
    gap: 18px;
}

.sm-preview-card {
    min-height: 70vh;
}

.sm-preview-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.preview-frame {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--sm-border);
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.image-layer-fg {
    position: absolute;
    top: 0;
    left: 0;
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: top left;
}

.watermark-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center;
}

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

.sm-format-item {
    padding: 12px 14px;
    border: 1px solid var(--sm-border);
    border-radius: 12px;
    cursor: pointer;
    background: #fff;
}

.sm-format-item.is-active {
    border-color: var(--sm-accent);
    background: var(--sm-accent-soft);
}

.sm-format-item strong,
.sm-format-item span {
    display: block;
}

.sm-table-wrap {
    overflow-x: auto;
}

.sm-table-wrap table {
    width: 100%;
}

.sm-table-wrap th,
.sm-table-wrap td {
    vertical-align: middle;
}

.sm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.sm-badge.is-admin { background: rgba(34, 197, 94, 0.15); color: #166534; }
.sm-badge.is-editor { background: rgba(59, 130, 246, 0.14); color: #1d4ed8; }
.sm-badge.is-inactive { background: rgba(239,68,68,.12); color: #b91c1c; }

@media (max-width: 960px) {
    .sm-editor-layout {
        grid-template-columns: 1fr;
    }
    .sm-preview-card {
        min-height: auto;
    }
}
