/* ==========================================================================
   3S MEDIA ENTERPRISE PLATFORM V3.0 — DESIGN TOKENS & ATOMIC PRIMITIVES
   ========================================================================== */
:root {
  --bg-app: #090c14;
  --bg-sidebar: #0d111c;
  --bg-panel: #121726;
  --bg-subtle: #181f33;
  --bg-hover: #1e2740;
  --border: #232d45;
  --border-strong: #324063;
  --ink-1: #f1f5f9;
  --ink-2: #94a3b8;
  --ink-3: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.14);
  --accent-glow: rgba(99, 102, 241, 0.3);
  --cyan: #06b6d4;
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --purple: #a855f7;
  --purple-soft: rgba(168, 85, 247, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* User-selectable Accent Color Palettes */
html[data-accent="cyan"] {
  --accent: #06b6d4; --accent-hover: #0891b2;
  --accent-soft: rgba(6, 182, 212, 0.15); --accent-glow: rgba(6, 182, 212, 0.3);
}
html[data-accent="emerald"] {
  --accent: #10b981; --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.15); --accent-glow: rgba(16, 185, 129, 0.3);
}
html[data-accent="violet"] {
  --accent: #8b5cf6; --accent-hover: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.16); --accent-glow: rgba(139, 92, 246, 0.3);
}
html[data-accent="amber"] {
  --accent: #f59e0b; --accent-hover: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.16); --accent-glow: rgba(245, 158, 11, 0.28);
}
html[data-accent="rose"] {
  --accent: #f43f5e; --accent-hover: #e11d48;
  --accent-soft: rgba(244, 63, 94, 0.15); --accent-glow: rgba(244, 63, 94, 0.3);
}

/* User-selectable Font Scales */
html[data-font="sm"] body { font-size: 12.6px; }
html[data-font="md"] body { font-size: 13.5px; }
html[data-font="lg"] body { font-size: 14.5px; }

html[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-panel: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #eef2ff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ink-1: #0f172a;
  --ink-2: #475569;
  --ink-3: #64748b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg-app);
  color: var(--ink-1);
  font-size: 13.5px;
  line-height: 1.5;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* Scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle); color: var(--ink-1);
  font-family: inherit; font-size: 12.6px; font-weight: 600;
  cursor: pointer; transition: all 0.14s ease; text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: transparent; color: #fff; font-weight: 700;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: transparent; color: #fff; }
.btn-emerald {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: transparent; color: #fff; font-weight: 700;
}
.btn-emerald:hover:not(:disabled) { opacity: 0.93; color: #fff; }
.btn-danger { border-color: rgba(239, 68, 68, 0.45); color: #f87171; background: var(--red-soft); }
.btn-sm { padding: 4px 9px; font-size: 11.6px; border-radius: 7px; }

/* Inputs */
.field-label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--ink-2); margin-bottom: 5px;
}
.inp, .sel, .txt {
  width: 100%; padding: 8px 11px; border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle); color: var(--ink-1);
  font-family: inherit; font-size: 13px; outline: none;
  transition: border-color 0.15s;
}
.inp:focus, .sel:focus, .txt:focus { border-color: var(--accent); }
.txt { resize: vertical; min-height: 68px; line-height: 1.45; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.2px; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap;
}
.b-red { background: var(--red-soft); color: #f87171; border-color: rgba(239, 68, 68, 0.35); }
.b-amber { background: var(--amber-soft); color: #fbbf24; border-color: rgba(245, 158, 11, 0.35); }
.b-green { background: var(--green-soft); color: #34d399; border-color: rgba(16, 185, 129, 0.35); }
.b-blue { background: var(--accent-soft); color: #818cf8; border-color: rgba(99, 102, 241, 0.35); }
.b-purple { background: var(--purple-soft); color: #c084fc; border-color: rgba(168, 85, 247, 0.35); }
.b-muted { background: var(--bg-subtle); color: var(--ink-2); border-color: var(--border); }

html[data-theme="light"] .b-red { color: #b91c1c; }
html[data-theme="light"] .b-amber { color: #b45309; }
html[data-theme="light"] .b-green { color: #047857; }
html[data-theme="light"] .b-blue { color: #4338ca; }
html[data-theme="light"] .b-purple { color: #7e22ce; }

/* WordPress-style Toggle Switch */
.wp-switch {
  position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
}
.wp-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.wp-slider {
  width: 40px; height: 22px; background: var(--border-strong);
  border-radius: 99px; position: relative; transition: background 0.2s; flex-shrink: 0;
}
.wp-slider::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  transition: transform 0.2s;
}
.wp-switch input:checked + .wp-slider { background: var(--green); }
.wp-switch input:checked + .wp-slider::after { transform: translateX(18px); }

/* Alert boxes */
.alert-box {
  padding: 10px 13px; border-radius: 10px; font-size: 12.5px; border: 1px solid var(--border);
}
.alert-red { background: var(--red-soft); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.alert-green { background: var(--green-soft); border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }
.alert-amber { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.45); color: #fcd34d; }
.upload-bar-track { height: 10px; border-radius: 6px; background: rgba(148, 163, 184, 0.25); overflow: hidden; }
.upload-bar-fill { height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(90deg, #06b6d4, #6366f1); transition: width .25s ease; }
.alert-blue { background: var(--accent-soft); border-color: rgba(99, 102, 241, 0.4); color: #c7d2fe; }

/* Toast */
#v3ToastWrap {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.v3-toast {
  background: #1e293b; color: #f8fafc; border: 1px solid var(--accent);
  padding: 10px 15px; border-radius: 10px; font-size: 12.8px; font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); pointer-events: auto;
}
