@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #090d16;
    --panel: rgba(18, 24, 38, .78);
    --panel-solid: #121827;
    --line: rgba(255, 255, 255, .08);
    --muted: #8994aa;
    --text: #f6f8fc;
    --accent: #ff593d;
    --accent-soft: rgba(255, 89, 61, .13);
    --green: #55d98b;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% -10%, rgba(62, 83, 149, .2), transparent 32rem),
        linear-gradient(145deg, #090d16 0%, #0b101a 55%, #080c14 100%);
    color: var(--text);
    font-family: Manrope, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(110px); opacity: .12; pointer-events: none; }
.ambient-one { width: 28rem; height: 28rem; background: #ff593d; right: -14rem; top: 18rem; }
.ambient-two { width: 22rem; height: 22rem; background: #456ff1; left: -11rem; bottom: -5rem; }

.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

.header { min-height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(145deg, #ff6d53, #e43c21); box-shadow: 0 10px 28px rgba(255, 89, 61, .24); font-weight: 800; }
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }

.profile { display: flex; align-items: center; gap: 11px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); }
.language-picker { position: relative; z-index: 12; }
.language-picker summary { display: flex; align-items: center; gap: 7px; min-width: 146px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 10px; background: #111827; color: var(--muted); font-size: 10px; cursor: pointer; list-style: none; user-select: none; }
.language-picker summary::-webkit-details-marker { display: none; }
.language-picker summary img, .language-menu img { width: 22px; height: 16px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,255,255,.1); }
.language-picker summary span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.language-picker summary b { color: #65718a; font-size: 13px; font-weight: 500; transition: transform .2s; }
.language-picker[open] summary { border-color: rgba(255,89,61,.45); }
.language-picker[open] summary b { transform: rotate(180deg); }
.language-menu { position: absolute; top: calc(100% + 9px); right: 0; width: 270px; max-height: min(480px, calc(100vh - 110px)); padding: 7px; overflow-y: auto; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: #111827; box-shadow: 0 22px 60px rgba(0,0,0,.48); }
.language-menu a { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; align-items: center; gap: 9px; min-height: 39px; padding: 7px 9px; border-radius: 9px; color: #c9d0dd; font-size: 10px; text-decoration: none; }
.language-menu a:hover { background: rgba(255,255,255,.055); color: white; }
.language-menu a.active { background: var(--accent-soft); color: #ff806a; }
.language-menu small { color: #65718a; font-size: 8px; text-transform: uppercase; }
.avatar { width: 38px; height: 38px; object-fit: cover; border-radius: 11px; }
.user-info { display: flex; flex-direction: column; min-width: 120px; }
.user-info strong { font-size: 13px; }
.user-info span { color: var(--muted); font-size: 10px; }
.user-info i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.logout-form { margin: 0; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; transition: background .2s; }
.icon-button:hover { background: rgba(255,255,255,.07); }
.icon-button img { width: 17px; height: 17px; opacity: .65; }

.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 40px; padding: 66px 0 52px; }
.eyebrow { margin: 0 0 11px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { max-width: 730px; margin: 0; font-size: clamp(38px, 5.3vw, 70px); line-height: 1.02; letter-spacing: -.055em; }
h1 span { color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.62); }
.hero-copy { max-width: 600px; margin: 22px 0 0; color: var(--muted); font-size: 15px; line-height: 1.75; }
.hero-stat { min-width: 180px; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.025); }
.hero-stat span, .hero-stat small { display: block; color: var(--muted); font-size: 11px; }
.hero-stat strong { display: block; margin: 5px 0 1px; font-size: 36px; line-height: 1; }

.workspace { margin-bottom: 80px; padding: 30px; border: 1px solid var(--line); border-radius: 28px; background: var(--panel); box-shadow: 0 30px 80px rgba(0,0,0,.24); backdrop-filter: blur(18px); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.section-head h2 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.toolbar { display: flex; align-items: center; gap: 10px; }
.team-switch { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: rgba(4,7,13,.42); }
.team-switch button { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; cursor: pointer; transition: .2s; }
.team-switch button.active { background: rgba(255,255,255,.08); color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.team-shield { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; color: white; font-size: 8px; font-weight: 800; }
.team-shield.ct { background: #477bdc; }
.team-shield.t { background: #c7943e; }
.search { display: flex; align-items: center; gap: 10px; width: min(300px, 100%); padding: 0 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(4,7,13,.42); transition: border .2s, box-shadow .2s; }
.search:focus-within { border-color: rgba(255,89,61,.55); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search input { width: 100%; height: 44px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.search input::placeholder { color: #657086; }

.categories { display: flex; gap: 8px; margin: 28px -2px 0; padding: 2px 2px 17px; overflow-x: auto; scrollbar-color: #2a3140 transparent; }
.category { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 11px 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; transition: .2s ease; }
.category span { color: #68758f; font-size: 17px; }
.category:hover { color: var(--text); border-color: rgba(255,255,255,.16); transform: translateY(-1px); }
.category.active { border-color: rgba(255,89,61,.34); background: var(--accent-soft); color: #ff806a; }
.category.active span { color: var(--accent); }

.catalog-meta { min-height: 29px; margin: 8px 0 18px; display: flex; align-items: center; justify-content: space-between; }
.catalog-meta p { display: flex; align-items: center; gap: 13px; margin: 0; font-size: 13px; font-weight: 700; }
.catalog-meta > span { color: var(--muted); font-size: 11px; }
.back-button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.035); color: var(--muted); font-size: 11px; cursor: pointer; }
.back-button:hover { color: var(--text); }

.items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; min-height: 280px; }
.item { min-width: 0; animation: card-in .45s both; animation-delay: var(--delay); }
.card-action { position: relative; width: 100%; height: 100%; min-height: 258px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(155deg, rgba(255,255,255,.045), rgba(255,255,255,.018)); text-align: left; cursor: pointer; transition: transform .24s ease, border .24s, background .24s; }
.card-action::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 38%, rgba(76,100,158,.15), transparent 48%); pointer-events: none; }
.card-action:hover { transform: translateY(-4px); border-color: rgba(255,255,255,.17); background: linear-gradient(155deg, rgba(255,255,255,.065), rgba(255,255,255,.024)); }
.card-action.selected { border-color: rgba(85,217,139,.48); box-shadow: inset 0 0 0 1px rgba(85,217,139,.12); }
.image-wrap { display: grid; place-items: center; height: 184px; padding: 23px; }
.skin-image { display: block; max-width: 100%; max-height: 125px; object-fit: contain; filter: drop-shadow(0 18px 16px rgba(0,0,0,.35)); transition: transform .28s ease; }
.agent-item .card-action { min-height: 330px; }
.agent-item .image-wrap { height: 256px; padding: 18px 24px 8px; }
.agent-item .skin-image { max-height: 235px; }
.no-image .image-wrap::after { content: 'DEFAULT'; display: grid; place-items: center; width: 92px; height: 92px; border: 1px solid rgba(255,255,255,.1); border-radius: 26px; background: rgba(255,255,255,.035); color: #64718a; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.card-action:hover .skin-image { transform: scale(1.055) rotate(-1deg); }
.card-copy { display: flex; flex-direction: column; gap: 4px; padding: 0 52px 20px 18px; }
.card-copy small { color: var(--muted); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.card-copy strong { overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.arrow { position: absolute; right: 16px; bottom: 17px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgba(255,255,255,.06); color: var(--muted); font-size: 13px; transition: .2s; }
.card-action:hover .arrow { background: var(--accent); color: white; }
.card-action.selected .arrow { background: var(--green); color: #07120b; }

.skeleton { min-height: 258px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(100deg, rgba(255,255,255,.025) 20%, rgba(255,255,255,.065) 38%, rgba(255,255,255,.025) 56%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.empty { grid-column: 1 / -1; min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; border: 1px dashed var(--line); border-radius: 18px; text-align: center; }
.empty > span { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 13px; border-radius: 14px; background: rgba(255,255,255,.05); color: var(--muted); font-size: 21px; }
.empty h3 { margin: 0 0 7px; font-size: 15px; }
.empty p { max-width: 420px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.error-state > span { background: var(--accent-soft); color: var(--accent); }
.error-state button { margin-top: 17px; padding: 9px 14px; border: 0; border-radius: 10px; background: var(--accent); color: white; font-size: 11px; font-weight: 700; cursor: pointer; }

.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(390px, calc(100vw - 40px)); padding: 14px 17px; border: 1px solid var(--line); border-radius: 13px; background: #171e2d; box-shadow: 0 18px 45px rgba(0,0,0,.35); font-size: 12px; opacity: 0; transform: translateY(14px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(85,217,139,.32); }
.toast.error { border-color: rgba(255,89,61,.38); }

.skin-dialog { width: min(820px, calc(100% - 28px)); max-height: min(840px, calc(100vh - 28px)); padding: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 24px; background: #111827; color: var(--text); box-shadow: 0 35px 100px rgba(0,0,0,.65); }
.skin-dialog::backdrop { background: rgba(3,6,12,.76); backdrop-filter: blur(8px); }
.dialog-card { position: relative; display: grid; grid-template-columns: .8fr 1.2fr; max-height: inherit; overflow: hidden; border-radius: inherit; }
.dialog-close { position: absolute; z-index: 2; top: 13px; right: 13px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: rgba(8,12,20,.7); color: var(--muted); font-size: 20px; cursor: pointer; }
.dialog-preview { position: relative; display: grid; place-items: center; min-height: 560px; padding: 35px; overflow: hidden; background: radial-gradient(circle at 50% 43%, rgba(75,99,160,.22), transparent 50%), #0b101b; touch-action: none; }
#dialog-image { z-index: 1; max-width: 100%; max-height: 190px; object-fit: contain; filter: drop-shadow(0 22px 20px rgba(0,0,0,.45)); pointer-events: none; user-select: none; }
.dialog-content { padding: 32px 30px 28px; overflow-y: auto; }
.dialog-content h2 { margin: 0; padding-right: 20px; font-size: 22px; line-height: 1.25; }
.dialog-hint { margin: 12px 0 25px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { display: flex; justify-content: space-between; color: #cbd2df; font-size: 11px; font-weight: 700; }
.field small { color: var(--muted); font-size: 9px; font-weight: 500; }
.field select, .field input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: #0b111d; color: var(--text); font-size: 11px; }
.field select:focus, .field input:focus { border-color: rgba(255,89,61,.55); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 15px; }
.apply-button { width: 100%; margin-top: 22px; padding: 12px 16px; border: 0; border-radius: 11px; background: linear-gradient(135deg, #ff654a, #e7472c); color: white; font-size: 11px; font-weight: 800; cursor: pointer; box-shadow: 0 10px 28px rgba(255,89,61,.2); }
.apply-button:hover { filter: brightness(1.08); }
.apply-button:disabled { opacity: .6; cursor: wait; }

@keyframes shimmer { to { background-position-x: -200%; } }
@keyframes card-in { from { opacity: 0; transform: translateY(9px); } }
@keyframes model-spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
    .items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-stat { display: none; }
    .section-head { align-items: flex-start; flex-direction: column; }
    .toolbar, .search { width: 100%; }
    .toolbar { align-items: stretch; flex-direction: column; }
}

@media (max-width: 560px) {
    .shell { width: min(100% - 24px, 1180px); }
    .header { min-height: 72px; }
    .brand small, .user-info { display: none; }
    .profile { gap: 5px; }
    .language-picker summary { min-width: 44px; padding-inline: 9px; }
    .language-picker summary span { display: none; }
    .language-menu { position: fixed; top: 70px; right: 12px; width: min(280px, calc(100vw - 24px)); max-height: calc(100vh - 82px); }
    .avatar { display: none; }
    .hero { padding: 42px 0 34px; }
    h1 { font-size: 39px; }
    .hero-copy { font-size: 13px; }
    .workspace { padding: 20px 14px; border-radius: 20px; }
    .items { grid-template-columns: 1fr; }
    .card-action { min-height: 245px; }
    .section-head { padding-inline: 4px; }
    .dialog-card { grid-template-columns: 1fr; }
    .dialog-preview { min-height: 190px; padding: 28px; }
    #dialog-image { max-height: 130px; }
    .dialog-content { padding: 26px 20px 22px; }
    .team-switch button { flex: 1; justify-content: center; }
    .skin-dialog { max-height: calc(100vh - 16px); }
    .dialog-card { display: block; overflow-y: auto; }
    .dialog-content { overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
