/* ==========================================================================
   BlogAI — design system
   Tokens → base → layout → components → pages → utilities
   ========================================================================== */
:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px; --radius-sm: 7px; --radius-lg: 14px;

  --bg: #f6f6f6; --surface: #ffffff; --surface-2: #fafafa; --surface-3: #f2f2f2;
  --border: #e7e7e7; --border-strong: #d2d2d2;
  --text: #303030; --text-2: #5a5a5a; --text-3: #8c8c8c;
  --primary: #F05A00; --primary-600: #CC4C00; --primary-50: #FFF4ED; --primary-100: #FFE2CF; --on-primary: #fff;
  --green: #059669; --green-50: #ecfdf5; --red: #dc2626; --red-50: #fef2f2; --amber: #b45309; --amber-50: #fffbeb;
  --blue: #0369a1; --blue-50: #f0f9ff; --indigo: #B84500; --indigo-50: #FFF1E7; --gray: #5a5a5a; --gray-50: #f2f2f2;
  --sidebar: #303030; --sidebar-2: #3d3d3d; --sidebar-text: #d4d4d4; --sidebar-active: #ffffff;
  --shadow-sm: 0 1px 2px rgba(48, 48, 48, .06);
  --shadow: 0 1px 3px rgba(48, 48, 48, .06), 0 6px 16px -8px rgba(48, 48, 48, .14);
  --shadow-lg: 0 20px 50px -12px rgba(48, 48, 48, .35);
  --ring: 0 0 0 3px rgba(240, 90, 0, .25);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1b1b1b; --surface: #262626; --surface-2: #2c2c2c; --surface-3: #333333;
  --border: #3a3a3a; --border-strong: #4a4a4a;
  --text: #f4f4f4; --text-2: #c2c2c2; --text-3: #8f8f8f;
  --primary: #FF6A14; --primary-600: #FF7F38; --primary-50: #3a2416; --primary-100: #4a2d18;
  --green: #34d399; --green-50: #0f2a24; --red: #f87171; --red-50: #2d1418; --amber: #fbbf24; --amber-50: #2b220e;
  --blue: #38bdf8; --blue-50: #0d2333; --indigo: #FF9A5C; --indigo-50: #3a2416; --gray: #c2c2c2; --gray-50: #333333;
  --sidebar: #141414; --sidebar-2: #222222;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 20px -10px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 20px; } h3 { font-size: 15px; } h4 { font-size: 14px; }
p { margin: 0 0 .75em; }
img { max-width: 100%; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip-link:focus { left: 8px; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; background: var(--sidebar); color: var(--sidebar-text); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; font-weight: 700; font-size: 17px; color: #fff; letter-spacing: -0.02em; }
.brand-lg { font-size: 22px; padding: 0; margin-bottom: 18px; color: var(--text); }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #9a9a9a; padding: 16px 10px 6px; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; margin-bottom: 1px; }
.nav-link:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.nav-link.active { background: linear-gradient(90deg, rgba(240,90,0,.30), rgba(240,90,0,.10)); color: var(--sidebar-active); box-shadow: inset 3px 0 0 #F05A00; }
.nav-link .icon { width: 17px; height: 17px; opacity: .9; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.06); }
.main-col { flex: 1; margin-left: 252px; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.content { padding: 24px; max-width: 1480px; width: 100%; }
.sidebar-backdrop { display: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--radius-sm); border: 1px solid transparent; font: 600 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; text-decoration: none !important; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px rgba(240,90,0,.35), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-600); }
.btn-secondary { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); }
.btn-secondary:hover { background: var(--primary-100); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-success { background: var(--green); color: #fff; }
.btn-link { background: none; color: var(--primary); padding: 0 6px; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.center { justify-content: center; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.icon-btn.danger:hover { background: var(--red-50); color: var(--red); }
.dot-count { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- user dropdown ---------- */
.dropdown { position: relative; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; color: var(--text); font: 500 13px var(--font); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #F05A00, #303030); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.dropdown-menu.right { right: 0; }
.dropdown.open .dropdown-menu { display: block; animation: pop .12s ease-out; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text); background: none; border: 0; font: 500 13.5px var(--font); cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 20px; }
.card > .card-body, .card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .muted { font-size: 13px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.form-card { padding: 22px; }
.grid { display: grid; gap: 20px; }
.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-side, .grid-main { grid-template-columns: minmax(0, 1fr) 340px; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head > div:first-child { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head > div:first-child:has(.back-link) { flex-direction: column; align-items: flex-start; gap: 4px; }
.page-head p { margin: 2px 0 0; }
.page-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); border: 1px solid var(--primary-100); }
.page-icon .icon { width: 22px; height: 22px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-weight: 500; font-size: 13px; }
.back-link .icon { width: 15px; height: 15px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 18px; }
.col-full { grid-column: span 6; } .col-half { grid-column: span 3; } .col-third { grid-column: span 2; } .col-two-thirds { grid-column: span 4; }
.form-section { padding-top: 8px; border-top: 1px dashed var(--border); margin-top: 4px; }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label-row label { font-weight: 600; font-size: 13px; color: var(--text); }
.label-row { display: flex; justify-content: space-between; align-items: center; }
.req { color: var(--red); }
.help { font-size: 12.5px; color: var(--text-3); }
.field-error { font-size: 12.5px; color: var(--red); font-weight: 500; }
.input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: 400 14px var(--font); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238391a7' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:hover { border-color: var(--text-3); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input.is-invalid, .is-invalid .input { border-color: var(--red); }
.input[readonly] { background: var(--surface-3); color: var(--text-2); }
.input-sm { height: 32px; font-size: 13px; width: auto; }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; height: 38px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 20px; margin-top: 22px; border-top: 1px solid var(--border); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider { width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .2s; flex-shrink: 0; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { box-shadow: var(--ring); }

/* tag input */
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: text; }
.tags:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-50); color: var(--primary); border: 1px solid var(--primary-100); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 12.5px; font-weight: 500; }
.tag button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; border-radius: 4px; }
.tag button:hover { background: var(--primary-100); }
.tags input { flex: 1; min-width: 120px; border: 0; outline: 0; background: transparent; color: var(--text); font: 14px var(--font); padding: 4px; }

/* ---------- tables ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search .input { padding-left: 34px; height: 34px; }
.table-wrap { overflow-x: auto; }
.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(--text-3); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .sort { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.table .sort::after { content: "↕"; opacity: .35; font-size: 11px; }
.table .sort.sorted-asc::after { content: "↑"; opacity: 1; }
.table .sort.sorted-desc::after { content: "↓"; opacity: 1; }
.table-sm td, .table-sm th { padding: 8px 12px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.row-actions { display: inline-flex; gap: 2px; align-items: center; justify-content: flex-end; }
.pager { display: flex; gap: 4px; }
.pager-btn { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--border); color: var(--text-2); font-weight: 500; padding: 0 8px; }
.pager-btn:hover { background: var(--surface-3); text-decoration: none; }
.pager-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager-btn.disabled { opacity: .4; pointer-events: none; }
.cell-title { font-weight: 600; color: var(--text); display: block; }
.cell-sub { color: var(--text-3); font-size: 12.5px; display: block; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-50); color: var(--green); } .badge-red { background: var(--red-50); color: var(--red); }
.badge-amber { background: var(--amber-50); color: var(--amber); } .badge-blue { background: var(--blue-50); color: var(--blue); }
.badge-indigo { background: var(--indigo-50); color: var(--indigo); } .badge-gray { background: var(--gray-50); color: var(--gray); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; border: 1px solid var(--border); }

/* ---------- alerts / toasts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; font-size: 13.5px; }
.alert > div { flex: 1; word-break: break-word; }
.alert-success { background: var(--green-50); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--green); }
.alert-danger { background: var(--red-50); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.alert-warning { background: var(--amber-50); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--amber); }
.alert-info { background: var(--blue-50); border-color: color-mix(in srgb, var(--blue) 30%, transparent); color: var(--blue); }
.alert-close { border: 0; background: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .6; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { min-width: 260px; max-width: 380px; background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; display: flex; gap: 10px; align-items: center; animation: slidein .2s ease-out; }
.toast.success { background: #065f46; color: #fff; } .toast.error { background: #991b1b; color: #fff; }
@keyframes slidein { from { opacity: 0; transform: translateY(10px); } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(8, 12, 24, .55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade .15s; }
.modal[hidden] { display: none; }
.modal-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .15s ease-out; border: 1px solid var(--border); }
.modal-sm { max-width: 400px; } .modal-lg { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.confirm-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--red-50); color: var(--red); display: grid; place-items: center; margin-bottom: 12px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 56px 20px; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--surface-3); color: var(--text-3); display: grid; place-items: center; }
.empty-icon .icon { width: 26px; height: 26px; }
.empty h3 { margin-bottom: 4px; }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; color: var(--text); position: relative; overflow: hidden; }
a.stat:hover { text-decoration: none; border-color: var(--primary-100); transform: translateY(-1px); }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat .dot { width: 8px; height: 8px; border-radius: 50%; }
.welcome { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 24px; border-radius: var(--radius-lg); background: linear-gradient(120deg, #303030 0%, #3a3a3a 45%, #F05A00 130%); color: #fff; margin-bottom: 20px; box-shadow: 0 10px 30px -12px rgba(48,48,48,.55); border-bottom: 3px solid #F05A00; flex-wrap: wrap; }
.welcome h2 { font-size: 21px; }
.welcome p { opacity: .85; margin: 4px 0 0; }
.welcome .btn-ghost { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.3); color: #fff; box-shadow: none; }
.welcome .btn-ghost:hover { background: rgba(255,255,255,.25); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 20px 20px 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar { width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 60%, transparent)); min-height: 3px; position: relative; }
.bar:hover::after { content: attr(data-v); position: absolute; top: -24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); font-size: 11px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.bar-label { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.health-dot.connected { background: var(--green); color: var(--green); } .health-dot.error { background: var(--red); color: var(--red); }
.health-dot.not_configured { background: var(--amber); color: var(--amber); } .health-dot.suspended { background: var(--gray); color: var(--gray); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); }

/* ---------- detail lists ---------- */
.dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.dl dt { color: var(--text-3); font-weight: 500; font-size: 13px; }
.dl dd { margin: 0; word-break: break-word; }
.copy-field { display: flex; align-items: center; gap: 6px; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 6px 6px 12px; font-family: var(--mono); font-size: 12.5px; }
.copy-field span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secret-box { border: 2px dashed var(--amber); background: var(--amber-50); border-radius: var(--radius); padding: 16px; }
.code-block { background: #262626; color: #f3f3f3; border-left: 3px solid var(--primary); border-radius: var(--radius); padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; white-space: pre; line-height: 1.6; max-height: 420px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 12px 14px; border: 0; background: none; color: var(--text-2); font: 600 13.5px var(--font); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { background: var(--surface-3); color: var(--text-2); border-radius: 99px; font-size: 11px; padding: 0 7px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.timeline { list-style: none; margin: 0; padding: 0 20px 10px; }
.timeline li { position: relative; padding: 10px 0 10px 24px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }

/* ---------- blog workspace ---------- */
.ws { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.ws-side { position: sticky; top: 80px; }
.ws-side .card { margin-bottom: 14px; }
.ws-side .card-pad { padding: 16px; }
.ws-side .field { margin-bottom: 12px; }
.ws-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 16px; }
.ws-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--text-3); font-size: 13px; }
.save-state { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-3); }
.save-state.dirty { color: var(--amber); } .save-state.saving { color: var(--blue); } .save-state.saved { color: var(--green); }
.title-input { font-size: 24px; font-weight: 700; border: 0; background: transparent; width: 100%; color: var(--text); padding: 4px 0; letter-spacing: -0.02em; font-family: var(--font); }
.title-input:focus { outline: none; box-shadow: none; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 60px; z-index: 5; }
.editor-toolbar button, .editor-toolbar select { height: 30px; min-width: 30px; border: 0; background: none; border-radius: 6px; color: var(--text-2); cursor: pointer; font: 600 13px var(--font); padding: 0 7px; }
.editor-toolbar button:hover { background: var(--surface-3); color: var(--text); }
.editor-toolbar .sep { width: 1px; background: var(--border); margin: 4px 4px; }
.editor-toolbar select { border: 1px solid var(--border); background: var(--surface); }
.editor { min-height: 520px; padding: 24px 32px; outline: none; font-size: 15.5px; line-height: 1.75; color: var(--text); }
.prose h1 { font-size: 28px; margin: 0 0 16px; } .prose h2 { font-size: 21px; margin: 28px 0 10px; } .prose h3 { font-size: 17px; margin: 22px 0 8px; }
.prose p { margin: 0 0 14px; } .prose ul, .prose ol { margin: 0 0 14px; padding-left: 24px; } .prose li { margin-bottom: 4px; }
.prose blockquote { margin: 0 0 14px; padding: 8px 16px; border-left: 3px solid var(--primary); background: var(--surface-2); color: var(--text-2); border-radius: 0 8px 8px 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 16px; font-size: 14px; } .prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; } .prose th { background: var(--surface-2); }
.prose img { border-radius: 10px; margin: 8px 0; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose a[data-link-type="external"]::after, .prose a[data-link-type="backlink"]::after { content: " ↗"; font-size: 11px; }
.editor:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.wc { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.wc .progress { width: 140px; }
.gen-overlay { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: rgba(8,12,24,.6); backdrop-filter: blur(4px); }
.gen-overlay[hidden] { display: none; }
.gen-card { background: var(--surface); border-radius: 18px; padding: 30px 34px; width: min(440px, calc(100vw - 32px)); text-align: center; box-shadow: var(--shadow-lg); }
.gen-spinner { width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 50%; border: 4px solid var(--primary-100); border-top-color: var(--primary); animation: spin .9s linear infinite; }
.gen-steps { list-style: none; padding: 0; margin: 16px 0 0; text-align: left; font-size: 13.5px; }
.gen-steps li { padding: 5px 0; color: var(--text-3); display: flex; gap: 8px; align-items: center; }
.gen-steps li.done { color: var(--green); } .gen-steps li.now { color: var(--text); font-weight: 600; }
.seo-score { display: flex; align-items: center; gap: 14px; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--c, var(--primary)) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; flex-shrink: 0; }
.ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.checks li:last-child { border-bottom: 0; }
.checks .st { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 11px; font-weight: 700; color: #fff; }
.st.pass { background: var(--green); } .st.warn { background: #f59e0b; } .st.fail { background: var(--red); }
.serp { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.serp-url { color: #188038; font-size: 13px; } .serp-title { color: #1a0dab; font-size: 19px; line-height: 1.3; margin: 2px 0; }
[data-theme="dark"] .serp-title { color: #8ab4f8; } [data-theme="dark"] .serp-url { color: #6dd58c; }
.serp-desc { color: var(--text-2); font-size: 13.5px; }
.counter { font-size: 12px; color: var(--text-3); text-align: right; }
.counter.bad { color: var(--red); } .counter.ok { color: var(--green); }
.link-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; background: var(--surface); }
.link-card.accepted { border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-50); }
.link-card.rejected { opacity: .55; }
.link-card .grow { flex: 1; min-width: 0; }
.link-card .url { font-family: var(--mono); font-size: 12px; color: var(--text-3); word-break: break-all; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.img-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.img-card img { aspect-ratio: 16/10; object-fit: cover; width: 100%; background: var(--surface-3); display: block; }
.img-card .img-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.img-card.featured { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-100); }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--surface-2); display: grid; gap: 8px; }
.preview-frame { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 auto; background: var(--surface); transition: width .25s; overflow: hidden; }
.preview-frame iframe { width: 100%; height: 720px; border: 0; display: block; background: #fff; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font: 600 12.5px var(--font); color: var(--text-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.warn-list { margin: 0; padding-left: 18px; color: var(--amber); font-size: 13px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 6; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }

/* ---------- auth & install ---------- */
.auth-body { background: var(--bg); min-height: 100vh; }
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-side { background: radial-gradient(900px 520px at -10% -20%, rgba(240,90,0,.55) 0%, transparent 60%), radial-gradient(700px 480px at 120% 120%, rgba(240,90,0,.35) 0%, transparent 55%), #303030; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; }
.auth-side .brand { color: #fff; }
.auth-side h2 { font-size: 30px; line-height: 1.25; max-width: 460px; margin-bottom: 26px; letter-spacing: -0.02em; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; color: #ececec; font-size: 15px; }
.auth-points li { display: flex; gap: 12px; align-items: center; }
.auth-points .icon { color: #FF8A47; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-title { font-size: 26px; margin-bottom: 6px; }
.install-wrap { max-width: 820px; margin: 0 auto; padding: 40px 20px; }
.req-list { list-style: none; margin: 0; padding: 12px 20px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; }
.req-list li { display: flex; gap: 8px; align-items: center; }
.req-list .ok .icon { color: var(--green); } .req-list .bad .icon { color: var(--red); }
.req-list .bad { color: var(--red); font-weight: 600; }
.install-wrap form.card { padding-bottom: 20px; }
.install-wrap .form-grid { padding: 18px 20px 0; }
.install-wrap .form-actions { padding: 18px 20px 0; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-grid; place-items: center; font-size: 12px; }
.error-page { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 20px; gap: 8px; }
.error-code { font-size: 84px; font-weight: 800; letter-spacing: -0.04em; background: linear-gradient(120deg, #F05A00, #303030); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }

/* ---------- role matrix ---------- */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.perm-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.perm-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface-2); }
.perm-box h4 { margin-bottom: 10px; display: flex; justify-content: space-between; }
.perm-box .check { display: flex; padding: 4px 0; }

/* ---------- utilities ---------- */
.muted { color: var(--text-3); } .small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.text-right { text-align: right; } .text-center { text-align: center; } .nowrap { white-space: nowrap; }
.inline { display: inline; } .hidden { display: none !important; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 10px; } .mt-3 { margin-top: 16px; } .mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 10px; } .mb-3 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .between { justify-content: space-between; } .gap-1 { gap: 6px; } .gap-2 { gap: 12px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.only-mobile { display: none; }
.danger-text { color: var(--red); } .success-text { color: var(--green); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side, .grid-main, .ws { grid-template-columns: minmax(0, 1fr); }
  .ws-side { position: static; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .main-col { margin-left: 0; }
  .only-mobile { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { padding: 0 12px; }
  .hide-mobile { display: none !important; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .col-full, .col-half, .col-third, .col-two-thirds { grid-column: span 1; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; } .dl dd { margin-bottom: 10px; }
  .editor { padding: 18px 16px; }
  .req-list { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table td { display: block; border: 0; padding: 5px 16px; text-align: left; }
  .table td::before { content: attr(data-label); display: block; font-weight: 600; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
  .table td.text-right { text-align: left; }
  .table td.text-right::before, .table td:not([data-label])::before { content: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- free AI presets, tags, stock photos ---------- */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.preset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); display: flex; flex-direction: column; scroll-margin-top: 80px; }
.preset.is-connected { border-color: color-mix(in srgb, var(--green) 45%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 10%, transparent); }
.preset:target { box-shadow: var(--ring); }
.preset form { margin-top: auto; }
.tag-pill { --tag: var(--primary); display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--tag); background: color-mix(in srgb, var(--tag) 12%, transparent); border: 1px solid color-mix(in srgb, var(--tag) 28%, transparent); white-space: nowrap; text-decoration: none !important; }
.tag-pill::before { content: "#"; opacity: .6; }
a.tag-pill:hover { background: color-mix(in srgb, var(--tag) 20%, transparent); }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-suggest button { border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 1px 9px; font: 500 12px var(--font); cursor: pointer; }
.tag-suggest button:hover { border-color: var(--primary); color: var(--primary); }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 420px; overflow-y: auto; }
.stock-item { position: relative; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--surface-3); padding: 0; }
.stock-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.stock-item span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); text-align: left; }
.stock-item.selected, .stock-item:focus-visible { border-color: var(--primary); }
.img-credit { font-size: 11.5px; color: var(--text-3); }
.engine-note { font-size: 12px; color: var(--text-3); }
.img-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; align-items: start; }

/* ---------- v3: confirmation dialogs, automation, template library, Canva ---------- */
.flex-between { display: flex !important; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dropdown-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 10px 10px 4px; font-weight: 700; border-top: 1px solid var(--border); margin-top: 4px; }
.radio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 12px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; margin-bottom: 8px; }
.radio-grid .radio-card { margin-bottom: 0; }
.radio-card:hover { border-color: var(--border-strong); }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-50); box-shadow: inset 0 0 0 1px var(--primary); }
.radio-card input { margin-top: 3px; accent-color: var(--primary); }
.radio-card span { display: flex; flex-direction: column; gap: 2px; }
.radio-card small { color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
.pub-opt { margin-top: 14px; }
.pub-opt-title { font-weight: 650; font-size: 13px; margin-bottom: 8px; }
.preflight { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.preflight li { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.preflight li.warn { background: var(--amber-50); }
.preflight .st { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0; }
.preflight .st.pass { background: var(--green); } .preflight .st.warn { background: #d97706; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.mini-stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); text-decoration: none !important; box-shadow: var(--shadow-sm); }
.mini-stat strong { display: block; font-size: 20px; line-height: 1.1; }
.mini-stat small { color: var(--text-2); }
.mini-stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.tone-amber { background: var(--amber-50); color: var(--amber); } .tone-blue { background: var(--blue-50); color: var(--blue); } .tone-green { background: var(--green-50); color: var(--green); }
.tone-red { background: var(--red-50); color: var(--red); } .tone-indigo { background: var(--primary-50); color: var(--primary); }
.sched-box { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 14px; background: var(--surface-2); }
.idea-list { display: grid; gap: 8px; }
.idea { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.idea:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.idea input { margin-top: 4px; accent-color: var(--primary); }
.idea span { display: flex; flex-direction: column; gap: 2px; } .idea small { color: var(--text-2); }
.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.tool-filter { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px; padding: 0 8px; }
.canva-row { margin-top: 4px; }
/* template library */
.tpl-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tpl-cats a { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-2); font-weight: 600; font-size: 13px; background: var(--surface); text-decoration: none; }
.tpl-cats a.active, .tpl-cats a:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tpl-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm); border-top: 3px solid var(--primary); }
.tpl-card.inactive { opacity: .6; border-top-color: var(--border-strong); }
.tpl-card h3 { font-size: 15px; } .tpl-card p { color: var(--text-2); font-size: 13px; margin: 0; flex: 1; }
.tpl-meta { display: flex; gap: 5px; flex-wrap: wrap; }
.tpl-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
.prompt-preview { white-space: pre-wrap; font: 12.5px/1.55 var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; max-height: 60vh; overflow: auto; }
.diff-changed { background: var(--primary-50); border-radius: 4px; }
[hidden] { display: none !important; }

/* never let long JSON, URLs or code widen the page (phones) */
.grid > *, .ws > *, .form-grid > *, .card, .card-pad, .modal-body { min-width: 0; }
pre, .code-block, .prompt-preview { max-width: 100%; overflow: auto; }
pre:not(.code-block) { white-space: pre-wrap; overflow-wrap: anywhere; }
.dl dd, .cell-sub, td { overflow-wrap: anywhere; }
.tabs .tab { flex-shrink: 0; }

/* ---------- v4: usage meters, calendar, audit, keyword planner ---------- */
.usage-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; }
.meter { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.meter-warn > span { background: var(--amber); } .meter-full > span { background: var(--red); }
.plan-row { padding: 10px 0; border-bottom: 1px solid var(--border); } .plan-row:last-of-type { border-bottom: 0; }
.xs { font-size: 12px; }
.seo-page { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.seo-page summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check-list { list-style: none; margin: 0; padding: 4px 16px 12px; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); }
.check-list li:last-child { border-bottom: 0; }
.check-list .badge { flex-shrink: 0; min-width: 62px; justify-content: center; }
a.stat { color: inherit; text-decoration: none; } a.stat:hover { box-shadow: var(--shadow); }
.bulk-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--border); }
.cannibal { border-bottom: 1px solid var(--border); } .cannibal ul { margin: 8px 0; padding-left: 20px; }
.badge-blue { background: var(--blue-50); color: var(--blue); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.cal-h { padding: 8px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.cal-d { min-height: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-d:nth-child(7n) { border-right: 0; } .cal-empty { background: var(--surface-2); } .cal-past { background: var(--surface-2); }
.cal-today .cal-n { background: var(--primary); color: #fff; border-radius: 99px; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-n { font-size: 12px; font-weight: 600; color: var(--text-2); }
.cal-ev { display: block; font-size: 11.5px; line-height: 1.3; padding: 4px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.cal-ev .badge { font-size: 10px; padding: 0 5px; }
.ev-plan { background: var(--indigo-50); cursor: grab; } .ev-sched { background: var(--blue-50); } .ev-pub { background: var(--green-50); }
.cal-d.drop { outline: 2px dashed var(--primary); outline-offset: -3px; } .dragging { opacity: .5; }
@media (max-width: 760px) { .cal { grid-template-columns: 1fr; } .cal-h, .cal-empty { display: none; } .cal-d { min-height: 0; border-right: 0; } .cal-d:not(:has(.cal-ev)) { display: none; } .cal-n::after { content: " " attr(data-date); } }
.suggest-box { margin-top: 8px; border: 1px solid var(--primary-100); background: var(--primary-50); border-radius: var(--radius); padding: 8px; display: grid; gap: 4px; }
.suggest-box .sugg { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.suggest-box .sugg:hover { border-color: var(--primary); }
.editor table { border-collapse: collapse; width: 100%; margin: 1em 0; } .editor th, .editor td { border: 1px solid var(--border-strong); padding: 6px 8px; text-align: left; }
.editor figure { margin: 1.2em auto; text-align: center; } .editor figure img { max-width: 100%; height: auto; border-radius: 8px; } .editor figcaption { font-size: 12px; color: var(--text-3); }
.field[hidden], [data-show][hidden] { display: none !important; }
.section-title { margin: 22px 0 10px; font-size: 16px; }
.log-view { max-height: 70vh; overflow: auto; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre-wrap; word-break: break-word; }
.onboarding .check-list li.ok { color: var(--muted); text-decoration: line-through; } .onboarding .check-list li.todo a { font-weight: 600; }
.justify-between { justify-content: space-between; }
.demo-points { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; gap: 6px; }
.demo-bar { background: #303030; color: #fff; font-size: 13px; padding: 8px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; text-align: center; }
.demo-bar a, .demo-bar button { color: #fff; } .demo-bar .btn { padding: 4px 10px; font-size: 12px; }
.demo-bar strong { color: #F05A00; }
.demo-bar .btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.45); }
.demo-bar .btn-ghost:hover { background: rgba(255,255,255,.12); }
.card-head { flex-wrap: wrap; row-gap: 8px; }
