/* ==========================================================
   Style Library (styles.js) — light theme, matches the CRM
   ========================================================== */
.sl-wrap { max-width: 1240px; margin: 0 auto; padding-bottom: 80px; color: #19191C; }
.sl-wrap .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.sl-sm { padding: 7px 12px !important; font-size: 12.5px !important; }

/* top bar */
.sl-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 4px 0 18px; flex-wrap: wrap; }
.sl-h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; color: #121214; }
.sl-sub { font-size: 14px; color: #6B6B76; max-width: 560px; }
.sl-top-actions { display: flex; gap: 10px; align-items: center; }
.sl-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #E2E2E5; border-radius: 10px; padding: 0 12px; height: 40px; min-width: 240px; }
.sl-search i { color: #8D8D9A; }
.sl-search input { border: none; outline: none; background: transparent; font-family: inherit; font-size: 13.5px; width: 100%; color: #19191C; }

.sl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.sl-chip { border: 1px solid #E2E2E5; background: #fff; color: #4A4A55; border-radius: 999px; padding: 7px 14px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.sl-chip em { font-style: normal; color: #9A9AA5; font-weight: 600; margin-left: 4px; }
.sl-chip:hover { border-color: #C9C9CF; }
.sl-chip.active { background: #19191C; border-color: #19191C; color: #fff; }
.sl-chip.active em { color: #B5B5BE; }

.sl-alert { background: #FEF2F2; border: 1px solid #FBD5D5; color: #9B1C1C; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 16px; display: flex; gap: 8px; align-items: center; }

/* grid */
.sl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.sl-card { background: #fff; border: 1px solid #E9E9EB; border-radius: 16px; overflow: hidden; cursor: pointer; transition: transform .18s, box-shadow .18s, border-color .18s; outline: none; }
.sl-card:hover, .sl-card:focus-visible { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(18, 18, 20, 0.10); border-color: #DCDCE0; }
.sl-cover, .sl-hero-cover { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #1A1A1D; }
.sl-cover img, .sl-cover video, .sl-hero-cover img, .sl-hero-cover video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sl-cover video { opacity: 0; transition: opacity .25s; }
.sl-card.playing .sl-cover video { opacity: 1; }
.sl-cover-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center; }
.sl-cover-ph span { color: rgba(255, 255, 255, 0.92); font-size: 26px; font-weight: 800; letter-spacing: -0.5px; text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.sl-play { position: absolute; right: 12px; bottom: 12px; width: 32px; height: 32px; border-radius: 50%; background: rgba(18,18,20,.6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; backdrop-filter: blur(6px); transition: opacity .2s; }
.sl-card.playing .sl-play { opacity: 0; }
.sl-card-body { padding: 16px 18px 16px; }
.sl-card-title { font-size: 16.5px; font-weight: 800; letter-spacing: -0.2px; color: #121214; }
.sl-card-tagline { font-size: 13px; color: #6B6B76; margin-top: 3px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sl-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.sl-dots { display: inline-flex; }
.sl-dots i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; margin-left: -5px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.sl-dots i:first-child { margin-left: 0; }
.sl-dots em { font-style: normal; font-size: 12px; color: #9A9AA5; }
.sl-card-font { font-size: 12.5px; color: #4A4A55; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-card-font b { font-size: 16px; margin-right: 3px; color: #121214; }
.sl-card-foot { display: flex; gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #F0F0F2; font-size: 12.5px; color: #6B6B76; }
.sl-card-foot i { margin-right: 3px; }
.sl-card-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.sl-card-tags span, .sl-tags span { font-size: 11.5px; font-weight: 700; color: #4A4A55; background: #F2F2F4; border-radius: 999px; padding: 3px 9px; }

/* empty states */
.sl-empty { text-align: center; padding: 50px 20px; color: #6B6B76; font-size: 14px; }
.sl-empty.big { background: #fff; border: 1px dashed #D4D4D9; border-radius: 18px; padding: 70px 20px; }
.sl-empty h3 { font-size: 18px; color: #121214; margin: 14px 0 6px; }
.sl-empty p { max-width: 460px; margin: 0 auto 18px; line-height: 1.5; }
.sl-empty-icon { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto; background: #F2F2F4; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #4A4A55; }
.sl-spin { font-size: 24px; animation: sl-spin 1s linear infinite; display: inline-block; }
@keyframes sl-spin { to { transform: rotate(360deg); } }

/* detail */
.sl-crumbs { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sl-back { background: none; border: none; font-family: inherit; font-size: 13.5px; font-weight: 700; color: #4A4A55; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 2px; }
.sl-back:hover { color: #121214; }
.sl-detail-actions { display: flex; gap: 8px; }
.sl-danger { color: #B42318 !important; }
.sl-danger:hover { background: #FEF3F2 !important; border-color: #FDA29B !important; }

.sl-hero { position: relative; border-radius: 16px; overflow: hidden; background: #121214; height: 200px; box-shadow: 0 8px 24px rgba(18,18,20,.08); }
.sl-hero.has-video { height: auto; aspect-ratio: 16 / 9; max-width: 760px; }
.sl-hero video, .sl-hero iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: contain; background: #000; }
.sl-hero .sl-hero-cover { position: absolute; inset: 0; aspect-ratio: auto; }
.sl-hero .sl-cover-ph span { font-size: 34px; }
.sl-hero-link { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); background: rgba(255,255,255,.95); color: #121214; font-weight: 700; font-size: 14px; border-radius: 999px; padding: 10px 18px; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.sl-hero-edit { position: absolute; left: 14px; top: 14px; display: flex; flex-wrap: wrap; gap: 8px; z-index: 2; }
.sl-btn-glass { background: rgba(18,18,20,.66); color: #fff; border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(8px); border-radius: 10px; padding: 8px 12px; font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.sl-btn-glass:hover { background: rgba(18,18,20,.82); }
.sl-btn-glass.danger:hover { background: rgba(180,35,24,.85); }

.sl-head { display: grid; grid-template-columns: 1fr 280px; gap: 28px; margin: 26px 0 30px; }
.sl-title { font-size: 32px; font-weight: 800; letter-spacing: -0.8px; margin: 0; color: #121214; }
.sl-tagline { font-size: 16px; color: #4A4A55; margin-top: 6px; }
.sl-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.sl-desc { margin-top: 16px; font-size: 14.5px; line-height: 1.65; color: #2A2A2F; max-width: 760px; }
.sl-desc p { margin: 0 0 8px; }
.sl-desc ul, .sl-rule-text ul { margin: 4px 0 10px; padding-left: 20px; }
.sl-desc a, .sl-rule-text a { color: #4C5FD5; word-break: break-all; }
.sl-desc.muted { color: #9A9AA5; }
.sl-head-side { background: #fff; border: 1px solid #E9E9EB; border-radius: 14px; padding: 16px 18px; align-self: start; }
.sl-side-label { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #8D8D9A; margin-bottom: 8px; }
.sl-side-muted { font-size: 13px; color: #6B6B76; line-height: 1.5; }
.sl-users { display: flex; flex-direction: column; gap: 6px; }
.sl-user { display: flex; align-items: center; gap: 8px; background: #F7F7F8; border: 1px solid #EEEEF0; border-radius: 10px; padding: 6px 10px; font-family: inherit; font-size: 13px; font-weight: 600; color: #19191C; cursor: pointer; text-align: left; }
.sl-user:hover { border-color: #D4D4D9; }
.sl-user span { width: 22px; height: 22px; border-radius: 50%; background: #19191C; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* edit inputs */
.sl-title-input { width: 100%; font-family: inherit; font-size: 28px; font-weight: 800; letter-spacing: -0.6px; color: #121214; border: 1px solid #E2E2E5; border-radius: 12px; padding: 8px 12px; background: #fff; outline: none; }
.sl-input, .sl-mini { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 13.5px; color: #19191C; background: #fff; border: 1px solid #E2E2E5; border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color .15s; }
textarea.sl-input { resize: vertical; line-height: 1.5; }
.sl-input:focus, .sl-mini:focus, .sl-title-input:focus { border-color: #9A9AA5; }
.sl-tagline-input { margin-top: 8px; font-size: 15px; }
.sl-label { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #6B6B76; margin: 16px 0 6px; }
.sl-label span { text-transform: none; letter-spacing: 0; font-weight: 500; color: #9A9AA5; margin-left: 4px; }
.sl-mini { padding: 7px 10px; font-size: 12.5px; }
.sl-x { background: none; border: none; color: #8D8D9A; cursor: pointer; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sl-x:hover { color: #B42318; background: #FEF3F2; }
.sl-x.on-img { position: absolute; top: 6px; right: 6px; background: rgba(255,255,255,.92); color: #19191C; }
.sl-add-mini { border: 1px dashed #C9C9CF; background: transparent; border-radius: 10px; padding: 8px 12px; font-family: inherit; font-size: 12.5px; font-weight: 700; color: #4A4A55; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.sl-add-mini:hover, .sl-add-row:hover { border-color: #8D8D9A; color: #121214; }
.sl-add-row { width: 100%; border: 1px dashed #C9C9CF; background: transparent; border-radius: 12px; padding: 11px; font-family: inherit; font-size: 13px; font-weight: 700; color: #4A4A55; cursor: pointer; }

/* Style DNA */
.sl-block-title { font-size: 12px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; color: #4A4A55; margin: 0 0 12px; display: flex; gap: 6px; align-items: center; }
.sl-dna { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 34px; }
.sl-dna-card { background: #fff; border: 1px solid #E9E9EB; border-radius: 16px; padding: 18px; }
.sl-dna-card.wide { grid-column: 1 / -1; }
.sl-dna-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sl-dna-head span { font-size: 14px; font-weight: 800; color: #121214; }
.sl-dna-head em { font-style: normal; font-size: 12px; color: #9A9AA5; }
.sl-dna-empty { font-size: 13px; color: #9A9AA5; }
.sl-head-add { border: 1px solid #E2E2E5; background: #F7F7F8; color: #4A4A55; border-radius: 8px; padding: 4px 10px; font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: all .15s; }
.sl-head-add:hover { border-color: #19191C; background: #19191C; color: #fff; }
.sl-click-edit { width: 100%; text-align: left; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; border: 1px dashed #D4D4D9; background: #FAFAFB; border-radius: 10px; padding: 11px 14px; color: #6B6B76; font-size: 13px; font-weight: 600; transition: all .15s; }
.sl-click-edit:hover { border-color: #8D8D9A; background: #F2F2F4; color: #121214; }
.sl-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sl-swatch { display: flex; align-items: center; gap: 10px; background: #F7F7F8; border: 1px solid #EEEEF0; border-radius: 12px; padding: 6px 12px 6px 6px; font-family: inherit; cursor: pointer; text-align: left; transition: border-color .15s; }
.sl-swatch:hover { border-color: #C9C9CF; }
.sl-swatch-color { width: 38px; height: 38px; border-radius: 9px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); flex-shrink: 0; position: relative; overflow: hidden; display: block; }
.sl-swatch-color input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.sl-swatch-txt b { display: block; font-size: 13px; color: #19191C; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sl-swatch-txt em { display: block; font-style: normal; font-size: 12px; color: #6B6B76; }
.sl-swatch.edit { cursor: default; padding-right: 6px; }
.sl-swatch.edit .sl-mini { width: 110px; }
.sl-fonts { display: flex; flex-direction: column; gap: 10px; }
.sl-font { display: flex; align-items: center; gap: 16px; background: #F7F7F8; border: 1px solid #EEEEF0; border-radius: 12px; padding: 12px 14px; }
.sl-font-sample { font-size: 30px; line-height: 1.1; color: #121214; min-width: 150px; white-space: nowrap; }
.sl-font-meta { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-width: 0; }
.sl-font-meta b { display: block; font-size: 13.5px; }
.sl-font-meta em { display: block; font-style: normal; font-size: 12px; color: #6B6B76; }
.sl-font-meta a { font-size: 12.5px; font-weight: 700; color: #19191C; text-decoration: none; white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.sl-font-meta a:hover { text-decoration: underline; }
.sl-font.edit { gap: 8px; padding: 8px; }
.sl-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.sl-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #F2F2F4; }
.sl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.sl-thumb a:hover img { transform: scale(1.03); }
.sl-thumb.add { border: 1px dashed #C9C9CF; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-family: inherit; font-size: 12.5px; font-weight: 700; color: #4A4A55; }
.sl-thumb.add i { font-size: 20px; }

/* tabs */
.sl-tabs { display: flex; gap: 6px; border-bottom: 1px solid #E5E5E8; margin-bottom: 22px; }
.sl-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 12px 16px; font-family: inherit; font-size: 14.5px; font-weight: 700; color: #6B6B76; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.sl-tab em { font-style: normal; font-size: 11.5px; background: #F2F2F4; color: #4A4A55; border-radius: 999px; padding: 1px 7px; }
.sl-tab:hover { color: #19191C; }
.sl-tab.active { color: #121214; border-bottom-color: #121214; }

.sl-sub-title { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 12px; }
.sl-sub-title span { font-size: 13px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #4A4A55; display: inline-flex; gap: 6px; align-items: center; }
.sl-section .sl-sub-title:not(:first-child) { margin-top: 30px; }
.sl-muted-box { background: #fff; border: 1px dashed #DCDCE0; border-radius: 12px; padding: 18px; font-size: 13.5px; color: #8D8D9A; }

/* rules */
.sl-rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.sl-rules.edit { grid-template-columns: 1fr 1fr; }
.sl-rules.edit .sl-add-row { grid-column: 1 / -1; }
.sl-rule { background: #fff; border: 1px solid #E9E9EB; border-radius: 14px; padding: 16px 18px; }
.sl-rule-title { font-size: 14px; font-weight: 800; color: #121214; margin-bottom: 8px; }
.sl-rule-text { font-size: 13.5px; line-height: 1.6; color: #2A2A2F; }
.sl-rule-text p { margin: 0 0 6px; }
.sl-rule.edit { padding: 12px; }
.sl-rule-top { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.sl-rule-title-input { flex: 1; border: none; outline: none; font-family: inherit; font-size: 14px; font-weight: 800; color: #121214; background: transparent; padding: 4px 2px; }
.sl-rule-title-input::placeholder { color: #B5B5BE; }

/* assets */
.sl-cat { margin-bottom: 22px; }
.sl-cat-head { font-size: 13.5px; font-weight: 800; color: #19191C; margin-bottom: 10px; display: flex; gap: 6px; align-items: center; }
.sl-cat-head em { font-style: normal; font-weight: 700; color: #9A9AA5; font-size: 12px; }
.sl-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.sl-asset { background: #fff; border: 1px solid #E9E9EB; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.sl-asset:hover { border-color: #DCDCE0; box-shadow: 0 8px 22px rgba(18,18,20,.07); }
.sl-asset-prev { position: relative; aspect-ratio: 16 / 9; background: #F2F2F4; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #9A9AA5; font-size: 28px; text-decoration: none; }
.sl-asset-prev img, .sl-asset-prev video { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.sl-asset-type { position: absolute; left: 8px; top: 8px; background: rgba(18,18,20,.72); color: #fff; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sl-asset-body { padding: 12px 14px 12px; display: flex; flex-direction: column; flex: 1; }
.sl-asset-name { font-size: 14px; font-weight: 700; color: #121214; }
.sl-asset-note { font-size: 12.5px; color: #6B6B76; margin-top: 4px; line-height: 1.45; }
.sl-asset-actions { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; }
.sl-asset-open { font-size: 12.5px; font-weight: 700; color: #19191C; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.sl-asset-open:hover { text-decoration: underline; }
.sl-asset-nolink { font-size: 12px; color: #B5B5BE; }
.sl-asset-tools { display: inline-flex; gap: 2px; }
.sl-asset-tools button { background: none; border: none; width: 28px; height: 28px; border-radius: 8px; color: #6B6B76; cursor: pointer; }
.sl-asset-tools button:hover { background: #F2F2F4; color: #121214; }

/* modal */
.sl-modal-bg { position: fixed; inset: 0; background: rgba(18,18,20,.45); z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }
.sl-modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 30px 70px rgba(0,0,0,.25); color: #19191C; }
.sl-modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 22px 4px; }
.sl-modal-title { font-size: 18px; font-weight: 800; }
.sl-modal-sub { font-size: 13px; color: #6B6B76; margin-top: 2px; }
.sl-modal-body { padding: 0 22px 10px; overflow-y: auto; }
.sl-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid #F0F0F2; }
.sl-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sl-prev-pick { display: flex; gap: 12px; align-items: center; }
.sl-prev-box { width: 160px; aspect-ratio: 16 / 9; border-radius: 10px; background: #F2F2F4; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #B5B5BE; font-size: 24px; flex-shrink: 0; }
.sl-prev-box img, .sl-prev-box video { width: 100%; height: 100%; object-fit: cover; }
.sl-prev-btns { display: flex; flex-direction: column; gap: 6px; }

/* toast */
.sl-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #19191C; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s; z-index: 4000; }
.sl-toast.show { opacity: 1; transform: translate(-50%, 0); }
.sl-toast.error { background: #B42318; }

@media (max-width: 900px) {
    .sl-head { grid-template-columns: 1fr; }
    .sl-dna { grid-template-columns: 1fr; }
    .sl-rules.edit { grid-template-columns: 1fr; }
    .sl-hero { height: 160px; }
}

/* Board view (freelancers, read-only) */
#view-style { overflow-y: auto; }
#style-board-root .sl-wrap { padding-top: 4px; }
.sl-head.solo { grid-template-columns: 1fr 280px; }
.sl-head-side.board { display: flex; flex-direction: column; }
.sl-board-all { justify-content: center; }
.sl-head.solo:not(:has(.sl-head-side)) { grid-template-columns: 1fr; }
