:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-soft: #eef2fb;
  --muted: #667085;
  --text: #1f2937;
  --primary: #4f63cf;
  --primary-2: #3f52be;
  --border: #d9e0f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at 8% 8%, rgba(79, 99, 207, .16), transparent 42%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
body.has-mobile-app-nav {
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.05rem 1.3rem;
  background: rgba(246, 248, 253, 0.88);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

nav { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; }
nav a { color: var(--muted); }
nav a:hover { color: var(--text); text-decoration: none; }

main, .site-footer {
  max-width: 1140px;
  margin: 0 auto;
  padding: .9rem 1rem 2.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  color: #fff;
  padding: .58rem .92rem;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.03); text-decoration: none; }

.btn-ghost {
  background: var(--panel-soft);
  color: var(--text);
}

.panel {
  margin: .9rem 0;
  padding: 1rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(35, 51, 92, 0.07);
}

.grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid article,
blockquote {
  margin: 0;
  padding: .85rem;
  border-radius: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

blockquote span {
  color: var(--muted);
  display: block;
  margin-top: .5rem;
  font-size: .9rem;
}

.form-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

label { display: grid; gap: .32rem; font-weight: 500; }
.full { grid-column: 1 / -1; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .62rem;
  background: #fff;
  color: var(--text);
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(79, 99, 207, .2);
  border-color: var(--primary);
}

.site-footer { text-align: center; padding-top: 0; }
.muted { color: var(--muted); font-size: .9rem; }

.mobile-app-nav {
  display: none;
}
.global-upload-overlay{
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, .84);
  z-index: 10080;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.global-upload-overlay.is-open{
  display: flex;
}
.global-upload-dialog{
  width: min(560px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(9, 17, 37, .25);
  padding: .95rem;
}
.global-upload-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-bottom: .6rem;
}
.global-upload-close{
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: .3rem .52rem;
  cursor: pointer;
}
.global-upload-form{
  display: grid;
  gap: .55rem;
}
.global-upload-form label{
  display: grid;
  gap: .3rem;
  color: var(--muted);
  font-size: .92rem;
}
.global-upload-options{
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.global-upload-options label{
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.global-upload-options input[type="number"]{
  width: 100px;
}
.global-upload-actions{
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}
.upload-toast{
  position: fixed;
  right: 12px;
  bottom: 14px;
  z-index: 10120;
  width: min(360px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(9, 17, 37, .25);
  padding: .6rem .68rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .56rem;
  align-items: start;
  opacity: 0;
  transform: translateY(8px) scale(.985);
  transition: opacity .18s ease, transform .18s ease;
}
.upload-toast.is-visible{
  opacity: 1;
  transform: translateY(0) scale(1);
}
.upload-toast.is-error{
  border-left-color: #c25a5a;
}
.upload-toast__icon{
  font-size: 1.1rem;
  line-height: 1;
  margin-top: .1rem;
  animation: upload-toast-clink .9s ease-out 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.upload-toast__body{
  display: grid;
  gap: .18rem;
}
.upload-toast__body strong{
  font-size: .9rem;
}
.upload-toast__body span{
  font-size: .84rem;
  color: var(--muted);
}
.upload-toast__close{
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  padding: .12rem .38rem;
  line-height: 1.1;
}
@keyframes upload-toast-clink{
  0%{ transform: rotate(-8deg) translateY(-1px); opacity: .2; }
  45%{ transform: rotate(6deg) translateY(0); opacity: 1; }
  100%{ transform: rotate(0deg) translateY(0); opacity: 1; }
}
body.has-mobile-app-nav .upload-toast{
  bottom: calc(104px + env(safe-area-inset-bottom));
}

.calendar-head { margin: .8rem 0; }
.calendar-grid {
  display: grid;
  gap: .5rem;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.calendar-dow {
  font-weight: 700;
  color: var(--muted);
  font-size: .9rem;
  padding: .35rem;
}
.calendar-cell {
  min-height: 110px;
  background: #f9fbff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .4rem;
}
.calendar-cell--dim { opacity: .55; }
.calendar-date {
  font-weight: 700;
  margin-bottom: .35rem;
}
.calendar-event {
  font-size: .82rem;
  margin: .2rem 0;
  padding: .15rem .3rem;
  border-radius: 6px;
  background: #e8edfd;
}
.calendar-event span {
  color: var(--muted);
  margin-left: .3rem;
}

.creator-library-list {
  display: grid;
  gap: .65rem;
}

.creator-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: .6rem;
  align-items: center;
  padding: .6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8faff;
}

.creator-item img,
.creator-item video {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.drag-handle {
  cursor: grab;
  user-select: none;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 720px) {
  .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) and (pointer: coarse), (max-width: 1024px) and (hover: none){
  .mobile-app-nav{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 180;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: .35rem .35rem calc(.35rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(8px);
    width: 100%;
    max-width: 100vw;
  }
  .mobile-app-nav.is-subber{
    grid-template-columns: repeat(4, 1fr);
  }
  .mobile-app-nav__item{
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    font-size: .72rem;
    padding: .22rem .15rem;
    border-radius: 10px;
    transition: background-color .16s ease, color .16s ease, transform .16s ease;
  }
  .mobile-app-nav__item.is-active{
    color: var(--primary);
    background: rgba(79, 99, 207, .12);
  }
  .mobile-app-nav__item.is-active .mobile-app-nav__icon{
    transform: translateY(-1px);
  }
  .mobile-app-nav__icon{
    font-size: 1.15rem;
    line-height: 1;
    transition: transform .16s ease, color .16s ease;
  }
  .mobile-app-nav__item--plus .mobile-app-nav__icon{
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--primary), var(--primary-2));
    color: #fff;
  }
}

/* Global checkbox-to-slider styling */
label:has(> input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: .52rem;
}
input[type="checkbox"]{
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(90, 103, 146, .38);
  background: linear-gradient(180deg, rgba(110,120,148,.25), rgba(78,86,112,.2));
  box-shadow: inset 0 1px 2px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.18);
  cursor: pointer;
  transition: background .22s ease, border-color .22s ease, box-shadow .22s ease;
  vertical-align: middle;
}
input[type="checkbox"]::after{
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #dce3ff);
  box-shadow: 0 2px 5px rgba(13, 18, 34, .35);
  transition: transform .24s cubic-bezier(.2,.8,.2,1), background .2s ease;
}
input[type="checkbox"]:checked{
  background: linear-gradient(180deg, #4f63cf, #637de4);
  border-color: rgba(99,125,228,.88);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.24), 0 0 0 3px rgba(99,125,228,.18);
}
input[type="checkbox"]:checked::after{
  transform: translateX(18px);
  background: linear-gradient(180deg, #ffffff, #f0f4ff);
}
input[type="checkbox"]:disabled{
  opacity: .52;
  cursor: not-allowed;
}
