/* ==========================================================================
   FUSIONOVA · ADMIN — GitHub-inspired Control Centre
   ========================================================================== */

:root {
  /* GitHub Dark palette */
  --bg-canvas:     #0d1117;
  --bg-default:    #010409;
  --bg-overlay:    #161b22;
  --bg-subtle:     #161b22;
  --bg-emphasis:   #21262d;
  --bg-hover:      #1c2128;
  --bg-active:     #282e36;

  --border-default:#30363d;
  --border-muted:  #21262d;
  --border-subtle: rgba(240,246,252,0.1);

  --fg-default:    #e6edf3;
  --fg-muted:      #7d8590;
  --fg-subtle:     #6e7681;
  --fg-on-emphasis:#ffffff;

  --accent-fg:     #2f81f7;
  --accent-emphasis:#1f6feb;
  --accent-muted:  rgba(56,139,253,0.4);
  --accent-subtle: rgba(56,139,253,0.15);

  --success-fg:    #3fb950;
  --success-emphasis:#238636;
  --success-subtle: rgba(46,160,67,0.15);

  --danger-fg:     #f85149;
  --danger-emphasis:#da3633;
  --danger-subtle: rgba(248,81,73,0.15);

  --attention-fg:  #d29922;
  --attention-emphasis:#9e6a03;
  --attention-subtle: rgba(187,128,9,0.15);

  --done-fg:       #a371f7;
  --done-subtle:   rgba(163,113,247,0.15);

  /* Fusionova brand accent (used sparingly for identity) */
  --brand-fg:      #a78bfa;
  --brand-emphasis:#7c3aed;
  --brand-subtle:  rgba(139,92,246,0.15);

  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";

  --header-height: 62px;
  --sidebar-width: 296px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 0 rgba(255,255,255,0.03), 0 0 1px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 3px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-overlay: 0 16px 32px rgba(0,0,0,0.5);
}

/* RESET */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-canvas);
  color: var(--fg-default);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-fg); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; border: 0; background: transparent; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

::selection { background: var(--accent-emphasis); color: var(--fg-on-emphasis); }

/* ==========================================================================
   TOP HEADER
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--bg-default);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg-default);
}
.app-header .brand-logo { height: 28px; width: auto; }
.app-header .brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
}
.app-header .brand-name .sep { color: var(--fg-subtle); margin: 0 6px; }
.app-header .brand-name .scope { color: var(--fg-muted); }

.app-header .search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.app-header .search input {
  width: 100%;
  background: var(--bg-emphasis);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 7px 12px 7px 36px;
  color: var(--fg-default);
  outline: none;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.app-header .search input::placeholder { color: var(--fg-muted); }
.app-header .search input:focus {
  border-color: var(--accent-emphasis);
  background: var(--bg-canvas);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.app-header .search .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
}
.app-header .search kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}

.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-header .icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  transition: background .15s, color .15s;
  position: relative;
}
.app-header .icon-btn:hover { background: var(--bg-emphasis); color: var(--fg-default); }
.app-header .icon-btn .dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--accent-fg);
  border: 2px solid var(--bg-default);
  border-radius: 50%;
}
.app-header .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-emphasis), var(--accent-emphasis));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid var(--border-default);
}
.app-header .avatar img { width:100%; height:100%; object-fit: cover; }

/* User dropdown */
.user-menu { position: relative; }
.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 260px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  padding: 4px;
  display: none;
  z-index: 100;
}
.user-menu.open .user-menu-panel { display: block; }
.user-menu-header {
  padding: 12px;
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: 4px;
}
.user-menu-header .name { font-weight: 600; color: var(--fg-default); }
.user-menu-header .email { color: var(--fg-muted); font-size: 12px; margin-top: 2px; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--fg-default);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.user-menu-item:hover { background: var(--accent-emphasis); color: var(--fg-on-emphasis); text-decoration: none; }
.user-menu-item.danger:hover { background: var(--danger-emphasis); }
.user-menu-divider { height: 1px; background: var(--border-muted); margin: 4px 0; }

/* ==========================================================================
   APP LAYOUT
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: calc(100vh - var(--header-height));
}
.app-sidebar {
  border-right: 1px solid var(--border-default);
  background: var(--bg-canvas);
  padding: 20px 14px;
  overflow-y: auto;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
}
.app-main {
  padding: 24px 32px 64px;
  min-width: 0;
}

/* SIDEBAR */
.sidebar-section { margin-bottom: 20px; }
.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  padding: 6px 10px;
  margin-bottom: 4px;
  font-weight: 600;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg-default);
  font-size: 14px;
  font-weight: 500;
  transition: background .12s;
  position: relative;
}
.nav-link:hover { background: var(--bg-emphasis); text-decoration: none; }
.nav-link.active {
  background: var(--bg-emphasis);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 6px; bottom: 6px;
  width: 3px;
  background: var(--brand-fg);
  border-radius: 2px;
}
.nav-link svg { color: var(--fg-muted); flex-shrink: 0; }
.nav-link.active svg { color: var(--brand-fg); }
.nav-link .count {
  margin-left: auto;
  background: var(--bg-emphasis);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  border: 1px solid var(--border-default);
}
.nav-link.active .count {
  background: var(--brand-subtle);
  color: var(--brand-fg);
  border-color: transparent;
}

/* ==========================================================================
   PAGE HEAD
   ========================================================================== */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-muted);
  flex-wrap: wrap;
}
.page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--fg-default);
}
.page-subtitle { color: var(--fg-muted); margin-top: 4px; font-size: 14px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--accent-fg); }
.breadcrumb .sep { color: var(--fg-subtle); }
.breadcrumb .current { color: var(--fg-default); font-weight: 600; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 16px;
  height: 32px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-default);
  background: var(--bg-emphasis);
  color: var(--fg-default);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--fg-muted); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--success-emphasis);
  border-color: rgba(240,246,252,0.1);
  color: var(--fg-on-emphasis);
}
.btn-primary:hover { background: #2ea043; border-color: rgba(240,246,252,0.1); }

.btn-accent {
  background: var(--accent-emphasis);
  border-color: rgba(240,246,252,0.1);
  color: var(--fg-on-emphasis);
}
.btn-accent:hover { background: #388bfd; }

.btn-danger { color: var(--danger-fg); }
.btn-danger:hover { background: var(--danger-emphasis); color: var(--fg-on-emphasis); border-color: var(--danger-emphasis); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-emphasis); border-color: transparent; }

.btn-lg { height: 38px; padding: 6px 20px; font-size: 14px; }
.btn-sm { height: 26px; padding: 2px 10px; font-size: 12px; }

/* ==========================================================================
   CARDS / SURFACES
   ========================================================================== */
.surface {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
}
.surface-head {
  padding: 16px;
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.surface-body { padding: 16px; }

/* Stat tiles */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat-label {
  color: var(--fg-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat-label svg { color: var(--brand-fg); }
.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 8px;
  color: var(--fg-default);
}
.stat-delta {
  font-size: 12px;
  color: var(--success-fg);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-delta.down { color: var(--danger-fg); }
.stat-delta.flat { color: var(--fg-muted); }

/* ==========================================================================
   FILTER / TOOLBAR
   ========================================================================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
  flex-wrap: wrap;
}
.toolbar .search-input {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.toolbar .search-input input {
  width: 100%;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 5px 12px 5px 32px;
  color: var(--fg-default);
  outline: none;
}
.toolbar .search-input input:focus { border-color: var(--accent-emphasis); box-shadow: 0 0 0 3px var(--accent-subtle); }
.toolbar .search-input .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-canvas);
  padding: 3px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.filter-tab {
  padding: 4px 10px;
  border-radius: 5px;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter-tab.active { background: var(--bg-emphasis); color: var(--fg-default); }
.filter-tab .count {
  background: var(--bg-active);
  padding: 0 6px;
  border-radius: 20px;
  font-size: 11px;
}
.filter-tab.active .count { background: var(--brand-subtle); color: var(--brand-fg); }

/* ==========================================================================
   ITEM LIST (GitHub-style issues list)
   ========================================================================== */
.item-list {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--border-muted);
  transition: background .1s;
}
.list-item:first-child { border-top: none; }
.list-item:hover { background: var(--bg-hover); }

.list-item .check { margin-top: 3px; }
.list-item .check input { accent-color: var(--accent-fg); width: 14px; height: 14px; cursor: pointer; }

.list-item .icon-status {
  width: 18px; height: 18px;
  margin-top: 2px;
  color: var(--success-fg);
  flex-shrink: 0;
}
.list-item.draft .icon-status { color: var(--fg-muted); }
.list-item.scheduled .icon-status { color: var(--attention-fg); }

.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-default);
  line-height: 1.4;
  display: inline;
  cursor: pointer;
}
.list-item-title:hover { color: var(--accent-fg); text-decoration: underline; }
.list-item-labels { display: inline-flex; gap: 6px; margin-left: 8px; vertical-align: middle; }

.list-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  color: var(--fg-muted);
  font-size: 12px;
  margin-top: 6px;
}
.list-item-meta .with-icon { display: inline-flex; align-items: center; gap: 4px; }

.list-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity .12s;
}
.list-item:hover .list-item-actions { opacity: 1; }

.list-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--fg-muted);
}
.list-empty .icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bg-emphasis);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--fg-subtle);
}
.list-empty h3 { color: var(--fg-default); margin-bottom: 6px; font-size: 16px; }

/* Labels (GitHub-style colored chips) */
.label {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 22px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1;
}
.label-status-published { background: var(--success-subtle); color: var(--success-fg); border-color: rgba(46,160,67,0.3); }
.label-status-draft     { background: var(--bg-emphasis); color: var(--fg-muted); border-color: var(--border-default); }
.label-status-scheduled { background: var(--attention-subtle); color: var(--attention-fg); border-color: rgba(187,128,9,0.3); }

/* tag chips coloured by category */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 22px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-default);
  background: var(--bg-emphasis);
  color: var(--fg-default);
}
.tag-Technology   { background: rgba(56,139,253,0.15);  color: #79c0ff;  border-color: rgba(56,139,253,0.3); }
.tag-Safety       { background: rgba(248,81,73,0.15);   color: #ff7b72;  border-color: rgba(248,81,73,0.3); }
.tag-Policy       { background: rgba(187,128,9,0.15);   color: #e3b341;  border-color: rgba(187,128,9,0.3); }
.tag-Stories      { background: rgba(163,113,247,0.15); color: #d2a8ff;  border-color: rgba(163,113,247,0.3); }
.tag-Education    { background: rgba(46,160,67,0.15);   color: #7ee787;  border-color: rgba(46,160,67,0.3); }
.tag-Law          { background: rgba(236,72,153,0.15);  color: #ff9bd0;  border-color: rgba(236,72,153,0.3); }
.tag-Smart        { background: rgba(139,92,246,0.15);  color: #c4b5fd;  border-color: rgba(139,92,246,0.3); }

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */
.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--fg-default);
  margin-bottom: 6px;
}
.field-help { color: var(--fg-muted); font-size: 12px; margin-top: 4px; }

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  color: var(--fg-default);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent-emphasis);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.input-lg { font-size: 18px; padding: 10px 14px; font-weight: 600; }

.checkbox-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-default); cursor: pointer; }
.checkbox-row input { accent-color: var(--accent-fg); }

/* Segmented selector (card style picker) */
.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.segmented label {
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  display: block;
  position: relative;
}
.segmented label:hover { border-color: var(--fg-muted); }
.segmented input { position: absolute; opacity: 0; }
.segmented input:checked + .segmented-card {
  /* applied via parent */
}
.segmented label:has(input:checked) {
  border-color: var(--accent-fg);
  background: var(--accent-subtle);
}
.segmented label:has(input:checked)::after {
  content: '';
  position: absolute;
  top: 8px; right: 8px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-fg);
  box-shadow: inset 0 0 0 3px var(--bg-canvas);
}
.segmented-card .name { font-weight: 600; color: var(--fg-default); margin-bottom: 4px; font-size: 13px; }
.segmented-card .desc { color: var(--fg-muted); font-size: 11px; line-height: 1.4; }
.segmented-card .preview {
  border-radius: 6px;
  background: linear-gradient(135deg, #4c1d95, #ec4899);
  padding: 14px;
  margin-bottom: 10px;
  color: rgba(255,255,255,0.9);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.1);
  height: 72px;
  display: flex;
  align-items: flex-end;
  position: relative;
  overflow: hidden;
}
.segmented-card.featured .preview { background: linear-gradient(135deg, #5b21b6, #ec4899 80%); }
.segmented-card.minimal .preview { background: var(--bg-canvas); border: 1px solid var(--border-default); color: var(--fg-default); }
.segmented-card.gradient .preview { background: linear-gradient(135deg, #1f6feb, #a371f7 70%, #ec4899); }
.segmented-card.bordered .preview { background: var(--bg-overlay); border: 2px solid var(--brand-fg); color: var(--brand-fg); }

/* ==========================================================================
   EDITOR
   ========================================================================== */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: flex-start;
}
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px;
  background: var(--bg-canvas);
  border-top: 1px solid var(--border-default);
  border-left: 1px solid var(--border-default);
  border-right: 1px solid var(--border-default);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.editor-toolbar .tb-btn {
  width: 30px; height: 30px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 600;
}
.editor-toolbar .tb-btn:hover { background: var(--bg-emphasis); color: var(--fg-default); }
.editor-toolbar .tb-sep { width: 1px; background: var(--border-default); margin: 4px 6px; }

.editor-textarea {
  width: 100%;
  min-height: 480px;
  border: 1px solid var(--border-default);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  border-top: none;
  background: var(--bg-canvas);
  padding: 18px 20px;
  color: var(--fg-default);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
}
.editor-textarea:focus { border-color: var(--accent-emphasis); }

/* Side meta panel */
.meta-panel { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--header-height) + 24px); }
.meta-block {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.meta-block h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-canvas);
  position: relative;
  overflow: hidden;
}
.login-shell::before, .login-shell::after {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  pointer-events: none;
}
.login-shell::before { background: var(--brand-emphasis); top: -200px; left: -150px; }
.login-shell::after  { background: var(--accent-emphasis); bottom: -200px; right: -150px; }

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-overlay);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}
.login-logo img { width: 64px; margin-bottom: 18px; }
.login-logo h1 { font-size: 22px; font-weight: 600; color: var(--fg-default); }
.login-logo p { color: var(--fg-muted); margin-top: 6px; text-align: center; font-size: 13px; }

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: white;
  color: #1f1f1f;
  font-weight: 500;
  font-size: 14px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  border: 1px solid white;
  cursor: pointer;
  transition: filter .15s, transform .08s;
}
.google-btn:hover { filter: brightness(0.97); }
.google-btn:active { transform: scale(0.99); }
.google-btn:disabled { opacity: 0.6; cursor: progress; }

.login-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; color: var(--fg-muted); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-default); }

.login-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-muted);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--fg-default);
  line-height: 1.5;
}
.login-note .icon { color: var(--accent-fg); flex-shrink: 0; margin-top: 1px; }

.login-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--danger-subtle);
  border: 1px solid rgba(248,81,73,0.4);
  border-radius: var(--radius-md);
  color: var(--danger-fg);
  font-size: 13px;
  margin-top: 16px;
}

.login-back {
  position: absolute;
  top: 24px; left: 24px;
  color: var(--fg-muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}
.login-back:hover { color: var(--fg-default); text-decoration: none; }

/* ==========================================================================
   TOAST / DIALOG
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-default);
  font-size: 13px;
  box-shadow: var(--shadow-overlay);
  transform: translateY(100px);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 380px;
}
.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast.success { border-color: rgba(46,160,67,0.4); }
.toast.success .icon { color: var(--success-fg); }
.toast.error { border-color: rgba(248,81,73,0.4); }
.toast.error .icon { color: var(--danger-fg); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1,4,9,0.7);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-overlay);
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; color: var(--fg-default); }
.modal-body p { color: var(--fg-muted); line-height: 1.6; }
.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-muted);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Loading spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent-fg);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  display: inline-block;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-emphasis) 25%, var(--bg-hover) 50%, var(--bg-emphasis) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ==========================================================================
   ACTIVITY / RECENT
   ========================================================================== */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-muted);
}
.activity-item:first-child { border-top: none; }
.activity-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--fg-on-emphasis);
  font-size: 12px;
}
.activity-icon.create { background: var(--success-emphasis); }
.activity-icon.edit   { background: var(--accent-emphasis); }
.activity-icon.delete { background: var(--danger-emphasis); }
.activity-icon.publish{ background: var(--brand-emphasis); }
.activity-body { flex: 1; font-size: 13px; }
.activity-body .who { font-weight: 600; }
.activity-body .target { color: var(--accent-fg); font-weight: 500; }
.activity-time { color: var(--fg-muted); font-size: 12px; margin-top: 2px; }

/* ==========================================================================
   PUBLIC BLOG PREVIEW (used in editor)
   ========================================================================== */
.preview-card {
  background: linear-gradient(135deg, #2E1065, #5B21B6 70%);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: white;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}
.preview-card .tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.preview-card h4 {
  font-size: 18px;
  line-height: 1.3;
  margin-bottom: 8px;
}
.preview-card p { color: rgba(255,255,255,0.75); font-size: 13px; line-height: 1.5; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
  .editor-grid { grid-template-columns: 1fr; }
  .meta-panel { position: static; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .app-header { padding: 0 16px; gap: 8px; }
  .app-header .search { display: none; }
  .app-main { padding: 16px; }
  .page-title { font-size: 20px; }
  .stat-value { font-size: 24px; }
}

/* Mobile sidebar toggle */
.mobile-menu-btn { display: none; }
@media (max-width: 860px) {
  .mobile-menu-btn { display: inline-flex; }
  .app-sidebar.mobile-open {
    display: block;
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--header-height));
    z-index: 80;
    box-shadow: var(--shadow-overlay);
  }
}
