@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ================================================================
   DESIGN TOKENS
================================================================ */
:root {
  /* Sidebar */
  --sb-width: 260px;
  --sb-collapsed: 70px;
  --sb-bg: #0f172a;
  --sb-hover: #1e293b;
  --sb-active: #1e40af;
  --sb-active-bg: rgba(30,64,175,.18);
  --sb-text: rgba(203,213,225,.85);
  --sb-text-muted: rgba(148,163,184,.6);
  --sb-border: rgba(255,255,255,.06);

  /* Topbar */
  --topbar-h: 60px;
  --topbar-bg: #fff;
  --topbar-border: #e2e8f0;

  /* Canvas */
  --bg: #f1f5f9;
  --panel: #ffffff;
  --panel-border: #e2e8f0;
  --panel-shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);

  /* Typography */
  --ink: #0f172a;
  --ink-muted: #64748b;
  --ink-faint: #94a3b8;

  /* Brand */
  --brand: #1e40af;
  --brand-light: #3b82f6;
  --brand-bg: #eff6ff;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --green: #15803d;
  --green-bg: #f0fdf4;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;

  /* Sizes */
  --radius: 10px;
  --radius-sm: 6px;
}

/* ================================================================
   RESET
================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

/* ================================================================
   AUTH PAGES (login / forgot / reset)
================================================================ */
body.admin-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #1e3a5f 100%);
}

.auth-wrap { width: 100%; max-width: 420px; padding: 24px; }

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  background: linear-gradient(135deg,#1e40af,#3b82f6);
  border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(30,64,175,.4);
}
.auth-logo .logo-mark svg { width: 28px; height: 28px; fill: #fff; }
.auth-logo h1 { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.auth-logo h1 span { color: #60a5fa; }
.auth-logo p { color: rgba(148,163,184,.8); font-size: 13px; margin-top: 4px; }

.auth-card {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.auth-card .form-group { margin-bottom: 16px; }
.auth-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: rgba(148,163,184,.9);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.auth-card input::placeholder { color: rgba(148,163,184,.5); }
.auth-card input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
  background: rgba(255,255,255,.1);
}

.auth-card .btn-primary {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  background: linear-gradient(135deg,#1e40af,#2563eb);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  box-shadow: 0 4px 14px rgba(37,99,235,.4);
}
.auth-card .btn-primary:hover { opacity: .92; transform: translateY(-1px); }
.auth-card .btn-primary:active { transform: translateY(0); }

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: rgba(148,163,184,.7);
}
.auth-footer a { color: #60a5fa; }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border-left: 3px solid;
}
.alert-danger { background: rgba(220,38,38,.12); color: #fca5a5; border-color: #dc2626; }
.alert-success { background: rgba(21,128,61,.12); color: #86efac; border-color: #15803d; }
.alert-info { background: rgba(30,64,175,.12); color: #93c5fd; border-color: #1e40af; }

/* ================================================================
   ADMIN SHELL — SIDEBAR
================================================================ */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sb-width);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width .25s ease;
  overflow: hidden;
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sb-logo .mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: linear-gradient(135deg,#1e40af,#3b82f6);
  border-radius: 8px;
  flex-shrink: 0;
}
.sb-logo .mark svg { width: 18px; height: 18px; fill: #fff; }
.sb-logo .name { font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; }
.sb-logo .name span { color: #60a5fa; }

.sb-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sb-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sb-text-muted);
  padding: 16px 18px 6px;
  white-space: nowrap;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 18px;
  color: var(--sb-text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 0;
  transition: background .15s, color .15s;
  position: relative;
  cursor: pointer;
  text-decoration: none !important;
}
.sb-item:hover { background: var(--sb-hover); color: #fff; }
.sb-item.active {
  background: var(--sb-active-bg);
  color: #60a5fa;
}
.sb-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: #3b82f6;
  border-radius: 0 3px 3px 0;
}
.sb-item .icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .7;
}
.sb-item:hover .icon, .sb-item.active .icon { opacity: 1; }
.sb-item .badge-count {
  margin-left: auto;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sb-divider { border: none; border-top: 1px solid var(--sb-border); margin: 8px 0; }

.sb-user {
  padding: 14px 18px;
  border-top: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sb-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg,#1e40af,#7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sb-user .user-info { min-width: 0; }
.sb-user .user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .user-role { font-size: 11px; color: var(--sb-text-muted); }

/* ================================================================
   ADMIN SHELL — MAIN CONTENT
================================================================ */
.admin-content {
  margin-left: var(--sb-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.topbar .breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink-muted);
  flex: 1;
}
.topbar .breadcrumb a { color: var(--ink-muted); }
.topbar .breadcrumb .sep { color: var(--ink-faint); }
.topbar .breadcrumb .current { color: var(--ink); font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg,#1e40af,#7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  cursor: pointer;
  position: relative;
}
.topbar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 180px;
  display: none;
  z-index: 300;
}
.topbar-dropdown.open { display: block; }
.topbar-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
}
.topbar-dropdown a:hover { background: var(--bg); text-decoration: none; }
.topbar-dropdown a svg { width: 15px; height: 15px; opacity: .5; }
.topbar-dropdown .dd-divider { border: none; border-top: 1px solid var(--panel-border); margin: 4px 0; }
.topbar-dropdown .dd-logout { color: var(--red) !important; }

/* Page content wrapper */
.page-content { padding: 28px; flex: 1; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.page-header p { color: var(--ink-muted); font-size: 13.5px; margin-top: 2px; }

/* ================================================================
   CARDS / PANELS
================================================================ */
.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
}
.card-body { padding: 20px 24px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--panel-border);
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-footer { padding: 12px 24px; border-top: 1px solid var(--panel-border); }

/* Legacy .panel support */
.panel { background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); box-shadow: var(--panel-shadow); padding: 24px; margin-bottom: 20px; }
.panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { margin-bottom: 0; }

/* ================================================================
   STAT CARDS (Dashboard)
================================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--panel-shadow);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #f0fdf4; color: #15803d; }
.stat-icon.amber { background: #fffbeb; color: #d97706; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.red { background: #fef2f2; color: #dc2626; }
.stat-icon.gray { background: #f8fafc; color: #64748b; }
.stat-body { min-width: 0; }
.stat-num { font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -0.5px; }
.stat-lbl { font-size: 12px; color: var(--ink-muted); margin-top: 4px; font-weight: 500; }
.stat-trend { font-size: 11.5px; margin-top: 6px; }
.stat-trend.up { color: var(--green); }
.stat-trend.down { color: var(--red); }

/* ================================================================
   TABLES
================================================================ */
.table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.admin-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--panel-border);
  background: #f8fafc;
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.admin-table tbody tr { transition: background .1s; }
.admin-table tbody tr:hover { background: #f8fafc; }
.admin-table tbody tr:last-child td { border-bottom: none; }

/* ================================================================
   BADGES
================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge-new { background: #fef3c7; color: #92400e; }
.badge-read { background: #eff6ff; color: #1e40af; }
.badge-replied { background: #f0fdf4; color: #15803d; }
.badge-archived { background: #f1f5f9; color: #64748b; }
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-published { background: #f0fdf4; color: #15803d; }
.badge-super_admin { background: #f5f3ff; color: #5b21b6; }
.badge-editor { background: #eff6ff; color: #1e40af; }
.badge-active { background: #f0fdf4; color: #15803d; }
.badge-locked { background: #fef2f2; color: #dc2626; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-success { background: #f0fdf4; color: #15803d; }

/* ================================================================
   BUTTONS
================================================================ */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost, .btn-small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 6px rgba(30,64,175,.3);
}
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(30,64,175,.35); }
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--panel-border);
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: #fecaca;
}
.btn-danger:hover { background: #fecaca; }
.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
}
.btn-ghost:hover { background: #f1f5f9; color: var(--ink); }
.btn-small { padding: 6px 12px; font-size: 12.5px; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--panel-border);
  cursor: pointer;
  color: var(--ink-muted);
  transition: all .15s;
}
.btn-icon:hover { background: #f1f5f9; color: var(--ink); }
.btn-icon svg { width: 15px; height: 15px; }

/* Link-style danger button */
.link-danger {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ================================================================
   FORMS
================================================================ */
.form-grid { display: grid; gap: 20px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-group .hint { font-size: 11.5px; color: var(--ink-faint); text-transform: none; letter-spacing: 0; margin-top: 2px; }
.form-control {
  padding: 10px 13px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-control.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-control { resize: vertical; min-height: 100px; }
.char-count { font-size: 11px; color: var(--ink-faint); text-align: right; }
.char-count.warn { color: var(--amber); }
.char-count.over { color: var(--red); }

/* Inline form (status change etc) */
.inline-form { display: inline-flex; align-items: center; gap: 8px; }

/* Page-form legacy */
.page-form { display: grid; gap: 6px; }
.page-form label { font-size: 12px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-top: 12px; }
.page-form input, .page-form textarea, .page-form select { padding: 9px 12px; border: 1px solid var(--panel-border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; width: 100%; }
.page-form input:focus, .page-form textarea:focus, .page-form select:focus { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.page-form .hint { font-size: 11.5px; color: var(--ink-faint); text-transform: none; letter-spacing: 0; }
.page-form button { margin-top: 18px; justify-self: start; }

/* ================================================================
   TOOLBAR / SEARCH / FILTERS
================================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.search-box svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--ink-faint);
}
.search-box input {
  width: 100%;
  padding: 9px 12px 9px 35px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: #fff;
}
.search-box input:focus { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

.filter-tabs { display: flex; gap: 4px; align-items: center; }
.filter-tabs a {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  transition: all .15s;
}
.filter-tabs a:hover { background: #f1f5f9; text-decoration: none; }
.filter-tabs a.active { background: var(--brand-bg); color: var(--brand); font-weight: 600; }

/* ================================================================
   ACTIVITY FEED
================================================================ */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand-light);
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-body { flex: 1; }
.activity-body strong { font-weight: 600; }
.activity-meta { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }

/* ================================================================
   MISC COMPONENTS
================================================================ */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.pager a { padding: 6px 14px; border: 1px solid var(--panel-border); border-radius: var(--radius-sm); font-size: 13px; color: var(--ink-muted); }
.pager a:hover { background: #f8fafc; text-decoration: none; }

.link-more { display: inline-block; font-size: 13px; color: var(--brand); margin-top: 12px; }
.link-more:hover { text-decoration: underline; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.detail-grid dt { font-size: 11px; color: var(--ink-muted); text-transform: uppercase; font-weight: 700; letter-spacing: .05em; }
.detail-grid dd { font-size: 14px; margin-top: 3px; }

.message-body {
  background: #f8fafc;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  line-height: 1.7;
  margin-bottom: 20px;
  font-size: 14px;
}

.attachment-list { list-style: none; margin-bottom: 20px; }
.attachment-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.file-name { font-weight: 600; font-size: 13.5px; }
.file-meta { color: var(--ink-faint); font-size: 12px; flex: 1; }

.status-form { display: flex; align-items: center; gap: 10px; margin: 20px 0; }

.build-log {
  background: #0f172a;
  color: #94a3b8;
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  white-space: pre-wrap;
  margin-top: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; }

/* Grid stats legacy */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card .stat-num { display: block; font-size: 26px; font-weight: 600; }
.stat-card .stat-lbl { font-size: 12px; color: var(--ink-muted); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  animation: slideInToast .3s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
@keyframes slideInToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Reset token display */
.token-box {
  background: #0f172a;
  color: #86efac;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  word-break: break-all;
  margin: 12px 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-muted);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: .3; display: block; }
.empty-state p { font-size: 15px; }
.empty-state small { font-size: 13px; }

/* Quill editor overrides */
.ql-toolbar { border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important; border-color: var(--panel-border) !important; background: #f8fafc; }
.ql-container { border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important; border-color: var(--panel-border) !important; font-family: inherit !important; font-size: 14px !important; min-height: 320px; }
.ql-editor { min-height: 320px; }

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 1024px) {
  :root { --sb-width: var(--sb-collapsed); }
  .sb-section-label, .sb-item .sb-label, .sb-user .user-info, .sb-logo .name { display: none; }
  .sb-item { justify-content: center; padding: 10px; }
  .sb-item::before { display: none; }
  .sb-logo { justify-content: center; padding: 16px 10px; }
  .sb-user { justify-content: center; padding: 14px 10px; }
  .form-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ================================================================
   EDITOR & YOAST SEO STYLES
================================================================ */
.wp-editor-container, .editor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
}
@media (max-width: 1080px) {
  .wp-editor-container, .editor-layout { grid-template-columns: 1fr; }
}

/* Title & Permalink */
.wp-title-card, .title-card {
  padding: 24px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  margin-bottom: 20px;
}
.wp-title-input, .title-input {
  width: 100%;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  padding: 12px 16px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
}
.wp-title-input:focus, .title-input:focus {
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.wp-permalink-row, .permalink-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  font-size: 13px;
  margin-top: 14px;
}
.wp-permalink-prefix, .permalink-prefix { color: var(--ink-muted); font-family: monospace; font-size: 12px; }
.wp-permalink-input, .permalink-slug {
  font-family: monospace;
  font-size: 13px;
  color: var(--brand);
  font-weight: 600;
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
}

/* Editor Container */
.wp-editor-card, .editor-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  margin-bottom: 24px;
  overflow: hidden;
}
.wp-editor-header, .editor-card-header {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wp-editor-header h2, .editor-card-header h2 { font-size: 15px; font-weight: 700; color: var(--ink); margin: 0; }

.wp-editor-mode-toggle, .editor-tabs { display: flex; background: #e2e8f0; border-radius: 6px; padding: 2px; gap: 4px; }
.wp-mode-btn, .editor-tab-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 5px;
  transition: all .15s;
}
.wp-mode-btn.active, .editor-tab-btn.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Formatting Toolbar */
.wp-toolbar, .toolbar-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--panel-border);
}
.wp-tb-btn, .tb-btn {
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all .1s;
}
.wp-tb-btn:hover, .tb-btn:hover { background: #f1f5f9; border-color: #94a3b8; }
.wp-tb-select, .tb-select {
  padding: 5px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.wp-tb-divider, .tb-sep { width: 1px; height: 22px; background: var(--panel-border); margin: 0 4px; }

/* Rich Editor Area */
.wp-visual-area, .rich-editor-area {
  min-height: 440px;
  padding: 24px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
  outline: none;
  background: #fff;
}
.wp-visual-area p, .rich-editor-area p { margin-bottom: 1.2em; }
.wp-visual-area h2, .rich-editor-area h2 { font-size: 24px; font-weight: 700; margin: 1.5em 0 0.6em; color: var(--ink); }
.wp-visual-area h3, .rich-editor-area h3 { font-size: 20px; font-weight: 700; margin: 1.2em 0 0.5em; color: var(--ink); }
.wp-visual-area ul, .rich-editor-area ul, .wp-visual-area ol, .rich-editor-area ol { margin: 1em 0 1.2em 2em; }
.wp-visual-area blockquote, .rich-editor-area blockquote { border-left: 4px solid var(--brand); padding-left: 16px; color: var(--ink-muted); font-style: italic; margin: 1.5em 0; }

.wp-html-area, .raw-html-area {
  width: 100%;
  min-height: 440px;
  padding: 20px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  line-height: 1.6;
  background: #0f172a;
  color: #38bdf8;
  border: none;
  outline: none;
  resize: vertical;
  display: none;
}

/* Yoast-style SEO Box */
.yoast-container, .yoast-card {
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  margin-bottom: 24px;
  overflow: hidden;
}
.yoast-main-header, .yoast-header {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.yoast-brand, .yoast-title-wrap { display: flex; align-items: center; gap: 12px; }
.yoast-logo-badge, .yoast-icon {
  width: 32px; height: 32px;
  background: #a855f7;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.yoast-brand h3, .yoast-header h3 { font-size: 16px; font-weight: 700; margin: 0; color: #fff; }
.yoast-brand p { font-size: 12px; color: #94a3b8; margin: 2px 0 0 0; }

.yoast-score-pill, .yoast-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  transition: all .2s;
}
.yoast-score-pill.none  { background: #334155; color: #cbd5e1; }
.yoast-score-pill.poor, .yoast-badge.poor { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.yoast-score-pill.ok,   .yoast-badge.ok   { background: #fffbeb; color: #d97706; border: 1px solid #fef3c7; }
.yoast-score-pill.good, .yoast-badge.good { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.yoast-score-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.yoast-score-pill.none .yoast-score-dot { background: #94a3b8; }
.yoast-score-pill.poor .yoast-score-dot { background: #dc2626; }
.yoast-score-pill.ok   .yoast-score-dot { background: #d97706; }
.yoast-score-pill.good .yoast-score-dot { background: #16a34a; }

.yoast-tabs-bar, .yoast-nav {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid var(--panel-border);
  padding: 0 16px;
}
.yoast-tab-item, .yoast-nav-btn {
  padding: 14px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.yoast-tab-item:hover, .yoast-nav-btn:hover { color: var(--ink); }
.yoast-tab-item.active, .yoast-nav-btn.active { color: var(--brand); border-bottom-color: var(--brand); background: #fff; }
.yoast-tab-dot { width: 8px; height: 8px; border-radius: 50%; }

.yoast-content-pane, .yoast-body { padding: 24px; }

.yoast-keyphrase-box {
  background: #f8fafc;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}
.yoast-keyphrase-box label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  display: block;
  margin-bottom: 6px;
}
.yoast-keyphrase-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.yoast-keyphrase-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

.google-card-preview, .google-preview {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 18px;
  font-family: arial, sans-serif;
  margin-bottom: 20px;
}
.g-preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 12px; color: #5f6368; }
.g-mode-btn { background: #f1f3f4; border: none; padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.g-mode-btn.active { background: #e8f0fe; color: #1a73e8; font-weight: 600; }

.g-url-text, .google-preview .g-url { color: #202124; font-size: 13px; margin-bottom: 4px; word-break: break-all; }
.g-title-text, .google-preview .g-title { color: #1a0dab; font-size: 20px; line-height: 1.3; font-weight: 400; text-decoration: none; display: block; margin-bottom: 4px; cursor: pointer; }
.g-title-text:hover, .google-preview .g-title:hover { text-decoration: underline; }
.g-desc-text, .google-preview .g-desc { color: #4d5156; font-size: 14px; line-height: 1.55; }

.yoast-analysis-section { margin-top: 20px; }
.yoast-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin-bottom: 12px; }

.yoast-check-row, .seo-check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--panel-border);
  margin-bottom: 8px;
  font-size: 13.5px;
  line-height: 1.5;
}
.yoast-check-indicator, .seo-check-icon {
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.yoast-check-indicator.green, .seo-check-icon.green { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.18); }
.yoast-check-indicator.amber, .seo-check-icon.amber { background: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,0.18); }
.yoast-check-indicator.red,   .seo-check-icon.red   { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.18); }
.yoast-check-indicator.gray,  .seo-check-icon.gray  { background: #94a3b8; }

.yoast-check-body strong { color: var(--ink); font-weight: 600; }
.yoast-check-body p { margin: 2px 0 0 0; font-size: 12.5px; color: var(--ink-muted); }

.yoast-progress-bar, .char-meter-bar { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.yoast-progress-fill, .char-meter-fill { height: 100%; transition: width .3s, background .3s; }

/* Sidebar Panels */
.wp-side-panel, .side-card {
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.wp-side-header, .side-card-header { padding: 14px 18px; background: #f8fafc; border-bottom: 1px solid var(--panel-border); font-size: 14px; font-weight: 700; color: var(--ink); }
.wp-side-body, .side-card-body { padding: 18px; }

.btn-publish-hero, .btn-publish-main {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37,99,235,0.3);
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-publish-hero:hover, .btn-publish-main:hover { opacity: .95; transform: translateY(-1px); }

