:root {
    --bg: #f6f4ef;
    --card: #ffffff;
    --border: #e7e3da;
    --border-strong: #d8d3c6;
    --hover: #f1eee6;
    --text: #1c1b1a;
    --muted: #77726a;
    --primary: #5158f6;
    --primary-hover: #3f46e0;
    --primary-soft: rgba(81, 88, 246, 0.09);
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --success: #16a34a;
    --radius: 14px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(28, 27, 26, 0.05);
    --shadow: 0 10px 30px rgba(28, 27, 26, 0.1);
    --shadow-lg: 0 24px 70px rgba(28, 27, 26, 0.18);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --topbar-h: 56px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: clip;
}

html {
    overflow-x: clip;
}

/* drawer rejimi: shell yashirilmaydi — drawer o'zi ekranni qoplaydi */

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input,
textarea,
select {
    font-family: inherit;
    color: var(--text);
}

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

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

/* ---------------- shell ---------------- */

.studio-shell {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
}

.studio-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.studio-main {
    flex: 1;
    width: 100%;
    max-width: 1280px;
    padding: 16px 14px 90px;
}

/* ---------------- topbar ---------------- */

.studio-topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--topbar-h);
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
}

.topbar-title {
    min-width: 0;
}

.topbar-title h1 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-title p {
    display: none;
}

.topbar-actions {
    margin-left: auto;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-build {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #b3ada1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
}

.topbar-actions .btn svg:last-child {
    display: none;
}

/* ---------------- sidebar ---------------- */

.studio-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 85vw);
    background: #ffffff;
    border-right: 1px solid var(--border);
    z-index: 110;
    display: flex;
    flex-direction: column;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
}

.studio-sidebar.open {
    transform: translateX(0);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 27, 26, 0.42);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

.sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-brand {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(135deg, #5158f6, #7c5cf0);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 16px;
    font-weight: 800;
    flex: 0 0 auto;
}

.sidebar-brand small {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
}

.nav-section-label {
    padding: 14px 12px 5px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #a49e92;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 9px 12px;
    border-radius: 11px;
    font-weight: 600;
    font-size: 14px;
    color: #4a463f;
}

.nav-item svg {
    flex: 0 0 auto;
    color: var(--muted);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-item.active svg {
    color: var(--primary);
}

.nav-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 8px;
}

.nav-item.active .nav-count {
    color: var(--primary);
    background: #fff;
    border-color: rgba(81, 88, 246, 0.3);
}

.sidebar-foot {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 0 0 auto;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg);
}

.user-chip .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1c1b1a;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    flex: 0 0 auto;
}

.user-chip b {
    display: block;
    font-size: 13px;
    line-height: 1.2;
}

.user-chip small {
    color: var(--muted);
    font-size: 11px;
}

.sidebar-version {
    text-align: center;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #a49e92;
}

/* ---------------- buttons ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 11px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-ghost {
    background: #fff;
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--hover);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-dark {
    background: #1c1b1a;
    color: #fff;
}

.btn-sm {
    min-height: 38px;
    padding: 7px 13px;
    font-size: 13px;
    border-radius: 10px;
}

.btn-lg {
    min-height: 50px;
    padding: 13px 24px;
    font-size: 15px;
    border-radius: 13px;
}

.btn-block {
    width: 100%;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text);
    flex: 0 0 auto;
}

.icon-btn:hover {
    background: var(--hover);
}

.sidebar-toggle {
    display: inline-flex;
}

.close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: transparent;
    display: grid;
    place-items: center;
    color: var(--muted);
    flex: 0 0 auto;
}

.close:hover {
    background: var(--hover);
    color: var(--text);
}

/* ---------------- cards ---------------- */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.card-head h3 {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.card-head .muted {
    font-size: 12.5px;
}

.card-head .spacer {
    margin-left: auto;
}

.card-head .actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

.card-body {
    padding: 16px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.search-box svg {
    position: absolute;
    left: 12px;
    color: var(--muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 42px;
    padding: 0 12px 0 38px;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: #fff;
    font-size: 16px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------------- table ---------------- */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.data {
    width: 100%;
    border-collapse: collapse;
}

table.data th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.data tbody tr:last-child td {
    border-bottom: none;
}

.doc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.doc-row .thumb {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--bg);
    flex: 0 0 auto;
}

.doc-row .thumb-ph {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px dashed var(--border-strong);
    background: var(--bg);
    display: grid;
    place-items: center;
    color: var(--muted);
    flex: 0 0 auto;
}

.doc-row .doc-text {
    min-width: 0;
}

.doc-row .doc-text b {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
}

.doc-row .doc-text small {
    color: var(--muted);
    font-size: 11.5px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    background: var(--bg);
    border: 1px solid var(--border);
    color: #4a463f;
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-soft);
    border-color: rgba(81, 88, 246, 0.3);
    color: var(--primary);
}

.hide-sm {
    display: none;
}

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

.text-sm {
    font-size: 12.5px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-16 {
    margin-bottom: 16px;
}

/* ---------------- stats / quick ---------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    flex: 0 0 auto;
}

.stat-card .stat-num {
    display: block;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.stat-card .stat-label {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
}

.quick-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.quick-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font-weight: 700;
    font-size: 13.5px;
}

.quick-item .qi-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--bg);
    color: var(--text);
    flex: 0 0 auto;
}

/* ---------------- forms ---------------- */

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field label {
    font-size: 12.5px;
    font-weight: 700;
    color: #4a463f;
}

.field label .req {
    color: var(--danger);
}

.field input[type="text"],
.field input[type="url"],
.field input[type="date"],
.field input[type="number"],
.field input[type="password"],
.field select,
.field textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: #fff;
    font-size: 16px;
    outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.field textarea {
    resize: vertical;
    min-height: 88px;
    line-height: 1.6;
}

.field .hint {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
}

.fs-label {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 6px;
}

.fs-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 18px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

.form-actions .spacer {
    margin-left: auto;
}

/* ---------------- upload / gallery ---------------- */

.upload-box {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fbfaf7;
    cursor: pointer;
}

.upload-box img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: #fff;
}

.upload-box .up-ph {
    width: 64px;
    height: 64px;
    border-radius: 11px;
    background: #fff;
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--muted);
    flex: 0 0 auto;
}

.upload-box .up-text {
    min-width: 0;
}

.upload-box .up-text b {
    display: block;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.upload-box .up-text small {
    color: var(--muted);
    font-size: 12px;
}

.gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.gallery-thumbs .g-item {
    position: relative;
    width: 92px;
    height: 62px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.gallery-thumbs .g-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumbs .g-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(28, 27, 26, 0.75);
    color: #fff;
    display: grid;
    place-items: center;
}

.gallery-thumbs .g-remove:hover {
    background: var(--danger);
}

/* ---------------- accordion ---------------- */

.accordion {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.accordion + .accordion {
    margin-top: 12px;
}

details.accordion > summary {
    list-style: none;
    cursor: pointer;
}

details.accordion > summary::-webkit-details-marker {
    display: none;
}

.accordion-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    background: none;
    border: none;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--text);
    text-align: left;
}

.accordion-head .acc-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
}

.accordion-head .chev {
    margin-left: auto;
    color: var(--muted);
    transition: transform 0.2s ease;
    flex: 0 0 auto;
}

details.accordion[open] > .accordion-head .chev {
    transform: rotate(180deg);
}

.accordion-body {
    display: block;
}

/* eski (div) accordion versiyasi uchun zaxira */
div.accordion > .accordion-body {
    display: none;
}

div.accordion.open > .accordion-body {
    display: block;
}

div.accordion.open > .accordion-head .chev {
    transform: rotate(180deg);
}

.accordion-inner {
    overflow: hidden;
}

.accordion-pad {
    padding: 4px 16px 18px;
    border-top: 1px solid var(--border);
}

/* ---------------- social ---------------- */

.social-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.social-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.social-chip .sc-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.social-chip .sc-icon svg {
    width: 18px;
    height: 18px;
}

.social-chip b {
    display: block;
    font-size: 13px;
    line-height: 1.2;
}

.social-chip small {
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

.social-chip .sc-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.social-chip .sc-remove-form {
    display: flex;
}

.social-chip .sc-edit:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.social-chip .sc-remove:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.social-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.social-opt {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 6px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: #fff;
    font-size: 11.5px;
    font-weight: 700;
    color: #4a463f;
    cursor: pointer;
    text-align: center;
}

.social-opt input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.social-opt.selected,
.social-opt:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}

.social-opt.used {
    opacity: 0.45;
    cursor: not-allowed;
}

.social-opt .so-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
}

.social-add-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
}

/* ---------------- geo ---------------- */

.geo-country .accordion-head {
    cursor: pointer;
}

.geo-country .acc-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.geo-country-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.geo-country-text strong {
    font-size: 14px;
    letter-spacing: -0.01em;
}

.geo-country-text small {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
}

.geo-country .badge {
    display: none;
}

.geo-move {
    display: flex;
    gap: 6px;
    margin-left: auto;
    flex: 0 0 auto;
}

.geo-move + .geo-remove-form {
    margin-left: 0;
}

.geo-move .icon-btn {
    width: 34px;
    height: 34px;
}

.geo-remove-form {
    display: flex;
    flex: 0 0 auto;
}

.city-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.city-chip {
    padding: 8px 12px;
}

.city-chip .sc-remove-form {
    margin-left: auto;
    display: flex;
}

.city-add-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
}

.geo-add-country {
    margin-top: 16px;
    padding: 16px;
    background: #fbfaf7;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

.geo-add-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.geo-add-grid input[type="text"] {
    width: 100%;
    padding: 11px 14px;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: #fff;
    font-size: 16px;
    outline: none;
}

.geo-add-grid input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.geo-add-grid input[type="file"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    background: #fff;
    font-size: 12.5px;
}

/* ---------------- drawer (mobile: fullscreen, o'zi scroll) ---------------- */

.drawer-backdrop {
    display: none;
}

.drawer {
    display: none;
}

.drawer.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.drawer-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 30;
}

.drawer-head h3 {
    font-size: 15.5px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-head .close {
    margin-left: auto;
}

.drawer-head-save {
    margin-left: auto;
}

.drawer-head-save + .close {
    margin-left: 6px;
}

.drawer-body {
    padding: 16px 14px;
}

.drawer-foot {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: #fbfaf7;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    position: sticky;
    bottom: 0;
    z-index: 30;
}

.drawer-foot .btn {
    width: 100%;
}

/* ---------------- modal ---------------- */

.modal-root {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-root[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 27, 26, 0.45);
}

.modal {
    position: relative;
    background: #fff;
    width: 100%;
    max-height: 90dvh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-lg);
}

.modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-head h3 {
    font-size: 15.5px;
    font-weight: 800;
}

.modal-head .close {
    margin-left: auto;
}

.modal-body {
    padding: 18px;
    font-size: 14px;
    color: #3d3a35;
}

.modal-foot {
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}

.modal-foot .btn {
    width: 100%;
}

/* ---------------- es modal (tarmoq edit) ---------------- */

.es-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.es-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 27, 26, 0.45);
}

.es-modal {
    position: relative;
    width: 100%;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-lg);
    max-height: 92dvh;
    overflow-y: auto;
}

.es-modal-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-bottom: 1px solid var(--border);
}

.es-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.es-modal-head h3 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.es-modal-head p {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
}

.es-modal-head .close {
    margin-left: auto;
    flex: 0 0 auto;
}

.es-modal-body {
    padding: 18px;
}

.es-modal-body .field label {
    font-size: 13px;
}

.es-modal-body input[type="text"] {
    width: 100%;
    padding: 13px 16px;
    font-size: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: #fff;
    outline: none;
}

.es-modal-body input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.es-modal-body .hint {
    display: block;
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--muted);
}

.es-preview {
    margin-top: 18px;
    padding: 14px;
    background: #fbfaf7;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.es-preview-label {
    display: block;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 10px;
}

.es-preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px 8px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.es-preview-chip .sc-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.es-preview-chip svg:last-child {
    color: var(--muted);
    flex: 0 0 auto;
}

.es-preview-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60vw;
}

.es-modal-foot {
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    background: #fbfaf7;
    border-top: 1px solid var(--border);
}

.es-modal-foot .btn {
    width: 100%;
}

/* ---------------- panes ---------------- */

.pane-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
}

.pane {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.pane-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}

.pane-head h3 {
    font-size: 14px;
    font-weight: 800;
}

.pane-head .actions {
    margin-left: auto;
}

.pane-list {
    max-height: 380px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pane-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: none;
}

.pane-item:last-child {
    border-bottom: none;
}

.pane-item.active {
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
}

.pane-item .order-badge {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    flex: 0 0 auto;
}

.pane-item.active .order-badge {
    background: #fff;
    color: var(--primary);
    border-color: rgba(81, 88, 246, 0.3);
}

.pane-item .pane-text {
    min-width: 0;
}

.pane-item .pane-text b {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.pane-item .pane-text small {
    color: var(--muted);
    font-size: 11.5px;
}

.pane-detail {
    padding: 16px;
}

/* ---------------- rte ---------------- */

.rte-wrapper {
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.rte-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.rte-toolbar-static {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px;
    background: #1c1b1a;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rte-toolbar-static button {
    min-width: 44px;
    height: 40px;
    padding: 0 10px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
    flex: 0 0 auto;
}

.rte-toolbar-static button:active {
    background: rgba(255, 255, 255, 0.22);
}

.rte-toolbar-static .sep {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
    flex: 0 0 auto;
}

.rte-editor {
    min-height: 240px;
    padding: 16px;
    outline: none;
    font-size: 15px;
    line-height: 1.75;
}

.rte-editor:empty::before {
    content: attr(data-placeholder);
    color: #b3ada1;
}

.rte-editor p {
    margin: 0 0 14px;
}

.rte-editor h2,
.rte-editor h3 {
    margin: 20px 0 10px;
    letter-spacing: -0.02em;
}

.rte-editor blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 3px solid #222;
    background: #fbfaf7;
    border-radius: 0 12px 12px 0;
    color: #3d3a35;
}

.rte-editor pre {
    margin: 16px 0;
    padding: 14px 16px;
    background: #1c1b1a;
    color: #e7e7e7;
    border-radius: 12px;
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
}

.rte-editor code {
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.92em;
    background: #f1eee6;
    padding: 2px 6px;
    border-radius: 6px;
}

.rte-editor pre code {
    background: none;
    padding: 0;
}

.rte-editor a {
    color: var(--primary);
    text-decoration: underline;
}

.rte-editor img {
    max-width: 100%;
    border-radius: 12px;
    margin: 10px 0;
}

.rte-editor .embed-video {
    position: relative;
    aspect-ratio: 16 / 9;
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.rte-editor .embed-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------------- spinner / yuklanmoqda ---------------- */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(28, 27, 26, 0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

.spinner-lg {
    width: 36px;
    height: 36px;
    border-width: 3px;
    color: var(--primary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.upload-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(28, 27, 26, 0.45);
    display: grid;
    place-items: center;
    padding: 20px;
}

.upload-overlay-card {
    background: #fff;
    border-radius: 20px;
    padding: 30px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 320px;
}

.upload-overlay-card b {
    font-size: 16px;
    font-weight: 800;
}

.upload-overlay-card small {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.btn .spinner {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
}

.btn[disabled] {
    opacity: 0.75;
    cursor: wait;
}

/* ---------------- toast ---------------- */

.toast-stack {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1c1b1a;
    color: #fff;
    padding: 12px 16px;
    border-radius: 13px;
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    font-weight: 600;
}

.toast.toast-success svg {
    color: #4ade80;
}

.toast.toast-danger svg {
    color: #f87171;
}

.toast.out {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

/* ---------------- empty / misc ---------------- */

.empty {
    padding: 44px 18px;
    text-align: center;
    color: var(--muted);
}

.empty .empty-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    color: var(--muted);
}

.empty b {
    display: block;
    color: var(--text);
    font-size: 14.5px;
    margin-bottom: 4px;
}

.list-plain {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.list-plain li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.list-plain li:last-child {
    border-bottom: none;
}

.list-plain .thumb {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex: 0 0 auto;
}

/* ---------------- login ---------------- */

.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(560px 300px at 15% 0%, rgba(81, 88, 246, 0.09), transparent 60%),
        radial-gradient(480px 300px at 95% 100%, rgba(124, 92, 240, 0.09), transparent 60%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    padding: 32px 24px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    text-align: center;
}

.login-brand .brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    font-size: 22px;
}

.login-brand h1 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.login-brand p {
    color: var(--muted);
    font-size: 13px;
}

.login-card .field {
    margin-bottom: 14px;
}

.login-card .field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    font-size: 16px;
    outline: none;
    background: #fff;
}

.login-card .field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.login-error {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: 11px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
}

.login-note {
    margin-top: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

/* ---------------- desktop (min-width: 760px) ---------------- */

@media (min-width: 760px) {
    .studio-main {
        padding: 24px 24px 60px;
    }

    .studio-topbar {
        height: 64px;
        padding: 0 24px;
    }

    .topbar-title h1 {
        font-size: 17px;
    }

    .topbar-title p {
        display: block;
        font-size: 12px;
        color: var(--muted);
        margin-top: -2px;
    }

    .topbar-actions .btn svg:last-child {
        display: inline-block;
    }

    .card-head {
        padding: 16px 20px;
    }

    .card-head .actions {
        width: auto;
    }

    .card-body {
        padding: 20px;
    }

    .search-box {
        flex: 0 0 auto;
    }

    .search-box input {
        width: 240px;
        font-size: 14px;
    }

    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }

    .stat-card {
        padding: 18px;
    }

    .quick-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .form-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px 18px;
    }

    .form-grid .full {
        grid-column: 1 / -1;
    }

    .field input[type="text"],
    .field input[type="url"],
    .field input[type="date"],
    .field input[type="number"],
    .field input[type="password"],
    .field select,
    .field textarea {
        font-size: 14px;
    }

    .hide-sm {
        display: table-cell;
    }

    .doc-row .doc-text b {
        max-width: 320px;
    }

    table.data th {
        padding: 12px 16px;
    }

    table.data td {
        padding: 12px 16px;
    }

    .drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(600px, 92vw);
        min-height: 0;
        border-left: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        transform: translateX(103%);
        transition: transform 0.24s ease;
        z-index: 90;
        overflow-y: hidden;
    }

    .drawer.open {
        display: flex;
        transform: translateX(0);
        left: auto;
        width: min(600px, 92vw);
        overflow-y: hidden;
    }

    .drawer-head {
        padding: 16px 22px;
        position: static;
        z-index: auto;
    }

    .drawer-foot {
        position: static;
        z-index: auto;
    }

    .drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(28, 27, 26, 0.42);
        z-index: 80;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.24s ease;
    }

    .drawer-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }

    body.drawer-open {
        overflow: hidden;
    }

    .drawer-body {
        padding: 22px;
        overflow-y: auto;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .drawer-foot {
        flex-direction: row;
        padding: 14px 22px;
    }

    .drawer-foot .btn {
        width: auto;
    }

    .modal-root {
        align-items: center;
        padding: 20px;
    }

    .modal {
        max-width: 480px;
        border-radius: var(--radius-lg);
    }

    .modal.modal-lg {
        max-width: 820px;
    }

    .modal-foot {
        flex-direction: row;
        justify-content: flex-end;
    }

    .modal-foot .btn {
        width: auto;
    }

    .es-modal-overlay {
        align-items: center;
        padding: 20px;
    }

    .es-modal {
        max-width: 680px;
        border-radius: 22px;
    }

    .es-modal-foot {
        flex-direction: row;
        justify-content: flex-end;
    }

    .es-modal-foot .btn {
        width: auto;
    }

    .es-preview-url {
        max-width: 420px;
    }

    .toast-stack {
        left: auto;
        right: 24px;
        bottom: 24px;
        width: 340px;
    }

    .social-add-row {
        grid-template-columns: 1fr auto;
        align-items: end;
    }

    .social-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .city-add-row {
        grid-template-columns: 1fr auto;
        align-items: end;
    }

    .geo-add-grid {
        grid-template-columns: 1fr 1fr auto;
        align-items: end;
    }

    .geo-country .badge {
        display: inline-flex;
    }

    .login-card {
        padding: 40px 36px;
    }
}

/* ---------------- desktop sidebar (min-width: 980px) ---------------- */

@media (min-width: 980px) {
    .studio-shell {
        display: grid;
        grid-template-columns: 280px 1fr;
    }

    .studio-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        width: auto;
        transform: none;
        z-index: 40;
    }

    .sidebar-backdrop {
        display: none;
    }

    .sidebar-toggle {
        display: none;
    }

    .pane-grid {
        grid-template-columns: 360px 1fr;
    }

    .pane-list {
        max-height: calc(100vh - 260px);
    }

    .pane-detail {
        padding: 22px;
    }
}

/* ---------------- touch devices ---------------- */

@media (hover: none) and (pointer: coarse) {
    .card,
    .stat-card,
    .quick-item,
    .nav-item,
    .btn,
    .pane-item,
    .social-opt,
    table.data tbody tr {
        transition: none;
    }
}
