/* ============================================================
   ClipMail — Professional SaaS Theme (Bootstrap 5)
   ============================================================ */

:root {
  --cm-primary: #4f46e5;
  --cm-primary-dark: #4338ca;
  --cm-primary-light: #eef2ff;
  --cm-accent: #06b6d4;
  --cm-ink: #0f172a;
  --cm-slate: #475569;
  --cm-muted: #64748b;
  --cm-line: #e2e8f0;
  --cm-bg: #f6f8fb;
  --cm-radius: 14px;
  --cm-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --cm-shadow-md: 0 10px 30px -12px rgba(15, 23, 42, .18);
  --cm-shadow-lg: 0 24px 60px -20px rgba(30, 27, 75, .28);
  --bs-body-font-family: "Inter", "Noto Sans Malayalam", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--bs-body-font-family);
  background-color: var(--cm-bg);
  color: var(--cm-ink);
  font-size: .95rem;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.02em; color: var(--cm-ink); }
p { color: var(--cm-slate); }
a { text-decoration: none; }

::selection { background: rgba(79, 70, 229, .18); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 2px solid var(--cm-bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   Navbar
   ============================================================ */
.cm-navbar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cm-line);
  padding: .55rem 0;
  min-height: 64px;
}

.cm-brand { display: flex; align-items: center; gap: .65rem; font-weight: 800; font-size: 1.25rem; color: var(--cm-ink) !important; letter-spacing: -.03em; }
.cm-brand img { height: 50px; width: auto; }
.cm-brand-badge {
  font-size: .58rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  background: linear-gradient(135deg, var(--cm-primary), var(--cm-accent));
  color: #fff; border-radius: 99px; padding: 3px 8px; margin-top: 2px;
}

.cm-navbar .nav-link {
  color: var(--cm-slate); font-weight: 600; font-size: .92rem;
  padding: .55rem 1rem !important; border-radius: 10px;
  transition: all .18s ease;
}
.cm-navbar .nav-link:hover { color: var(--cm-primary); background: var(--cm-primary-light); }
.cm-navbar .nav-link.active { color: var(--cm-primary); background: var(--cm-primary-light); }
.cm-navbar .nav-link i { margin-right: .45rem; width: 1.1em; text-align: center; }

.cm-navbar .dropdown-menu {
  border: 1px solid var(--cm-line); border-radius: 14px;
  box-shadow: var(--cm-shadow-md); padding: .5rem; margin-top: .65rem !important;
  min-width: 230px;
}
.cm-navbar .dropdown-item { border-radius: 9px; padding: .55rem .85rem; font-weight: 500; font-size: .9rem; color: var(--cm-slate); }
.cm-navbar .dropdown-item:hover { background: var(--cm-primary-light); color: var(--cm-primary); }
.cm-navbar .dropdown-item i { margin-right: .5rem; width: 1.15em; }
.cm-navbar .dropdown-header { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--cm-muted); font-weight: 700; }
.cm-navbar .dropdown-divider { border-color: var(--cm-line); opacity: 1; }

.cm-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cm-primary), #7c3aed);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .82rem; flex: 0 0 auto;
}
.cm-user-name { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.cm-user-role { font-size: .74rem; color: var(--cm-muted); }

.navbar-toggler { border: 1px solid var(--cm-line); border-radius: 10px; padding: .45rem .6rem; }
.navbar-toggler:focus { box-shadow: 0 0 0 3px rgba(79, 70, 229, .25); }

/* ============================================================
   Buttons
   ============================================================ */
.btn { font-weight: 600; border-radius: 10px; transition: all .18s ease; }
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(79, 70, 229, .3); }

.btn-cm-primary {
  background: linear-gradient(135deg, var(--cm-primary) 0%, #6d28d9 100%);
  color: #fff; border: none;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .55);
}
.btn-cm-primary:hover, .btn-cm-primary:focus { color: #fff; transform: translateY(-1px); box-shadow: 0 10px 24px -8px rgba(79, 70, 229, .65); filter: brightness(1.05); }
.btn-cm-primary:active { transform: translateY(0); }

.btn-cm-ghost { background: #fff; color: var(--cm-ink); border: 1px solid var(--cm-line); box-shadow: var(--cm-shadow-sm); }
.btn-cm-ghost:hover { border-color: var(--cm-primary); color: var(--cm-primary); background: var(--cm-primary-light); }

/* ============================================================
   Cards / panels
   ============================================================ */
.card { border: 1px solid var(--cm-line); border-radius: var(--cm-radius); box-shadow: var(--cm-shadow-sm); }
.cm-card { background: #fff; border: 1px solid var(--cm-line); border-radius: var(--cm-radius); box-shadow: var(--cm-shadow-sm); }
.cm-card-hover { transition: all .2s ease; }
.cm-card-hover:hover { transform: translateY(-3px); box-shadow: var(--cm-shadow-md); border-color: #c7d2fe; }

/* ---- Archive dashboard hero (dashboard.php) ---- */
.cm-dash-hero {
  position: relative;
  padding: 2.6rem 0 2.8rem;
  background:
    radial-gradient(42rem 22rem at 112% -18%, rgba(6, 182, 212, .16), transparent 60%),
    radial-gradient(40rem 24rem at -12% 120%, rgba(79, 70, 229, .18), transparent 60%),
    #fff;
  border-bottom: 1px solid var(--cm-line);
  overflow: hidden;
}
.cm-dash-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 80% at 40% 30%, black 20%, transparent 78%);
}
.cm-dash-hero .cm-dash-kicker {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--cm-primary-light); color: var(--cm-primary);
  border: 1px solid #c7d2fe; border-radius: 99px;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  padding: .4rem .95rem; margin-bottom: 1.2rem;
}
.cm-dash-hero h1 {
  position: relative;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 800; letter-spacing: -.03em; margin: 0 0 .6rem;
}
.cm-dash-hero h1 .grad {
  background: linear-gradient(120deg, var(--cm-primary), var(--cm-accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cm-dash-hero p { position: relative; font-size: 1rem; color: var(--cm-slate); max-width: 40rem; margin: 0; }
.cm-dash-stats {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem;
}
.cm-dash-stats div {
  background: #fff; border: 1px solid var(--cm-line); border-radius: 14px;
  box-shadow: var(--cm-shadow-sm); padding: .85rem .6rem; text-align: center;
}
.cm-dash-stats b { display: block; font-size: 1.05rem; font-weight: 800; color: var(--cm-ink); }
.cm-dash-stats span { font-size: .68rem; color: var(--cm-muted); font-weight: 600; letter-spacing: .02em; }

/* ---- Archive dashboard tiles (dashboard.php) ---- */
.cm-dash-section-head { margin-bottom: 1.1rem; }
.cm-dash-section-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; color: var(--cm-ink); margin: 0; }
.cm-dash-section-sub { font-size: .88rem; color: var(--cm-muted); margin: .2rem 0 0; }

.cm-tile {
  display: flex; flex-direction: column; height: 100%;
  background: #fff; border: 1px solid var(--cm-line); border-radius: 16px;
  padding: 1.25rem 1.2rem 1.15rem;
  color: inherit; text-decoration: none;
  box-shadow: var(--cm-shadow-sm);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.cm-tile:hover { border-color: #c7d2fe; box-shadow: var(--cm-shadow-md); transform: translateY(-3px); color: inherit; }
.cm-tile-ic {
  width: 46px; height: 46px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: var(--cm-primary);
  background: var(--cm-primary-light); border: 1px solid #e0e7ff;
  margin-bottom: .9rem;
}
.cm-tile-kicker { font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--cm-muted); }
.cm-tile-title { font-size: 1rem; font-weight: 700; color: var(--cm-ink); margin: .2rem 0 .35rem; letter-spacing: -.01em; }
.cm-tile-desc { font-size: .82rem; color: var(--cm-slate); margin: 0 0 1rem; flex: 1 1 auto; }
.cm-tile-go { font-size: .8rem; font-weight: 700; color: var(--cm-primary); display: inline-flex; align-items: center; gap: .4rem; }
.cm-tile-go i { font-size: .72rem; transition: transform .18s ease; }
.cm-tile:hover .cm-tile-go i { transform: translateX(3px); }

.cm-page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.35rem; }
.cm-page-title { font-size: 1.5rem; margin: 0; display: flex; align-items: center; gap: .7rem; }
.cm-page-title i { color: var(--cm-primary); font-size: 1.2rem; }
.cm-page-sub { color: var(--cm-muted); font-size: .9rem; margin: .25rem 0 0 0; }

/* Legacy page containers (channels.php etc.) */
#login-overlay, .tile_count { background: transparent; border: none; box-shadow: none; }
.tile_count .page-header { border: none; padding-bottom: .4rem; margin: 0 0 1.25rem; }
.custom-wall { display: block; margin-top: 0; }

/* ============================================================
   Forms
   ============================================================ */
.form-label { font-weight: 600; font-size: .85rem; color: var(--cm-ink); margin-bottom: .35rem; }
.form-control, .form-select {
  border: 1.5px solid var(--cm-line); border-radius: 10px;
  padding: .6rem .85rem; font-size: .93rem; background-color: #fff;
  transition: all .18s ease; color: var(--cm-ink);
}
.form-control:focus, .form-select:focus {
  border-color: var(--cm-primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}
.form-control::placeholder { color: #a4b0c1; }

.form-check-input { border: 1.5px solid #cbd5e1; }
.form-check-input:checked { background-color: var(--cm-primary); border-color: var(--cm-primary); }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); border-color: var(--cm-primary); }
.form-check-label { font-size: .88rem; color: var(--cm-slate); font-weight: 500; }

.input-group-text { background: var(--cm-primary-light); border: 1.5px solid var(--cm-line); color: var(--cm-primary); border-radius: 10px; }

/* ============================================================
   Auth layout (signin / register / forgot password)
   ============================================================ */
.cm-auth {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center;
  padding: 3rem 1rem;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60rem 32rem at 115% -10%, rgba(6, 182, 212, .10), transparent 60%),
    radial-gradient(52rem 30rem at -12% 110%, rgba(79, 70, 229, .12), transparent 60%),
    var(--cm-bg);
}
.cm-auth::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 75%);
  pointer-events: none;
}

.cm-auth-shell {
  position: relative; z-index: 1;
  width: 100%; max-width: 1020px; margin: 0 auto;
  background: #fff;
  border-radius: 22px;
  border: 1px solid var(--cm-line);
  box-shadow: var(--cm-shadow-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.cm-auth-shell.cm-auth-narrow { max-width: 460px; grid-template-columns: 1fr; }

/* Brand side */
.cm-auth-brand {
  position: relative;
  background: linear-gradient(150deg, #312e81 0%, var(--cm-primary) 55%, #7c3aed 100%);
  color: #fff;
  padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
.cm-auth-brand::before, .cm-auth-brand::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.cm-auth-brand::before { width: 320px; height: 320px; top: -110px; right: -110px; }
.cm-auth-brand::after { width: 240px; height: 240px; bottom: -100px; left: -80px; }

.cm-auth-brand .brand-mark { display: flex; align-items: center; gap: .7rem; font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; }
.cm-auth-brand .brand-mark img { height: 40px; width: auto; }
.cm-auth-brand h2 { color: #fff; font-size: 1.75rem; line-height: 1.25; letter-spacing: -.02em; margin-top: 2rem; }
.cm-auth-brand p { color: rgba(255, 255, 255, .78); font-size: .95rem; }

.cm-feature { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1.1rem; }
.cm-feature i {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
  background: rgba(255, 255, 255, .14);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .95rem; color: #fff;
}
.cm-feature strong { display: block; color: #fff; font-size: .93rem; margin-bottom: .1rem; }
.cm-feature span { color: rgba(255, 255, 255, .68); font-size: .84rem; line-height: 1.45; }

/* Form side */
.cm-auth-form { padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.cm-auth-form .auth-logo { height: 56px; width: auto; margin-bottom: 1rem; }
.cm-auth-title { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .3rem; }
.cm-auth-sub { color: var(--cm-muted); font-size: .92rem; margin-bottom: 1.6rem; }

.cm-success-icon {
  width: 72px; height: 72px; margin: 0 auto 1.2rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 2rem; color: #fff;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 14px 30px -10px rgba(16, 185, 129, .55);
}

.cm-pass-wrap { position: relative; }
.cm-pass-toggle {
  position: absolute; right: .65rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--cm-muted); padding: .25rem;
}
.cm-pass-toggle:hover { color: var(--cm-primary); }

.cm-auth-shell.cm-auth-register { max-width: 1180px; grid-template-columns: .85fr 1.15fr; }

.cm-auth-form-scroll { max-height: calc(100vh - 130px); overflow-y: auto; }
.cm-auth-form-scroll::-webkit-scrollbar-thumb { border: none; background: #cbd5e1; }

/* Register — section divider labels */
.cm-auth-sect {
  display: flex; align-items: center; gap: .55rem;
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em;
  color: var(--cm-primary); margin: 1.35rem 0 .85rem;
}
.cm-auth-sect::after { content: ""; flex: 1; height: 1px; background: var(--cm-line); }
.cm-auth-sect i { font-size: .85rem; }

/* Register — password strength meter */
.cm-str { height: 5px; border-radius: 99px; background: #e2e8f0; overflow: hidden; }
.cm-str-bar { height: 100%; width: 0; border-radius: 99px; background: #f43f5e; transition: width .18s ease, background .18s ease; }
.cm-str-bar[data-l="1"] { background: #f43f5e; }
.cm-str-bar[data-l="2"] { background: #f59e0b; }
.cm-str-bar[data-l="3"] { background: #10b981; }
.cm-str-bar[data-l="4"] { background: #059669; }
.cm-pass-match { border-color: #10b981 !important; box-shadow: 0 0 0 .2rem rgba(16, 185, 129, .12); }

/* Register — brand accent + stats */
.cm-auth-brand .cm-eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .22);
  padding: .3rem .8rem; border-radius: 99px; font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
}
.cm-auth-stats { display: flex; gap: 1.5rem; margin: 1.5rem 0 .4rem; }
.cm-auth-stats b { display: block; font-size: 1.15rem; letter-spacing: -.01em; }
.cm-auth-stats span { font-size: .74rem; color: rgba(255, 255, 255, .6); }
.cm-auth-footlink {
  display: inline-flex; align-items: center; gap: .5rem; margin-top: 1.4rem;
  color: rgba(255, 255, 255, .85); font-size: .84rem; text-decoration: none;
  border-top: 1px solid rgba(255, 255, 255, .16); padding-top: 1rem;
}
.cm-auth-footlink:hover { color: #fff; }

@media (max-width: 767.98px) {
  .cm-auth { padding: 1.5rem .9rem; }
  .cm-auth-shell, .cm-auth-shell.cm-auth-register { grid-template-columns: 1fr; }
  .cm-auth-brand { display: none; }
  .cm-auth-form { padding: 2rem 1.5rem; }
  .cm-auth-form-scroll { max-height: none; overflow: visible; }
}

/* ============================================================
   Landing hero (index.php)
   ============================================================ */
.cm-hero {
  position: relative;
  padding: 4.5rem 0 5rem;
  background:
    radial-gradient(58rem 30rem at 108% -12%, rgba(6, 182, 212, .12), transparent 60%),
    radial-gradient(50rem 28rem at -10% 112%, rgba(79, 70, 229, .14), transparent 60%),
    #fff;
  border-bottom: 1px solid var(--cm-line);
  overflow: hidden;
}
.cm-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 85% 75% at 45% 35%, black 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 45% 35%, black 25%, transparent 78%);
  pointer-events: none;
}

.cm-hero .eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--cm-primary-light); color: var(--cm-primary);
  border: 1px solid #c7d2fe; border-radius: 99px;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  padding: .4rem .95rem; margin-bottom: 1.4rem;
}
.cm-hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
  font-weight: 800; letter-spacing: -.035em; line-height: 1.12;
}
.cm-hero h1 .grad {
  background: linear-gradient(120deg, var(--cm-primary), var(--cm-accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cm-hero .lead-txt { font-size: 1.08rem; color: var(--cm-slate); max-width: 34rem; }

.cm-hero-stat { border-left: 3px solid #c7d2fe; padding-left: 1rem; margin-top: 1.5rem; }
.cm-hero-stat b { display: block; font-size: 1.35rem; color: var(--cm-ink); }
.cm-hero-stat span { font-size: .82rem; color: var(--cm-muted); }

/* Login card floating on hero */
.cm-hero-card {
  position: relative; z-index: 1;
  background: #fff; border: 1px solid var(--cm-line);
  border-radius: 20px; box-shadow: var(--cm-shadow-lg);
  padding: 2.25rem;
}
.cm-hero-card .card-icon {
  width: 54px; height: 54px; border-radius: 15px;
  background: linear-gradient(135deg, var(--cm-primary), #7c3aed);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.35rem; margin-bottom: 1rem;
  box-shadow: 0 10px 22px -8px rgba(79, 70, 229, .6);
}

/* Feature strip under hero */
.cm-strip { padding: 3.5rem 0; }
.cm-strip-title { text-align: center; font-size: 1.6rem; margin-bottom: .5rem; }
.cm-strip-sub { text-align: center; color: var(--cm-muted); margin-bottom: 2.5rem; }
.cm-fcard { text-align: left; background: #fff; border: 1px solid var(--cm-line); border-radius: 16px; padding: 1.6rem; height: 100%; box-shadow: var(--cm-shadow-sm); transition: all .2s ease; }
.cm-fcard:hover { transform: translateY(-4px); box-shadow: var(--cm-shadow-md); border-color: #c7d2fe; }
.cm-fcard i.ic {
  width: 46px; height: 46px; border-radius: 13px; font-size: 1.1rem;
  background: var(--cm-primary-light); color: var(--cm-primary);
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.cm-fcard h5 { font-size: 1.02rem; margin-bottom: .4rem; }
.cm-fcard p { font-size: .88rem; color: var(--cm-muted); margin: 0; line-height: 1.55; }

/* ============================================================
   Footer
   ============================================================ */
.cm-footer { background: #0f172a; color: #94a3b8; padding: 3rem 0 2rem; margin-top: 0; }
.cm-footer h6 { color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 1rem; }
.cm-footer a { color: #94a3b8; font-size: .9rem; display: inline-block; padding: .18rem 0; transition: color .15s ease; }
.cm-footer a:hover { color: #fff; }
.cm-footer .fbrand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 800; font-size: 1.15rem; margin-bottom: .8rem; }
.cm-footer .fbrand img { height: 32px; width: auto; }
.cm-footer .fsocial a {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  display: inline-flex; align-items: center; justify-content: center;
  margin-right: .5rem; font-size: .9rem; padding: 0;
}
.cm-footer .fsocial a:hover { background: var(--cm-primary); color: #fff; }
.cm-footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 2.2rem; padding-top: 1.3rem; font-size: .83rem; }
.cm-footer-bottom span { color: #64748b; }

/* ============================================================
   Alerts / misc
   ============================================================ */
.alert { border-radius: 12px; border: 1px solid transparent; font-size: .89rem; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.badge-soft { background: var(--cm-primary-light); color: var(--cm-primary); font-weight: 600; border-radius: 99px; padding: .38em .8em; font-size: .74rem; }

.table { --bs-table-border-color: var(--cm-line); }
.table thead th {
  background: #f8fafc; color: var(--cm-muted);
  font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  border-bottom: 1px solid var(--cm-line) !important; white-space: nowrap;
}

.modal-content { border: 1px solid var(--cm-line); border-radius: 16px; box-shadow: var(--cm-shadow-lg); }
.dropdown-menu { border: 1px solid var(--cm-line); border-radius: 12px; box-shadow: var(--cm-shadow-md); }

/* ============================================================
   Bootstrap 3 compatibility shims (legacy inner pages)
   ============================================================ */
.form-group { margin-bottom: 1rem; }
[class*="col-md-offset-"] { position: relative; min-height: 1px; }
.col-md-offset-4 { margin-left: 33.33333333%; }
.col-md-offset-3 { margin-left: 25%; }
.col-md-offset-2 { margin-left: 16.66666667%; }
@media (min-width: 992px) {
  .col-md-offset-4 { margin-left: 33.33333333%; }
  .col-md-offset-3 { margin-left: 25%; }
  .col-md-offset-2 { margin-left: 16.66666667%; }
}
.panel { background: #fff; border: 1px solid var(--cm-line); border-radius: var(--cm-radius); box-shadow: var(--cm-shadow-sm); margin-bottom: 1.25rem; }
.panel-heading { padding: .9rem 1.15rem; border-bottom: 1px solid var(--cm-line); font-weight: 700; background: #f8fafc; border-radius: var(--cm-radius) var(--cm-radius) 0 0; }
.panel-body { padding: 1.15rem; }
.page-header { padding-bottom: .5rem; margin: 1.2rem 0; border-bottom: 1px solid var(--cm-line); }

/* ============================================================
   News watch page (channels.php)
   ============================================================ */

/* Live indicator */
.cm-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; display: inline-block; animation: cm-pulse 1.6s ease infinite; }
@keyframes cm-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Player */
.cm-player {
  position: relative;
  background: #000;
  border-radius: var(--cm-radius);
  overflow: hidden;
  box-shadow: var(--cm-shadow-md);
}
.cm-player video { display: block; width: 100% !important; height: auto !important; max-height: 62vh; background: #000; }

.cm-news-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; margin-bottom: .65rem; }

.cm-meta-badge {
  display: inline-flex; align-items: center; gap: .45rem;
  background: #fff; border: 1px solid var(--cm-line); color: var(--cm-slate);
  border-radius: 99px; padding: .32rem .85rem; font-size: .8rem; font-weight: 600;
}
.cm-meta-badge i { color: var(--cm-primary); }

/* Related thumbs strip */
.cm-thumb-strip {
  display: flex; gap: .75rem; overflow-x: auto;
  padding: .25rem .25rem .5rem;
  scrollbar-width: thin;
}
.cm-thumb-strip a {
  flex: 0 0 auto; position: relative;
  border-radius: 10px; overflow: hidden; line-height: 0;
  outline: 2px solid transparent; transition: all .18s ease;
}
.cm-thumb-strip a:hover { transform: translateY(-2px); box-shadow: var(--cm-shadow-sm); }
.cm-thumb-strip a.active-thumb, .cm-thumb-strip a:hover { outline-color: var(--cm-primary); }
.cm-thumb-strip img { width: 132px !important; height: 88px !important; object-fit: cover; border: none !important; padding: 0 !important; border-radius: 10px; }

/* Sidebar news list */
.cm-newslist { list-style: none; margin: 0; padding: 0; }
.cm-newslist > li { border-bottom: 1px solid var(--cm-line); }
.cm-newslist > li:last-child { border-bottom: none; }
.cm-newscard {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: .95rem .6rem; border-radius: 12px;
  cursor: pointer; text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.cm-newscard:hover { background: var(--cm-primary-light); text-decoration: none; }
.cm-newscard .news-thumb {
  flex: 0 0 auto; width: 104px; height: 70px;
  border-radius: 10px; object-fit: cover;
  border: none !important; padding: 0 !important;
  box-shadow: var(--cm-shadow-sm);
}
.cm-newscard h5 {
  font-size: .9rem; font-weight: 700; line-height: 1.35;
  margin: 0 0 .3rem; color: var(--cm-ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cm-newscard:hover h5 { color: var(--cm-primary-dark); }
.cm-newscard .news-date { font-size: .74rem; color: var(--cm-muted); font-weight: 600; margin-bottom: .3rem; }
.cm-newscard .news-date i { color: var(--cm-primary); margin-right: .25rem; }
.cm-newscard p {
  font-size: .8rem; color: var(--cm-muted); margin: 0; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Sidebar card header */
.cm-side-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding-bottom: .9rem; margin-bottom: .35rem; border-bottom: 1px solid var(--cm-line);
}
.cm-side-head h6 { margin: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--cm-muted); }

/* Watch page (channels.php) */
.cm-side-sticky { position: sticky; top: 80px; }
.cm-watch-scroll { height: calc(100vh - 360px); min-height: 380px; overflow-y: auto; padding-right: .15rem; }
.cm-list-status { text-align: center; font-size: .78rem; color: var(--cm-muted); font-weight: 600; padding: .75rem 0; }
.cm-list-loading, .cm-list-empty { display: flex; align-items: center; justify-content: center; gap: .5rem; text-align: center; padding: 1.5rem .5rem; color: var(--cm-muted); font-size: .85rem; }
.cm-list-empty { flex-direction: column; gap: .35rem; }
.cm-list-empty i { font-size: 1.5rem; color: #cbd5e1; }
.cm-newscard.is-active { background: var(--cm-primary-light); }
.cm-newscard.is-active h5 { color: var(--cm-primary-dark); }
.cm-newscard.is-active .news-thumb { outline: 2px solid var(--cm-primary); outline-offset: 1px; }
.cm-thumb-fallback { display: flex; align-items: center; justify-content: center; background: #f1f5f9; color: #94a3b8; font-size: 1.15rem; }
.cm-player-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; min-height: 340px; text-align: center; color: var(--cm-muted); background: linear-gradient(160deg, #0f172a, #1e293b); border-radius: var(--cm-radius); padding: 2rem; }
.cm-player-empty i { font-size: 2.6rem; color: rgba(255,255,255,.35); }
.cm-player-empty strong { color: #fff; font-size: 1.05rem; font-weight: 700; }
.cm-player-empty span { color: rgba(255,255,255,.6); font-size: .85rem; max-width: 22rem; }

/* Media badges in sidebar list */
.cm-media-badges { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .3rem; }
.cm-media-badges span { display: inline-flex; align-items: center; gap: .25rem; background: var(--cm-primary-light); color: var(--cm-primary-dark); font-size: .7rem; font-weight: 600; border-radius: 99px; padding: .2rem .55rem; }
.cm-media-badges span i { font-size: .68rem; }

/* Media gallery (no-video player area) */
.cm-media-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; padding: 1rem; background: #f8fafc; border-radius: var(--cm-radius); }
.cm-media-gallery .cm-media { border-radius: 10px; overflow: hidden; outline: 2px solid transparent; transition: outline-color .15s; text-decoration: none; background: #fff; }
.cm-media-gallery .cm-media:hover { outline-color: var(--cm-primary); }
.cm-media-gallery .cm-media img { width: 100%; height: 120px; object-fit: cover; display: block; border-radius: 10px 10px 0 0; }
.cm-media-gallery .cm-media-pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; background: #fff; border: 1px solid #fecaca; border-radius: 10px; padding: 1rem; color: #dc2626; }
.cm-media-gallery .cm-media-pdf i { font-size: 2rem; }
.cm-media-gallery .cm-media-pdf .cm-media-pdf-name { font-size: .72rem; color: var(--cm-slate); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 991.98px) {
  .cm-side-sticky { position: static; }
  .cm-watch-scroll { height: auto; max-height: 460px; }
}

/* ---- Video detail view (loadvideo_ajax etc.) ---- */
.badge-soft.cm-warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-soft.cm-draft { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.cm-detail-rule {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding-bottom: 1rem; margin-bottom: 1.15rem;
  border-bottom: 1px solid var(--cm-line);
}

.cm-desc { color: var(--cm-slate); line-height: 1.75; font-size: .93rem; margin: 0; }

/* Related clip cards with play overlay */
.cm-thumb-strip.lg a { width: 158px; border-radius: 12px; }
.cm-thumb-strip.lg img { width: 158px !important; height: 100px !important; border-radius: 12px; }
.cm-rel-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .28);
  opacity: 0; transition: opacity .18s ease;
}
.cm-thumb-strip a:hover .cm-rel-play { opacity: 1; }
.cm-rel-play i {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; color: var(--cm-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; padding-left: 3px;
  box-shadow: 0 6px 14px -4px rgba(15, 23, 42, .4);
}

/* ---- Studio / upload pages ---- */
.badge-soft.soft-green { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.badge-soft.soft-red { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

.cm-btn-action {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--cm-line); color: var(--cm-slate);
  font-size: .9rem; text-decoration: none; padding: 0;
  transition: all .16s ease; flex: 0 0 auto;
}
.cm-btn-action:hover { border-color: var(--cm-primary); color: var(--cm-primary); background: var(--cm-primary-light); }
.cm-btn-action.danger:hover { border-color: #f87171; color: #dc2626; background: #fef2f2; }
.cm-btn-action.success:hover { border-color: #34d399; color: #059669; background: #ecfdf5; }
.cm-btn-action.action-label { width: auto; padding: 0 .75rem; gap: .42rem; font-size: .78rem; font-weight: 700; letter-spacing: .01em; }
.cm-btn-action.action-label span { white-space: nowrap; }

/* Scope pill radios */
.cm-scope-wrap { display: flex; gap: .75rem; }
.cm-scope-pill {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1.5px solid var(--cm-line); border-radius: 12px;
  padding: .68rem .9rem; margin: 0;
  font-size: .89rem; font-weight: 600; color: var(--cm-slate);
  cursor: pointer; transition: all .18s ease; background: #fff;
}
.cm-scope-pill input { position: absolute; opacity: 0; pointer-events: none; }
.cm-scope-pill:hover { border-color: #c7d2fe; }
.cm-scope-pill.active, .cm-scope-pill:has(input:checked) {
  border-color: var(--cm-primary); background: var(--cm-primary-light); color: var(--cm-primary-dark);
}

/* Add-video dashed tile */
.cm-add-tile {
  flex: 0 0 auto; width: 132px; height: 92px;
  border: 2px dashed #c7d2fe; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  color: var(--cm-primary); font-size: .78rem; font-weight: 600;
  background: var(--cm-primary-light);
  transition: all .18s ease; text-decoration: none; line-height: 1.2; text-align: center;
}
.cm-add-tile i { font-size: 1.2rem; }
.cm-add-tile:hover { border-color: var(--cm-primary); transform: translateY(-2px); box-shadow: var(--cm-shadow-sm); }

/* Single-column add actions (video / image / pdf) in the upload listing */
.cm-add-col {
  flex: 0 0 auto; width: 118px;
  display: flex; flex-direction: column; gap: .35rem;
  align-self: stretch; justify-content: center;
  padding-right: .65rem; margin-right: .25rem;
  border-right: 1px dashed var(--cm-line);
}
.cm-add-col .cm-add-tile {
  width: 100%; height: 34px; flex: 0 0 auto;
  flex-direction: row; gap: .4rem; padding: 0 .55rem;
  font-size: .68rem; text-align: left; justify-content: flex-start;
  border-radius: 9px; border-width: 1.5px;
}
.cm-add-col .cm-add-tile i { font-size: .82rem; }

/* Media thumb tiles (image / PDF) */
.cm-thumb-strip a.cm-media { outline-width: 2px; }
.cm-thumb-strip a.cm-media:hover { outline-color: var(--cm-primary); }
.cm-media-pdf {
  width: 132px !important; height: 92px;
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: .4rem;
  color: #dc2626; font-size: .78rem; font-weight: 600; line-height: 1.2; text-align: center;
}
.cm-media-pdf > i { font-size: 1.7rem; color: #dc2626; display: block; }
.cm-media-pdf-name {
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--cm-slate); font-size: .72rem; word-break: break-all;
}

/* Thumb delete overlay */
.cm-thumb-del {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(15, 23, 42, .75); color: #fff !important;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; opacity: 0; transition: opacity .15s ease;
}
.cm-thumb-strip a:hover .cm-thumb-del { opacity: 1; }
.cm-thumb-strip a { position: relative; }

/* Pagination compat */
.cm-page-count { font-size: .82rem; font-weight: 600; color: var(--cm-slate); background: #fff; border: 1px solid var(--cm-line); border-radius: 10px; padding: .5rem .85rem; }
ul.pagination { display: flex; gap: .35rem; list-style: none; padding: 0; margin: 1rem 0 0; flex-wrap: wrap; }
ul.pagination li a, ul.pagination li.page-link a, ul.pagination li.page-item a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 .6rem;
  border: 1px solid var(--cm-line); border-radius: 9px;
  color: var(--cm-slate); font-size: .85rem; font-weight: 600; text-decoration: none; background: #fff;
  transition: all .15s ease;
}
ul.pagination li a:hover { border-color: var(--cm-primary); color: var(--cm-primary); }
ul.pagination li.active a, ul.pagination li.page-item.active a {
  background: linear-gradient(135deg, var(--cm-primary), #6d28d9); color: #fff; border-color: transparent;
}
ul.pagination li.disabled a, ul.pagination li.page-link.disabled a { opacity: .5; pointer-events: none; }

.minw-0 { min-width: 0 !important; }

/* Filter pills + search toolbar */
.cm-filter-group { display: inline-flex; background: #fff; border: 1px solid var(--cm-line); border-radius: 11px; padding: 3px; gap: 2px; }
.cm-filter-btn {
  border: none; background: transparent; border-radius: 8px;
  font-size: .82rem; font-weight: 600; color: var(--cm-slate);
  padding: .38rem .85rem; transition: all .15s ease;
  text-decoration: none; display: inline-block; cursor: pointer;
}
.cm-filter-btn:hover { color: var(--cm-primary); }
.cm-filter-btn.active { background: var(--cm-primary); color: #fff; }
.cm-stream-filter {
  display: inline-flex; align-items: center; gap: .45rem;
  background: #fff; border: 1px solid var(--cm-line); border-radius: 11px; padding: 3px 6px 3px 10px;
}
.cm-stream-filter i { color: var(--cm-primary); font-size: .85rem; }
.cm-stream-filter select {
  border: none; box-shadow: none; background-color: transparent;
  font-size: .82rem; font-weight: 600; color: var(--cm-slate);
  padding: .38rem .6rem .38rem .2rem; width: auto; cursor: pointer;
}
.cm-stream-filter select:focus { box-shadow: none; border-color: var(--cm-primary); }
.cm-search-input {
  min-width: 190px; border-radius: 11px;
  font-size: .86rem; padding-left: 2.2rem;
  background-image: none; position: relative;
}
.cm-search-wrap { position: relative; display: inline-flex; align-items: center; }
.cm-search-wrap i { position: absolute; left: .75rem; color: var(--cm-muted); pointer-events: none; font-size: .85rem; }

/* History timeline */
.cm-tl { display: flex; flex-direction: column; }
.cm-tl-item {
  position: relative;
  display: flex; gap: .85rem; align-items: flex-start;
  padding-bottom: 1.1rem; margin-left: .35rem;
}
.cm-tl-item:not(:last-child)::before {
  content: ""; position: absolute; left: 17px; top: 38px; bottom: -2px;
  width: 2px; background: var(--cm-line); border-radius: 2px;
}
.cm-tl-ic {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; font-size: .85rem;
}
.cm-tl-action { font-size: .9rem; font-weight: 700; color: var(--cm-ink); line-height: 1.3; }
.cm-tl-meta { font-size: .78rem; color: var(--cm-muted); margin-top: .1rem; }
.cm-tl-meta strong { color: var(--cm-slate); font-weight: 600; }

/* User management */
.cm-avatar-lg {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--cm-primary), #7c3aed);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem;
}
.cm-role {
  display: inline-flex; align-items: center;
  border-radius: 99px; padding: .28rem .75rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
}
.cm-role.r-a { background: #eef2ff; color: #4f46e5; }
.cm-role.r-s { background: #f5f3ff; color: #7c3aed; }
.cm-role.r-v { background: #ecfeff; color: #0891b2; }
.cm-role.r-c { background: #fffbeb; color: #b45309; }
.cm-role.r-g { background: #f1f5f9; color: #64748b; }

/* Legacy setPaginate compat (expected news) */
ul.setPaginate { display: flex; gap: .35rem; list-style: none; padding: 0; margin: 1rem 0 0; flex-wrap: wrap; align-items: center; }
ul.setPaginate li a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 .6rem;
  border: 1px solid var(--cm-line); border-radius: 9px;
  color: var(--cm-slate); font-size: .85rem; font-weight: 600; text-decoration: none; background: #fff;
  transition: all .15s ease;
}
ul.setPaginate li a:hover { border-color: var(--cm-primary); color: var(--cm-primary); }
ul.setPaginate li a.current_page {
  background: linear-gradient(135deg, var(--cm-primary), #6d28d9); color: #fff !important; border-color: transparent;
}
ul.setPaginate li.setPage { font-size: .84rem; color: var(--cm-muted); font-weight: 600; padding-right: .5rem; }
ul.setPaginate li.dot { color: var(--cm-muted); }

/* ============================================================
   Studio pages (uploadnews.php) — SaaS polish
   ============================================================ */
.cm-studio-hero {
  position: relative;
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #7c3aed 100%);
  border-radius: 18px;
  padding: 1.75rem 2rem;
  color: #fff;
  box-shadow: var(--cm-shadow-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.cm-studio-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 85% 90% at 70% 10%, black 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 85% 90% at 70% 10%, black 20%, transparent 78%);
  pointer-events: none;
}
.cm-studio-hero > * { position: relative; z-index: 1; }
.cm-studio-hero h2 { color: #fff; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: .15rem 0 .3rem; }
.cm-studio-hero p.lead-txt { color: rgba(255,255,255,.78); margin: 0; font-size: .93rem; }

.cm-crumbs { display: flex; align-items: center; gap: .5rem; font-size: .78rem; font-weight: 600; color: rgba(255,255,255,.6); letter-spacing: .03em; text-transform: uppercase; }
.cm-crumbs i { font-size: .6rem; color: rgba(255,255,255,.45); }
.cm-crumbs .cur { color: #fff; }

/* Light background variant */
.cm-crumbs-dark { display: flex; align-items: center; gap: .5rem; font-size: .74rem; font-weight: 700; color: var(--cm-muted); letter-spacing: .06em; text-transform: uppercase; }
.cm-crumbs-dark i { font-size: .55rem; color: #b6c2d2; }
.cm-crumbs-dark .cur { color: var(--cm-primary); }

.cm-hero-chip {
  min-width: 96px; padding: .65rem 1rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 13px;
  text-align: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cm-hero-chip b { display: block; font-size: 1.3rem; font-weight: 800; color: #fff; line-height: 1.1; }
.cm-hero-chip span { font-size: .7rem; color: rgba(255,255,255,.75); font-weight: 600; letter-spacing: .04em; }

.cm-stat-card {
  background: #fff; border: 1px solid var(--cm-line); border-radius: var(--cm-radius);
  box-shadow: var(--cm-shadow-sm);
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: .9rem;
}
.cm-stat-card .st-ic {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
.cm-stat-card .st-ic.indigo { background: var(--cm-primary-light); color: var(--cm-primary); }
.cm-stat-card .st-ic.amber { background: #fffbeb; color: #d97706; }
.cm-stat-card .st-ic.green { background: #ecfdf5; color: #059669; }
.cm-stat-card .st-ic.gray { background: #f1f5f9; color: #64748b; }
.cm-stat-card b { display: block; font-size: 1.35rem; font-weight: 800; line-height: 1.05; color: var(--cm-ink); }
.cm-stat-card span { font-size: .78rem; color: var(--cm-muted); font-weight: 600; }

/* Listing cards: status-coded left edge */
.cm-news-item { border-left: 4px solid var(--cm-muted); }
.cm-news-item.is-approved { border-left-color: #10b981; }
.cm-news-item.is-pending { border-left-color: #f59e0b; }
.cm-news-item.is-archived { border-left-color: #94a3b8; }

.cm-section-tag {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--cm-primary); background: var(--cm-primary-light);
  border: 1px solid #c7d2fe; border-radius: 99px; padding: .32rem .85rem;
}

/* ============================================================
   Composer — New Story form
   ============================================================ */
.cm-composer { border: 0; overflow: visible; }
.cm-composer-head {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.25rem 1.4rem .25rem;
}
.cm-composer-ico {
  flex: 0 0 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, var(--cm-primary), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
  box-shadow: 0 10px 24px -10px rgba(79,70,229,.5);
}
.cm-composer-head h3 { font-size: 1.08rem; font-weight: 800; color: var(--cm-ink); letter-spacing: -.015em; margin: 0 0 .1rem; }
.cm-composer-head .lead-txt { margin: 0; font-size: .82rem; color: var(--cm-muted); }
.cm-composer-body { padding: 1rem 1.4rem .5rem; }

.cm-story-panel {
  background: #fbfcff; border: 1px solid var(--cm-line);
  border-radius: 12px; padding: 1.1rem 1.15rem; height: 100%;
}
.cm-story-panel-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .85rem; }
.cm-step-num {
  flex: 0 0 28px; height: 28px; border-radius: 9px;
  background: var(--cm-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800;
  box-shadow: 0 6px 14px -6px rgba(79,70,229,.45);
}
.cm-step-label { font-size: .84rem; font-weight: 700; color: var(--cm-ink); letter-spacing: -.01em; }
.cm-step-sub { font-size: .75rem; color: var(--cm-muted); margin-left: auto; }

.cm-composer .form-label {
  font-size: .75rem; font-weight: 600; color: var(--cm-slate);
  text-transform: uppercase; letter-spacing: .055em; margin-bottom: .35rem;
}
.cm-composer .form-control,
.cm-composer .form-select {
  border-radius: 10px; border-color: var(--cm-line); font-size: .92rem;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.cm-composer .form-control:focus,
.cm-composer .form-select:focus {
  border-color: var(--cm-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.10);
}
.cm-composer textarea.form-control { resize: vertical; }

.cm-composer-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .95rem 1.4rem; border-top: 1px dashed var(--cm-line);
  background: #fbfcff; border-radius: 0 0 var(--cm-radius) var(--cm-radius);
}
.cm-save-hint { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--cm-muted); }
.cm-save-hint i { color: var(--cm-primary); }

/* ============================================================
   SweetAlert2 theming
   ============================================================ */
.cm-swal {
  border-radius: 18px;
  border: 1px solid var(--cm-line);
  box-shadow: var(--cm-shadow-lg);
  font-family: var(--bs-body-font-family);
  padding: .5rem;
}
.cm-swal .swal2-title { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; color: var(--cm-ink); }
.cm-swal .swal2-html-container { color: var(--cm-slate); font-size: .9rem; }
.cm-swal .swal2-confirm, .cm-swal .swal2-cancel {
  border-radius: 10px !important; font-weight: 600 !important;
  padding: .55rem 1.4rem !important; font-size: .9rem !important;
  box-shadow: none !important;
}

/* ============================================================
   Flatpickr theming
   ============================================================ */.flatpickr-day.selected, .flatpickr-day.selected:hover {
  background: var(--cm-primary); border-color: var(--cm-primary);
}
.flatpickr-day.today { border-color: var(--cm-primary); }
.flatpickr-day.today:hover { border-color: var(--cm-primary); }
.flatpickr-day:hover { background: var(--cm-primary-light); color: var(--cm-primary-dark); }
.flatpickr-day.prevMonthDay:hover, .flatpickr-day.nextMonthDay:hover { background: var(--cm-primary-light); }
.flatpickr-current-month .flatpickr-monthDropdown-months:hover,
.numInputWrapper:hover { background: transparent; }
.flatpickr-day.flatpickr-disabled, .flatpickr-day.flatpickr-disabled:hover {
  color: #cbd5e1; background: transparent; border-color: transparent; cursor: not-allowed;
}
.flatpickr-calendar {
  border-radius: 14px; border: 1px solid var(--cm-line);
  box-shadow: var(--cm-shadow-md); font-family: var(--bs-body-font-family);
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg { fill: var(--cm-primary); }
.flatpickr-weekday { color: var(--cm-muted); font-weight: 700; }

/* Reports page (uploadreports.php) */
.cm-report-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.25rem; border-bottom: 1px solid var(--cm-line); font-weight: 700; font-size: .95rem; color: var(--cm-ink); }
.cm-report-head i { color: var(--cm-primary); margin-right: .5rem; }
.cm-report-count { font-size: .75rem; color: var(--cm-primary-dark); background: var(--cm-primary-light); padding: .3rem .7rem; border-radius: 99px; font-weight: 600; }
.cm-report-group { margin-bottom: 1.5rem; }
.cm-report-group-head { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--cm-primary-dark); font-size: .95rem; margin-bottom: .6rem; }
.cm-report-group-head i { color: var(--cm-primary); }
.cm-report-badge { margin-left: auto; background: var(--cm-primary); color: #fff; font-size: .72rem; font-weight: 700; padding: .15rem .6rem; border-radius: 99px; }
.cm-report-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.cm-report-item { display: flex; gap: .9rem; background: #fff; border: 1px solid var(--cm-line); border-radius: 12px; padding: .85rem 1rem; transition: all .18s ease; }
.cm-report-item:hover { border-color: #c7d2fe; box-shadow: var(--cm-shadow-sm); }
.cm-report-idx { flex: 0 0 1.6rem; height: 1.6rem; border-radius: 9px; background: var(--cm-primary-light); color: var(--cm-primary); font-weight: 700; font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; }
.cm-report-title { font-weight: 700; color: var(--cm-ink); font-size: .93rem; line-height: 1.45; }
.cm-date-wrap { position: relative; }
.cm-date-wrap .form-control { padding-left: 2.4rem; }
.cm-date-ic { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--cm-muted); font-size: .95rem; pointer-events: none; }

/* Global database search (uploadnews.php + searchresults.php) */
.cm-global-search { padding: 1.25rem 1.4rem; }
.cm-search-row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.cm-search-wrap-lg { position: relative; flex: 1 1 320px; min-width: 240px; }
.cm-search-wrap-lg .form-control { padding: .8rem 1rem .8rem 2.8rem; font-size: 1.02rem; border-radius: 12px; }
.cm-search-ic { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--cm-muted); font-size: 1.05rem; pointer-events: none; }
.cm-search-hints { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }
.cm-search-hint { font-size: .72rem; font-weight: 600; color: var(--cm-muted); background: #f1f5f9; border: 1px solid var(--cm-line); border-radius: 99px; padding: .25rem .7rem; }
.cm-search-hint i { margin-right: .3rem; color: var(--cm-primary); }

/* Search results page */
.cm-rs-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .92rem; color: var(--cm-slate); padding-bottom: .8rem; border-bottom: 1px solid var(--cm-line); }
.cm-rs-head b { color: var(--cm-ink); }
.cm-rs-count { background: var(--cm-primary-light); color: var(--cm-primary-dark); font-weight: 700; font-size: .78rem; padding: .35rem .8rem; border-radius: 99px; }
.cm-rs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.cm-rs-item { border: 1px solid var(--cm-line); border-radius: 14px; padding: 1rem 1.15rem; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.cm-rs-item:hover { border-color: #c7d2fe; box-shadow: var(--cm-shadow-sm); }
.cm-rs-top { display: flex; align-items: flex-start; gap: .75rem; }
.cm-rs-type { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--cm-primary); background: var(--cm-primary-light); border-radius: 8px; padding: .28rem .6rem; margin-top: .15rem; }
.cm-rs-title { font-size: 1rem; font-weight: 700; color: var(--cm-ink); line-height: 1.4; }
.cm-rs-title a { color: inherit; text-decoration: none; }
.cm-rs-title a:hover { color: var(--cm-primary); }
.cm-rs-snippet { font-size: .86rem; color: var(--cm-slate); line-height: 1.55; margin-top: .45rem; }
.cm-rs-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.cm-rs-foot { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.cm-rs-mark mark, .cm-rs-title mark, .cm-rs-snippet mark { background: var(--cm-primary-light); color: var(--cm-primary-dark); border-radius: 4px; padding: 0 .2rem; font-weight: 600; }
.cm-rs-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; text-align: center; padding: 2.5rem .5rem; color: var(--cm-muted); font-size: .9rem; }
.cm-rs-empty i { font-size: 2rem; color: #cbd5e1; }

/* Meta badge variants */
.cm-meta-badge.success { border-color: #bbf7d0; color: #059669; background: #ecfdf5; }
.cm-meta-badge.success i { color: #059669; }
.cm-meta-badge.warn { border-color: #fde68a; color: #b45309; background: #fffbeb; }
.cm-meta-badge.warn i { color: #d97706; }
.cm-meta-badge.dim { border-color: #e2e8f0; color: #64748b; background: #f8fafc; }
.cm-meta-badge.dim i { color: #64748b; }

/* Search results page — hero & thumbnails */
.cm-rs-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; background: linear-gradient(120deg, #f5f3ff, #eef2ff 55%, #ffffff); border: 1px solid var(--cm-line); border-radius: var(--cm-radius); padding: 1.4rem 1.6rem; margin-bottom: 1.15rem; }
.cm-rs-hero-ico { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 14px; background: #fff; border: 1px solid #e0e7ff; color: var(--cm-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; box-shadow: var(--cm-shadow-sm); }
.cm-rs-hero .cm-q { color: var(--cm-primary-dark); }
.cm-rs-item { display: flex; gap: 1rem; align-items: flex-start; }
.cm-rs-media { flex: 0 0 auto; width: 128px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--cm-line); background: #f1f5f9; box-shadow: var(--cm-shadow-sm); text-decoration: none; display: flex; }
.cm-rs-media:hover { border-color: var(--cm-primary); }
.cm-rs-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-rs-thumb-fallback { display: flex; align-items: center; justify-content: center; color: #cbd5e1; font-size: 1.5rem; }
.cm-rs-thumb-fallback i { color: #cbd5e1; }
.cm-rs-main { flex: 1; min-width: 0; }

/* Edit story popup (editnews.php) */
.cm-edit-wrap { font-size: .9rem; width: min(660px, 94vw); max-width: 100%; }
.cm-edit-head { display: flex; align-items: flex-start; gap: .85rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--cm-line); }
.cm-edit-head-ico { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; background: var(--cm-primary-light); color: var(--cm-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.cm-edit-close { margin-left: auto; width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--cm-line); background: #fff; color: var(--cm-slate); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .15s ease; }
.cm-edit-close:hover { border-color: #f87171; color: #dc2626; background: #fef2f2; }
.cm-edit-body { padding: 1.25rem; }
.cm-edit-foot { display: flex; gap: .6rem; padding-top: .25rem; }

/* Search result type tabs */
.cm-type-tabs { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
.cm-type-tab { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--cm-slate); background: #fff; border: 1px solid var(--cm-line); border-radius: 99px; padding: .4rem .9rem; text-decoration: none; transition: all .15s ease; }
.cm-type-tab:hover { border-color: var(--cm-primary); color: var(--cm-primary); }
.cm-type-tab.active { background: var(--cm-primary); border-color: var(--cm-primary); color: #fff; }
.cm-type-tab i { font-size: .82rem; }

/* Media asset grid (videos / images / pdfs) */
.cm-asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.cm-asset { display: flex; flex-direction: column; border: 1px solid var(--cm-line); border-radius: 14px; overflow: hidden; background: #fff; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.cm-asset:hover { border-color: #c7d2fe; box-shadow: var(--cm-shadow-md); transform: translateY(-2px); }
.cm-asset-thumb { position: relative; display: block; aspect-ratio: 16 / 10; background: #f1f5f9; overflow: hidden; }
.cm-asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-asset-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .28); opacity: 0; transition: opacity .18s ease; }
.cm-asset-thumb:hover .cm-asset-play { opacity: 1; }
.cm-asset-play i { width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--cm-primary); display: flex; align-items: center; justify-content: center; font-size: .95rem; padding-left: 3px; box-shadow: 0 6px 14px -4px rgba(15, 23, 42, .4); }
.cm-asset-kind { position: absolute; top: .5rem; left: .5rem; display: inline-flex; align-items: center; gap: .3rem; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: rgba(15, 23, 42, .65); border-radius: 7px; padding: .22rem .5rem; }
.cm-asset-pdf { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; background: #fef2f2; color: #dc2626; padding: 1rem; text-align: center; }
.cm-asset-pdf i { font-size: 2.4rem; }
.cm-asset-pdf span { font-size: .72rem; color: var(--cm-slate); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-asset-body { padding: .8rem .9rem .95rem; }
.cm-asset-title { font-size: .88rem; font-weight: 700; color: var(--cm-ink); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cm-asset-title mark { background: var(--cm-primary-light); color: var(--cm-primary-dark); border-radius: 4px; padding: 0 .18rem; }
.cm-asset-meta { display: flex; flex-wrap: wrap; gap: .3rem .7rem; margin-top: .55rem; font-size: .72rem; color: var(--cm-muted); font-weight: 600; }
.cm-asset-meta i { color: var(--cm-primary); margin-right: .25rem; }

/* Redesigned search results header */
.cm-rs-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--cm-line); background: linear-gradient(120deg, #f8fafc, #eef2ff); }
.cm-rs-head-main { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.cm-rs-head-ico { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; background: #fff; border: 1px solid #e0e7ff; color: var(--cm-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; box-shadow: var(--cm-shadow-sm); }
.cm-rs-head-title { font-size: 1rem; font-weight: 800; color: var(--cm-ink); letter-spacing: -.01em; }
.cm-rs-head-q { color: var(--cm-primary-dark); font-weight: 700; }
.cm-rs-head-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.cm-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: .24rem .65rem; border: 1px solid var(--cm-line); background: #fff; color: var(--cm-slate); }
.cm-chip i { font-size: .72rem; }
.cm-chip.chip-news i { color: #4f46e5; }
.cm-chip.chip-video i { color: #0ea5e9; }
.cm-chip.chip-image i { color: #16a34a; }
.cm-chip.chip-pdf i { color: #dc2626; }
.cm-rs-count { background: var(--cm-primary); color: #fff; font-weight: 700; font-size: .78rem; padding: .35rem .85rem; border-radius: 99px; }

/* Result groups */
.cm-rs-group { margin-bottom: 1.75rem; }
.cm-rs-group:last-child { margin-bottom: 0; }
.cm-rs-group-head { display: flex; align-items: center; gap: .5rem; font-size: 1rem; font-weight: 800; color: var(--cm-ink); margin-bottom: .9rem; padding-bottom: .55rem; border-bottom: 1px solid var(--cm-line); }
.cm-rs-group-head > i { color: var(--cm-primary); }
.cm-rs-group-count { background: var(--cm-primary-light); color: var(--cm-primary-dark); font-size: .72rem; font-weight: 700; padding: .15rem .6rem; border-radius: 99px; }
.cm-rs-group-all { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--cm-primary); text-decoration: none; }
.cm-rs-group-all:hover { color: var(--cm-primary-dark); }
.cm-rs-group-all i { font-size: .7rem; }

/* Nested media strip inside a news result */
.cm-rs-mediastrip { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.cm-rs-tile { position: relative; width: 108px; height: 70px; border-radius: 10px; overflow: hidden; border: 1px solid var(--cm-line); background: #f1f5f9; display: block; text-decoration: none; transition: all .15s ease; }
.cm-rs-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-rs-tile:hover { border-color: var(--cm-primary); box-shadow: var(--cm-shadow-sm); transform: translateY(-2px); }
.cm-rs-tile-badge { position: absolute; bottom: .3rem; right: .3rem; width: 22px; height: 22px; border-radius: 50%; background: rgba(15, 23, 42, .7); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .6rem; padding-left: 1px; }
.cm-rs-tile-pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; background: #fef2f2; color: #dc2626; }
.cm-rs-tile-pdf i { font-size: 1.35rem; }
.cm-rs-tile-pdf span { font-size: .58rem; color: var(--cm-slate); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Photo archive */
.cm-photo-strip { display: flex; flex-wrap: wrap; gap: .6rem; }
.cm-photo { position: relative; width: 132px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--cm-line); background: #f1f5f9; box-shadow: var(--cm-shadow-sm); }
.cm-photo > a:first-child { display: block; width: 100%; height: 100%; }
.cm-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.cm-photo:hover img { transform: scale(1.05); }
.cm-photo-dl { position: absolute; bottom: 6px; left: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(15, 23, 42, .72); color: #fff !important; display: flex; align-items: center; justify-content: center; font-size: .7rem; opacity: 0; transition: opacity .15s ease; text-decoration: none; }
.cm-photo-del { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(220, 38, 38, .82); color: #fff !important; display: flex; align-items: center; justify-content: center; font-size: .7rem; opacity: 0; transition: opacity .15s ease; cursor: pointer; }
.cm-photo-sz { position: absolute; bottom: 6px; right: 6px; font-size: .6rem; font-weight: 700; color: #fff; background: rgba(15, 23, 42, .62); border-radius: 6px; padding: .1rem .35rem; }
.cm-photo:hover .cm-photo-dl, .cm-photo:hover .cm-photo-del { opacity: 1; }
.cm-album-empty { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--cm-muted); background: #f8fafc; border: 1px dashed var(--cm-line); border-radius: 12px; padding: .9rem 1.1rem; }
.cm-album-empty i { color: var(--cm-primary); font-size: 1.1rem; }
.cm-album-empty a { font-weight: 700; color: var(--cm-primary); text-decoration: none; }

/* Photo archive: header search bar */
.cm-search-btn { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; margin-left: -1px; }
.cm-search-btn i.fa { margin: 0; }
.cm-search-ctx { display: flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--cm-slate); background: var(--cm-primary-light); border: 1px solid #c7d2fe; border-radius: 10px; padding: .45rem .9rem; }
.cm-search-ctx a { color: var(--cm-primary); font-weight: 600; text-decoration: none; white-space: nowrap; }
