:root {
  --primary: #6d0f1f; --primary-dark: #430812; --accent: #d4a24c;
  --p-50: color-mix(in srgb, var(--primary) 5%, #fff);
  --p-100: color-mix(in srgb, var(--primary) 11%, #fff);
  --p-200: color-mix(in srgb, var(--primary) 22%, #fff);
  --ink: #1f1a1c; --ink-2: #4b4447; --muted: #857c80; --line: #ebe4e6; --bg: #f6f3f4;
  --radius: 12px; --side-w: 258px;
  --font: 'Poppins', 'Hind Siliguri', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.55; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; font: 500 13.5px var(--font); cursor: pointer; transition: .15s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-light:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; font-size: 12.5px; transition: .15s; }
.icon-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.icon-btn.primary { background: var(--p-50); color: var(--primary); border-color: var(--p-200); }
.icon-btn.danger:hover { border-color: #c62828; color: #c62828; background: #fdecec; }
.icon-btn.on { color: var(--primary); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.link { font-weight: 500; font-size: 13px; cursor: pointer; }

/* layout */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: linear-gradient(180deg, var(--primary-dark), color-mix(in srgb, var(--primary-dark) 70%, #000)); color: #fff; display: flex; flex-direction: column; z-index: 50; transition: transform .25s; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand img { width: 38px; height: 38px; background: #fff; border-radius: 10px; padding: 5px; }
.side-brand span { font-weight: 600; font-size: 16px; display: flex; flex-direction: column; line-height: 1.2; }
.side-brand small { font-weight: 400; font-size: 11px; opacity: .65; }
.sidebar nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar nav a, .side-foot a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 9px; color: rgba(255,255,255,.75); font-size: 13.5px; }
.sidebar nav a i, .side-foot a i { width: 18px; text-align: center; opacity: .85; }
.sidebar nav a:hover, .side-foot a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 6px 18px -8px rgba(0,0,0,.4); }
.pill { margin-left: auto; background: var(--accent); color: #2a1a0a; font-size: 11px; padding: 1px 8px; border-radius: 99px; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topnav { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 12px 26px; min-height: 64px; }
.topnav h1 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav-right { display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.burger { display: none; width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 16px; color: var(--primary); }
.content { padding: 24px 26px 60px; flex: 1; }
.side-backdrop { display: none; }

/* cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 15.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head h2 i { color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .card { margin-bottom: 20px; }
.help { margin: 0 0 14px; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 13.5px; }
.alert.ok { background: #e8f7ee; color: #1b6b3a; border: 1px solid #bfe7cd; }
.alert.err { background: #fdecec; color: #a12727; border: 1px solid #f5c2c2; }

/* dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); transition: .15s; }
.stat:hover { border-color: var(--p-200); transform: translateY(-2px); }
.stat > i { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--p-100); color: var(--primary); font-size: 19px; }
.stat strong { display: block; font-size: 24px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12.5px; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.quick-actions a { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px dashed var(--p-200); border-radius: 10px; background: var(--p-50); color: var(--ink); font-weight: 500; font-size: 13px; }
.quick-actions a i { color: var(--primary); font-size: 16px; }
.quick-actions a:hover { border-style: solid; border-color: var(--primary); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border: 0; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: #fcfafb; }
.table .t { font-weight: 500; color: var(--ink); display: block; }
.table .t:hover { color: var(--primary); }
.table small { display: block; font-size: 12px; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { margin-left: 2px; }
.table tr.unread td { background: var(--p-50); }
.table tr.unread .t { font-weight: 700; }
.inline { display: inline; }
.tag { display: inline-block; background: var(--bg); border: 1px solid var(--line); padding: 2px 9px; border-radius: 6px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.status, .status-btn { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; border: 0; font-family: var(--font); }
.status-btn { cursor: pointer; }
.s-published, .s-done { background: #e6f6ec; color: #1b7a3f; }
.s-draft, .s-read { background: #f1eef0; color: #6d6468; }
.s-new { background: #fff3d6; color: #8a5a00; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d5cdd0; }
.dot.ok { background: #2e9d5b; }
.person { display: flex; align-items: center; gap: 10px; }
.star { color: var(--accent); font-size: 11px; }

/* tree */
.tree-title { display: flex; align-items: center; gap: 8px; padding-left: calc(var(--d) * 26px); }
.tree-toggle { width: 22px; height: 22px; border: 0; background: var(--p-50); color: var(--primary); border-radius: 6px; cursor: pointer; flex-shrink: 0; transition: transform .15s; }
tr.collapsed .tree-toggle { transform: rotate(-90deg); }
.tree-dot { width: 22px; flex-shrink: 0; position: relative; }
.tree-dot::before { content: ''; position: absolute; left: 8px; top: -2px; width: 6px; height: 6px; border-radius: 50%; background: var(--p-200); }
.tree-ico { width: 30px; height: 30px; display: grid; place-items: center; background: var(--bg); border-radius: 8px; flex-shrink: 0; }
.tree tr.depth-0 td { background: #fdfbfc; }
.tree tr.depth-0 .t { font-weight: 600; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 360px; min-width: 200px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.search input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: var(--bg); }
.search input:focus { outline: none; border-color: var(--primary); background: #fff; }
.filter-tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; }
.filter-tabs a { padding: 6px 14px; border-radius: 7px; color: var(--ink-2); font-size: 13px; }
.filter-tabs a.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field > span small { font-weight: 400; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field select, .field textarea, .prefix-input, .inline-form select {
  width: 100%; padding: 9px 12px; border: 1px solid #ddd3d6; border-radius: 9px; font: 400 14px var(--font); background: #fff; color: var(--ink); transition: .15s; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--p-100); }
.field input[type=color] { width: 100%; height: 40px; border: 1px solid #ddd3d6; border-radius: 9px; padding: 3px; background: #fff; }
.field input[type=file] { font-size: 12.5px; }
.input-lg { font-size: 17px !important; font-weight: 500 !important; padding: 12px 14px !important; }
.prefix-input { display: flex; align-items: center; padding: 0 0 0 12px; overflow: hidden; }
.prefix-input em { font-style: normal; color: var(--muted); font-size: 12.5px; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.prefix-input input { border: 0 !important; box-shadow: none !important; padding: 9px 12px 9px 2px !important; flex: 1; min-width: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.thumb { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.thumb img { max-width: 120px; max-height: 70px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }
.thumb .check { margin: 0; }
.plain-html { width: 100%; min-height: 240px; font-family: Consolas, monospace; font-size: 13px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }

/* edit layout */
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.edit-side .card { padding: 18px; }
.sticky-card { position: sticky; top: 80px; z-index: 5; }
.publish-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.publish-actions .btn-primary { flex: 1; }
.doc-checks { max-height: 260px; overflow: auto; }
.doc-checks .check small { display: block; }

/* import */
.import-card { border: 1px solid var(--p-200); background: linear-gradient(180deg, var(--p-50), #fff); }
.import-card.pulse { animation: pulse 1.6s ease 2; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--p-100); } }
.dropzone { border: 2px dashed var(--p-200); border-radius: 12px; padding: 26px; text-align: center; background: #fff; transition: .15s; }
.dropzone.over { border-color: var(--primary); background: var(--p-50); }
.dropzone > i { font-size: 34px; color: var(--primary); margin-bottom: 6px; }
.dropzone p { margin: 4px 0; }
.import-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.radio { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.radio input { accent-color: var(--primary); margin-top: 3px; }
.radio:has(input:checked) { border-color: var(--primary); background: var(--p-50); }
.radio strong { display: block; font-size: 13px; }
.radio small { color: var(--muted); font-size: 11.5px; line-height: 1.4; display: block; }
.import-status { padding: 12px 14px; border-radius: 10px; background: #eef4ff; color: #1d4ea1; font-size: 13px; margin-top: 8px; }
.import-status.ok { background: #e8f7ee; color: #1b6b3a; }
.import-status.error { background: #fdecec; color: #a12727; }

/* sections */
.section-item { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; background: #fff; overflow: hidden; }
.section-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.handle { color: var(--muted); padding: 0 4px; }
.sec-title { flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid #ddd3d6; border-radius: 8px; font: 600 14px var(--font); }
.sec-title:focus, .sec-type:focus { outline: none; border-color: var(--primary); }
.sec-type { padding: 8px; border: 1px solid #ddd3d6; border-radius: 8px; font: 13px var(--font); background: #fff; }
.sec-btns { display: flex; gap: 4px; }
.section-body { padding: 12px; }
.anchor-field { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.anchor-field input { border: 1px dashed var(--line); border-radius: 6px; padding: 3px 8px; font: 12px var(--font); color: var(--ink-2); width: 200px; }
.section-item.collapsed .section-body { display: none; }
.section-item.collapsed .sec-collapse i { transform: rotate(180deg); }
.empty-sec { text-align: center; color: var(--muted); padding: 26px; border: 2px dashed var(--line); border-radius: 12px; }
.tox-tinymce { border-radius: 10px !important; border-color: #ddd3d6 !important; }

/* settings */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 5px; }
.tabs a { padding: 9px 16px; border-radius: 8px; color: var(--ink-2); white-space: nowrap; font-weight: 500; }
.tabs a.active { background: var(--primary); color: #fff; }
.swatch-group { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 10px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.swatch input { position: absolute; opacity: 0; }
.swatch-card { display: block; border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; transition: .15s; background: #fff; }
.swatch input:checked + .swatch-card { border-color: var(--primary); box-shadow: 0 0 0 4px var(--p-100); }
.swatch input:focus-visible + .swatch-card { outline: 2px solid var(--primary); }
.swatch-preview { display: block; height: 64px; border-radius: 8px; position: relative; margin-bottom: 8px; }
.swatch-preview b { position: absolute; right: 10px; bottom: 10px; width: 46px; height: 14px; border-radius: 99px; }
.swatch-preview em { position: absolute; left: 10px; top: 12px; width: 60%; height: 8px; border-radius: 99px; background: rgba(255,255,255,.55); box-shadow: 0 16px 0 -1px rgba(255,255,255,.3); }
.swatch-colors { display: flex; gap: 4px; margin-bottom: 8px; }
.swatch-colors i { flex: 1; height: 6px; border-radius: 99px; }
.swatch-card strong { font-size: 13px; }
.save-bar { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); display: flex; justify-content: flex-end; }
.details { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0 0 16px; }
.details dt { color: var(--muted); font-weight: 500; }
.details dd { margin: 0; }
.details .msg { background: var(--bg); padding: 12px; border-radius: 9px; }
.inline-form label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.inline-form select { width: auto; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 80% 0, color-mix(in srgb, var(--primary) 60%, #ff6b81), transparent 60%), linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.login-card { width: 100%; max-width: 410px; background: #fff; border-radius: 18px; padding: 34px 30px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.45); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand img { width: 52px; height: 52px; background: var(--p-50); border-radius: 14px; padding: 8px; }
.login-brand strong { display: block; font-size: 16.5px; color: var(--primary); line-height: 1.25; }
.login-brand span { font-size: 12.5px; color: var(--muted); }
.input-ico { position: relative; }
.input-ico > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-ico input { padding-left: 38px !important; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 8px; }
.back-site { display: block; text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* responsive */
@media (max-width: 1200px) {
  .edit-grid { grid-template-columns: 1fr; }
  .sticky-card { position: static; }
  .import-opts { grid-template-columns: 1fr; }
}
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  body.side-open .sidebar { transform: none; box-shadow: 10px 0 40px rgba(0,0,0,.3); }
  body.side-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  .main { margin-left: 0; }
  .burger { display: grid; place-items: center; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .hide-md { display: none !important; }
}
@media (max-width: 640px) {
  .content { padding: 16px 12px 50px; }
  .topnav { padding: 10px 12px; }
  .topnav h1 { font-size: 15.5px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .stat-grid { gap: 10px; }
  .stat { padding: 14px; gap: 10px; }
  .stat > i { width: 40px; height: 40px; font-size: 16px; }
  .quick-actions { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .section-head { flex-wrap: wrap; }
  .sec-title { flex: 1 1 100%; order: -1; }
  .handle { display: none; }
  .sec-btns { margin-left: auto; }
  .tree-title { padding-left: calc(var(--d) * 14px); }
  .tree-ico { display: none; }
  .table .actions .icon-btn { width: 30px; height: 30px; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 10px; }
  .toolbar .search { max-width: none; }
}
