/* ============================================================
   admin.css - ReadNowNews Admin Panel v4.0
   Admin-only newsroom CMS design system. Scoped to .adm-*.
   ============================================================ */

:root {
  --adm-page-bg: #f5f7fb;
  --adm-bg: var(--adm-page-bg);
  --adm-sidebar-bg: #08111f;
  --adm-sidebar-panel: #0d1a2d;
  --adm-sidebar-hover: rgba(255,255,255,0.07);
  --adm-sidebar-active: #1f6feb;
  --adm-sidebar-active-soft: rgba(31,111,235,0.18);
  --adm-sidebar-text: #d7deea;
  --adm-sidebar-muted: #8290a6;
  --adm-topbar-bg: rgba(255,255,255,0.94);
  --adm-surface: #ffffff;
  --adm-surface-2: #f8fafc;
  --adm-surface-hover: #f1f5f9;
  --adm-border: #dce3ee;
  --adm-border-light: #edf1f7;
  --adm-divider: #e7ecf4;
  --adm-text: #111827;
  --adm-text-secondary: #475569;
  --adm-text-muted: #7b8798;
  --adm-primary: #1f6feb;
  --adm-primary-hover: #1859c8;
  --adm-primary-light: #eaf2ff;
  --adm-success: #16845b;
  --adm-success-light: #e7f8ef;
  --adm-warning: #b7791f;
  --adm-warning-light: #fff7e5;
  --adm-danger: #c73535;
  --adm-danger-light: #fff0f0;
  --adm-info: #2563eb;
  --adm-info-light: #eef5ff;
  --adm-input-bg: #ffffff;
  --adm-focus: 0 0 0 3px rgba(31,111,235,0.2);
  --adm-shadow-sm: 0 1px 2px rgba(16,24,40,0.06);
  --adm-shadow: 0 10px 24px rgba(16,24,40,0.08);
  --adm-shadow-lg: 0 22px 55px rgba(8,17,31,0.22);
  --adm-radius-xs: 6px;
  --adm-radius-sm: 8px;
  --adm-radius: 12px;
  --adm-radius-lg: 16px;
  --adm-sidebar-width: 268px;
  --adm-sidebar-collapsed: 78px;
  --adm-topbar-height: 68px;
  --adm-content-max: 1440px;
  --adm-space-1: 4px;
  --adm-space-2: 8px;
  --adm-space-3: 12px;
  --adm-space-4: 16px;
  --adm-space-5: 20px;
  --adm-space-6: 24px;
  --adm-space-8: 32px;
  --adm-font-xs: 12px;
  --adm-font-sm: 13px;
  --adm-font-md: 14px;
  --adm-font-lg: 18px;
  --adm-font-xl: 24px;
  --adm-font-2xl: 30px;
  --adm-transition: 160ms ease;
}

#app.adm-active, #app.adm-active * { box-sizing: border-box; }
#app.adm-active { min-height: 100vh; background: var(--adm-page-bg); }

.adm-layout {
  min-height: 100vh;
  background: var(--adm-page-bg);
  color: var(--adm-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Devanagari", Arial, sans-serif;
  font-size: var(--adm-font-md);
  line-height: 1.55;
}

.adm-main {
  min-height: 100vh;
  margin-left: var(--adm-sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.adm-content {
  flex: 1;
  width: 100%;
  max-width: var(--adm-content-max);
  margin: 0 auto;
  padding: 28px 32px 40px;
}

.adm-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--adm-sidebar-width);
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--adm-sidebar-text);
  background: linear-gradient(180deg, #08111f 0%, #0b1728 52%, #091220 100%);
  border-right: 1px solid rgba(255,255,255,0.08);
}

.adm-sidebar-brand {
  min-height: 82px;
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.09);
}

.adm-sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  padding: 4px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.22);
}

.adm-brand-title { display: flex; flex-direction: column; min-width: 0; }
.adm-brand-name { color: #fff; font-weight: 800; font-size: 16px; letter-spacing: 0; }
.adm-brand-kicker { color: var(--adm-sidebar-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

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

.adm-nav-group { margin: 0 0 18px; }
.adm-nav-group-label {
  padding: 0 12px 8px;
  color: var(--adm-sidebar-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.adm-sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 9px 11px;
  margin: 2px 0;
  color: var(--adm-sidebar-text);
  text-decoration: none;
  border-radius: 10px;
  border-left: 0;
  cursor: pointer;
  transition: background var(--adm-transition), color var(--adm-transition), transform var(--adm-transition);
}

.adm-sidebar-link:hover, .adm-sidebar-link:focus-visible {
  background: var(--adm-sidebar-hover);
  color: #fff;
  outline: none;
}

.adm-sidebar-link.active {
  background: linear-gradient(90deg, var(--adm-sidebar-active-soft), rgba(31,111,235,0.07));
  color: #fff;
  font-weight: 750;
  box-shadow: inset 3px 0 0 var(--adm-sidebar-active);
}

.adm-sidebar-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  font-size: 15px;
}
.adm-sidebar-link.active .adm-sidebar-icon { background: rgba(31,111,235,0.34); }
.adm-sidebar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.adm-sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.035);
}
.adm-sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.adm-sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2f7bf4, #65d6ad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.adm-sidebar-user-info { min-width: 0; }
.adm-sidebar-username { color: #fff; font-size: 13px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-sidebar-role { color: var(--adm-sidebar-muted); font-size: 12px; text-transform: capitalize; }

.adm-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--adm-topbar-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--adm-topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--adm-border);
}
.adm-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-surface);
  color: var(--adm-text);
  font-size: 20px;
  cursor: pointer;
}
.adm-topbar-meta { min-width: 0; }
.adm-breadcrumb { color: var(--adm-text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.adm-topbar-title { margin: 1px 0 0; color: var(--adm-text); font-size: 19px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.adm-topbar-spacer { flex: 1; }
.adm-topbar-search { position: relative; width: min(320px, 28vw); }
.adm-topbar-search .adm-input { height: 40px; padding-left: 36px; border-radius: 999px; background: var(--adm-surface-2); }
.adm-search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--adm-text-muted); }
.adm-server-status { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 11px; border-radius: 999px; background: var(--adm-success-light); color: var(--adm-success); font-size: 12px; font-weight: 800; white-space: nowrap; }
.adm-status-dot { width: 8px; height: 8px; border-radius: 99px; background: currentColor; box-shadow: 0 0 0 3px rgba(22,132,91,.14); }
.adm-topbar-user { display: flex; align-items: center; gap: 9px; color: var(--adm-text-secondary); font-size: 13px; font-weight: 700; }
.adm-topbar-avatar { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: #eaf2ff; color: var(--adm-primary); font-weight: 850; }

.adm-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin: 0 0 22px;
}
.adm-section-title { margin: 0; color: var(--adm-text); font-size: 24px; line-height: 1.25; font-weight: 850; }
.adm-section-subtitle { margin: 5px 0 0; color: var(--adm-text-secondary); font-size: 14px; }
.adm-dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  margin-bottom: 22px;
  background: linear-gradient(135deg, #0d1a2d 0%, #17355d 55%, #1f6feb 100%);
  color: #fff;
  border-radius: 18px;
  box-shadow: var(--adm-shadow);
}
.adm-dashboard-hero h2 { margin: 0; color: #fff; font-size: 26px; font-weight: 850; }
.adm-dashboard-hero p { margin: 6px 0 0; color: rgba(255,255,255,.78); }
.adm-dashboard-hero .adm-btn { background: #fff; color: #0d1a2d; border-color: rgba(255,255,255,.2); }

.adm-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.adm-stat-card {
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border-light);
  border-radius: var(--adm-radius);
  box-shadow: var(--adm-shadow-sm);
  transition: transform var(--adm-transition), box-shadow var(--adm-transition), border-color var(--adm-transition);
}
.adm-stat-card:hover { transform: translateY(-1px); box-shadow: var(--adm-shadow); border-color: #c9d7ea; }
.adm-stat-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 21px; flex-shrink: 0; }
.adm-stat-info { min-width: 0; }
.adm-stat-value { color: var(--adm-text); font-size: 26px; font-weight: 850; line-height: 1.05; }
.adm-stat-label { margin-top: 5px; color: var(--adm-text-secondary); font-size: 13px; font-weight: 650; white-space: normal; }

.adm-grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 20px; }
.adm-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.adm-card {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border-light);
  border-radius: var(--adm-radius);
  padding: 18px;
  box-shadow: var(--adm-shadow-sm);
}
.adm-card-title { margin: 0 0 14px; padding: 0 0 12px; border-bottom: 1px solid var(--adm-divider); color: var(--adm-text); font-size: 15px; font-weight: 850; }
.adm-mt { margin-top: 20px; }

.adm-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 12px;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border-light);
  border-radius: var(--adm-radius);
  box-shadow: var(--adm-shadow-sm);
}
.adm-toolbar-spacer { flex: 1; }

.adm-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  transition: background var(--adm-transition), border-color var(--adm-transition), color var(--adm-transition), transform var(--adm-transition);
  text-decoration: none;
  white-space: nowrap;
}
.adm-btn:focus-visible, .adm-input:focus-visible, .adm-sidebar-link:focus-visible { outline: none; box-shadow: var(--adm-focus); }
.adm-btn:disabled { opacity: .55; cursor: not-allowed; }
.adm-btn-primary { background: var(--adm-primary); color: #fff; border-color: var(--adm-primary); }
.adm-btn-primary:hover:not(:disabled) { background: var(--adm-primary-hover); border-color: var(--adm-primary-hover); }
.adm-btn-success { background: var(--adm-success); color: #fff; }
.adm-btn-warning { background: var(--adm-warning); color: #fff; }
.adm-btn-danger { background: var(--adm-danger); color: #fff; }
.adm-btn-outline { background: var(--adm-surface); color: var(--adm-text); border-color: var(--adm-border); }
.adm-btn-outline:hover:not(:disabled) { background: var(--adm-surface-hover); }
.adm-btn-sm { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.adm-btn-block { width: 100%; }
.adm-btn-icon { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--adm-text-secondary); cursor: pointer; }
.adm-btn-icon:hover { background: var(--adm-surface-hover); color: var(--adm-text); }

.adm-form { width: 100%; }
.adm-form-row { display: flex; gap: 16px; margin-bottom: 14px; }
.adm-form-group { margin-bottom: 14px; }
.adm-label { display: block; margin-bottom: 7px; color: var(--adm-text); font-size: 13px; font-weight: 800; }
.adm-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-input-bg);
  color: var(--adm-text);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--adm-transition), box-shadow var(--adm-transition), background var(--adm-transition);
}
.adm-input:hover { border-color: #c5d0df; }
.adm-input:focus { outline: none; border-color: var(--adm-primary); box-shadow: var(--adm-focus); }
.adm-input-sm { min-height: 38px; padding: 7px 11px; font-size: 13px; }
.adm-textarea-sm { min-height: 76px; resize: vertical; }
.adm-textarea-lg { min-height: 320px; resize: vertical; line-height: 1.75; }
.adm-checkbox-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.adm-checkbox { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 7px 10px; border: 1px solid var(--adm-border-light); border-radius: 10px; background: var(--adm-surface-2); color: var(--adm-text-secondary); font-size: 13px; font-weight: 700; cursor: pointer; }
.adm-checkbox input { accent-color: var(--adm-primary); }
.adm-flex-1 { flex: 1; min-width: 0; } .adm-flex-2 { flex: 2; min-width: 0; } .adm-flex-3 { flex: 3; min-width: 0; }

.adm-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.adm-editor-main, .adm-editor-side { display: flex; flex-direction: column; gap: 14px; }
.adm-editor-side { position: sticky; top: calc(var(--adm-topbar-height) + 20px); }
.adm-editor-toolbar { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px; border: 1px solid var(--adm-border); border-radius: 10px; background: var(--adm-surface-2); margin-bottom: 8px; }
.adm-tool-btn { min-width: 32px; height: 32px; border: 1px solid var(--adm-border); border-radius: 8px; background: #fff; color: var(--adm-text-secondary); font-weight: 800; }

.adm-table-wrap { overflow: auto; max-width: 100%; background: var(--adm-surface); border: 1px solid var(--adm-border-light); border-radius: var(--adm-radius); box-shadow: var(--adm-shadow-sm); }
.adm-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
.adm-table th, .adm-table td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--adm-border-light); color: var(--adm-text-secondary); font-size: 13px; vertical-align: middle; }
.adm-table thead th { position: sticky; top: 0; z-index: 1; background: #f8fafc; color: #334155; font-size: 11px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.adm-table tbody tr:nth-child(even) { background: #fcfdff; }
.adm-table tbody tr:hover { background: #f2f7ff; }
.adm-table-title { max-width: 360px; color: var(--adm-text); font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-table-actions { white-space: nowrap; text-align: right; }
.adm-td-id, .adm-th-id { width: 48px; color: var(--adm-text-muted); }

.adm-badge { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; white-space: nowrap; border: 1px solid transparent; }
.adm-badge-success { background: var(--adm-success-light); color: var(--adm-success); border-color: rgba(22,132,91,.16); }
.adm-badge-warning { background: var(--adm-warning-light); color: var(--adm-warning); border-color: rgba(183,121,31,.18); }
.adm-badge-danger { background: var(--adm-danger-light); color: var(--adm-danger); border-color: rgba(199,53,53,.18); }
.adm-badge-info { background: var(--adm-info-light); color: var(--adm-info); border-color: rgba(37,99,235,.18); }
.adm-badge-muted, .adm-badge { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

.adm-list { display: flex; flex-direction: column; }
.adm-list-row { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 10px 0; border-bottom: 1px solid var(--adm-border-light); color: var(--adm-text-secondary); font-size: 13px; }
.adm-list-row:last-child { border-bottom: 0; }
.adm-list-row > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--adm-text); }
.adm-list-meta { color: var(--adm-text-muted); font-size: 12px; flex-shrink: 0; }
.adm-list-empty, .adm-empty-state { padding: 28px; text-align: center; color: var(--adm-text-muted); }

.adm-link { color: var(--adm-primary); text-decoration: none; cursor: pointer; font-weight: 750; }
.adm-link:hover { text-decoration: underline; }
.adm-tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.adm-tag, .adm-tag-item { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--adm-primary-light); color: var(--adm-primary); font-size: 12px; font-weight: 800; }

.adm-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 16px; }
.adm-media-item { overflow: hidden; background: var(--adm-surface); border: 1px solid var(--adm-border-light); border-radius: var(--adm-radius); box-shadow: var(--adm-shadow-sm); transition: transform var(--adm-transition), box-shadow var(--adm-transition); }
.adm-media-item:hover { transform: translateY(-2px); box-shadow: var(--adm-shadow); }
.adm-media-thumb { width: 100%; aspect-ratio: 16 / 10; height: auto; object-fit: cover; display: block; background: var(--adm-surface-2); }
.adm-media-thumb-sm { width: 54px; height: 38px; object-fit: cover; border-radius: 8px; background: var(--adm-surface-2); }
.adm-media-info { padding: 12px; }
.adm-media-title { color: var(--adm-text); font-size: 13px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-media-meta { margin-top: 3px; color: var(--adm-text-muted); font-size: 12px; }
.adm-media-actions { display: flex; gap: 6px; justify-content: flex-end; padding: 8px 10px; border-top: 1px solid var(--adm-border-light); background: var(--adm-surface-2); }

.adm-cat-card { padding: 0; overflow: hidden; }
.adm-cat-header { display: flex; align-items: center; gap: 12px; padding: 16px; }
.adm-cat-icon { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--adm-primary-light); color: var(--adm-primary); font-size: 20px; }
.adm-cat-details { padding: 0 16px 14px; color: var(--adm-text-secondary); font-size: 13px; }
.adm-cat-actions { display: flex; justify-content: flex-end; gap: 7px; padding: 10px 14px; border-top: 1px solid var(--adm-border-light); background: var(--adm-surface-2); }

.adm-preview-article { max-width: 860px; padding: 26px; background: var(--adm-surface); border: 1px solid var(--adm-border-light); border-radius: var(--adm-radius-lg); box-shadow: var(--adm-shadow-sm); }
.adm-preview-title { margin: 0 0 16px; font-size: 30px; line-height: 1.25; font-weight: 900; color: var(--adm-text); }
.adm-preview-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--adm-divider); color: var(--adm-text-secondary); }
.adm-preview-image { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--adm-radius); margin-bottom: 20px; }
.adm-preview-content { font-size: 16px; line-height: 1.85; white-space: pre-wrap; }

.adm-login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 18%, rgba(31,111,235,.24), transparent 28%),
    radial-gradient(circle at 82% 12%, rgba(101,214,173,.16), transparent 24%),
    linear-gradient(135deg, #07101d 0%, #0d1a2d 54%, #132f52 100%);
  color: #fff;
}
.adm-login-card {
  width: min(100%, 440px);
  padding: 30px;
  background: rgba(255,255,255,.98);
  color: var(--adm-text);
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 20px;
  box-shadow: var(--adm-shadow-lg);
}
.adm-login-logo { text-align: center; margin-bottom: 18px; }
.adm-login-logo img { height: 66px; width: auto; margin-bottom: 14px; object-fit: contain; }
.adm-login-logo h2 { margin: 0; color: #0d1a2d; font-size: 25px; font-weight: 900; }
.adm-login-subtitle { margin: 0 0 22px; color: var(--adm-text-secondary); text-align: center; font-size: 14px; }
.adm-login-status { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 18px; color: var(--adm-success); font-size: 12px; font-weight: 850; }
.adm-password-wrap { position: relative; }
.adm-password-wrap .adm-input { padding-right: 48px; }
.adm-password-toggle { position: absolute; right: 6px; top: 6px; width: 34px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--adm-text-muted); cursor: pointer; }
.adm-password-toggle:hover { background: var(--adm-surface-hover); color: var(--adm-text); }

.adm-alert { padding: 11px 13px; border-radius: 10px; font-size: 13px; font-weight: 750; margin-bottom: 15px; }
.adm-alert-error { background: var(--adm-danger-light); color: var(--adm-danger); border: 1px solid rgba(199,53,53,.2); }
.adm-toast-container { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.adm-toast { padding: 12px 14px; border-radius: 12px; color: #fff; font-size: 13px; font-weight: 750; box-shadow: var(--adm-shadow-lg); animation: admToastIn .22s ease; }
.adm-toast-success { background: var(--adm-success); } .adm-toast-error { background: var(--adm-danger); } .adm-toast-warning { background: var(--adm-warning); } .adm-toast-info { background: var(--adm-info); }
@keyframes admToastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.adm-loading { display: grid; place-items: center; min-height: 260px; padding: 36px; color: var(--adm-text-secondary); }
.adm-spinner { width: 38px; height: 38px; border: 3px solid var(--adm-border); border-top-color: var(--adm-primary); border-radius: 50%; animation: admSpin .8s linear infinite; margin-bottom: 14px; }
@keyframes admSpin { to { transform: rotate(360deg); } }
.adm-skeleton { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.adm-skeleton-line { height: 14px; border-radius: 999px; background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: admShimmer 1.4s infinite; }
@keyframes admShimmer { to { background-position: -200% 0; } }
.adm-error-state { padding: 30px; text-align: center; color: var(--adm-text-secondary); background: var(--adm-surface); border: 1px solid var(--adm-border-light); border-radius: var(--adm-radius); }
.adm-error-icon, .adm-empty-icon { font-size: 32px; margin-bottom: 8px; }
.adm-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.adm-pagination-info { color: var(--adm-text-secondary); font-size: 13px; font-weight: 700; }
.adm-text-muted { color: var(--adm-text-muted); }
.adm-hide-mobile { }

body.adm-sidebar-open-body { overflow: hidden; }
.adm-sidebar-backdrop { display: none; }

@media (max-width: 1180px) {
  .adm-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-grid-2, .adm-grid-3, .adm-editor-layout { grid-template-columns: 1fr; }
  .adm-editor-side { position: static; }
  .adm-topbar-search { display: none; }
}

@media (max-width: 860px) {
  .adm-sidebar { transform: translateX(-100%); transition: transform 220ms ease; box-shadow: var(--adm-shadow-lg); }
  .adm-sidebar.adm-sidebar-open { transform: translateX(0); }
  .adm-main { margin-left: 0; }
  .adm-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .adm-topbar { height: 62px; padding: 0 14px; }
  .adm-topbar-title { font-size: 17px; }
  .adm-server-status, .adm-topbar-user, .adm-topbar .adm-btn-primary { display: none; }
  .adm-content { padding: 18px 14px 28px; }
  .adm-section-header, .adm-dashboard-hero { align-items: flex-start; flex-direction: column; }
  .adm-form-row { flex-direction: column; gap: 0; }
  .adm-form-row .adm-flex-1, .adm-form-row .adm-flex-2, .adm-form-row .adm-flex-3 { flex: none; }
  .adm-table-wrap { margin-left: -2px; margin-right: -2px; border-radius: 10px; }
  .adm-hide-mobile { display: none !important; }
  .adm-sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 90; background: rgba(8,17,31,.48); }
  body.adm-sidebar-open-body .adm-sidebar-backdrop { display: block; }
}

@media (max-width: 520px) {
  .adm-stats-grid { grid-template-columns: 1fr; }
  .adm-toolbar { align-items: stretch; flex-direction: column; }
  .adm-toolbar .adm-input, .adm-toolbar .adm-btn { width: 100%; }
  .adm-toolbar-spacer { display: none; }
  .adm-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .adm-login-wrap { padding: 16px; }
  .adm-login-card { padding: 22px; border-radius: 16px; }
  .adm-dashboard-hero h2 { font-size: 22px; }
  .adm-section-title { font-size: 21px; }
  .adm-preview-title { font-size: 23px; }
  .adm-toast-container { left: 12px; right: 12px; width: auto; }
}


/* ============================================================
   Dark mode protection
   Keep the admin CMS on its deliberate light-content theme. System
   dark mode must not create black-on-dark or white-on-white controls.
   ============================================================ */
@media (prefers-color-scheme: dark) {
  #app.adm-active,
  #app.adm-active .adm-layout {
    color-scheme: light;
    background: var(--adm-page-bg);
    color: var(--adm-text);
  }
  #app.adm-active .adm-card,
  #app.adm-active .adm-table-wrap,
  #app.adm-active .adm-toolbar,
  #app.adm-active .adm-input,
  #app.adm-active .adm-login-card {
    background-color: var(--adm-surface);
    color: var(--adm-text);
  }
}

/* Task 28.6 CMS extension layout */
.adm-editor-main{min-width:0}.adm-article-editor{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px;align-items:start}.adm-editor-side{display:grid;gap:16px}.adm-content-editor{font-family:inherit;line-height:1.6}.adm-feature-preview{width:100%;max-height:180px;object-fit:cover;border-radius:8px;margin-top:10px}.adm-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.adm-grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.adm-muted{color:#6b7280;font-size:12px;margin-top:4px}.adm-media-thumb-sm{width:64px;height:48px;object-fit:cover;border-radius:6px;background:#f3f4f6;display:grid;place-items:center;font-size:12px}.adm-modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.48);z-index:9999;display:flex;align-items:center;justify-content:center;padding:18px}.adm-modal{width:min(900px,100%);max-height:88vh;overflow:auto;background:#fff;border-radius:8px;padding:18px;box-shadow:0 20px 60px rgba(0,0,0,.25)}.adm-modal-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.adm-tabs{display:flex;gap:10px;align-items:center;margin-bottom:14px}.adm-media-item.selected{outline:3px solid #c40000}.publication-detail .article-hero-image{width:100%;max-height:520px;object-fit:cover;border-radius:8px}.article-image{margin:22px 0}.article-image img{max-width:100%;height:auto;border-radius:8px}.article-image.align-center{text-align:center}.article-image.align-left{float:left;max-width:44%;margin-right:18px}.article-image.align-right{float:right;max-width:44%;margin-left:18px}.article-image.align-full img{width:100%}.article-image figcaption{font-size:13px;color:#667085;margin-top:6px}
@media (max-width: 900px){.adm-article-editor{grid-template-columns:1fr}.adm-form-grid,.adm-grid-3{grid-template-columns:1fr}.adm-modal{max-height:92vh}.article-image.align-left,.article-image.align-right{float:none;max-width:100%;margin-left:0;margin-right:0}}

/* Admin media picker repair */
body.adm-modal-open { overflow: hidden; }
.adm-card,
.adm-media-item,
.adm-media-select-card,
.adm-media-img-wrap {
  position: relative;
}
.adm-card::before,
.adm-card::after,
.adm-media-item::before,
.adm-media-item::after,
.adm-media-select-card::before,
.adm-media-select-card::after {
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
}
.adm-modal-backdrop.adm-media-picker-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, .66);
  z-index: 9998;
  display: block;
  padding: 5vh 16px;
  overflow: auto;
}
.adm-media-modal {
  position: relative;
  width: min(1100px, calc(100vw - 32px));
  max-height: 90vh;
  margin: 0 auto;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  z-index: 9999;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .34);
}
.adm-media-picker-tools,
.adm-media-upload-panel,
.adm-media-picker-footer,
.adm-media-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.adm-media-picker-tools { margin: 0 0 12px; }
.adm-media-upload-panel {
  padding: 12px;
  margin-bottom: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.adm-media-upload-panel input[type="file"] {
  display: block;
  width: min(100%, 520px);
  min-height: 42px;
  padding: 8px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  cursor: pointer;
}
.adm-upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
}
.adm-upload-label:hover {
  border-color: #c40000;
  color: #c40000;
}
.adm-media-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 12px;
}
.adm-media-select-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
.adm-media-select-card:hover {
  transform: translateY(-1px);
  border-color: #c40000;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
}
.adm-media-select-card.selected {
  outline: 3px solid rgba(196,0,0,.26);
  border-color: #c40000;
}
.adm-media-select-card.broken .adm-media-img-wrap::after {
  content: "Image unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  color: #64748b;
  background: #f1f5f9;
  font-size: 12px;
}
.adm-media-img-wrap {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 8px;
  background: #f1f5f9;
}
.adm-media-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.adm-media-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  font-size: 13px;
}
.adm-media-select-card small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}
.adm-media-picker-footer {
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}
.adm-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e2e8f0;
  border-top-color: #c40000;
  border-radius: 50%;
  animation: admSpin .8s linear infinite;
}
@keyframes admSpin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .adm-modal-backdrop.adm-media-picker-backdrop { padding: 14px; }
  .adm-media-modal { width: 100%; max-height: calc(100vh - 28px); }
  .adm-media-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Home15 local upload workflow */
.adm-upload-zone {
  margin: 0 0 18px;
  padding: 18px;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.adm-upload-zone.is-dragging {
  border-color: #c40000;
  background: #fff5f5;
  box-shadow: 0 0 0 4px rgba(196, 0, 0, .08);
}
.adm-file-input {
  position: static !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 0 8px;
  padding: 10px;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  background: #fff;
  color: #344054;
}
.adm-upload-choose {
  position: relative;
  overflow: hidden;
  min-height: 82px;
  padding: 12px;
  border-radius: 10px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: #344054;
  text-align: center;
  cursor: pointer;
}
.adm-file-input.adm-file-input-direct {
  position: absolute !important;
  inset: 0 !important;
  z-index: 3;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: inherit;
  opacity: 0;
  cursor: pointer;
}
.adm-upload-choose strong { color: #c40000; font-size: 1.05rem; }
.adm-upload-choose span { color: #667085; font-size: .88rem; }
.adm-upload-selection {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}
#adm-media-file-name {
  min-width: 0;
  color: #344054;
  font-size: .88rem;
  overflow-wrap: anywhere;
}
.adm-upload-status { min-height: 20px; margin-top: 8px; color: #475467; font-size: .84rem; }
.adm-upload-error { color: #b42318; font-weight: 700; }
.adm-upload-help {
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #475467;
}
.adm-upload-help ol { margin: 8px 0 0; padding-left: 22px; }
.adm-upload-help li { margin: 5px 0; }
.adm-media-upload-panel .adm-upload-zone { margin-bottom: 12px; }
.adm-direct-featured-upload {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}
.adm-direct-featured-upload input[type="file"] {
  display: block !important;
  position: static !important;
  width: 100% !important;
  height: auto !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer;
}
@media (max-width: 640px) {
  .adm-upload-zone { padding: 12px; }
  .adm-upload-selection { align-items: stretch; flex-direction: column; }
  .adm-upload-selection .adm-btn { width: 100%; min-height: 44px; }
}
