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

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

body {
  background: #0f172a;
  color: #e2e8f0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── Layout ── */
#app { display: flex; min-height: 100vh; }

#sidebar {
  width: 240px;
  min-width: 0;
  background: #1e293b;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  border-right: 1px solid #334155;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Collapsed sidebar */
#sidebar.collapsed { width: 64px; }

#sidebar.collapsed .brand-selector-wrap,
#sidebar.collapsed .nav-section-label,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .sidebar-user { display: none; }

#sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
  margin: 2px 6px;
}
#sidebar.collapsed .nav-item .icon { font-size: 20px; width: auto; }
#sidebar.collapsed .nav-item { position: relative; }
#sidebar.collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #e2e8f0;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  z-index: 300;
  pointer-events: none;
  border: 1px solid #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
#sidebar.collapsed .btn-logout { justify-content: center; padding: 10px 0; }

/* Sidebar toggle button */
#sidebar-toggle {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 4px;
  font-size: 1rem;
  font-family: monospace;
  font-weight: bold;
  line-height: 1;
  transition: all 0.15s;
}
#sidebar-toggle:hover { color: #e2e8f0; background: rgba(255,255,255,0.08); }

/* Main content */
#main-content {
  margin-left: 240px;
  padding: 32px;
  min-height: 100vh;
  flex: 1;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
#main-content.sidebar-collapsed { margin-left: 64px; }

/* Mobile menu button */
#mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 195;
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: background 0.15s;
}
#mobile-menu-btn:hover { background: #334155; }

/* Sidebar backdrop */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 192;
  backdrop-filter: blur(2px);
}
#sidebar-backdrop.visible { display: block; }

/* Mobile responsive */
@media (max-width: 768px) {
  #sidebar {
    width: 240px !important;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 210;
  }
  #sidebar.mobile-open { transform: translateX(0); }
  #sidebar.collapsed .brand-selector-wrap,
  #sidebar.collapsed .nav-section-label,
  #sidebar.collapsed .nav-label,
  #sidebar.collapsed .sidebar-user { display: revert; }
  #sidebar.collapsed .nav-item { justify-content: flex-start; padding: 12px 20px; margin: 2px 8px; }
  #sidebar.collapsed .nav-item .icon { font-size: 18px; width: 20px; }
  #sidebar.collapsed .btn-logout { justify-content: flex-start; padding: 10px; }
  #sidebar.collapsed .nav-item:hover::after { display: none; }
  #sidebar-toggle { display: none; }
  #mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
  #main-content { margin-left: 0 !important; padding: 24px 16px; padding-top: 60px; }
  #sidebar-backdrop.visible { display: block; }
}

/* ── Sidebar Logo ── */
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo img { height: 36px; flex-shrink: 0; }
.sidebar-logo > span { font-weight: 700; color: #f1f5f9; font-size: 1.1rem; white-space: nowrap; overflow: hidden; flex: 1; min-width: 0; }

/* ── Sidebar Nav ── */
#sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #64748b;
  padding: 16px 20px 6px;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  border-radius: 8px;
  margin: 2px 8px;
  color: #94a3b8;
  transition: all 0.15s;
  text-decoration: none;
  font-weight: 500;
}
.nav-item:hover { background: rgba(0,86,235,0.12); color: #e2e8f0; }
.nav-item.active { background: #0056EB; color: white; }
.nav-item .icon { font-size: 18px; width: 20px; text-align: center; }

/* ── Sidebar Footer ── */
#sidebar-footer {
  padding: 16px;
  border-top: 1px solid #334155;
}
.sidebar-user {
  font-size: 0.8rem;
  color: #64748b;
  padding: 4px 0 10px;
}
.btn-logout {
  width: 100%;
  background: #334155;
  color: #e2e8f0;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s;
}
.btn-logout:hover { background: #ef4444; color: white; }

/* ── Page ── */
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h1 { flex: 1; }

h1 { font-size: 1.75rem; font-weight: 700; color: #f1f5f9; }
h2 { font-size: 1.25rem; font-weight: 600; color: #e2e8f0; margin-bottom: 16px; }
h3 { font-size: 1rem; font-weight: 600; color: #cbd5e1; }

/* ── Cards ── */
.card {
  background: #1e293b;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid #334155;
}

/* ── Stat Grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 500px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #334155;
  border-top: 3px solid #0056EB;
  text-align: center;
}
.stat-card .stat-icon { font-size: 2rem; margin-bottom: 8px; }
.stat-card .value { font-size: 2.5rem; font-weight: 700; color: #0056EB; line-height: 1; }
.stat-card .label { color: #94a3b8; font-size: 0.875rem; margin-top: 6px; }

/* ── Buttons ── */
.btn {
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-primary { background: #0056EB; color: white; }
.btn-primary:hover { background: #0047c4; }
.btn-secondary { background: #334155; color: #e2e8f0; }
.btn-secondary:hover { background: #475569; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: #94a3b8; border: 1px solid #334155; }
.btn-ghost:hover { background: #334155; color: #e2e8f0; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon { padding: 6px 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th {
  background: #0f172a;
  padding: 12px;
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.05em;
  font-weight: 600;
  white-space: nowrap;
}
td {
  padding: 12px;
  border-bottom: 1px solid #334155;
  color: #cbd5e1;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(51,65,85,0.5); }
.td-actions { white-space: nowrap; display: flex; gap: 6px; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-published { background:rgba(16,185,129,0.15); color:#10b981; border:1px solid rgba(16,185,129,0.3); padding:2px 8px; border-radius:12px; font-size:0.75rem; }
.badge-scheduled { background:rgba(0,86,235,0.15);   color:#60a5fa; border:1px solid rgba(0,86,235,0.3);  padding:2px 8px; border-radius:12px; font-size:0.75rem; }
.badge-draft     { background:rgba(100,116,139,0.15); color:#94a3b8; border:1px solid rgba(100,116,139,0.3); padding:2px 8px; border-radius:12px; font-size:0.75rem; }
.badge-active { background: rgba(16,185,129,0.12); color: #10b981; }
.badge-inactive { background: rgba(239,68,68,0.12); color: #ef4444; }
.badge-platform { background: rgba(0,86,235,0.12); color: #60a5fa; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
}
input, select, textarea {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: #0056EB; }
textarea { resize: vertical; min-height: 100px; }
select { cursor: pointer; }
input[type="color"] { padding: 4px 8px; height: 42px; cursor: pointer; }
input[type="range"] { padding: 0; }
input[type="checkbox"] { width: auto; height: auto; cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Color picker row ── */
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] { width: 50px; flex-shrink: 0; }
.color-row input[type="text"] { flex: 1; }
.color-preview {
  width: 32px; height: 32px;
  display: inline-block;
  border-radius: 6px;
  border: 1px solid #334155;
  flex-shrink: 0;
}

/* ── Media ── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.media-item {
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.media-item:hover { border-color: #0056EB; }
.media-item.selected { border-color: #0056EB; }
.media-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: #1e293b;
}
.media-item .media-icon {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: #1e293b;
}
.media-item .info {
  padding: 8px;
  font-size: 0.75rem;
  color: #94a3b8;
}
.media-item .info .fname {
  color: #e2e8f0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-item .info .fmeta { margin-top: 2px; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed #334155;
  border-radius: 12px;
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 24px;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: #0056EB;
  background: rgba(0,86,235,0.05);
}
.upload-zone .upload-icon { font-size: 3rem; margin-bottom: 12px; }
.upload-zone p { color: #94a3b8; margin-top: 8px; font-size: 0.875rem; }

/* ── Filter Tabs ── */
.filter-tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-tab {
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
}
.filter-tab:hover { border-color: #0056EB; color: #e2e8f0; }
.filter-tab.active { background: #0056EB; border-color: #0056EB; color: white; }

/* ── Filters bar ── */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-bar select, .filters-bar input { width: auto; flex: 1; min-width: 120px; }
.filters-bar input[type="search"] { max-width: 280px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
}
.pagination button {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  cursor: pointer;
  font-size: 0.875rem;
}
.pagination button:hover { border-color: #0056EB; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { color: #94a3b8; font-size: 0.875rem; }

/* ── Designer ── */
#designer-wrap {
  display: flex;
  height: calc(100vh - 180px);
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #334155;
}
#designer-tools {
  width: 200px;
  min-width: 200px;
  background: #1e293b;
  padding: 16px;
  overflow-y: auto;
  border-right: 1px solid #334155;
}
#designer-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  overflow: auto;
  padding: 20px;
}
#designer-props {
  width: 220px;
  min-width: 220px;
  background: #1e293b;
  padding: 16px;
  overflow-y: auto;
  border-left: 1px solid #334155;
}
.tool-btn {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-btn:hover { background: rgba(0,86,235,0.12); border-color: #0056EB; }
.tool-btn.danger { color: #ef4444; border-color: #ef444430; }
.tool-btn.danger:hover { background: rgba(239,68,68,0.1); border-color: #ef4444; }
.tool-divider { border: none; border-top: 1px solid #334155; margin: 12px 0; }
.props-empty { color: #64748b; font-size: 0.8rem; text-align: center; padding: 20px 0; }
.props-section { margin-bottom: 12px; }
.props-section h4 { font-size: 0.75rem; text-transform: uppercase; color: #64748b; margin-bottom: 8px; letter-spacing: 0.05em; }
.props-row { margin-bottom: 8px; }
.props-row label { font-size: 0.75rem; color: #94a3b8; display: block; margin-bottom: 3px; }
.props-row input, .props-row select, .props-row textarea {
  padding: 6px 10px;
  font-size: 0.8rem;
}
.template-item {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  transition: border-color 0.15s;
}
.template-item:hover { border-color: #0056EB; }
.template-item .tname { color: #e2e8f0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.template-item .tdel { color: #ef4444; background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px; flex-shrink: 0; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: #1e293b;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  padding: 32px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-lg { max-width: 800px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-header h2 { margin-bottom: 0; }
.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: #e2e8f0; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #334155;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #1e293b;
  border-left: 4px solid #0056EB;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  font-size: 0.875rem;
  color: #e2e8f0;
  min-width: 240px;
  animation: slideIn 0.3s ease;
  pointer-events: auto;
}
.toast-success { border-left-color: #10b981; }
.toast-error { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Tags ── */
.tag {
  display: inline-block;
  background: rgba(0,86,235,0.12);
  color: #60a5fa;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  margin: 2px;
}

/* ── Misc ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }
.text-muted { color: #64748b; }
.text-sm { font-size: 0.8rem; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Reveal btn ── */
.reveal-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
}
.reveal-btn:hover { color: #e2e8f0; }

/* ── Platform accordion ── */
.platform-section { margin-bottom: 16px; }
.platform-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0f172a;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #334155;
  margin-bottom: 8px;
}
.platform-header:hover { border-color: #0056EB; }
.platform-header h3 { font-size: 0.95rem; color: #e2e8f0; }
.platform-body { display: none; }
.platform-body.open { display: block; }

/* ── Canvas fabric wrapper ── */
.canvas-outer { box-shadow: 0 8px 32px rgba(0,0,0,0.6); }
canvas { display: block; }

/* ── Quick links ── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.quick-link {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: #e2e8f0;
}
.quick-link:hover { border-color: #0056EB; background: rgba(0,86,235,0.08); }
.quick-link .icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.quick-link span { font-size: 0.875rem; font-weight: 500; }

/* ── Progress bar ── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: #0056EB;
  border-radius: 3px;
  transition: width 0.3s;
}

/* ── Media preview in modal ── */
.media-preview img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  display: block;
  margin: 0 auto 16px;
}
.media-preview video {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  display: block;
  margin: 0 auto 16px;
}
.media-preview .file-icon {
  font-size: 5rem;
  text-align: center;
  padding: 32px;
}

.copy-url {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.copy-url code { flex: 1; font-size: 0.8rem; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-url button { background: none; border: none; color: #0056EB; cursor: pointer; font-size: 0.8rem; white-space: nowrap; }

/* ── brand font preview ── */
.font-preview {
  margin-top: 10px;
  padding: 16px;
  background: #0f172a;
  border-radius: 8px;
  border: 1px solid #334155;
}

/* Brand selector in sidebar */
.brand-selector-wrap {
  padding: 16px 16px 8px;
  border-bottom: 1px solid #334155;
  margin-bottom: 8px;
}
.brand-selector-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.brand-selector-select {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
}
.brand-selector-select:focus {
  border-color: #0056EB;
  outline: none;
}

/* Brands grid */
.brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.brand-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 20px;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.brand-card:hover {
  border-color: #334155;
}
.brand-card-active {
  border-color: #0056EB !important;
}
.brand-card-colors {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #334155;
}
.brand-card-logo img {
  max-height: 48px;
  max-width: 120px;
  margin-bottom: 12px;
}
.brand-card-logo-placeholder {
  font-size: 2rem;
  margin-bottom: 12px;
}
.brand-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 4px;
}
.brand-card-url {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 12px;
}
.brand-active-badge {
  display: inline-block;
  background: rgba(0, 86, 235, 0.15);
  color: #60a5fa;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.brand-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* Color row in brand settings */
.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.color-row label {
  width: 80px;
  color: #94a3b8;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.color-row input[type="color"] {
  width: 48px;
  height: 36px;
  padding: 2px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.color-hex-input {
  width: 100px !important;
  font-family: monospace;
  flex-shrink: 0;
}

/* ── Designer: Text Alignment Buttons ─────────────────── */
.align-btns {
  display: flex;
  gap: 4px;
}
.align-btn {
  flex: 1;
  padding: 7px 4px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.align-btn:hover {
  background: rgba(0,86,235,0.15);
  border-color: #0056EB;
  color: #e2e8f0;
}
.align-btn.active {
  background: #0056EB;
  border-color: #0056EB;
  color: #fff;
}

/* ── Evergreen Badge & Toggle ──────────────────────────── */
.badge-evergreen {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.evergreen-toggle {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 4px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #10b981;
  cursor: pointer;
}

.checkbox-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkbox-text strong {
  color: #e2e8f0;
  font-size: 0.9rem;
}

.checkbox-text small {
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.4;
}

/* ── Sortable Table Headers ────────────────────────────── */
.th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.th-sortable:hover {
  color: #e2e8f0;
  background: rgba(0, 86, 235, 0.08);
}
.sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.8rem;
}
.sort-inactive {
  color: #475569;
}
.sort-active {
  color: #0056EB;
  font-weight: bold;
}

/* ── Field hints & input-with-button ──────────────────── */
.field-hint {
  color: #64748b;
  font-size: 0.78rem;
  margin-top: 5px;
  line-height: 1.4;
}

.input-with-btn {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-btn input {
  flex: 1;
}

/* ── Accounts / Platform Cards ─────────────────────────── */
.accounts-profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-badge {
  background: rgba(0,86,235,0.15);
  color: #0056EB;
  border: 1px solid rgba(0,86,235,0.3);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.profile-connected-count {
  color: #64748b;
  font-size: 0.85rem;
}

.accounts-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.platform-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s;
}

.platform-card.connected {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.04);
}

.platform-card.unavailable {
  opacity: 0.5;
}

.platform-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.platform-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.platform-avatar {
  width: 44px;
  height: 44px;
  object-fit: cover;
}

.platform-icon-large {
  font-size: 1.4rem;
  line-height: 1;
}

.platform-card-meta {
  flex: 1;
  min-width: 0;
}

.platform-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.platform-account-name {
  font-size: 0.78rem;
  color: #10b981;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.platform-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-connected   { background: #10b981; box-shadow: 0 0 6px #10b981; }
.dot-disconnected { background: #475569; }

.platform-card-footer {
  padding-top: 4px;
  border-top: 1px solid #1e293b;
}

.platform-card.connected .platform-card-footer {
  border-top-color: rgba(16, 185, 129, 0.15);
}

/* ── Brand Settings — dynamic colors & fonts ───────────── */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.card-header-row h2 { margin-bottom: 0; }

.color-role-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 5px;
  padding: 2px 8px;
  flex-shrink: 0;
  min-width: 70px;
  text-align: center;
}
.primary-badge {
  background: rgba(0,86,235,0.15);
  color: #0056EB;
  border: 1px solid rgba(0,86,235,0.3);
}

.color-label-input {
  width: 130px;
  flex-shrink: 0;
  font-size: 0.85rem;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  padding: 6px 10px;
}

.extra-color-row,
.extra-font-row {
  margin-top: 10px;
  animation: fadeInRow 0.15s ease;
}

@keyframes fadeInRow {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Font rows */
.font-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #1e293b;
}
.font-row:last-child { border-bottom: none; }

.font-name-input {
  flex: 1;
  font-size: 0.9rem;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  padding: 7px 10px;
}

.font-preview-box {
  font-size: 1.4rem;
  color: #e2e8f0;
  padding: 12px 0 4px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 4px;
  min-height: 2.5rem;
  transition: font-family 0.2s;
}

/* ── AI Generate Wizard ─────────────────────────────────── */
.gen-set-banner { display:flex; gap:16px; align-items:center; background:#1e293b; border-radius:10px; padding:14px; margin-bottom:16px; }
.gen-set-thumb { width:80px; height:80px; object-fit:cover; border-radius:8px; flex-shrink:0; }
.gen-slides-list { display:flex; flex-direction:column; gap:12px; max-height:380px; overflow-y:auto; }
.gen-slide-row { display:flex; gap:12px; align-items:flex-start; background:#1e293b; border-radius:8px; padding:12px; }
.gen-slide-thumb { width:70px; height:70px; object-fit:cover; border-radius:6px; flex-shrink:0; }
.gen-slide-meta { flex:1; display:flex; flex-direction:column; gap:6px; }
.gen-slide-text { width:100%; background:#0f172a; border:1px solid #334155; border-radius:6px; color:#e2e8f0; padding:8px; font-size:0.85rem; resize:vertical; min-height:60px; }
.badge-hook { background:rgba(239,68,68,0.15); color:#ef4444; border:1px solid rgba(239,68,68,0.3); }
.badge-body { background:rgba(59,130,246,0.15); color:#60a5fa; border:1px solid rgba(59,130,246,0.3); }
.badge-cta  { background:rgba(234,179,8,0.15);  color:#facc15; border:1px solid rgba(234,179,8,0.3); }

/* ── Designer v2 — Zoom + Layers ──────────────────────────── */

/* Replace canvas-wrap with flex column area */
#designer-canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #0f172a;
}

#zoom-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: #1a2540;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}
#zoom-bar button {
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.12s;
  line-height: 1.6;
}
#zoom-bar button:hover { background: #1e293b; border-color: #475569; }
#zoom-label { color: #60a5fa; font-size: 0.8rem; font-weight: 600; min-width: 38px; }

/* Canvas scroll area — checkerboard bg */
.canvas-outer {
  flex: 1;
  overflow: auto;
  background-color: #111827;
  background-image:
    linear-gradient(45deg, #1a2035 25%, transparent 25%),
    linear-gradient(-45deg, #1a2035 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a2035 75%),
    linear-gradient(-45deg, transparent 75%, #1a2035 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  min-height: 0;
}
.canvas-outer canvas { box-shadow: 0 8px 40px rgba(0,0,0,0.7); display: block; }

/* Layers panel */
#layers-list { max-height: 260px; overflow-y: auto; }

.layer-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  border-radius: 5px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  margin-bottom: 2px;
  transition: background 0.1s;
  user-select: none;
}
.layer-row:hover { background: #0f172a; }
.layer-row.selected { background: #0f172a; border-color: #0056EB; }
.layer-row.drag-over { border-color: #ED832B; background: rgba(237,131,43,0.08); }
.layer-row.dragging { opacity: 0.4; }
.layer-drag {
  color: #334155;
  cursor: grab;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
}
.layer-drag:active { cursor: grabbing; }
.layer-icon { font-size: 0.75rem; width: 16px; text-align: center; flex-shrink: 0; color: #94a3b8; }
.layer-name {
  flex: 1;
  font-size: 0.76rem;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layer-btn {
  background: none;
  border: none;
  color: #475569;
  cursor: pointer;
  padding: 2px 3px;
  font-size: 0.75rem;
  line-height: 1;
  border-radius: 3px;
  flex-shrink: 0;
  transition: color 0.1s;
}
.layer-btn:hover { color: #e2e8f0; background: #334155; }
.layer-locked .layer-name { color: #475569; }

/* Designer tools grid */
#designer-tools { width: 210px; min-width: 210px; }
#designer-props { width: 230px; min-width: 230px; }

/* ── AI Content Strategy ─────────────────────────────────── */
.strategy-section {
  margin-bottom: 28px;
}
.strategy-section-header {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1e293b;
}
#strategy-card .card-header-row { align-items: flex-start; gap: 16px; }

/* ── Sidebar collapse polish ── */
.sidebar-logo { overflow: hidden; }
.brand-selector-wrap { padding: 12px 12px 4px; }
.brand-selector-label { white-space: nowrap; }
.brand-selector-select { min-width: 0; width: 100%; }

/* ── Video Generator ─────────────────────────────────────── */
.video-job-card video { border-radius: 8px; }
@keyframes pulse-bar {
  0%   { width: 15%; }
  50%  { width: 85%; }
  100% { width: 15%; }
}
.video-progress-bar { width: 30%; }
.page-sub { color: #64748b; font-size: 0.9rem; margin: -16px 0 0; }
