/* ==========================================================================
   Voyara admin panel
   Brand colours (--primary, --accent ...) are printed by theme_vars(), so the
   panel follows the colours chosen in Settings > Appearance.
   ========================================================================== */

:root {
  --primary: #14532D;
  --primary-rgb: 20, 83, 45;
  --accent: #2EAA5C;
  --accent-rgb: 46, 170, 92;
  --action: #2EAA5C;
  --action-rgb: 46, 170, 92;
  --sun: #FFB547;
  --sun-rgb: 255, 181, 71;
  --soft: #EEF7F1;
  --bg: #F3F6F9;
  --surface: #fff;
  --ink: #0F2233;
  --body: #475A6B;
  --muted: #8293A2;
  --line: #E3EAF0;
  --line-soft: #EEF2F6;
  --success: #149A63;
  --success-bg: #E5F6EE;
  --warning: #C98207;
  --warning-bg: #FFF3DC;
  --danger: #DC3F48;
  --danger-bg: #FDEBEC;
  --info: #2878C8;
  --info-bg: #E5F0FB;
  --neutral: #66788A;
  --neutral-bg: #EDF1F5;
  --f-head: 'Outfit', 'Segoe UI', Arial, sans-serif;
  --f-body: 'Jost', 'Segoe UI', Arial, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-xs: 0 1px 2px rgba(15, 34, 51, .05);
  --shadow: 0 1px 2px rgba(15, 34, 51, .04), 0 10px 28px rgba(15, 34, 51, .05);
  --shadow-lg: 0 24px 60px rgba(15, 34, 51, .18);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --sidebar-w: 268px;
  --sidebar-mini: 80px;
  --topbar-h: 70px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, h5 { font-family: var(--f-head); color: var(--ink); margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; background: var(--line-soft); padding: 2px 6px; border-radius: 6px; color: var(--ink); word-break: break-all; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; color: var(--ink); }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.w-100 { width: 100%; }

/* ---------- Layout ---------- */

.admin-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, .07), transparent 60%),
    linear-gradient(180deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 78%, #000) 100%);
  color: rgba(255, 255, 255, .72);
  transition: width .25s var(--ease), transform .3s var(--ease);
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 0 22px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex-shrink: 0;
}
.sidebar-brand a.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: #fff; }
.sidebar-brand img { height: 32px; width: auto; max-width: 150px; }
.sidebar-brand .brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--accent); color: #fff;
  font-family: var(--f-head); font-weight: 700; font-size: 18px;
}
.sidebar-brand .brand-name { font-family: var(--f-head); font-weight: 600; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand .collapse-btn {
  margin-left: auto; width: 32px; height: 32px; border-radius: 9px; border: 0;
  background: rgba(255, 255, 255, .08); color: #fff; display: grid; place-items: center; flex-shrink: 0;
}
.sidebar-brand .collapse-btn:hover { background: rgba(255, 255, 255, .16); }
.sidebar-brand .collapse-btn .on-mob { display: none; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 12px 24px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.nav-group + .nav-group { margin-top: 16px; }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: rgba(255, 255, 255, .42); padding: 0 12px 6px; white-space: nowrap;
}
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: 11px;
  color: rgba(255, 255, 255, .74);
  font-size: 14.5px;
  white-space: nowrap;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav-link i { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; opacity: .9; }
.nav-link span.txt { overflow: hidden; text-overflow: ellipsis; }
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, .13); color: #fff; font-weight: 500; }
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--accent);
}
.nav-link .count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 20px;
  background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 600;
  display: inline-grid; place-items: center;
}
.sidebar-foot {
  padding: 14px 22px; font-size: 12px; color: rgba(255, 255, 255, .4);
  border-top: 1px solid rgba(255, 255, 255, .08); white-space: nowrap; overflow: hidden;
}

.main { margin-left: var(--sidebar-w); min-width: 0; transition: margin-left .25s var(--ease); }

/* Desktop mini sidebar */
@media (min-width: 1100px) {
  .sidebar-mini .sidebar { width: var(--sidebar-mini); }
  .sidebar-mini .main { margin-left: var(--sidebar-mini); }
  .sidebar-mini .sidebar .brand-name,
  .sidebar-mini .sidebar .nav-label,
  .sidebar-mini .sidebar .nav-link span.txt,
  .sidebar-mini .sidebar .sidebar-foot,
  .sidebar-mini .sidebar .brand img { display: none; }
  .sidebar-mini .sidebar-brand { padding: 0 12px; justify-content: center; }
  .sidebar-mini .sidebar-brand a.brand { display: none; }
  .sidebar-mini .sidebar-brand .collapse-btn { margin: 0; }
  .sidebar-mini .sidebar-brand .collapse-btn i { transform: rotate(180deg); }
  .sidebar-mini .nav-link { justify-content: center; padding: 11px 0; }
  .sidebar-mini .nav-link .count { position: absolute; top: 3px; right: 8px; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; }
  .sidebar-mini .nav-group + .nav-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .07); }
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: rgba(243, 246, 249, .86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .burger { display: none; }
.icon-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  display: inline-grid; place-items: center; flex-shrink: 0;
  transition: border-color .2s, box-shadow .2s, color .2s;
}
.icon-btn:hover { border-color: rgba(var(--primary-rgb), .3); color: var(--primary); box-shadow: var(--shadow-xs); }
.icon-btn i { font-size: 18px; }
.icon-btn .dot {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 20px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600;
  display: grid; place-items: center; border: 2px solid var(--bg);
}
.top-search { position: relative; flex: 1; max-width: 440px; min-width: 0; }
.top-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.top-search input {
  width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); padding: 0 14px 0 40px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.top-search input:focus { border-color: rgba(var(--primary-rgb), .45); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .08); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.view-site {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 14px;
}
.view-site:hover { color: var(--primary); border-color: rgba(var(--primary-rgb), .3); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 70;
  width: 300px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 8px; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility .18s;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu .menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.dropdown-menu .menu-head strong { display: block; color: var(--ink); font-family: var(--f-head); font-weight: 600; }
.dropdown-menu a, .dropdown-menu button.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: 10px;
  color: var(--body); background: none; border: 0; text-align: left; font-size: 14px;
}
.dropdown-menu a:hover, .dropdown-menu button.menu-item:hover { background: var(--line-soft); color: var(--ink); }
.dropdown-menu a i, .dropdown-menu button.menu-item i { font-size: 16px; color: var(--muted); }
.dropdown-menu .note-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.dropdown-menu .note-icon i { color: inherit; }
.dropdown-menu .empty-note { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.dropdown-menu .empty-note i { font-size: 26px; display: block; margin-bottom: 6px; color: var(--success); }

.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 3px; border-radius: 14px; }
.user-btn .meta { text-align: left; line-height: 1.2; }
.user-btn .meta strong { display: block; font-size: 14px; color: var(--ink); font-weight: 600; }
.user-btn .meta small { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.user-btn > i { color: var(--muted); font-size: 12px; }

.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, var(--accent)));
  color: #fff; font-family: var(--f-head); font-weight: 600; font-size: 15px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.avatar.lg { width: 72px; height: 72px; border-radius: 20px; font-size: 24px; }
.avatar.round { border-radius: 50%; }

.content { padding: 28px; max-width: 1480px; margin: 0 auto; }

/* ---------- Page header ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 600; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.page-head .crumbs a { color: var(--muted); }
.page-head .crumbs a:hover { color: var(--primary); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 500; font-size: 14.5px; white-space: nowrap; line-height: 1;
  background: var(--primary); color: #fff; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s;
}
.btn:hover { color: #fff; box-shadow: 0 8px 20px rgba(var(--primary-rgb), .25); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn i { font-size: 16px; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { box-shadow: 0 8px 20px rgba(var(--accent-rgb), .3); }
.btn-success { background: var(--success); }
.btn-success:hover { box-shadow: 0 8px 20px rgba(20, 154, 99, .25); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { box-shadow: 0 8px 20px rgba(220, 63, 72, .25); }
.btn-light { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-light:hover { color: var(--primary); border-color: rgba(var(--primary-rgb), .35); box-shadow: var(--shadow-xs); }
.btn-ghost-danger { background: var(--surface); color: var(--danger); border-color: var(--line); }
.btn-ghost-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); box-shadow: none; }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.row-actions form { margin: 0; }
.act {
  width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--body); transition: all .2s;
}
.act i { font-size: 15px; }
.act:hover { color: var(--primary); border-color: rgba(var(--primary-rgb), .35); background: rgba(var(--primary-rgb), .04); }
.act.danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.act.success:hover { color: #fff; background: var(--success); border-color: var(--success); }

/* ---------- Cards ---------- */

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(227, 234, 240, .7); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 16.5px; font-weight: 600; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-head .link { font-size: 13.5px; font-weight: 500; display: inline-flex; gap: 4px; align-items: center; }
.card-body { padding: 22px; }
.card-body.tight { padding: 8px 22px; }
.card-foot { padding: 16px 22px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
:not(.grid) > .card + .card { margin-top: 22px; }
.card.flush > .table-scroll { border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-main-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack > * + * { margin-top: 22px; }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 20px); }

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

.stat { padding: 20px 22px; display: flex; gap: 16px; align-items: flex-start; position: relative; overflow: hidden; }
.stat .ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; font-size: 21px; }
.stat .label { font-size: 13.5px; color: var(--muted); margin-bottom: 4px; }
.stat .value { font-family: var(--f-head); font-size: 26px; font-weight: 600; color: var(--ink); line-height: 1.15; letter-spacing: -.02em; word-break: break-word; }
.stat .trend { font-size: 12.5px; margin-top: 6px; display: inline-flex; gap: 4px; align-items: center; color: var(--muted); }
.stat .trend.up { color: var(--success); }
.stat .trend.down { color: var(--danger); }
.stat::after { content: ""; position: absolute; right: -30px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%; background: currentColor; opacity: .035; }
.tone-primary { background: rgba(var(--primary-rgb), .09); color: var(--primary); }
.tone-accent { background: rgba(var(--accent-rgb), .12); color: var(--accent); }
.tone-success { background: var(--success-bg); color: var(--success); }
.tone-warning { background: var(--warning-bg); color: var(--warning); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Charts ---------- */

.chart-wrap { position: relative; }
.chart-scroll { overflow-x: auto; scrollbar-width: thin; }
.bar-chart { width: 100%; height: auto; min-width: 540px; overflow: visible; }
.bar-chart .grid-line { stroke: var(--line); stroke-dasharray: 3 5; }
.bar-chart .axis { fill: var(--muted); font-size: 11.5px; font-family: var(--f-body); }
.bar-chart .bar { fill: url(#barGrad); transition: opacity .2s; cursor: pointer; }
.bar-chart .bar.current { fill: url(#barGradAccent); }
.bar-chart .bar-hit { fill: transparent; cursor: pointer; }
.bar-chart g.col:hover .bar { opacity: .82; }
.bar-chart .trend-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; opacity: .5; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 8px 12px; font-size: 13px; line-height: 1.35;
  transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .15s; white-space: nowrap; box-shadow: var(--shadow-lg);
}
.chart-tip strong { display: block; font-family: var(--f-head); font-size: 15px; }
.chart-tip.show { opacity: 1; }
.chart-summary { display: flex; gap: 28px; flex-wrap: wrap; }
.chart-summary div span { display: block; font-size: 12.5px; color: var(--muted); }
.chart-summary div strong { font-family: var(--f-head); font-size: 19px; color: var(--ink); font-weight: 600; }

.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: center; }
.donut { width: 170px; height: 170px; flex-shrink: 0; position: relative; }
.donut svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.donut circle { fill: none; stroke-width: 4.6; }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.2; }
.donut .center strong { display: block; font-family: var(--f-head); font-size: 28px; color: var(--ink); font-weight: 600; }
.donut .center span { font-size: 12px; color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 150px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legend li i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend li strong { margin-left: auto; color: var(--ink); font-weight: 600; padding-left: 12px; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); padding: 12px 16px; background: #F8FAFC; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #FAFCFD; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .text-right { text-align: right; }
.table.compact td { padding-top: 11px; padding-bottom: 11px; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main .thumb { width: 52px; height: 40px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: var(--line-soft); }
.cell-main .thumb.square { width: 44px; height: 44px; }
.cell-main .thumb.contain { object-fit: contain; padding: 4px; background: #fff; border: 1px solid var(--line); }
.cell-main strong, .cell-title { color: var(--ink); font-weight: 600; display: block; line-height: 1.35; }
.cell-main small, .cell-sub { color: var(--muted); font-size: 12.5px; display: block; line-height: 1.4; }
.cell-main a.cell-title:hover { color: var(--accent); }
.code-tag { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; font-weight: 600; color: var(--primary); letter-spacing: .02em; }
.row-unread td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.row-unread .cell-title { font-weight: 700; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 25px; padding: 0 10px; border-radius: 30px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap; line-height: 1;
  background: var(--neutral-bg); color: var(--neutral);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--neutral-bg); color: var(--neutral); }
.badge-primary { background: rgba(var(--primary-rgb), .09); color: var(--primary); }
.badge-accent { background: rgba(var(--accent-rgb), .12); color: color-mix(in srgb, var(--accent) 80%, #000); }
.stars { color: var(--sun); display: inline-flex; gap: 1px; font-size: 13px; }
.stars .off { color: #D6DEE5; }

/* ---------- Toolbar / filters ---------- */

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line-soft); }
.toolbar .search { position: relative; flex: 1 1 240px; min-width: 0; max-width: 360px; }
.toolbar .search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.toolbar .search .input { padding-left: 38px; width: 100%; }
.toolbar .input, .toolbar .select { height: 40px; width: auto; min-width: 0; }
.toolbar .select { flex: 0 1 180px; }
.toolbar input[type=date].input { flex: 0 1 160px; }
.toolbar .spacer { flex: 1; }
.tabs-line { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; }
.tabs-line::-webkit-scrollbar { display: none; }
.tabs-line a, .tabs-line button {
  display: inline-flex; align-items: center; gap: 8px; padding: 15px 10px 13px; border: 0; background: none; color: var(--muted);
  font-weight: 500; font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs-line a:hover, .tabs-line button:hover { color: var(--ink); }
.tabs-line a.active, .tabs-line button.active { color: var(--primary); border-bottom-color: var(--accent); }
.tabs-line .num { font-size: 11.5px; background: var(--line-soft); color: var(--body); border-radius: 20px; padding: 1px 8px; }
.tabs-line .active .num { background: rgba(var(--accent-rgb), .14); color: color-mix(in srgb, var(--accent) 80%, #000); }

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2, .form-grid .full { grid-column: 1 / -1; }
.field { min-width: 0; }
.field > label, .label { display: block; font-weight: 500; color: var(--ink); font-size: 14px; margin-bottom: 7px; }
.field > label .req { color: var(--danger); margin-left: 2px; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.field .error { font-size: 12.5px; color: var(--danger); margin-top: 6px; display: flex; gap: 5px; align-items: center; }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s; font-size: 14.5px;
}
.textarea { height: auto; min-height: 110px; padding: 11px 14px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%238293A2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.input:focus, .select:focus, .textarea:focus { border-color: rgba(var(--primary-rgb), .5); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .09); }
.input::placeholder, .textarea::placeholder { color: #A6B3BF; }
.is-invalid { border-color: var(--danger) !important; }
.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group .addon {
  display: grid; place-items: center; padding: 0 13px; background: #F6F8FA; border: 1px solid var(--line); color: var(--muted); font-size: 14px; white-space: nowrap;
}
.input-group .addon:first-child { border-radius: 11px 0 0 11px; border-right: 0; }
.input-group .addon:last-child { border-radius: 0 11px 11px 0; border-left: 0; }
.input-group .input { min-width: 0; flex: 1; }
.input-group .addon:first-child + .input { border-radius: 0 11px 11px 0; }
.input-group .input:has(+ .addon) { border-radius: 11px 0 0 11px; }
.input-group .btn { border-radius: 0 11px 11px 0; height: 44px; }
.input-group .input + .btn { margin-left: -1px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.form-section + .form-section { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.form-section > h3 { font-size: 15.5px; margin-bottom: 4px; }
.form-section > p.section-help { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.form-section > h3 + .form-grid, .form-section > h3 + .field { margin-top: 14px; }

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; width: 42px; height: 24px; border-radius: 20px; background: #D5DEE6; flex-shrink: 0; transition: background .2s; margin-top: 1px;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s var(--ease);
}
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .15); }
.switch .switch-text strong { display: block; font-weight: 500; color: var(--ink); font-size: 14px; line-height: 1.4; }
.switch .switch-text small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 2px; }
.switch.sm .track { width: 36px; height: 20px; }
.switch.sm .track::after { width: 14px; height: 14px; }
.switch.sm input:checked + .track::after { transform: translateX(16px); }
.inline-toggle { margin: 0; display: inline-flex; }
.inline-toggle .switch { gap: 0; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.check-card { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, background .2s; }
.check-card input { width: 17px; height: 17px; accent-color: var(--primary); flex-shrink: 0; }
.check-card i { font-size: 18px; color: var(--primary); }
.check-card:has(input:checked) { border-color: rgba(var(--primary-rgb), .45); background: rgba(var(--primary-rgb), .04); }

/* Image upload */
.upload { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.upload .preview {
  width: 120px; height: 90px; border-radius: 12px; background: var(--line-soft) center/cover no-repeat; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--muted); font-size: 26px; flex-shrink: 0; overflow: hidden;
}
.upload .preview.contain { background-size: contain; background-color: #fff; }
.upload .preview.dark { background-color: var(--primary); }
.upload .preview.has-image i { display: none; }
.upload .controls { flex: 1; min-width: 180px; }
.file-btn { position: relative; display: inline-flex; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.upload .file-name { font-size: 12.5px; color: var(--muted); margin-top: 6px; word-break: break-all; }
.upload .remove-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--danger); margin-top: 8px; cursor: pointer; }

.dropzone {
  position: relative; border: 2px dashed var(--line); border-radius: 14px; padding: 22px; text-align: center; color: var(--muted);
  background: #FAFCFD; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.drag { border-color: rgba(var(--primary-rgb), .45); background: rgba(var(--primary-rgb), .03); }
.dropzone i { font-size: 28px; color: var(--primary); display: block; margin-bottom: 6px; }
.dropzone strong { color: var(--ink); font-weight: 500; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .picked { font-size: 13px; color: var(--primary); margin-top: 6px; }

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; margin-bottom: 14px; }
.thumb-grid:empty { display: none; }
.thumb-item { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--line-soft); }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s, filter .2s; }
.thumb-item label {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 8px; background: rgba(255, 255, 255, .92);
  display: grid; place-items: center; color: var(--danger); cursor: pointer; box-shadow: var(--shadow-xs);
}
.thumb-item input { position: absolute; opacity: 0; pointer-events: none; }
.thumb-item:has(input:checked) img { opacity: .35; filter: grayscale(1); }
.thumb-item:has(input:checked) label { background: var(--danger); color: #fff; }

/* Repeaters */
.repeater { display: grid; gap: 10px; }
.repeater-row { display: flex; gap: 8px; align-items: flex-start; }
.repeater-row > .input, .repeater-row > .grow { flex: 1; min-width: 0; }
.repeater-row .handle { color: #B8C4CE; padding-top: 12px; flex-shrink: 0; }
.repeater-row .act { height: 44px; width: 44px; border-radius: 11px; flex-shrink: 0; }
.repeater-add { margin-top: 10px; }
.day-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #FBFCFD; display: grid; gap: 10px; }
.day-card .day-top { display: flex; gap: 10px; align-items: center; }
.day-card .day-num {
  height: 30px; padding: 0 12px; border-radius: 9px; background: rgba(var(--primary-rgb), .09); color: var(--primary);
  font-family: var(--f-head); font-weight: 600; font-size: 13px; display: grid; place-items: center; white-space: nowrap; flex-shrink: 0;
}
.day-card .day-top .input { flex: 1; min-width: 0; }
.day-card .day-top .act { height: 44px; width: 44px; border-radius: 11px; flex-shrink: 0; }
.skill-row .input.pct { flex: 0 0 110px; }

/* Rich text toolbar */
.editor { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; transition: border-color .2s, box-shadow .2s; }
.editor:focus-within { border-color: rgba(var(--primary-rgb), .5); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .09); }
.editor-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: #F7F9FB; border-bottom: 1px solid var(--line); }
.editor-bar button {
  min-width: 34px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--body); font-size: 14px; font-weight: 600;
}
.editor-bar button:hover { background: #fff; color: var(--primary); box-shadow: var(--shadow-xs); }
.editor-bar .sep { width: 1px; background: var(--line); margin: 4px 4px; }
.editor .textarea { border: 0; border-radius: 0; box-shadow: none !important; min-height: 280px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }

/* ---------- Alerts / notes ---------- */

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.alert > i { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.alert strong { color: inherit; }
.alert-info { background: var(--info-bg); color: #1D5E9F; }
.alert-warning { background: var(--warning-bg); color: #8A5A05; }
.alert-danger, .alert-error { background: var(--danger-bg); color: #A82C33; }
.alert-success { background: var(--success-bg); color: #0E7149; }
.alert p:last-child { margin: 0; }

.copy-field { display: flex; gap: 0; min-width: 0; }
.copy-field .input { border-radius: 11px 0 0 11px; background: #F8FAFC; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; min-width: 0; }
.copy-field .btn { border-radius: 0 11px 11px 0; height: 44px; margin-left: -1px; }

/* ---------- Toasts ---------- */

.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: grid; gap: 10px; width: 380px; max-width: calc(100vw - 32px); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 16px; border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); font-size: 14px; color: var(--ink);
  animation: toastIn .35s var(--ease); position: relative; overflow: hidden;
}
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--info); }
.toast .t-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; font-size: 16px; background: var(--info-bg); color: var(--info); }
.toast .t-body { flex: 1; min-width: 0; padding-top: 4px; line-height: 1.45; word-break: break-word; }
.toast .t-close { border: 0; background: none; color: var(--muted); padding: 4px; line-height: 1; }
.toast-success::before { background: var(--success); }
.toast-success .t-ico { background: var(--success-bg); color: var(--success); }
.toast-error::before { background: var(--danger); }
.toast-error .t-ico { background: var(--danger-bg); color: var(--danger); }
.toast-warning::before { background: var(--warning); }
.toast-warning .t-ico { background: var(--warning-bg); color: var(--warning); }
.toast.hide { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ---------- Modal ---------- */

.modal { border: 0; padding: 0; border-radius: 18px; width: 440px; max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg); color: var(--body); }
.modal::backdrop { background: rgba(10, 25, 38, .45); backdrop-filter: blur(3px); }
.modal[open] { animation: toastIn .25s var(--ease); }
.modal-body { padding: 26px 26px 8px; display: flex; gap: 16px; }
.modal-body .m-ico { width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center; font-size: 21px; background: var(--danger-bg); color: var(--danger); }
.modal-body h3 { font-size: 18px; margin-bottom: 6px; }
.modal-body p { margin: 0; font-size: 14.5px; }
.modal-foot { padding: 18px 26px 22px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Empty states ---------- */

.empty { text-align: center; padding: 54px 24px; }
.empty .e-ico {
  width: 68px; height: 68px; border-radius: 20px; margin: 0 auto 16px; display: grid; place-items: center; font-size: 28px;
  background: rgba(var(--primary-rgb), .07); color: var(--primary);
}
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 380px; margin: 0 auto 16px; font-size: 14px; }
.empty.sm { padding: 30px 18px; }
.empty.sm .e-ico { width: 52px; height: 52px; font-size: 22px; border-radius: 16px; margin-bottom: 10px; }

/* ---------- Pagination ---------- */

.pager { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 22px; border-top: 1px solid var(--line-soft); }
.pager .info { font-size: 13.5px; color: var(--muted); }
.pager nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pager nav a, .pager nav span {
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: 10px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--body); font-size: 14px; font-weight: 500;
}
.pager nav a:hover { border-color: rgba(var(--primary-rgb), .35); color: var(--primary); }
.pager nav .active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager nav .disabled { opacity: .45; }

/* ---------- Detail lists ---------- */

.dl { display: grid; grid-template-columns: minmax(0, 140px) minmax(0, 1fr); gap: 11px 16px; font-size: 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--ink); font-weight: 500; word-break: break-word; }
.totals { display: grid; gap: 9px; font-size: 14.5px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals div span:last-child { color: var(--ink); font-weight: 500; }
.totals .grand { padding-top: 12px; margin-top: 4px; border-top: 1px dashed var(--line); font-family: var(--f-head); font-size: 18px; }
.totals .grand span { color: var(--ink); font-weight: 600 !important; }
.progress { height: 7px; border-radius: 10px; background: var(--line-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; gap: 12px; align-items: center; padding: 13px 22px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow strong { display: block; color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .grow small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .rank { width: 28px; height: 28px; border-radius: 9px; background: var(--line-soft); display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--ink); flex-shrink: 0; }
.list-row img.thumb { width: 48px; height: 48px; border-radius: 11px; object-fit: cover; flex-shrink: 0; }
.list-row .end { text-align: right; flex-shrink: 0; }
.list-row .end strong { display: block; color: var(--ink); font-size: 14px; }
.list-row .end small { color: var(--muted); font-size: 12px; }
.message-body { background: #F8FAFC; border: 1px solid var(--line-soft); border-radius: 14px; padding: 18px 20px; color: var(--ink); white-space: pre-line; word-break: break-word; line-height: 1.7; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 24px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .1); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline small { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- Tabs (panels) ---------- */

.tab-panel { display: none; }
.tab-panel.active { display: block; }
.pill-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; flex-wrap: wrap; max-width: 100%; }
.pill-tabs a, .pill-tabs button {
  border: 0; background: none; padding: 8px 14px; border-radius: 10px; font-weight: 500; font-size: 14px; color: var(--body); white-space: nowrap;
  display: inline-flex; gap: 6px; align-items: center;
}
.pill-tabs a:hover, .pill-tabs button:hover { color: var(--primary); }
.pill-tabs .active { background: var(--primary); color: #fff !important; }
.pill-tabs .active .badge { background: rgba(255, 255, 255, .2); color: #fff; }

/* ---------- Settings ---------- */

.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.settings-nav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line);
  color: var(--body); font-weight: 500; font-size: 14px; white-space: nowrap;
}
.settings-nav a:hover { color: var(--primary); border-color: rgba(var(--primary-rgb), .3); }
.settings-nav a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.gateway-card .card-head .g-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
.gateway-card .g-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.gateway-card.is-off .card-body { opacity: .78; }
.save-bar {
  position: sticky; bottom: 0; z-index: 30; margin-top: 22px; padding: 14px 22px; display: flex; justify-content: flex-end; gap: 10px; align-items: center;
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.save-bar .hint { margin-right: auto; font-size: 13px; color: var(--muted); }

.preset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.preset {
  border: 2px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; text-align: left; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.preset:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.preset.active { border-color: var(--ink); }
.preset .swatches { display: flex; height: 42px; border-radius: 9px; overflow: hidden; margin-bottom: 10px; }
.preset .swatches span { flex: 1; }
.preset .swatches span:first-child { flex: 2.2; }
.preset strong { font-size: 13.5px; color: var(--ink); font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 48px; height: 44px; border-radius: 11px; border: 1px solid var(--line); padding: 4px; background: #fff; cursor: pointer; flex-shrink: 0; }
.color-row input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input[type=color]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.color-row .input { text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.preview-site { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.preview-site .p-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; background: var(--p-primary, #14532D); color: #fff; }
.preview-site .p-logo { font-family: var(--f-head); font-weight: 700; font-size: 18px; }
.preview-site .p-logo span { color: var(--p-accent); }
.preview-site .p-nav { display: flex; gap: 14px; font-size: 13px; opacity: .85; }
.preview-site .p-hero { padding: 26px 18px; background: var(--p-soft); }
.preview-site .p-kicker { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--p-accent); }
.preview-site .p-title { font-family: var(--f-head); font-weight: 700; font-size: 24px; color: var(--p-primary); line-height: 1.2; margin: 4px 0 12px; }
.preview-site .p-title span { color: var(--p-accent); }
.preview-site .p-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.preview-site .p-btn { padding: 9px 18px; border-radius: 40px; background: var(--p-action); color: #fff; font-size: 13px; font-weight: 600; }
.preview-site .p-btn.alt { background: transparent; color: var(--p-primary); border: 1.5px solid var(--p-primary); }
.preview-site .p-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px 18px 20px; }
.preview-site .p-card { border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.preview-site .p-card .img { height: 64px; background: linear-gradient(135deg, var(--p-primary), var(--p-accent)); position: relative; }
.preview-site .p-card .img i { position: absolute; top: 8px; left: 8px; background: var(--p-sun); color: #3a2a00; font-style: normal; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.preview-site .p-card .txt { padding: 10px 12px; font-size: 12.5px; }
.preview-site .p-card .txt b { display: block; color: var(--p-primary); font-family: var(--f-head); font-size: 14px; }
.preview-site .p-card .txt span { color: var(--p-accent); font-weight: 600; }

/* Template preview */
.preview-frame { width: 100%; height: 680px; border: 1px solid var(--line); border-radius: 14px; background: #EEF3F6; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.var-chips button { border: 1px dashed rgba(var(--primary-rgb), .35); background: rgba(var(--primary-rgb), .04); color: var(--primary); padding: 4px 10px; border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.var-chips button:hover { background: rgba(var(--primary-rgb), .1); }

/* Gallery admin */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; padding: 22px; }
.media-card { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; }
.media-card .img { position: relative; aspect-ratio: 4 / 3; background: var(--line-soft); }
.media-card .img img { width: 100%; height: 100%; object-fit: cover; }
.media-card .img .badge { position: absolute; top: 8px; left: 8px; background: rgba(255, 255, 255, .92); }
.media-card .meta { padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.media-card .meta .grow { flex: 1; min-width: 0; }
.media-card .meta strong { display: block; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.media-card .meta small { color: var(--muted); font-size: 12px; }

/* Icon preview */
.icon-preview { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(var(--primary-rgb), .08); color: var(--primary); font-size: 20px; flex-shrink: 0; }

/* ---------- Auth pages ---------- */

.auth-body { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-visual {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(80% 60% at 100% 0%, rgba(var(--accent-rgb), .35), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(255, 255, 255, .08), transparent 60%),
    linear-gradient(150deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000));
}
.auth-visual::before {
  content: ""; position: absolute; inset: 0; opacity: .08;
  background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 22px 22px;
}
.auth-visual > * { position: relative; }
.auth-visual .brand img { height: 38px; width: auto; }
.auth-visual h2 { color: #fff; font-size: 38px; line-height: 1.15; max-width: 460px; font-weight: 600; }
.auth-visual h2 span { color: var(--sun); }
.auth-visual p { color: rgba(255, 255, 255, .75); max-width: 440px; font-size: 16px; margin-top: 16px; }
.auth-visual .auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-visual .auth-points li { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, .88); }
.auth-visual .auth-points i { width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .12); display: grid; place-items: center; }
.auth-visual .foot { font-size: 13px; color: rgba(255, 255, 255, .5); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h1 { font-size: 28px; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 28px; }
.auth-card .field + .field { margin-top: 16px; }
.auth-card .row-between { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 22px; font-size: 14px; }
.auth-card .btn { height: 48px; font-size: 15px; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 46px; }
.pass-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 36px; height: 36px; border-radius: 9px; }
.pass-wrap button:hover { color: var(--primary); background: var(--line-soft); }
.demo-box { margin-top: 24px; border: 1px dashed rgba(var(--accent-rgb), .55); background: rgba(var(--accent-rgb), .05); border-radius: 14px; padding: 14px 16px; display: flex; gap: 14px; align-items: center; }
.demo-box .grow { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; }
.demo-box strong { color: var(--ink); display: block; }
.demo-box code { background: #fff; }
.code-input { letter-spacing: .5em; text-align: center; font-size: 24px !important; font-family: var(--f-head); height: 58px !important; }

/* ---------- Print ---------- */

.print-page { background: #fff; max-width: 860px; margin: 0 auto; padding: 40px; color: #23384A; }
.print-page header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 22px; border-bottom: 2px solid var(--primary); margin-bottom: 26px; }
.print-page h1 { font-size: 24px; }
.print-page table { width: 100%; border-collapse: collapse; margin: 10px 0 22px; font-size: 14px; }
.print-page th, .print-page td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.print-page th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.print-page .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; margin-bottom: 18px; }
.print-page h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 8px; }
.print-actions { text-align: center; padding: 18px; }
@media print {
  .print-actions { display: none; }
  .print-page { padding: 0; }
  body { background: #fff; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1099px) {
  .sidebar { transform: translateX(-100%); width: 284px; visibility: hidden; transition: transform .3s var(--ease), visibility .3s; }
  .sidebar-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .sidebar-brand .collapse-btn .on-desk { display: none; }
  .sidebar-brand .collapse-btn .on-mob { display: block; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(10, 25, 38, .45); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
  .sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .sidebar-open { overflow: hidden; }
  .main { margin-left: 0; }
  .topbar .burger { display: inline-grid; }
  .grid-main, .grid-main-wide { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .auth-body { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
  .user-btn .meta, .user-btn > i { display: none; }
  .view-site span { display: none; }
  .view-site { width: 40px; padding: 0; justify-content: center; }
}

@media (max-width: 767px) {
  body { font-size: 14.5px; }
  .content { padding: 18px 16px 28px; }
  .topbar { padding: 0 16px; gap: 10px; height: 64px; }
  :root { --topbar-h: 64px; }
  .top-search { display: none; }
  .top-search.mobile-open { display: block; position: absolute; left: 12px; right: 12px; top: 11px; max-width: none; z-index: 5; }
  .search-toggle { display: inline-grid !important; }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .page-head h1 { font-size: 22px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .grid { gap: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
  .stat { padding: 16px; flex-direction: column; gap: 10px; }
  .stat .ico { width: 40px; height: 40px; font-size: 18px; border-radius: 12px; }
  .stat .value { font-size: 21px; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .card-head, .card-body, .card-foot, .toolbar { padding-left: 16px; padding-right: 16px; }
  :not(.grid) > .card + .card { margin-top: 16px; }
  .stack > * + * { margin-top: 16px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .settings-nav { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 18px; padding: 0 16px 4px; scrollbar-width: none; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .toolbar .select, .toolbar input[type=date].input { flex: 1 1 140px; }
  .toolbar .btn { flex: 1 1 auto; }
  .list-row { padding-left: 16px; padding-right: 16px; }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dl dd { margin-bottom: 10px; }
  .modal-body { padding: 22px 20px 6px; }
  .modal-foot { padding: 16px 20px 20px; }
  .save-bar { padding: 12px 14px; }
  .save-bar .hint { display: none; }
  .save-bar .btn { flex: 1; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; }
  .pager { justify-content: center; padding: 14px 16px; }
  .pager .info { width: 100%; text-align: center; }
  .chart-summary { gap: 18px; }
  .preview-frame { height: 520px; }
  .print-page { padding: 18px; }
  .print-page .cols { grid-template-columns: minmax(0, 1fr); }

  /* Tables become stacked cards on phones */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.responsive tbody tr:last-child { border-bottom: 0; }
  .table.responsive td {
    display: block; text-align: right; padding: 7px 0 !important; border: 0; min-height: 34px; overflow: hidden; word-break: break-word;
  }
  .table.responsive td::before {
    content: attr(data-label); float: left; white-space: nowrap; font-weight: 600; color: var(--muted);
    font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; margin-right: 12px;
  }
  .table.responsive td.td-main { text-align: left; padding-bottom: 10px !important; }
  .table.responsive td.td-main::before { display: none; }
  .table.responsive td .cell-main { display: inline-flex; vertical-align: middle; text-align: left; }
  .table.responsive td.td-main .cell-main { display: flex; }
  .table.responsive td .row-actions { flex-wrap: wrap; }
  .table.responsive td.td-actions { padding-top: 10px !important; }
  .table.responsive td.td-actions::before { display: none; }
  .table.responsive td:empty { display: none; }
  .table.responsive .row-unread td:first-child { box-shadow: none; }
  .table.responsive .row-unread { box-shadow: inset 3px 0 0 var(--accent); }
  .table-scroll:has(.table.responsive) { overflow-x: visible; }
}

@media (min-width: 768px) {
  .search-toggle { display: none !important; }
}

@media (max-width: 400px) {
  .top-actions { gap: 6px; }
  .icon-btn, .view-site { width: 38px; height: 38px; }
}

@media (max-width: 359px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr) !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
