/* ========= Admin / Super Admin panel ========= */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; background: #f6f4f1; }
.admin-sidebar { background: #1f1916; color: #e9e1da; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-brand { padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .08); display: flex; flex-direction: column; gap: .35rem; }
.admin-brand .logo-text { color: #fff; }
.role-chip { align-self: flex-start; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; background: var(--brand); color: #fff; padding: .15rem .55rem; border-radius: 999px; }
.admin-nav { display: flex; flex-direction: column; padding: .75rem .6rem; gap: 2px; }
.admin-nav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: 8px; text-decoration: none; font-size: .925rem; color: #d8cec6; }
.admin-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-nav a.active { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 500; }
.nav-group { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #8f847c; padding: 1rem .75rem .35rem; }
.admin-sidebar-foot { margin-top: auto; padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; justify-content: space-between; align-items: center; }
.admin-sidebar-foot a, .admin-sidebar-foot .link-btn { color: #d8cec6; text-decoration: none; display: inline-flex; gap: .35rem; align-items: center; }
.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.admin-menu-btn { display: none; }
.admin-content { padding: 1.5rem; max-width: 1400px; width: 100%; }
.admin-backdrop { display: none; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.admin-head h1 { font-family: var(--font-body); font-size: 1.6rem; font-weight: 600; margin: .15rem 0 0; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.admin-head p { margin: .25rem 0 0; }
.admin-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; margin-bottom: 1.25rem; }
.admin-card h2 { font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; margin: 0 0 .9rem; }
.admin-card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .9rem; }
.admin-card-head h2 { margin: 0; }
.admin-card.sticky { position: sticky; top: 72px; }
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.admin-grid-2.wide-left { grid-template-columns: 1.5fr 1fr; }
.admin-grid-2.wide-right { grid-template-columns: 1fr 2fr; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.admin .input, .admin .select { padding: .55rem .75rem; border-radius: 8px; font-size: .925rem; }
.admin .field { margin-bottom: .85rem; }
.input-sm { padding: .4rem .6rem !important; font-size: .85rem !important; }
.input-xs { width: 80px !important; padding: .35rem .5rem !important; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.toolbar { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar .input { flex: 1; min-width: 220px; }
.toolbar .select { width: auto; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 500; color: var(--ink-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; padding: .6rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .7rem .6rem; border-bottom: 1px solid #f0ebe6; vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td, .table tr.selected td { background: #faf7f3; }
.table a { text-decoration: none; }
.thumb-sm { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--tint); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .2rem; }
.stat span { font-size: .8rem; color: var(--ink-soft); }
.stat strong { font-size: 1.7rem; font-weight: 600; }
.stat small { color: var(--ink-soft); }
.stat.warn { border-color: #f1d9a8; background: #fffaf0; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: .5rem; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar { width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; transition: opacity .2s; }
.bar-col:hover .bar { opacity: 1; }
.bar-col span { font-size: .7rem; color: var(--ink-soft); }
.status-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.status-list li { display: flex; justify-content: space-between; align-items: center; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tab { background: none; border: 0; padding: .7rem 1rem; border-bottom: 2px solid transparent; color: var(--ink-soft); white-space: nowrap; }
.tab.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 500; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d5ccc4; border-radius: 999px; transition: background .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::before { transform: translateX(16px); }

/* product editor */
.rte-toolbar { display: flex; gap: 2px; flex-wrap: wrap; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 4px; background: #faf8f6; }
.rte-toolbar button { border: 0; background: none; padding: .35rem .6rem; border-radius: 6px; font-size: .85rem; }
.rte-toolbar button:hover { background: #ece6e0; }
.rte-editor { min-height: 180px; border: 1px solid var(--line); border-radius: 0 0 8px 8px; padding: .75rem 1rem; background: #fff; outline: none; }
.rte-editor.tall { min-height: 360px; }
.rte-editor:focus { border-color: var(--brand); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.media-item { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--tint); display: flex; flex-direction: column; }
.media-item.cover { grid-column: span 2; grid-row: span 2; }
.media-item img { width: 100%; aspect-ratio: 1; object-fit: cover; flex: 1; }
.media-badge { position: absolute; top: 8px; left: 8px; background: var(--ink); color: #fff; font-size: .7rem; padding: .1rem .5rem; border-radius: 999px; }
.media-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 3px; opacity: 0; transition: opacity .15s; }
.media-item:hover .media-actions, .media-item:focus-within .media-actions { opacity: 1; }
.media-actions button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .92); font-size: .85rem; }
.media-actions button.danger { color: var(--danger); }
.media-actions button:disabled { opacity: .35; }
.media-alt { border: 0; border-top: 1px solid var(--line); padding: .35rem .5rem; font-size: .75rem; background: #fff; }
.dropzone { position: relative; aspect-ratio: 1; border: 2px dashed #cfc4ba; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; color: var(--ink-soft); cursor: pointer; text-align: center; transition: border-color .2s, background .2s; }
.dropzone:hover { border-color: var(--brand); background: #fff; color: var(--brand); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.busy { pointer-events: none; opacity: .6; }
.variant-table .input { min-width: 90px; }
.seo-preview { display: flex; flex-direction: column; gap: .1rem; padding: .9rem; background: #faf8f6; border-radius: 8px; margin-bottom: 1rem; }
.seo-title { color: #1a0dab; font-size: 1.05rem; }
.seo-url { color: #006621; font-size: .8rem; word-break: break-all; }
.seo-desc { color: #545454; font-size: .85rem; }

.image-field { display: flex; gap: .75rem; align-items: center; }
.image-field-preview { position: relative; flex: 0 0 84px; height: 84px; border-radius: 10px; border: 1px dashed #cfc4ba; display: grid; place-items: center; color: var(--ink-soft); overflow: hidden; background: #faf8f6; }
.image-field-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-field-text { font-size: 2rem; }
.image-field-clear { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); font-size: .7rem; }
.image-field-actions { display: grid; gap: .4rem; flex: 1; }
.image-field-actions .btn { justify-self: start; cursor: pointer; }

.section-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.section-list li { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.section-list li.selected { border-color: var(--brand); }
.section-list li.inactive { opacity: .55; }
.section-list .grow, .slide-item .grow { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.reorder { display: flex; flex-direction: column; }
.reorder button { border: 0; background: none; font-size: .65rem; padding: 1px 4px; color: var(--ink-soft); }
.reorder button:disabled { opacity: .25; }
.slide-list { display: grid; gap: .5rem; }
.slide-item { display: flex; align-items: center; gap: .75rem; padding: .5rem; border: 1px solid var(--line); border-radius: 10px; }
.slide-item.inactive { opacity: .55; }
.slide-item img { width: 96px; height: 48px; object-fit: cover; border-radius: 6px; }
.repeat-row { border: 1px solid var(--line); border-radius: 10px; padding: .75rem; margin-bottom: .75rem; display: grid; gap: .5rem; }
.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list li { padding: .6rem .5rem; border-bottom: 1px solid #f0ebe6; display: flex; flex-direction: column; }
.simple-list li.selected { background: #faf7f3; }
.perm-list { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .9rem; margin: 0 0 1rem; }
.perm-list legend { font-size: .85rem; font-weight: 500; padding: 0 .25rem; }
.perm-list .check { align-items: flex-start; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: .875rem; margin: 0 0 1rem; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; font-weight: 500; word-break: break-all; }
.note-box { background: #fff8e6; border: 1px solid #f1dfae; border-radius: 8px; padding: .75rem; margin-top: 1rem; font-size: .9rem; }
.color-row { display: flex; gap: .5rem; align-items: center; }
.color-row input[type=color] { width: 44px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }

/* categories tree */
.cat-tree { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.cat-main { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; background: #fff; }
.cat-main.selected, .cat-subs li.selected { border-color: var(--brand); }
.cat-main.inactive > .cat-row, .cat-subs li.inactive { opacity: .55; }
.cat-row { display: flex; align-items: center; gap: .6rem; }
.cat-row .grow { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cat-subs { list-style: none; padding: 0 0 0 1.25rem; margin: .5rem 0 0; display: grid; gap: .35rem; }
.cat-subs li { border: 1px solid transparent; border-radius: 8px; padding: .3rem .5rem; }
.cat-subs li:hover { background: #faf7f3; }
.cat-branch { color: var(--ink-soft); }

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .editor-grid, .admin-grid-2, .admin-grid-2.wide-left, .admin-grid-2.wide-right { grid-template-columns: 1fr; }
    .admin-card.sticky { position: static; }
}
@media (max-width: 860px) {
    .admin { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .25s; }
    .admin.sidebar-open .admin-sidebar { transform: none; }
    .admin.sidebar-open .admin-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }
    .admin-menu-btn { display: inline-grid; }
    .admin-content { padding: 1rem; }
    .form-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .media-item.cover { grid-column: span 1; grid-row: span 1; }
}

@media print {
    .admin-sidebar, .admin-topbar, .editor-side, .admin-head .btn, .admin-card-head .btn { display: none !important; }
    .admin { display: block; background: #fff; }
    .editor-grid { display: block; }
    .admin-card { border: 0; }
}

/* coupons */
.admin-sub { font-family: var(--font-body); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin: 1.1rem 0 .4rem; font-weight: 600; }
.input.upper { text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.cat-picker { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .8rem; max-height: 260px; overflow-y: auto; }
.check.indent { padding-left: 1.5rem; font-size: .9rem; }
.coupon-preview { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; padding: .8rem; border: 1px dashed var(--brand); border-radius: 10px; background: #fbf6f8; font-size: .9rem; }

/* emails */
.input.code { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; line-height: 1.5; }
.token-list { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.token { border: 1px solid var(--line); background: #faf8f6; border-radius: 6px; padding: .15rem .45rem; font-family: ui-monospace, Consolas, monospace; font-size: .75rem; }
.token:hover { border-color: var(--brand); color: var(--brand); }
.email-preview { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 10px; background: #f6f1eb; margin-top: .5rem; }

/* seo */
.seo-score { font-size: .8rem; font-weight: 600; padding: .25rem .7rem; border-radius: 999px; }
.seo-score.good { background: #e3f3e8; color: var(--success); }
.seo-score.ok { background: #fdf3df; color: var(--warn); }
.seo-score.bad { background: #fdecea; color: var(--danger); }
.seo-issues { list-style: none; padding: 0; margin: .75rem 0 0; display: grid; gap: .3rem; font-size: .85rem; }
.seo-issues li::before { margin-right: .4rem; }
.seo-issues li.bad::before { content: "⚠"; color: var(--warn); }
.seo-issues li.good::before { content: "✓"; color: var(--success); }

/* reviews admin */
.admin-reviews { display: grid; gap: 1rem; }
.admin-review { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.admin-review-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .4rem; }
.admin-review-body { margin: 0 0 .5rem; white-space: pre-line; }

/* instagram admin */
.ig-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem; }
.ig-admin-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.ig-admin-item.inactive { opacity: .5; }
.ig-admin-item img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--tint); }
.ig-admin-meta { padding: .5rem .6rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.ig-admin-item .btn-row { padding: 0 .6rem .6rem; }
.checklist { list-style: none; padding: 0; display: grid; gap: .4rem; }
.tips { padding-left: 1.2rem; display: grid; gap: .45rem; }

/* tooltips */
.hint { position: relative; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: #e9e2db; color: var(--ink-soft); font-size: .68rem; font-weight: 700; font-style: italic; font-family: Georgia, serif; cursor: help; vertical-align: middle; margin-left: .25rem; flex-shrink: 0; text-transform: none; letter-spacing: 0; }
.hint:hover, .hint:focus { background: var(--brand); color: #fff; outline: none; }
.hint-bubble { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 260px; background: #2a211d; color: #fff; font: 400 .8rem/1.45 var(--font-body); font-style: normal; padding: .55rem .7rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); opacity: 0; visibility: hidden; transition: opacity .15s; z-index: 80; pointer-events: none; text-align: left; white-space: normal; }
.hint-wide .hint-bubble { max-width: 340px; }
.hint-bubble::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #2a211d; }
.hint:hover .hint-bubble, .hint:focus .hint-bubble { opacity: 1; visibility: visible; }
@media (max-width: 860px) { .hint-bubble { left: auto; right: -10px; transform: none; } .hint-bubble::after { left: auto; right: 12px; transform: none; } }

/* category step */
.req { color: var(--danger); }
.category-card.needs-attention { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); }
.category-path { font-size: .85rem; background: #f4ece3; padding: .25rem .7rem; border-radius: 999px; }
.inline-add { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; }
.inline-add .input { padding: .4rem .6rem; }
.field > .link-btn { justify-self: start; margin-top: .2rem; }
