/* ==========================================================================
   THRF admin panel
   ========================================================================== */
:root {
    --primary: #1C5CAB; --primary-dark: #0F3F7C; --secondary: #4E8AD4; --accent: #2E9E6B; --tint: #DCE9F9; --surface: #F4F4F1;
    --navy: #0b1f3a; --navy-2: #12305a; --bg: #f3f6fb; --card: #fff; --line: #e1e7f0; --text: #1B2A3D; --muted: #667489;
    --danger: #d64545; --warn: #e0a800; --ok: #1f9d63; --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 40, 80, .06), 0 1px 3px rgba(15, 40, 80, .06);
    --shadow: 0 8px 24px rgba(15, 50, 100, .09);
    --shadow-lg: 0 20px 50px rgba(10, 30, 70, .22);
    --side-w: 272px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.admin, body.login-page {
    margin: 0; font-family: 'Inter', 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 14.5px; line-height: 1.55;
    color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
p { margin: 0 0 .9em; }
ul { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(78, 138, 212, .55); outline-offset: 2px; }
[hidden] { display: none !important; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: #eef2f8; padding: .1em .4em; border-radius: 4px; }
.muted { color: var(--muted); }
.icon { flex: none; vertical-align: middle; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }

/* ---- Shell ------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.side {
    width: var(--side-w); flex: none; background: var(--navy); color: #c9d6ea; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #2b4570 transparent;
}
.side__brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.2rem; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .08); position: sticky; top: 0; background: var(--navy); z-index: 2; }
.side__brand:hover { color: #fff; }
.side__brand span { display: flex; flex-direction: column; line-height: 1.15; }
.side__brand strong { font-size: 1.15rem; letter-spacing: .03em; }
.side__brand small { opacity: .65; font-size: .75rem; }
.side__nav { padding: .6rem .7rem 2rem; display: flex; flex-direction: column; gap: 2px; }
.nav-h { margin: 1.1rem .6rem .35rem; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #6f87ad; font-weight: 700; }
.nav-a { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: 8px; color: #c9d6ea; font-weight: 500; font-size: .9rem; position: relative; }
.nav-a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-a.is-on { background: var(--primary); color: #fff; }
.nav-a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-a em { font-style: normal; opacity: .6; font-size: .85em; }
.pill { background: var(--accent); color: #fff; border-radius: 999px; font-size: .7rem; padding: .05rem .5rem; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot--ok { background: #3ccf8e; }
.dot--empty { background: transparent; box-shadow: inset 0 0 0 2px #53698d; }
.dot--fn { background: #5aa0f0; }
.muted-tag { font-size: .68rem; background: rgba(255, 255, 255, .12); padding: .05rem .4rem; border-radius: 4px; }
.grp > summary { list-style: none; cursor: pointer; }
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary .chev { transition: transform .2s; opacity: .6; flex: none; }
.grp[open] > summary .chev { transform: rotate(180deg); }
.grp[open] > summary { color: #fff; }
.side__sub { list-style: none; margin: 2px 0 4px 1.05rem; padding-left: .55rem; border-left: 1px solid rgba(255, 255, 255, .12); display: flex; flex-direction: column; gap: 1px; }
.side__sub .nav-a { font-size: .86rem; padding: .38rem .55rem; }
.side-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; padding: .7rem 1.5rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); min-height: 64px; flex-wrap: wrap; }
.topbar__burger { display: none; border: 0; background: none; padding: .3rem; border-radius: 8px; }
.topbar__title { flex: 1 1 280px; min-width: 0; }
.topbar__title h1 { margin: 0; font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__title p { margin: 0; font-size: .82rem; color: var(--muted); }
.topbar__actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-left: auto; }
.topbar__actions form { margin: 0; }
.content { padding: 1.5rem; max-width: 1280px; width: 100%; margin-inline: auto; }

@media (max-width: 991px) {
    .side { position: fixed; left: 0; top: 0; z-index: 100; transform: translateX(-102%); transition: transform .25s; box-shadow: var(--shadow-lg); }
    .side-open .side { transform: none; }
    .side-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 20, 40, .55); z-index: 90; }
    .topbar__burger { display: inline-grid; }
    .topbar { padding-inline: 1rem; }
    .topbar__actions .btn span { display: none; }
    .content { padding: 1rem; }
}

/* ---- Buttons ----------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent; background: var(--primary); color: #fff; font-weight: 600; font-size: .9rem; line-height: 1.2; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn--sm { padding: .38rem .75rem; font-size: .83rem; }
.btn--lg { padding: .75rem 1.4rem; font-size: 1rem; }
.btn--block { width: 100%; }
.btn--light { background: #fff; color: var(--text); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn--light:hover { background: var(--tint); color: var(--primary-dark); border-color: var(--secondary); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: var(--tint); color: var(--primary-dark); }
.btn--ghost-dark { background: transparent; color: var(--muted); border-color: transparent; }
.btn--ghost-dark:hover { background: #eef2f8; color: var(--text); }
.btn--ok { background: var(--accent); }
.btn--ok:hover { background: #237f55; }
.btn--danger { background: #fff; color: var(--danger); border-color: #f0c4c4; }
.btn--danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { background: #eef2f8; color: var(--primary); }
.icon-btn--danger:hover { background: #fdeeee; color: var(--danger); }
.icon-btn[disabled] { opacity: .3; pointer-events: none; }
.icon-x { border: 0; background: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.icon-x:hover { background: #eef2f8; color: var(--text); }

/* ---- Alerts / toasts --------------------------------------------------- */
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.1rem; border: 1px solid; font-size: .92rem; }
.alert ul { margin: .3rem 0 0 1.1rem; }
.alert--ok { background: #eaf8f1; color: #155c3b; border-color: #b8e6cf; }
.alert--err { background: #fdeeee; color: #8e2b2b; border-color: #f2c4c4; }
.alert--info { background: #eef5ff; color: #1c4a86; border-color: #c6dcfa; }
.toasts { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 400; display: grid; gap: .6rem; width: min(380px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .6rem; align-items: center; padding: .8rem 1rem; border-radius: 10px; background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); animation: toast-in .25s ease-out; font-size: .9rem; }
.toast--ok { background: #17794d; } .toast--err { background: #b53a3a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---- Cards / layout helpers ------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card__head h2, .card__head h3 { margin: 0; font-size: 1.05rem; }
.card__body { padding: 1.3rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 1.25rem; }
.toolbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.toolbar .spacer { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #eef2f8; color: #4b5b73; white-space: nowrap; }
.badge--ok { background: #e3f6ec; color: #17794d; }
.badge--warn { background: #fff4d6; color: #8a6500; }
.badge--blue { background: var(--tint); color: var(--primary-dark); }
.badge--off { background: #f0f1f4; color: #7b8697; }

/* ---- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .7rem 1rem; background: #f8fafd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fafcff; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: .15rem; justify-content: flex-end; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; }
.table .title-cell { font-weight: 600; }
.table .title-cell small { display: block; font-weight: 400; color: var(--muted); }
.table form { display: inline; margin: 0; }
.pager { display: flex; justify-content: center; margin-top: 1.2rem; }
.pager ul { display: flex; gap: .3rem; list-style: none; flex-wrap: wrap; }
.pager a, .pager span { display: inline-flex; align-items: center; min-width: 36px; height: 36px; justify-content: center; padding: 0 .7rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 600; font-size: .85rem; gap: .2rem; }
.pager a:hover { border-color: var(--primary); color: var(--primary); }
.pager .is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .is-disabled, .pager .is-gap { color: #a3afc0; background: transparent; border-color: transparent; }

/* ---- Forms ------------------------------------------------------------- */
.fld { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.1rem; min-width: 0; }
.fld > label, .fld > .lbl { font-weight: 600; font-size: .86rem; }
.fld input[type="text"], .fld input[type="url"], .fld input[type="email"], .fld input[type="number"], .fld input[type="password"], .fld input[type="date"], .fld input[type="datetime-local"],
.fld input[type="search"], .fld select, .fld textarea, .input {
    width: 100%; padding: .6rem .8rem; border: 1px solid #cfd8e5; border-radius: 8px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.fld textarea { resize: vertical; min-height: 90px; }
.fld textarea.code, textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; line-height: 1.5; background: #0f1b2d; color: #e6edf9; border-color: #0f1b2d; tab-size: 2; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(78, 138, 212, .22); }
.fld.has-error input, .fld.has-error select, .fld.has-error textarea { border-color: var(--danger); }
.fld__error { color: var(--danger); font-size: .82rem; margin: 0; }
.help { color: var(--muted); font-size: .8rem; margin: 0; }
.req { color: var(--danger); }
/* forms: full-width fields, with optional half-width pairs */
.form-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.1rem; }
.form-card > .fld { grid-column: 1 / -1; }
.form-card > .fld--half { grid-column: auto; }
.form-card > .fld:last-child { margin-bottom: 0; }
@media (max-width: 700px) { .form-card { grid-template-columns: minmax(0, 1fr); } .form-card > .fld--half { grid-column: 1 / -1; } }
.color-field { display: flex; align-items: center; gap: .7rem; }
.color-field input[type="color"] { width: 56px; height: 40px; padding: 2px; border: 1px solid #cfd8e5; border-radius: 8px; background: #fff; cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: .7rem; cursor: pointer; font-weight: 500; }
.switch input[type="checkbox"] { position: absolute; opacity: 0; }
.switch__ui { position: relative; width: 40px; height: 22px; border-radius: 999px; background: #c5cfde; transition: background .2s; flex: none; }
.switch__ui::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch input:checked + .switch__ui { background: var(--accent); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__ui { outline: 3px solid rgba(78, 138, 212, .55); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: .55rem; margin: .4rem 0 1.1rem; font-size: .9rem; }
.form-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.sticky-actions { position: sticky; bottom: 0; background: rgba(243, 246, 251, .95); backdrop-filter: blur(6px); padding: .9rem 0; margin-top: 1rem; border-top: 1px solid var(--line); z-index: 5; display: flex; gap: .7rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg a, .seg button { border: 0; background: none; padding: .4rem .85rem; font-size: .85rem; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: .4rem; }
.seg a:hover, .seg button:hover { background: #f1f5fb; color: var(--text); }
.seg .is-on { background: var(--primary); color: #fff; }
.seg .is-on:hover { background: var(--primary); color: #fff; }
.search-box { position: relative; }
.search-box input { padding-left: 2.2rem !important; min-width: 240px; }
.search-box .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* media field */
.media-field { display: flex; align-items: center; gap: .9rem; padding: .7rem; border: 1px dashed #b8c6da; border-radius: 10px; background: #fafcff; }
.media-field__preview { width: 76px; height: 60px; border-radius: 8px; overflow: hidden; background: #e8eef8; display: grid; place-items: center; color: #7b8ba6; flex: none; }
.media-field__preview img { width: 100%; height: 100%; object-fit: cover; }
.media-field__body { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.media-field__name { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.media-field__btns { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---- Modals ------------------------------------------------------------ */
dialog.modal { border: 0; padding: 0; border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); overflow: hidden; color: var(--text); }
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal::backdrop { background: rgba(8, 20, 40, .6); backdrop-filter: blur(2px); }
.modal--lg { width: min(780px, calc(100vw - 2rem)); }
.modal--xl { width: min(1080px, calc(100vw - 2rem)); height: min(760px, calc(100vh - 3rem)); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); }
.modal__head h2 { margin: 0; font-size: 1.1rem; }
.modal__tools { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.2rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: #fafcff; }
.modal__tools input[type="search"] { flex: 1; min-width: 160px; padding: .5rem .8rem; border: 1px solid #cfd8e5; border-radius: 8px; }
.modal__body { padding: 1.2rem; overflow-y: auto; flex: 1; position: relative; }
.modal__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.2rem; border-top: 1px solid var(--line); background: #fafcff; flex-wrap: wrap; }
.modal__foot-btns { display: flex; gap: .5rem; }
.modal form .modal__body { overflow-y: auto; }
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.drop-hint { display: none; position: absolute; inset: .6rem; border: 3px dashed var(--secondary); border-radius: 14px; background: rgba(220, 233, 249, .92); place-items: center; font-weight: 700; color: var(--primary-dark); font-size: 1.2rem; z-index: 3; }
.is-dragging .drop-hint { display: grid; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
.media-item { position: relative; border: 2px solid transparent; border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer; text-align: left; padding: 0; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.media-item:hover { transform: translateY(-2px); border-color: #b9cdea; }
.media-item.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(28, 92, 171, .22); }
.media-item__thumb { aspect-ratio: 4 / 3; background: #e8eef8; display: grid; place-items: center; color: #7b8ba6; overflow: hidden; }
.media-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-item__name { padding: .5rem .65rem .1rem; font-size: .78rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-item__meta { padding: 0 .65rem .55rem; font-size: .72rem; color: var(--muted); }
.media-item__check { position: absolute; top: .45rem; right: .45rem; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; display: none; place-items: center; }
.media-item.is-selected .media-item__check { display: grid; }
.media-item__actions { position: absolute; top: .4rem; left: .4rem; display: none; gap: .25rem; }
.media-item:hover .media-item__actions, .media-item:focus-within .media-item__actions { display: flex; }
.media-item__actions button { width: 28px; height: 28px; border-radius: 7px; border: 0; background: rgba(11, 31, 58, .8); color: #fff; display: grid; place-items: center; }
.media-item__actions button:hover { background: var(--primary); }
.media-item__actions button.danger:hover { background: var(--danger); }
.load-more { text-align: center; margin-top: 1rem; }
.is-uploading::after { content: 'Uploading…'; position: absolute; inset: 0; background: rgba(255, 255, 255, .8); display: grid; place-items: center; font-weight: 700; color: var(--primary); z-index: 4; }

/* ---- Login ------------------------------------------------------------- */
.login-page { background: #fff; }
.login { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.login__art { background: linear-gradient(145deg, var(--navy), var(--primary) 70%, var(--secondary)); color: #fff; display: grid; place-items: center; padding: 3rem; position: relative; overflow: hidden; text-align: center; }
.login__art::before { content: ''; position: absolute; width: 560px; height: 560px; right: -200px; top: -220px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.login__art::after { content: ''; position: absolute; width: 380px; height: 380px; left: -120px; bottom: -160px; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.login__art > div { position: relative; z-index: 1; max-width: 420px; }
.login__art h2 { font-size: 1.8rem; margin: 1.2rem 0 .3rem; }
.login__art p { opacity: .8; margin: 0; }
.login__form { display: grid; place-items: center; padding: 2rem; }
.login__form form { width: min(380px, 100%); }
.login__form h1 { font-size: 1.8rem; margin-bottom: .3rem; }
.login__form .fld { margin-top: 1rem; }
.login__back { margin-top: 1.5rem; text-align: center; font-size: .88rem; }
.pw { position: relative; }
.pw input { padding-right: 2.8rem !important; }
.pw__toggle { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; }
.pw__toggle:hover { color: var(--primary); background: #eef2f8; }
@media (max-width: 800px) { .login { grid-template-columns: 1fr; } .login__art { padding: 2rem 1rem; } .login__art h2 { font-size: 1.3rem; } }

/* ---- Dashboard --------------------------------------------------------- */
.stat-card { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; }
.stat-card__icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--primary); flex: none; }
.stat-card__icon--green { background: #e3f6ec; color: var(--ok); }
.stat-card__icon--amber { background: #fff4d6; color: #a37400; }
.stat-card__icon--rose { background: #fde8ec; color: #c43c58; }
.stat-card strong { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat-card span { color: var(--muted); font-size: .85rem; }
.progress { height: 8px; border-radius: 99px; background: #e6ecf6; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; }
.sect-row { display: grid; grid-template-columns: 1fr 150px 70px; gap: 1rem; align-items: center; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.sect-row:last-child { border-bottom: 0; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.quick a { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-weight: 600; background: #fff; }
.quick a:hover { border-color: var(--secondary); background: #f5f9ff; color: var(--primary); }
.quick .icon { color: var(--primary); }
.list-plain { list-style: none; }
.list-plain li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.list-plain small { color: var(--muted); display: block; }

/* ---- Pages list -------------------------------------------------------- */
.tree-row { display: flex; align-items: center; gap: .8rem; padding: .65rem 1rem; border-bottom: 1px solid var(--line); }
.tree-row:hover { background: #fafcff; }
.tree-row:last-child { border-bottom: 0; }
.tree-row__title { flex: 1; min-width: 0; font-weight: 600; display: flex; flex-direction: column; }
.tree-row__title small { font-weight: 400; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row__meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.tree-row__actions { display: flex; gap: .1rem; }
.tree-group-title { padding: .7rem 1rem; background: #f8fafd; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.tree-group-title:first-child { border-top: 0; }
@media (max-width: 800px) { .tree-row { flex-wrap: wrap; } .tree-row__meta { order: 3; width: 100%; } }

/* ---- Page builder ------------------------------------------------------ */
.builder-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .builder-layout { grid-template-columns: minmax(0, 1fr); } }
.builder-side { position: sticky; top: 80px; display: grid; gap: 1rem; max-height: calc(100vh - 100px); overflow-y: auto; padding-right: 2px; }
@media (max-width: 1100px) { .builder-side { position: static; max-height: none; } }
.builder-side .card__head { padding: .75rem 1.1rem; }
.builder-side .card__body { padding: 1rem 1.1rem; }
.builder-side .fld { margin-bottom: .9rem; }
.blocks { display: grid; gap: .75rem; }
.blocks-empty { text-align: center; padding: 3.5rem 1.5rem; border: 2px dashed #b8c6da; border-radius: 16px; background: #fafcff; }
.blocks-empty h3 { margin-bottom: .3rem; }
.blocks-empty .quick-add { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }
.blk-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.blk-card.is-open { border-color: #9fbbe3; box-shadow: var(--shadow); }
.blk-card.is-hidden { opacity: .6; }
.blk-card__head { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; cursor: pointer; user-select: none; }
.blk-card__handle { cursor: grab; color: #9aa7bb; padding: .2rem; display: grid; place-items: center; border-radius: 6px; }
.blk-card__handle:hover { background: #eef2f8; color: var(--primary); }
.blk-card__icon { width: 34px; height: 34px; border-radius: 9px; background: var(--tint); color: var(--primary); display: grid; place-items: center; flex: none; }
.blk-card__title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.blk-card__title strong { font-size: .92rem; }
.blk-card__title small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk-card__tools { display: flex; gap: .05rem; }
.blk-card__body { border-top: 1px solid var(--line); padding: 1rem 1.1rem 1.1rem; }
.blk-tabs { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.blk-tabs button { border: 0; background: none; padding: .5rem .9rem; font-weight: 600; font-size: .86rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.blk-tabs button.is-on { color: var(--primary); border-color: var(--primary); }
.blk-pane[hidden] { display: none; }
.blk-pane .fld { margin-bottom: .95rem; }
.blk-insert { display: flex; justify-content: center; height: 14px; position: relative; margin: -.2rem 0; }
.blk-insert::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed transparent; transition: border-color .15s; }
.blk-insert button { position: relative; z-index: 1; width: 26px; height: 26px; margin-top: -6px; border-radius: 50%; border: 2px solid var(--secondary); background: #fff; color: var(--secondary); opacity: 0; transform: scale(.7); transition: opacity .15s, transform .15s; display: grid; place-items: center; }
.blk-insert:hover::before { border-color: var(--secondary); }
.blk-insert:hover button, .blk-insert button:focus-visible { opacity: 1; transform: none; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow-lg); }
.add-bar { display: flex; justify-content: center; margin-top: .5rem; }
.rep { display: grid; gap: .55rem; }
.rep-item { border: 1px solid var(--line); border-radius: 10px; background: #fafcff; }
.rep-item__head { display: flex; align-items: center; gap: .5rem; padding: .4rem .55rem; cursor: pointer; }
.rep-item__head .handle { cursor: grab; color: #9aa7bb; display: grid; place-items: center; }
.rep-item__head .num { width: 22px; height: 22px; border-radius: 6px; background: #e3ecf9; color: var(--primary-dark); font-size: .75rem; font-weight: 700; display: grid; place-items: center; flex: none; }
.rep-item__head .label { flex: 1; min-width: 0; font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-item__head .label.is-empty { color: var(--muted); font-weight: 500; font-style: italic; }
.rep-item__body { padding: .8rem .85rem .2rem; border-top: 1px solid var(--line); background: #fff; border-radius: 0 0 10px 10px; }
.rep-add { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.icon-pick { position: relative; }
.icon-pick__btn { display: inline-flex; align-items: center; gap: .6rem; padding: .45rem .8rem; border: 1px solid #cfd8e5; border-radius: 8px; background: #fff; min-width: 160px; }
.icon-pick__btn .icon { color: var(--primary); }
.icon-pop { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: 330px; max-width: 80vw; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .7rem; }
.icon-pop input { width: 100%; padding: .5rem .7rem; border: 1px solid #cfd8e5; border-radius: 8px; margin-bottom: .6rem; }
.icon-pop__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; max-height: 220px; overflow-y: auto; }
.icon-pop__grid button { aspect-ratio: 1; border: 1px solid transparent; background: none; border-radius: 8px; color: var(--text); display: grid; place-items: center; }
.icon-pop__grid button:hover { background: var(--tint); color: var(--primary); }
.icon-pop__grid button.is-on { background: var(--primary); color: #fff; }
.palette { display: grid; gap: 1.2rem; }
.palette h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 .5rem; }
.palette__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem; }
.palette__item { display: flex; gap: .7rem; align-items: flex-start; text-align: left; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .15s, background .15s, transform .15s; }
.palette__item:hover { border-color: var(--secondary); background: #f5f9ff; transform: translateY(-1px); }
.palette__item .blk-card__icon { width: 36px; height: 36px; }
.palette__item strong { display: block; font-size: .88rem; }
.palette__item small { color: var(--muted); font-size: .77rem; line-height: 1.3; display: block; }
.savebar { display: flex; align-items: center; gap: .6rem; }
.dirty { display: none; align-items: center; gap: .35rem; font-size: .8rem; color: #8a6500; background: #fff4d6; border-radius: 999px; padding: .15rem .65rem; font-weight: 600; }
.is-dirty .dirty { display: inline-flex; }
.tox-tinymce { border-radius: 8px !important; border-color: #cfd8e5 !important; }

/* ---- Menu manager ------------------------------------------------------ */
.menu-tree, .menu-tree ul { list-style: none; }
.menu-tree ul { margin-left: 2rem; padding-left: .9rem; border-left: 2px solid #dbe5f3; min-height: 6px; }
.menu-node { margin-top: .5rem; }
.menu-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); }
.menu-row:hover { border-color: #b7cdea; }
.menu-row.is-off { opacity: .6; background: #f6f8fb; }
.menu-row__handle { cursor: grab; color: #9aa7bb; display: grid; place-items: center; padding: .2rem; border-radius: 6px; }
.menu-row__handle:hover { background: #eef2f8; color: var(--primary); }
.menu-row__title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.menu-row__title strong { font-size: .95rem; }
.menu-row__title small { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-row__badges { display: flex; gap: .35rem; flex-wrap: wrap; }
.menu-row__actions { display: flex; gap: .05rem; }
.menu-empty { padding: 2.5rem; text-align: center; color: var(--muted); border: 2px dashed #b8c6da; border-radius: 14px; }
.type-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.type-opts label { display: flex; flex-direction: column; gap: .15rem; padding: .65rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-size: .85rem; position: relative; }
.type-opts label strong { font-size: .88rem; }
.type-opts label small { color: var(--muted); font-size: .76rem; line-height: 1.3; }
.type-opts input { position: absolute; opacity: 0; }
.type-opts label:has(input:checked) { border-color: var(--primary); background: #f3f8ff; box-shadow: 0 0 0 3px rgba(28, 92, 171, .12); }
@media (max-width: 600px) { .type-opts { grid-template-columns: 1fr; } }

/* ---- Albums ------------------------------------------------------------ */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; }
.photo { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; cursor: grab; }
.photo input[type="text"] { border: 0; border-top: 1px solid var(--line); width: 100%; padding: .5rem .65rem; font-size: .82rem; }
.photo input[type="text"]:focus { outline: none; background: #f5f9ff; }
.photo__remove { position: absolute; top: .4rem; right: .4rem; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(11, 31, 58, .8); color: #fff; display: grid; place-items: center; }
.photo__remove:hover { background: var(--danger); }
.photo.is-removed { opacity: .35; }

/* ---- Message view ------------------------------------------------------ */
.msg-meta { display: grid; grid-template-columns: 130px 1fr; gap: .5rem 1rem; margin-bottom: 1.2rem; }
.msg-meta dt { color: var(--muted); font-weight: 600; font-size: .85rem; }
.msg-meta dd { margin: 0; }
.msg-body { background: #f8fafd; border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; white-space: pre-wrap; }
.stars { color: #f5b301; display: inline-flex; }
.stars .icon { fill: currentColor; }
.stars .off { color: #cfd8e5; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: .4rem; }
tr.is-unread td { font-weight: 600; background: #fbfdff; }

/* ---- Settings tabs ----------------------------------------------------- */
.tabs-nav { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.tabs-nav a { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem 1rem; border-radius: 999px; font-weight: 600; font-size: .88rem; color: var(--muted); background: #fff; border: 1px solid var(--line); }
.tabs-nav a:hover { color: var(--primary); border-color: var(--secondary); }
.tabs-nav a.is-on { background: var(--primary); color: #fff; border-color: var(--primary); }
.theme-preview { display: flex; gap: .5rem; margin-top: .4rem; }
.theme-preview i { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, .1); }

@media print { .side, .topbar { display: none; } }

/* ---- small screens ---------------------------------------------------- */
@media (max-width: 600px) {
    .blk-card__tools [data-act="dup"] { display: none; }
    .blk-card__tools .icon-btn { width: 28px; height: 28px; }
    .blk-card__head { gap: .4rem; padding: .5rem; }
    .rep-item__head [data-act="rep-dup"] { display: none; }
    .topbar__title p { display: none; }
    .menu-row { flex-wrap: wrap; }
    .menu-row__badges { order: 3; width: 100%; }
    .menu-row__title { flex-basis: 120px; }
    .menu-row__actions { order: 4; width: 100%; justify-content: flex-end; }
    .menu-tree ul { margin-left: 1rem; padding-left: .5rem; }
    .media-field { flex-wrap: wrap; }
}

/* ==========================================================================
   Top-bar tools (edit menus / clear cache / website theme)
   ========================================================================== */
.topbar__tools { display: flex; align-items: center; gap: .25rem; padding: .2rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.tool-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); transition: background .15s, color .15s; }
.tool-btn:hover { background: var(--tint); color: var(--primary-dark); }
.tool-btn.is-on { background: var(--tint); color: var(--primary); }
.tool-btn[disabled] { cursor: progress; }
.tool-btn.is-busy .icon { animation: tool-sweep .6s ease-in-out infinite alternate; transform-origin: 50% 20%; }
@keyframes tool-sweep { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }
@media (prefers-reduced-motion: reduce) { .tool-btn.is-busy .icon { animation: none; opacity: .5; } }

/* ---- Website theme slide-over ------------------------------------------ */
.tp-lock { overflow: hidden; }
.theme-panel { position: fixed; inset: 0; z-index: 300; }
.tp-backdrop { position: absolute; inset: 0; background: rgba(8, 20, 40, .5); opacity: 0; transition: opacity .2s; }
.tp-card { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: #fff; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s ease-out; }
.theme-panel.is-open .tp-backdrop { opacity: 1; }
.theme-panel.is-open .tp-card { transform: none; }
@media (prefers-reduced-motion: reduce) { .tp-backdrop, .tp-card { transition: none; } }
.tp-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); }
.tp-head > div { flex: 1; min-width: 0; }
.tp-head h3 { margin: 0; font-size: 1.05rem; }
.tp-head p { margin: 0; font-size: .8rem; color: var(--muted); }
.tp-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--tint); color: var(--primary); flex: none; }
.tp-body { flex: 1; overflow-y: auto; padding: 1rem 1.1rem 1.4rem; }
.tp-foot { display: flex; align-items: center; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); background: #fafbfd; }
.tp-foot .sp { flex: 1; }
.tp-label { margin: 1.2rem 0 .55rem; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tp-note { margin: 1rem 0 0; font-size: .82rem; }

.tp-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.tp-preset { display: flex; flex-direction: column; gap: .4rem; align-items: stretch; padding: .5rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; text-align: left; transition: border-color .15s, box-shadow .15s; }
.tp-preset:hover { border-color: #b9c6da; }
.tp-preset.is-on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(78, 138, 212, .22); }
.tp-sw { display: flex; height: 26px; border-radius: 6px; overflow: hidden; }
.tp-sw i { flex: 1; }
.tp-pn { font-size: .8rem; font-weight: 600; color: var(--text); }

.tp-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.tp-color { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; column-gap: .6rem; align-items: center; padding: .45rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.tp-color input { grid-row: 1 / 3; width: 38px; height: 38px; padding: 0; border: 1px solid #cfd8e5; border-radius: 8px; background: #fff; cursor: pointer; }
.tp-color span { font-size: .8rem; font-weight: 600; line-height: 1.2; }
.tp-color code { justify-self: start; font-size: .72rem; padding: 0; background: none; color: var(--muted); }

/* Mini preview of the public site, painted with the same CSS variable names as site.css. */
.tp-preview { --primary: #1C5CAB; --primary-dark: #0F3F7C; --secondary: #4E8AD4; --accent: #2E9E6B; --tint: #DCE9F9; --surface: #F4F4F1; --text: #1B2A3D;
    border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; color: var(--text); font-size: 11px; line-height: 1.3; pointer-events: none; user-select: none; }
.tpp-top { display: flex; justify-content: space-between; padding: 5px 10px; background: var(--primary-dark); color: #fff; font-size: 10px; }
.tpp-nav { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-bottom: 3px solid var(--primary); background: #fff; }
.tpp-nav b { margin-right: auto; color: var(--primary); font-size: 13px; letter-spacing: .04em; }
.tpp-nav span.on { color: var(--primary); font-weight: 700; border-bottom: 2px solid var(--accent); }
.tpp-banner { padding: 16px 12px; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; }
.tpp-banner small { display: block; opacity: .75; font-size: 9px; }
.tpp-banner b { font-size: 15px; }
.tpp-body { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--surface); }
.tpp-card { flex: 1; display: grid; gap: 2px; padding: 8px; border-radius: 8px; background: #fff; border-top: 3px solid var(--secondary); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.tpp-card i { width: 22px; height: 22px; border-radius: 50%; background: var(--tint); margin-bottom: 3px; }
.tpp-card span { color: var(--text); opacity: .7; font-size: 10px; }
.tpp-btns { display: grid; gap: 6px; }
.tpp-btn, .tpp-btn2 { padding: 5px 12px; border-radius: 6px; color: #fff; font-weight: 700; text-align: center; font-size: 10px; }
.tpp-btn { background: var(--primary); } .tpp-btn2 { background: var(--accent); }
.tpp-foot { padding: 8px 10px; background: var(--primary-dark); color: #fff; font-size: 10px; opacity: .95; }

/* ---- Users & roles ------------------------------------------------------ */
.avatar { --s: 40px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; overflow: hidden; display: inline-grid; place-items: center; background: hsl(var(--h, 215) 42% 42%); color: #fff; font-size: calc(var(--s) * .38); letter-spacing: .02em; line-height: 1; vertical-align: middle; }
.avatar b { font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person { display: flex; align-items: center; gap: .75rem; color: inherit; min-width: 0; }
.person:hover { color: var(--primary); }
.person strong { display: block; line-height: 1.25; }
.person small { display: block; color: var(--muted); font-weight: 400; }
.you { font-style: normal; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--tint); color: var(--primary-dark); padding: .05rem .4rem; border-radius: 4px; vertical-align: middle; }
.type-opts--2 { grid-template-columns: repeat(2, 1fr); margin-bottom: 0; }
@media (max-width: 600px) { .type-opts--2 { grid-template-columns: 1fr; } }

.photo-field__row { display: flex; align-items: center; gap: 1.1rem; padding: .8rem; border: 1px dashed #b8c6da; border-radius: 10px; background: #fafcff; flex-wrap: wrap; }
.photo-field__body { display: flex; flex-direction: column; gap: .35rem; min-width: 0; flex: 1; }
.photo-field__body .check { margin: .2rem 0 0; }
.photo-field input[type="file"] { max-width: 100%; font-size: .85rem; }

.profile { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 1.8rem; }
.profile h2 { margin: .9rem 0 .1rem; font-size: 1.3rem; }
.profile p { margin: 0 0 .6rem; }
.profile__badges { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }
.profile__meta { margin: 0; padding: 1.1rem 1.4rem; border-top: 1px solid var(--line); }
.pw-view { display: inline-flex; align-items: center; gap: .3rem; }
.pw-view__text { font-family: ui-monospace, Consolas, monospace; background: var(--bg, #f3f5f9); padding: .15rem .5rem; border-radius: 6px; letter-spacing: .04em; user-select: all; }
.pw-view .icon-btn { width: 30px; height: 30px; }
.profile__actions { display: flex; gap: .6rem; flex-wrap: wrap; border-top: 1px solid var(--line); }
.profile__actions form { margin: 0; }
@media (max-width: 700px) { .profile-grid { grid-template-columns: 1fr; } }

.access-list { list-style: none; }
.access-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.access-list li:last-child { border-bottom: 0; }
.access-list__name { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; }
.access-list__name .icon { color: var(--primary); }
.access-list__can { display: inline-flex; gap: .3rem; flex-wrap: wrap; }

.perm-tools { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.perm-table tbody + tbody tr:first-child td { border-top: 1px solid var(--line); }
.perm-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.perm-table tbody:last-of-type tr:last-child td { border-bottom: 0; }
.perm-group td { background: #f1f5fb; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); padding: .45rem 1rem; }
.perm-name span { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; }
.perm-name .icon { color: var(--primary); }
.perm-name small { display: block; color: var(--muted); font-size: .78rem; margin: .1rem 0 0 1.65rem; max-width: 460px; }
.perm-table .perm-col { text-align: center; width: 84px; }
.perm-table th.perm-col button { border: 0; background: none; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; padding: .1rem .3rem; border-radius: 6px; }
.perm-table th.perm-col button:hover { background: var(--tint); color: var(--primary-dark); }
.perm-table td.perm-one { text-align: left; }
.perm-table td.perm-one label { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 500; }
.perm-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.perm-table tr[data-perm-row]:hover { background: #fafcff; }

/* top bar: who is signed in */
.me { display: inline-flex; align-items: center; gap: .55rem; padding: .15rem .6rem .15rem .2rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text); font-weight: 600; font-size: .85rem; max-width: 190px; }
.me:hover { border-color: var(--secondary); color: var(--primary); }
.me > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 991px) { .me > span:last-child { display: none; } .me { padding: .15rem; } }

/* access denied */
.denied { text-align: center; padding: 3rem 1rem; }
.denied .icon { color: var(--primary); margin-bottom: .6rem; }
.denied h2 { margin-bottom: .4rem; }
.perm-table { min-width: 600px; }

/* ---- Dashboard welcome banner ------------------------------------------ */
@keyframes dh-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes dh-float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(16px, -22px); } }
@keyframes dh-pulse { 0% { box-shadow: 0 0 0 0 rgba(140, 240, 190, .8); } 70% { box-shadow: 0 0 0 9px rgba(140, 240, 190, 0); } 100% { box-shadow: 0 0 0 0 rgba(140, 240, 190, 0); } }
@keyframes dh-wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
.dh {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap;
    padding: 26px 30px; margin-bottom: 1.25rem; border-radius: 16px; color: #fff;
    background: linear-gradient(125deg, var(--primary-dark) 0%, var(--primary) 55%, var(--secondary) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), var(--shadow); animation: dh-rise .6s cubic-bezier(.2, .7, .2, 1) both;
}
.dh::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 55%); pointer-events: none; }
.dh::after { content: ""; position: absolute; right: -80px; top: -100px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgba(46, 158, 107, .55), rgba(46, 158, 107, 0) 66%); pointer-events: none; }
.dh > * { position: relative; z-index: 1; }
.dh > .dh-bubble { position: absolute; z-index: 0; border-radius: 50%; pointer-events: none; background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .42), rgba(255, 255, 255, .06) 60%); border: 1px solid rgba(255, 255, 255, .22); animation: dh-float 12s ease-in-out infinite; }
.dh > .dh-b1 { width: 140px; height: 140px; left: 40%; bottom: -72px; }
.dh > .dh-b2 { width: 70px; height: 70px; left: 58%; top: -26px; animation-delay: -4s; }
.dh > .dh-b3 { width: 34px; height: 34px; left: 30%; top: 14px; animation-delay: -8s; opacity: .7; }
.dh-l { flex: 1 1 420px; min-width: 0; }
.dh-date { display: inline-flex; align-items: center; gap: .4rem; font-size: 12.5px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; color: #cfe6ff; }
.dh-hello { margin: 6px 0; font-size: 27px; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.dh-wave { display: inline-block; transform-origin: 70% 70%; animation: dh-wave 2.6s ease-in-out 1s 2; }
.dh-sum { margin: 0 0 14px; color: #e3eefb; }
.dh-sum b { color: #fff; }
.dot-sep { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #9fe3c2; margin: 0 12px; vertical-align: middle; }
.dh-act { display: flex; gap: 8px; flex-wrap: wrap; }
.dh-btn { background: #fff; color: var(--primary-dark); box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.dh-btn:hover { background: var(--tint); color: var(--primary-dark); }
.dh-btn--ghost { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .4); box-shadow: none; }
.dh-btn--ghost:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.dh-r { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dh-clock { font-size: 40px; font-weight: 700; letter-spacing: 1px; font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 3px 10px rgba(0, 0, 0, .3); white-space: nowrap; }
.dh-tz, .dh-last { display: block; color: #cfe6ff; font-size: 12px; }
.dh-live { display: inline-flex; align-items: center; gap: 7px; margin-top: 4px; font-size: 12px; font-weight: 600; padding: 2px 11px; border-radius: 99px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35); }
.dh-live i { width: 8px; height: 8px; border-radius: 50%; background: #8cf0be; animation: dh-pulse 2.2s infinite; }
@media (max-width: 700px) {
    .dh { padding: 20px 18px; }
    .dh-hello { font-size: 21px; }
    .dh-r { text-align: left; align-items: flex-start; }
    .dh-clock { font-size: 30px; }
    .dot-sep { margin: 0 8px; }
}
@media (prefers-reduced-motion: reduce) { .dh, .dh > .dh-bubble, .dh-wave, .dh-live i { animation: none; } }

/* ---- History ------------------------------------------------------------ */
.badge--danger { background: #fde8e8; color: #b42323; }
.badge--brand { background: var(--primary); color: #fff; }
.hist-filter { padding: .9rem 1rem; margin-bottom: .8rem; }
.hist-filter__row { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; }
.hist-filter label { display: flex; flex-direction: column; gap: .25rem; font-size: .75rem; font-weight: 600; color: var(--muted); }
.hist-filter .input { min-width: 0; }
.hist-filter select.input { min-width: 150px; }
.hist-filter__q { flex: 1 1 240px; }
.hist-filter__q .input { width: 100%; }
.hist-filter__btns { display: flex; gap: .4rem; }
.hist-count { margin: 0 0 .6rem; font-size: .85rem; }
.hist { padding: .2rem 0; overflow: hidden; }
.hist-day { display: flex; align-items: center; gap: .45rem; margin: 0; padding: .7rem 1.1rem; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: #f8fafd; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.hist-day:first-child { border-top: 0; }
.hist-row { display: grid; grid-template-columns: 92px 30px minmax(0, 1fr) auto; gap: .8rem; align-items: start; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.hist-row:last-child { border-bottom: 0; }
.hist-row:hover { background: #fbfcfe; }
.hist-time b { display: block; font-size: .88rem; font-variant-numeric: tabular-nums; }
.hist-time small { color: var(--muted); font-size: .74rem; }
.hist-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #eef2f8; color: #4b5b73; }
.hist-row--ok .hist-ic { background: #e3f6ec; color: #17794d; }
.hist-row--info .hist-ic { background: var(--tint); color: var(--primary-dark); }
.hist-row--danger .hist-ic { background: #fde8e8; color: #b42323; }
.hist-row--warn .hist-ic { background: #fff4d6; color: #8a6500; }
.hist-row--brand .hist-ic { background: var(--primary); color: #fff; }
.hist-line { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .55rem; }
.hist-who { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); }
.hist-who:hover b { color: var(--primary); }
.hist-subj { font-weight: 600; overflow-wrap: anywhere; }
.hist-desc { margin: .3rem 0 0; color: var(--muted); font-size: .86rem; }
.hist-meta { font-size: .75rem; color: var(--muted); text-align: right; white-space: nowrap; }
.hist-meta small { display: block; }
.hist-changes { margin-top: .45rem; }
.hist-changes summary { cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--primary); width: max-content; }
.hist-diff { width: 100%; border-collapse: collapse; margin-top: .45rem; font-size: .83rem; border: 1px solid var(--line); }
.hist-diff th, .hist-diff td { padding: .45rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.hist-diff thead th { background: #f8fafd; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hist-diff tbody th { font-weight: 600; width: 26%; color: var(--text); }
.hist-old { background: #fff6f6; color: #8c2f2f; width: 37%; }
.hist-new { background: #f3fbf6; color: #155f3b; }
.hist-diff tr:last-child th, .hist-diff tr:last-child td { border-bottom: 0; }
@media (max-width: 800px) {
    .hist-row { grid-template-columns: 30px minmax(0, 1fr); }
    .hist-ic { grid-column: 1; grid-row: 1 / span 3; }
    .hist-time { grid-column: 2; grid-row: 1; display: flex; gap: .5rem; align-items: baseline; }
    .hist-time b { display: inline; }
    .hist-body { grid-column: 2; }
    .hist-meta { grid-column: 2; text-align: left; white-space: normal; }
    .hist-meta small { display: inline; margin-left: .5rem; }
    .hist-filter label { flex: 1 1 45%; }
    .hist-filter select.input { min-width: 0; width: 100%; }
}

/* ---- Design from a file (page editor) ----------------------------------- */
.imp-open { border-color: var(--secondary); color: var(--primary-dark); }
.imp-open .icon { color: var(--primary); }
.imp .modal__head h2 { display: flex; align-items: center; gap: .5rem; }
.imp .modal__head h2 .icon { color: var(--primary); }
.imp-lead { margin: 0 0 1rem; font-size: .9rem; }
.imp-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; text-align: center; cursor: pointer;
    padding: 1.6rem 1rem; border: 2px dashed #b8c6da; border-radius: 14px; background: #fafcff; transition: border-color .15s, background .15s;
}
.imp-drop:hover, .imp-drop.is-over { border-color: var(--secondary); background: var(--tint); }
.imp-drop.has-file { border-style: solid; border-color: var(--accent); background: #f1faf5; }
.imp-drop__ic { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); margin-bottom: .25rem; }
.imp-drop.has-file .imp-drop__ic { color: var(--accent); }
.imp-drop strong { font-size: .98rem; overflow-wrap: anywhere; }
.imp-drop small { color: var(--muted); }
.imp-opts { display: grid; gap: .8rem; margin-top: 1rem; }
.imp-opts fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.imp-opts legend { font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .4rem; padding: 0; }
.imp-radio { display: flex; gap: .55rem; align-items: flex-start; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.imp-radio:has(input:checked) { border-color: var(--secondary); background: #f5f9ff; box-shadow: 0 0 0 2px rgba(78, 138, 212, .18); }
.imp-radio input { margin-top: .2rem; }
.imp-radio b { display: block; font-size: .88rem; }
.imp-radio small { color: var(--muted); font-size: .78rem; }
.imp-engine { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .85rem; border-radius: 10px; background: #f4f6fa; font-size: .85rem; color: #3d4b60; }
.imp-engine > .icon { margin-top: .15rem; color: var(--muted); }
.imp-engine.is-ai { background: linear-gradient(120deg, #eef5ff, #effaf4); }
.imp-engine.is-ai > .icon { color: var(--accent); }
.imp-progress { display: flex; gap: .8rem; align-items: center; margin-top: 1rem; padding: .85rem 1rem; border-radius: 10px; background: var(--tint); color: var(--primary-dark); }
.imp-progress b { display: block; }
.imp-progress small { color: #43618a; }
.imp-spin { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 3px solid rgba(28, 92, 171, .2); border-top-color: var(--primary); animation: imp-spin .8s linear infinite; }
@keyframes imp-spin { to { transform: rotate(360deg); } }
.imp-result { margin-top: 1rem; padding: .85rem 1rem; border-radius: 10px; font-size: .87rem; }
.imp-result p { margin: .35rem 0 0; }
.imp-result--ok { background: #effaf4; border: 1px solid #bfe6d0; color: #155f3b; }
.imp-result--err { background: #fff3f3; border: 1px solid #f0c4c4; color: #9b2c2c; }
.imp-note { color: #7a5a00; background: #fff8e1; padding: .45rem .6rem; border-radius: 8px; }
.imp.is-busy .imp-drop { opacity: .6; pointer-events: none; }
@media (max-width: 600px) { .imp-opts fieldset { grid-template-columns: 1fr; } .imp-open span { display: none; } }
