/* =========================================================
   Beejly admin panel – matches the backend design screens
   ========================================================= */
:root {
    --green: #2f7041;
    --green-hover: #255c34;
    --green-ink: #2a5b31;
    --mint: #dff4eb;
    --mint-strong: #c9ecd9;
    --bg: #f7f7f7;
    --panel: #ffffff;
    --row: #fafafa;
    --line: #e5e5e5;
    --line-strong: #cfcfcf;
    --ink: #262626;
    --ink-2: #4a4a4a;
    --muted: #767676;
    --red: #c4416c;
    --red-bg: #fcd3e1;
    --ok-bg: #c8f5cf;
    --ok-ink: #2c9339;
    --warn-bg: #fff0c2;
    --warn-ink: #8a6400;

    --side-w: 280px;
    --radius: 10px;
    --font: "Instrument Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--green); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--green); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.ic { width: 22px; height: 22px; flex: none; }

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 20px 28px 48px; flex: 1; }

/* ---------------- Sidebar ---------------- */
.side {
    width: var(--side-w); flex: none;
    background: #fff;
    padding: 22px 16px 24px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    border-right: 1px solid #f0f0f0;
    transition: width .2s ease;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 26px; }
.side-logo img { height: 46px; width: auto; }
.icon-plain { background: none; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--ink-2); display: inline-grid; place-items: center; }
.icon-plain:hover { background: #f2f2f2; color: var(--ink); }
.side-toggle .ic { width: 26px; height: 26px; }

.channel { margin-bottom: 26px; }
.channel > summary {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid var(--line); border-radius: 12px;
    padding: 8px 12px 8px 8px; cursor: pointer; list-style: none;
}
.channel > summary::-webkit-details-marker { display: none; }
.avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-sq { border-radius: 10px; }
.channel-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.channel-text small { font-size: 13px; color: var(--ink-2); }
.channel-text strong { font-weight: 500; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { transition: transform .2s; }
details[open] > summary .chev { transform: rotate(180deg); }

.side-label { margin: 22px 10px 8px; font-size: 14px; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-2); }
.side-label:first-child { margin-top: 0; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin: 2px 0;
    border-radius: 9px;
    color: #5c5c5c; text-decoration: none; font-size: 17px; font-weight: 500;
    cursor: pointer; list-style: none;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link span { flex: 1; }
.nav-link:hover { background: #f4f6f4; color: var(--ink); }
.nav-link.is-active { background: var(--mint); color: var(--green-ink); font-weight: 600; }
.nav-group .chev { width: 20px; height: 20px; transform: rotate(180deg); }
.nav-group:not([open]) .chev { transform: rotate(0); }
.sub-nav { margin: 4px 0 8px 22px; padding-left: 0; border-left: 1.5px solid #d9d9d9; }
.sub-link {
    display: block; position: relative;
    padding: 9px 12px 9px 22px; color: #6a6a6a; text-decoration: none; font-size: 16px;
    border-radius: 8px;
}
.sub-link::before { content: ""; position: absolute; left: 0; top: 50%; width: 12px; border-top: 1.5px solid #d9d9d9; }
.sub-link:hover { color: var(--ink); background: #f6f6f6; }
.sub-link.is-active { color: var(--green-ink); font-weight: 600; }

/* Collapsed sidebar (desktop) */
.side-closed .side { width: 84px; padding-inline: 12px; }
.side-closed .side-logo, .side-closed .channel-text, .side-closed .channel .chev,
.side-closed .side-label, .side-closed .nav-link span, .side-closed .nav-link .chev,
.side-closed .sub-nav { display: none; }
.side-closed .side-head { justify-content: center; padding-inline: 0; }
.side-closed .side-toggle { transform: scaleX(-1); }
.side-closed .channel > summary { justify-content: center; padding: 6px; border: 0; }
.side-closed .nav-link { justify-content: center; padding: 12px; }
.side-closed .side-nav { padding-top: 10px; }

/* ---------------- Top bar ---------------- */
.topbar {
    display: flex; align-items: center; gap: 16px;
    background: #fff; padding: 18px 28px;
    position: sticky; top: 0; z-index: 30;
    border-bottom: 1px solid #f0f0f0;
}
.search { position: relative; display: flex; align-items: center; flex: 1; max-width: 600px; }
.search input {
    width: 100%; height: 48px;
    border: 1.5px solid #9c9c9c; border-radius: 10px;
    padding: 0 52px 0 16px; background: #fff; font-size: 16px;
}
.search input::placeholder { color: #8a8a8a; }
.search input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 112, 65, .15); }
.search button { position: absolute; right: 6px; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--ink-2); display: grid; }
.top-search input { height: 52px; border-width: 1.5px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.icon-btn {
    position: relative; width: 52px; height: 52px; border-radius: 12px;
    background: #f5f5f5; border: 0; display: grid; place-items: center; cursor: pointer; list-style: none; color: #3b3b3b;
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { background: #ececec; }
.dot-count {
    position: absolute; top: 9px; right: 9px;
    min-width: 17px; height: 17px; padding: 0 4px;
    background: #e5322d; color: #fff; border-radius: 5px;
    font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
}
.top-divider { width: 1px; height: 46px; background: #d6d6d6; }
.profile { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.profile::-webkit-details-marker { display: none; }
.profile-text { display: grid; line-height: 1.2; }
.profile-text strong { font-size: 18px; font-weight: 600; }
.profile-text small { font-size: 14px; color: var(--muted); }
.mobile-only { display: none; }

/* ---------------- Dropdowns ---------------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.menu-pop {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
    min-width: 220px; padding: 6px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .12);
}
.menu-pop.align-right { left: auto; right: 0; }
.menu-pop-wide { width: 320px; }
.menu-pop form { margin: 0; }
.menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border: 0; border-radius: 8px; background: none;
    color: var(--ink); text-decoration: none; text-align: left; font-size: 15px; cursor: pointer;
}
.menu-item .ic { width: 18px; height: 18px; color: var(--ink-2); }
.menu-item:hover { background: #f4f6f4; }
.menu-item.danger, .menu-item.danger .ic { color: var(--red); }
.menu-item.is-current { color: var(--green-ink); font-weight: 600; cursor: default; }
.menu-item.is-current .ic { color: var(--green); }
.menu-item.note { align-items: flex-start; font-size: 14px; }
.menu-item.note .ic { margin-top: 2px; color: var(--green); }
.pop-title { margin: 6px 10px 6px; font-weight: 600; }
.pop-empty { margin: 4px 10px 10px; color: var(--muted); font-size: 14px; }
.menu-pop-form { width: 280px; padding: 14px; display: grid; gap: 12px; }
.menu-pop-form label { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
.pop-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; padding: 0 18px;
    background: var(--green); color: #fff; border: 1.5px solid var(--green); border-radius: 6px;
    font-size: 17px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; list-style: none;
}
.btn::-webkit-details-marker { display: none; }
.btn:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn .ic { width: 20px; height: 20px; }
.btn-outline { background: #fff; color: var(--ink-2); border-color: #9c9c9c; }
.btn-outline:hover { background: #f5f5f5; border-color: #7a7a7a; color: var(--ink); }
.btn-lg { height: 60px; font-size: 22px; padding: 0 28px; }
.btn-block { width: 100%; }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #a83159; border-color: #a83159; }
.btn-danger-outline { background: #fff; color: var(--red); border-color: #e8a5bb; }
.btn-danger-outline:hover { background: #fff3f6; border-color: var(--red); color: var(--red); }
.has-dot { position: relative; }
.has-dot::after { content: ""; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* ---------------- Panels & toolbar ---------------- */
.panel { background: var(--panel); border: 1.5px solid #ececec; border-radius: 14px; padding: 26px; }
.panel + .panel { margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-head h2, .panel-title { margin: 0; font-size: 26px; font-weight: 500; }
.panel-title { font-size: 20px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-size: 19px; }
.link-arrow:hover { color: var(--green); }
.link-arrow .ic { width: 20px; height: 20px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.toolbar .search input { height: 46px; font-size: 16px; border-color: #9c9c9c; border-width: 1px; border-radius: 6px; }
.toolbar-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 18px; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 600; }
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link:hover { color: var(--green); }

/* ---------------- Tabs ---------------- */
.tabs {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
    border: 1.5px solid #e2e2e2; border-radius: 12px; padding: 7px; margin-bottom: 22px;
}
.tab { text-align: center; padding: 7px 10px; border-radius: 7px; color: #6a6a6a; text-decoration: none; font-size: 19px; }
.tab:hover { background: #f5f7f5; color: var(--ink); }
.tab.is-active { background: var(--mint); color: var(--green-ink); font-weight: 600; }
.filter-note { margin: -8px 0 16px; color: var(--muted); }

/* ---------------- Stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat {
    display: grid; align-content: start; gap: 6px;
    background: #fff; border: 1.5px solid #ececec; border-radius: 10px;
    padding: 20px 22px 18px; text-decoration: none; color: var(--ink);
    min-height: 172px;
}
.stat:hover { border-color: #cfe3d4; }
.stat-icon { width: 52px; height: 52px; border-radius: 50%; background: #2b6a3b; color: #fff; display: grid; place-items: center; margin-bottom: 12px; }
.stat-icon .ic { width: 28px; height: 28px; }
.stat-label { font-size: 20px; color: #3d3d3d; }
.stat-value { font-size: 36px; font-weight: 500; color: var(--green-ink); line-height: 1.1; }
.stat-main { background: linear-gradient(165deg, #4a7533 0%, #2d5a1c 45%, #174304 100%); border-color: transparent; color: #fff; }
.stat-main .stat-icon { background: #fff; color: #2b6a3b; }
.stat-main .stat-label, .stat-main .stat-value { color: #fff; }
.stat-main:hover { border-color: transparent; filter: brightness(1.05); }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th {
    background: #f6f6f6; text-align: left; font-weight: 500; font-size: 18px;
    padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table th + th { border-left: 1px solid var(--line); }
.table th.col-actions { padding: 15px 14px; }
.th-sort { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 15px 14px; color: var(--ink); text-decoration: none; }
.th-sort:hover { background: #efefef; }
.ic-sort { width: 16px; height: 16px; color: #9a9a9a; }
.th-sort.is-active .ic-sort { color: var(--green); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 18px; color: #3a3a3a; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfcfb; }
.col-reel { width: 34%; }
.col-actions { width: 90px; }
.reel-cell { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; max-width: 300px; }
.reel-cell img { width: 48px; height: 56px; object-fit: cover; border-radius: 4px; flex: none; }
.reel-cell span { display: grid; min-width: 0; }
.reel-cell strong { font-weight: 500; font-size: 17px; }
.reel-cell small { font-size: 14px; color: #555; }
.reel-cell:hover strong { color: var(--green); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-count { font-size: 13px; color: var(--muted); background: #f1f1f1; border-radius: 999px; padding: 1px 7px; }
.row-menu summary { padding: 6px; }
.row-menu .ic { width: 24px; height: 24px; }

.badge { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 14px; font-weight: 500; line-height: 1.3; }
.badge-published { background: var(--ok-bg); color: var(--ok-ink); }
.badge-cancelled { background: var(--red-bg); color: var(--red); }
.badge-draft { background: #ececec; color: #5f5f5f; }
.badge-scheduled { background: var(--warn-bg); color: var(--warn-ink); }

/* ---------------- Category list ---------------- */
.list-hint { margin: -6px 0 14px; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.grip-inline .ic { width: 16px; height: 16px; color: var(--green); vertical-align: -3px; }
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.cat-item {
    display: flex; align-items: center; gap: 6px;
    background: var(--row); border: 1px solid #ececec; border-radius: 4px;
    padding: 0 18px 0 14px; min-height: 64px;
    transition: box-shadow .15s, opacity .15s;
}
.cat-item.is-dragging { opacity: .45; }
.cat-item.is-over { box-shadow: 0 -3px 0 var(--green); }
.cat-item.is-over-after { box-shadow: 0 3px 0 var(--green); }
.cat-item.is-inactive .cat-name { color: var(--muted); }
.grip { background: none; border: 0; padding: 6px 2px; cursor: grab; color: var(--green); display: grid; border-radius: 6px; }
.grip:active { cursor: grabbing; }
.grip .ic { width: 26px; height: 26px; }
.cat-name { flex: 1; text-align: left; background: none; border: 0; padding: 12px 4px; font-size: 20px; color: var(--ink); cursor: pointer; }
.cat-name:hover { color: var(--green); }
.cat-meta { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.cat-meta a { text-decoration: none; }
.cat-meta a:hover { color: var(--green); text-decoration: underline; }
.tag-soft { background: var(--mint); color: var(--green-ink); border-radius: 999px; padding: 2px 9px; font-size: 13px; }
.cat-item form { margin: 0 0 0 10px; }
.cat-remove .ic { width: 30px; height: 30px; stroke-width: 1.4; color: #333; }
.cat-remove:hover .ic { color: var(--red); }
.save-state { min-height: 20px; margin: 12px 0 0; font-size: 14px; color: var(--green-ink); }

/* ---------------- Forms ---------------- */
.field { display: grid; gap: 7px; margin-bottom: 18px; border: 0; padding: 0; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label, .label { font-size: 18px; color: #333; font-weight: 400; padding: 0; }
.req { color: #e3242b; }
.hint { font-size: 13px; color: var(--muted); }
.field-error { font-size: 14px; color: var(--red); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=datetime-local], select, textarea {
    width: 100%; min-height: 46px;
    border: 1px solid #e3e3e3; border-radius: 4px; background: #fbfbfb;
    padding: 10px 14px; font-size: 17px; color: var(--ink);
}
textarea { resize: vertical; min-height: 120px; }
input::placeholder, textarea::placeholder { color: #9a9a9a; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(47, 112, 65, .14); }
input[type=file] { font-size: 15px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 16px; cursor: pointer; margin: 4px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.check-list { display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.field-group { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px 18px; margin: 0; }
.field-group legend { padding: 0 6px; font-weight: 600; font-size: 17px; }
.field-small { max-width: 180px; }
.input-prefix { display: flex; align-items: center; border: 1px solid #e3e3e3; border-radius: 4px; background: #f1f1f1; }
.input-prefix span { padding: 0 6px 0 14px; color: var(--muted); }
.input-prefix input { border: 0; border-radius: 0 4px 4px 0; }

.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.form-side { display: grid; gap: 20px; }
.form-side .panel + .panel { margin-top: 0; }
.form-main .field-group { margin-top: 4px; }
.form-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.form-actions .btn-lg { font-size: 19px; height: 54px; }
.form-actions-inline { margin-top: 6px; }
.danger-row { margin-top: 24px; }
.cover-drop {
    display: grid; place-items: center;
    aspect-ratio: 9 / 13; width: 100%; max-width: 220px;
    border: 1.5px dashed #c9c9c9; border-radius: 10px; background: #fafafa; overflow: hidden; cursor: pointer;
}
.cover-drop:hover { border-color: var(--green); }
.cover-drop img { width: 100%; height: 100%; object-fit: cover; }
.cover-empty { display: grid; justify-items: center; gap: 8px; color: var(--muted); text-align: center; padding: 16px; font-size: 14px; }
.visually-hidden-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.visually-hidden-input:focus-visible + .hint { outline: 2px solid var(--green); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.settings-grid .panel + .panel { margin-top: 0; }
.info-panel p { margin: 0 0 12px; }

/* ---------------- Modal ---------------- */
.modal {
    width: min(100% - 32px, 768px); padding: 0; border: 0; border-radius: 22px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .25); color: var(--ink);
}
.modal::backdrop { background: rgba(30, 30, 30, .55); }
.modal-sm { width: min(100% - 32px, 460px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; background: #f7f7f7; padding: 14px 24px 14px 36px; }
.modal-head h2 { margin: 0; font-size: 32px; font-weight: 500; color: var(--green-ink); }
.modal-sm .modal-head h2 { font-size: 22px; }
.modal-close .ic { width: 40px; height: 40px; color: var(--green); stroke-width: 1.8; }
.modal-body { padding: 26px 36px 8px; max-height: 64vh; overflow-y: auto; }
.modal-sm .modal-body p { margin: 0; font-size: 16px; }
.modal-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 82px; padding: 28px 36px 24px; }
.modal-sm .modal-foot { gap: 12px; }
.modal-sm .btn-lg { height: 50px; font-size: 18px; }
.modal-foot .btn-outline { background: #f5f5f5; color: #333; border-color: #c9c9c9; }
.more-options { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.more-options summary { cursor: pointer; font-weight: 600; color: var(--green-ink); margin-bottom: 10px; }
.more-options .field { margin-top: 8px; }

/* ---------------- Toasts, empty, pager ---------------- */
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: 10px; margin: 0 0 18px; font-weight: 500;
}
.toast span { flex: 1; }
.toast .ic { width: 20px; height: 20px; }
.toast-ok { background: #e3f5e8; color: #1f5a2c; }
.toast-err { background: #fde7ee; color: #9c2c52; }
.empty { text-align: center; padding: 48px 20px; border: 1.5px dashed var(--line); border-radius: 12px; color: var(--muted); }
.empty p { margin: 0 0 16px; font-size: 17px; }
.pager { margin-top: 20px; }
.pager ul { list-style: none; display: flex; justify-content: center; gap: 6px; padding: 0; margin: 0; flex-wrap: wrap; }
.pager a { display: inline-block; min-width: 38px; text-align: center; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); background: #fff; }
.pager .active a { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------------- Login ---------------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: min(100%, 420px); background: #fff; border: 1.5px solid #ececec; border-radius: 18px; padding: 34px 32px 26px; text-align: center; }
.login-card form { text-align: left; margin: 20px 0 18px; }
.login-logo { height: 58px; width: auto; margin: 0 auto 14px; }
.login-card h1 { font-size: 21px; font-weight: 600; margin: 0 0 10px; }
.login-card .btn-lg { font-size: 19px; height: 54px; margin-top: 6px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1280px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat { min-height: 0; }
    .tab { font-size: 16px; }
    .table th, .table td { font-size: 16px; }
}
@media (max-width: 1000px) {
    .form-layout { grid-template-columns: 1fr; }
    .profile-text { display: none; }
}
@media (max-width: 860px) {
    .side { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .25s ease; width: 280px !important; box-shadow: 0 0 40px rgba(0,0,0,.2); }
    .side-open .side { transform: none; }
    .side-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; display: none; }
    .side-open .side-backdrop { display: block; }
    .side-closed .side-logo, .side-closed .channel-text, .side-closed .side-label, .side-closed .nav-link span, .side-closed .sub-nav { display: revert; }
    .mobile-only { display: grid; }
    .side-toggle { display: none; }
    .topbar { padding: 12px 16px; gap: 10px; }
    .top-actions { gap: 8px; }
    .icon-btn { width: 44px; height: 44px; }
    .top-divider { display: none; }
    .content { padding: 16px; }
    .panel { padding: 18px; }
    .tabs { grid-template-columns: repeat(2, 1fr); }
    .modal-foot { gap: 12px; }
    .modal-head h2 { font-size: 24px; }
    .modal-body, .modal-foot { padding-inline: 20px; }
    .modal-head { padding-left: 20px; }
    .btn-lg { font-size: 18px; height: 52px; }
    .cat-meta .tag-soft { display: none; }
}
@media (max-width: 560px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-label { font-size: 15px; }
    .stat-value { font-size: 28px; }
    .top-search { display: none; }
    .cat-meta a { display: none; }
    .cat-name { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------------- Instagram page ---------------- */
.ig-lead { margin: -6px 0 18px; }
.ig-connect { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ig-option { border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: grid; gap: 10px; align-content: start; }
.ig-option h3 { margin: 0; font-size: 18px; font-weight: 600; }
.ig-option p { margin: 0; }
.ig-option .btn { justify-self: start; }
.ig-option .btn-lg { font-size: 18px; height: 52px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
code { background: #f1f1f1; padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; }
.ig-account { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ig-avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(45deg, #f58529, #dd2a7b 50%, #8134af); flex: none; }
.ig-avatar .ic { width: 30px; height: 30px; }
.ig-account-text { flex: 1; min-width: 220px; display: grid; gap: 2px; }
.ig-account-text strong { font-size: 20px; font-weight: 600; }
.ig-account-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ig-account-actions form { margin: 0; }
.tabs-3 { grid-template-columns: repeat(3, 1fr); }

.ig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.ig-card { border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.ig-card:has(.ig-check:checked) { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 112, 65, .18); }
.ig-card.is-imported { opacity: .8; }
.ig-thumb { position: relative; display: block; aspect-ratio: 9 / 16; background: #e9e9e9; cursor: pointer; }
.ig-card.is-imported .ig-thumb { cursor: default; }
.ig-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ig-check { position: absolute; top: 10px; left: 10px; z-index: 1; width: 22px; height: 22px; accent-color: var(--green); cursor: pointer; }
.ig-flag { position: absolute; top: 10px; left: 10px; }
.ig-body { padding: 10px 12px 12px; display: grid; gap: 4px; }
.ig-caption { margin: 0; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.ig-meta { margin: 0; font-size: 13px; }
.ig-links { margin: 2px 0 0; display: flex; gap: 12px; font-size: 13px; }
.ig-links a { text-decoration: none; }
.ig-links a:hover { text-decoration: underline; }

.ig-bar {
    position: sticky; bottom: 12px; z-index: 20;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 20px; padding: 12px 16px;
    background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
}
.ig-bar.has-selection { border-color: var(--green); }
.ig-all { margin: 0; font-size: 15px; }
.ig-count { margin-right: auto; color: var(--ink-2); }
.ig-cats .menu-pop { top: auto; bottom: calc(100% + 8px); }
.ig-cats .more-count { background: var(--mint); color: var(--green-ink); }
.ig-status select { min-height: 46px; width: auto; }
.ig-note { margin-top: 10px; font-size: 14px; color: var(--green-ink); }
.fail-list { margin: 6px 0 0; padding-left: 18px; font-weight: 400; }
.narrow-panel { max-width: 620px; margin-top: 20px; }

@media (max-width: 860px) {
    .ig-connect { grid-template-columns: 1fr; }
    .ig-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
    .ig-count { margin-right: 0; }
}
.menu-pop-form label.check { display: flex; font-weight: 400; font-size: 15px; gap: 10px; }

/* ---------------- Category picker in tables ---------------- */
.cat-pick {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    background: none; border: 1px solid transparent; border-radius: 8px;
    padding: 6px 8px; margin-left: -9px;
    font: inherit; font-size: inherit; color: inherit; cursor: pointer; text-align: left;
}
.cat-pick span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-pick .chev { width: 16px; height: 16px; color: var(--muted); flex: none; }
.cat-pick:hover { border-color: var(--line-strong); background: #fff; }
.cat-pick.is-empty { border: 1.5px dashed #9fc6aa; background: #f3faf5; color: var(--green-ink); font-size: 15px; font-weight: 500; }
.cat-pick.is-empty:hover { border-color: var(--green); }
.ig-dot { position: absolute; margin: 34px 0 0 32px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(45deg, #f58529, #dd2a7b 50%, #8134af); border: 2px solid #fff; }
.ig-dot .ic { width: 11px; height: 11px; }
.reel-cell { position: relative; }
@keyframes rowSaved { from { background: #e3f5e8; } to { background: transparent; } }
.row-saved td { animation: rowSaved 1.6s ease-out; }

.modal-sub { margin: 2px 0 0; color: var(--muted); font-size: 15px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-hint { margin: 0 0 14px; }
.pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; max-height: 300px; overflow-y: auto; padding: 2px; }
.pick-option { padding: 6px 8px; border-radius: 8px; margin: 0; }
.pick-option:hover { background: #f4f6f4; }
.pick-option:has(input:checked) { background: var(--mint); color: var(--green-ink); }
.pick-publish { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 16px; }
.pick-publish input { width: 20px; height: 20px; accent-color: var(--green); margin-top: 2px; flex: none; }
.pick-publish .muted { font-size: 14px; }
#pick-modal .modal-foot { gap: 24px; }

.ig-panel .panel-head { align-items: flex-start; }
.panel-sub { margin: 4px 0 0; }
.with-icon { display: flex; align-items: center; gap: 10px; }
.ig-mini { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(45deg, #f58529, #dd2a7b 50%, #8134af); }
.ig-mini .ic { width: 19px; height: 19px; }
.ig-cta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.ig-cta > div { flex: 1; min-width: 240px; }
.ig-cta .panel-title { margin-bottom: 4px; }
.ig-cta p { margin: 0; }
.panel + .panel, .ig-panel + .panel { margin-top: 20px; }

.toast-float { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 90; box-shadow: 0 10px 30px rgba(0,0,0,.18); max-width: min(92vw, 640px); margin: 0; }

@media (max-width: 860px) {
    .pick-grid { grid-template-columns: 1fr; }
    #pick-modal .modal-foot { gap: 12px; }
}
