:root {
    --bg: #11161c;
    --panel: #191f27;
    --panel2: #202832;
    --line: #303a45;
    --text: #e4eaf1;
    --muted: #8c9aa9;
    --accent: #58ddbc;
    --accent2: #163d36;
    --danger: #ff8e94;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
    font-size: 13px;
    color: var(--text);
    background: var(--bg);
    color-scheme: dark
}

* {
    box-sizing: border-box
}

body {
    margin: 0
}

button,
input,
select,
textarea {
    font: inherit
}

button {
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--panel2);
    color: var(--text);
    border-radius: 7px;
    padding: 9px 12px;
    white-space: nowrap;
    transition: background .12s, border-color .12s
}

button:hover {
    background: #2c3743;
    border-color: #516171
}

button:disabled {
    opacity: .4;
    cursor: not-allowed
}

button.primary {
    background: var(--accent);
    color: #0a2b23;
    border-color: var(--accent);
    font-weight: 700
}

button.primary:hover {
    background: #82ebd0
}

button.secondary {
    background: #242e38
}

button.quiet {
    border-color: transparent;
    background: transparent
}

button.quiet:hover {
    background: var(--panel2)
}

button.danger {
    color: var(--danger);
    background: #3d242c;
    border-color: #58323a
}

.text-button {
    padding: 0;
    color: var(--accent);
    background: none;
    border: 0;
    font-size: 11px
}

.icon-btn {
    padding: 0 7px;
    background: none;
    font-size: 20px;
    border: 0
}

.wide {
    width: 100%
}

.grow {
    flex: 1;
    min-width: 0
}

.hidden {
    display: none !important
}

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

.small {
    font-size: 11px;
    line-height: 1.65
}

.eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
    color: var(--muted)
}

.row {
    display: flex;
    gap: 10px;
    align-items: flex-end
}

.compact {
    gap: 6px
}

.row>label {
    min-width: 0
}

.inline {
    display: flex;
    align-items: center;
    gap: 7px
}

.inline input {
    width: auto;
    margin: 0;
    accent-color: var(--accent)
}

label {
    display: block;
    line-height: 1.6;
    font-size: 12px;
    margin-bottom: 15px
}

label>input,
label>select,
label>textarea {
    margin-top: 6px
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #121920;
    color: var(--text);
    padding: 9px 10px;
    outline: none
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent)
}

textarea {
    resize: vertical
}

select {
    cursor: pointer
}

input[type=range] {
    padding: 0;
    accent-color: var(--accent)
}

a {
    color: var(--accent);
    text-decoration: none
}

h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -.7px
}

h2 {
    font-size: 19px;
    margin: 0
}

h3 {
    font-size: 14px
}

.topbar {
    height: 62px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
    background: #171e26
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -.6px
}

.brand-icon {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border: 2px solid var(--accent);
    color: var(--accent);
    border-radius: 8px;
    font-size: 20px
}

.version {
    font-size: 9px;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 2px 5px;
    border-radius: 4px;
    letter-spacing: 0
}

.header-divider,
.bottom-divider {
    width: 1px;
    height: 20px;
    background: var(--line)
}

.header-subtitle {
    font-size: 12px;
    color: var(--muted)
}

.badge {
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 5px 10px;
    color: var(--muted);
    font-size: 10px
}

.badge.online {
    color: var(--accent);
    border-color: #315b4f;
    background: #172d28
}

.badge.offline {
    color: #f1bd77
}

.user-menu {
    position: relative
}

.user-menu summary {
    font-size: 12px;
    cursor: pointer;
    list-style: none
}

.user-menu>div {
    position: absolute;
    right: 0;
    top: 28px;
    width: 170px;
    z-index: 50;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 8px;
    box-shadow: 0 15px 30px #0007
}

.user-menu a,
.user-menu button {
    display: block;
    padding: 9px;
    color: var(--text);
    width: 100%;
    text-align: left;
    background: none;
    border: 0
}

.workspace {
    height: calc(100dvh - 62px);
    display: grid;
    grid-template-columns: 238px minmax(360px, 1fr) 296px;
    min-height: 450px
}

.left-panel,
.right-panel {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0
}

.left-panel {
    border-right: 1px solid var(--line);
    padding: 18px 14px 0
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px
}

.project-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 13px;
    color: var(--muted);
    font-size: 10px
}

.progress-track {
    height: 3px;
    background: var(--line);
    margin: 9px 0 16px;
    border-radius: 3px;
    overflow: hidden
}

.progress-track i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent)
}

#uploadBtn {
    font-size: 11px;
    padding: 10px 5px;
    margin-bottom: 14px
}

#fileSearch {
    font-size: 11px;
    margin-bottom: 10px
}

.filter-row {
    display: flex;
    gap: 3px;
    margin-bottom: 10px
}

.filter-row button {
    font-size: 10px;
    flex: 1;
    border: 0;
    padding: 6px 2px;
    background: transparent;
    color: var(--muted)
}

.filter-row button.active {
    background: #2c3841;
    color: var(--text)
}

.asset-list {
    overflow: auto;
    flex: 1;
    margin: 0 -6px;
    padding: 0 4px
}

.asset-row {
    display: flex;
    gap: 9px;
    padding: 9px 7px;
    margin: 3px 0;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    align-items: center
}

.asset-row:hover {
    background: #242c35
}

.asset-row.active {
    background: #243931;
    border-color: #3e7764
}

.asset-row img {
    width: 58px;
    height: 43px;
    object-fit: contain;
    background: #0e1319;
    border-radius: 4px
}

.asset-meta {
    min-width: 0;
    flex: 1
}

.asset-meta strong {
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis
}

.asset-meta small {
    color: var(--muted);
    display: block;
    margin-top: 5px;
    font-size: 10px
}

.status-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #758596;
    margin-right: 4px
}

.status-dot.done {
    background: var(--accent)
}

.status-dot.in_progress {
    background: #e4b867
}

.left-bottom {
    border-top: 1px solid var(--line);
    padding: 13px 0
}

.left-bottom button {
    font-size: 11px
}

.editor {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0
}

.editor-top {
    height: 56px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
    background: #181f27
}

#imageName {
    font-size: 12px;
    font-weight: 550;
    display: inline-block;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle
}

#imageSize {
    margin-left: 10px
}

.save-state {
    font-size: 10px;
    color: var(--muted)
}

.save-state.error {
    color: var(--danger)
}

.review-button {
    font-size: 11px;
    color: var(--accent);
    border-color: #345b50;
    background: #213b32
}

.review-button.done {
    background: var(--accent);
    color: #14362a
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 10px;
    min-height: 48px;
    border-bottom: 1px solid var(--line);
    background: #1b222b;
    flex-wrap: wrap
}

.toolbar button {
    background: transparent;
    border-color: transparent;
    padding: 5px 6px;
    min-width: 28px;
    height: 29px;
    font-size: 15px
}

.toolbar button span {
    font-size: 10px;
    margin-left: 3px
}

.toolbar button.active {
    color: var(--accent);
    background: #214036;
    border-color: #345b4b
}

.toolbar button:hover {
    background: #303d49
}

.tool-divider {
    width: 1px;
    height: 20px;
    background: var(--line);
    margin: 0 4px
}

#zoomValue {
    font-size: 10px;
    min-width: 34px;
    text-align: center
}

#fitBtn {
    font-size: 10px
}

.stage-wrap {
    position: relative;
    flex: 1;
    overflow: hidden;
    background-color: #0e1319;
    background-image: radial-gradient(#29323d 1px, transparent 1px);
    background-size: 18px 18px;
    min-height: 150px
}

#stage {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    touch-action: none;
    user-select: none
}

#background {
    pointer-events: none
}

#shapeLayer [data-id] {
    cursor: pointer
}

#stage text {
    pointer-events: none;
    font-family: inherit
}

.canvas-hint {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    padding: 8px 14px;
    background: #202b35ed;
    border: 1px solid #42515d;
    border-radius: 20px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none
}

.welcome {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    background: radial-gradient(ellipse at 55% 30%, #1e393144, transparent 65%)
}

.welcome-icon {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border: 1px solid #386654;
    border-radius: 18px;
    background: #173027;
    color: var(--accent);
    font-size: 42px;
    margin-bottom: 12px
}

.welcome h1 {
    font-size: 34px;
    line-height: 1.38;
    letter-spacing: -1.5px;
    margin: 10px 0
}

.welcome>p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.8;
    margin-bottom: 26px
}

.welcome-features {
    display: flex;
    gap: 18px;
    color: #6f8590;
    font-size: 10px;
    margin-top: 25px
}

.loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: #121922b0;
    backdrop-filter: blur(2px);
    z-index: 10
}

.editor-bottom {
    height: 45px;
    background: #181f27;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px
}

.editor-bottom button {
    font-size: 10px;
    padding: 6px 9px
}

.editor-bottom label {
    margin: 0;
    font-size: 10px
}

#imagePosition {
    font-size: 10px
}

.right-panel {
    border-left: 1px solid var(--line)
}

.right-tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
    height: 56px;
    flex-shrink: 0
}

.right-tabs button {
    border: 0;
    border-radius: 0;
    background: none;
    flex: 1;
    color: var(--muted);
    font-size: 12px
}

.right-tabs button.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent)
}

.right-tabs span {
    font-size: 10px;
    background: #2e3a43;
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: 4px
}

.tab-content {
    overflow: auto;
    padding: 17px 15px;
    flex: 1
}

.section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    margin: 0 0 10px;
    color: #a7b5c3
}

#currentLabel {
    margin-bottom: 12px
}

.compact {
    margin-bottom: 18px
}

.compact button {
    font-size: 10px;
    padding: 7px 9px
}

.shape-list {
    max-height: 32vh;
    overflow: auto;
    margin: 0 -4px 14px
}

.shape-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 8px 6px;
    cursor: pointer;
    font-size: 11px
}

.shape-row.active {
    background: #2b3944;
    border-color: #4b606f
}

.shape-row:hover {
    background: #25313b
}

.shape-color {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    flex-shrink: 0
}

.shape-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.shape-kind {
    font-size: 9px;
    color: var(--muted)
}

.shape-row button {
    background: none;
    border: 0;
    padding: 0 3px;
    font-size: 14px;
    color: var(--muted)
}

.selection-editor {
    border-top: 1px solid var(--line);
    padding-top: 14px
}

.selection-editor label {
    margin-bottom: 9px;
    font-size: 10px
}

.selection-editor input {
    padding: 6px 8px;
    font-size: 11px
}

#applyPropsBtn {
    font-size: 11px;
    margin-bottom: 9px;
    padding: 7px
}

.proposal-heading {
    border-top: 1px solid var(--line);
    padding: 16px 0 12px;
    display: flex;
    justify-content: space-between;
    font-size: 11px
}

.proposal-heading b {
    color: var(--accent);
    font-size: 10px;
    padding-left: 5px
}

.proposal-card {
    border: 1px solid #3f525c;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 9px;
    font-size: 11px;
    background: #1e2a32
}

.proposal-card .row {
    align-items: center;
    justify-content: space-between
}

.proposal-card button {
    padding: 4px 8px;
    font-size: 10px
}

.proposal-card small {
    display: block;
    color: var(--muted);
    font-size: 9px;
    margin: 5px 0
}

.prediction-list {
    max-height: 35vh;
    overflow: auto
}

#inferBtn,
#batchBtn {
    margin-top: 10px
}

.ai-note {
    border: 1px solid #35463e;
    background: #1c2b25;
    border-radius: 8px;
    padding: 12px;
    margin-top: 20px;
    font-size: 11px;
    line-height: 1.7
}

.ai-note strong {
    color: #add6c1
}

.ai-note p {
    color: #8eafa0;
    margin: 7px 0 0
}

#modelHint {
    min-height: 30px
}

#aiJobStatus {
    color: var(--muted);
    margin-top: 15px;
    white-space: pre-wrap;
    overflow-wrap: anywhere
}

.empty-small {
    padding: 28px 6px;
    text-align: center;
    font-size: 11px;
    line-height: 1.8;
    color: var(--muted)
}

dialog {
    background: #1c242e;
    color: var(--text);
    border: 1px solid #3c4a58;
    border-radius: 14px;
    width: min(500px, 92vw);
    padding: 25px;
    max-height: 85vh;
    box-shadow: 0 30px 100px #0009
}

dialog::backdrop {
    background: #080c12b0;
    backdrop-filter: blur(3px)
}

.dialog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px
}

.dialog-heading button {
    border: 0;
    background: none;
    font-size: 23px;
    padding: 0 4px;
    color: var(--muted)
}

.large-dialog {
    width: min(760px, 94vw)
}

.dropzone {
    padding: 28px 16px;
    border: 1px dashed #506676;
    border-radius: 10px;
    text-align: center;
    background: #17212b;
    margin: 20px 0
}

.dropzone.dragover {
    border-color: var(--accent);
    background: #19362c
}

.status-output {
    font-family: inherit;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 220px;
    overflow: auto;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.8
}

details summary {
    cursor: pointer;
    font-size: 12px
}

details input {
    margin: 10px 0
}

.job-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin: 10px 0
}

.job-row header {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.job-row p {
    font-size: 11px;
    color: var(--muted)
}

.job-row pre {
    font-size: 10px;
    color: var(--danger);
    white-space: pre-wrap;
    overflow-wrap: anywhere
}

.job-row button {
    font-size: 10px;
    padding: 5px 9px
}

.help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 25px
}

.help-grid p {
    font-size: 12px;
    color: #a2b0be;
    line-height: 1.9
}

.toast {
    position: fixed;
    bottom: 65px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #264437;
    border: 1px solid #4f8d70;
    color: #d7eee1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 12px;
    box-shadow: 0 8px 40px #0007;
    max-width: 80vw;
    white-space: pre-wrap
}

.toast.error {
    background: #402830;
    border-color: #8b4d59;
    color: #ffd5dc
}

.auth-page {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    background: radial-gradient(ellipse at 40% 30%, #1c3a32, #10161e 65%)
}

.auth-card {
    width: 410px;
    max-width: 90vw;
    padding: 36px;
    background: #1b232c;
    border: 1px solid #35433f;
    border-radius: 17px;
    box-shadow: 0 20px 100px #0005
}

.auth-card .brand {
    margin-bottom: 32px
}

.auth-card h1 {
    font-size: 30px;
    line-height: 1.4;
    margin: 12px 0
}

.auth-card form {
    margin-top: 26px
}

.auth-card>p:last-child {
    margin-top: 20px;
    margin-bottom: 0
}

.auth-card .errorlist {
    color: var(--danger);
    padding-left: 15px;
    font-size: 12px
}

.auth-footer {
    position: fixed;
    bottom: 25px;
    color: #5e756e;
    font-size: 10px;
    letter-spacing: 2px
}
.auth-footer img {
    width: 120px;
    height: auto;
    object-fit: contain;
}
.error-box {
    padding: 12px;
    background: #442b32;
    border-radius: 6px;
    color: #ffb7bc;
    margin-bottom: 15px;
    font-size: 12px
}

code {
    font-family: ui-monospace, monospace;
    font-size: .9em;
    overflow-wrap: anywhere
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px
}

::-webkit-scrollbar-thumb {
    background: #3a4855;
    border-radius: 8px
}

@media(max-width:1250px) {
    .workspace {
        grid-template-columns: 205px minmax(340px, 1fr) 265px
    }

    .toolbar button span {
        display: none
    }

    .header-subtitle {
        display: none
    }

    #imageSize {
        display: none
    }

    .topbar {
        gap: 10px;
        padding: 0 15px
    }

    .toolbar {
        padding: 8px 5px
    }
}

@media(max-width:980px) {
    .workspace {
        grid-template-columns: 170px minmax(300px, 1fr) 235px
    }

    .left-panel {
        padding: 15px 9px 0
    }

    .tab-content {
        padding: 14px 10px
    }

    .editor-bottom {
        gap: 3px;
        padding: 0 5px
    }

    #cursorPosition {
        display: none
    }

    .topbar .header-divider {
        display: none
    }

    .welcome h1 {
        font-size: 27px
    }

    .welcome-features {
        gap: 7px;
        font-size: 9px
    }

    .asset-row img {
        width: 42px
    }

    .editor-top {
        padding: 0 8px;
        gap: 5px
    }

    #imageName {
        max-width: 150px
    }
}

@media(max-width:760px) {
    body {
        min-width: 760px
    }

    .workspace {
        height: calc(100vh - 62px)
    }

    .topbar {
        min-width: 760px
    }
}

.topbar .company-logo {
    display: block;
    height: 28px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    margin-left: 8px;
    flex-shrink: 0;
}