/* =========================================================
   Dreamy Mockups — mobile-first glassmorphic dark theme
   ========================================================= */

:root{
  --bg-base: #08090d;
  --bg-raised: #0f1017;
  --bg-raised-2: #14151f;
  --border-soft: rgba(255,255,255,0.08);
  --border-softer: rgba(255,255,255,0.05);
  --text-primary: #f2f1f7;
  --text-secondary: #a8a6b8;
  --text-muted: #6b6980;
  --accent-primary: #8b5cf6;
  --accent-glow: #06b6d4;
  --danger: #f36a6a;
  --success: #4ade80;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --shadow-soft: 0 8px 30px rgba(0,0,0,0.45);
  font-size: 16px;
}

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

html, body{
  margin: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body{
  background-image:
    radial-gradient(circle at 15% -10%, rgba(139,92,246,0.16), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(6,182,212,0.12), transparent 40%);
  background-attachment: fixed;
}

a{ color: inherit; }
img{ max-width: 100%; display: block; }
button{ font-family: inherit; }
input, select, textarea{ font-family: inherit; }

/* ---------- Glass primitive ---------- */
.glass{
  background: rgba(20, 21, 31, 0.62);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

/* ---------- Notices / banners ---------- */
.notice{
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 0 0 14px;
  border: 1px solid var(--border-soft);
}
.notice--info{ background: rgba(139,92,246,0.12); border-color: rgba(139,92,246,0.35); }
.notice--error{ background: rgba(243,106,106,0.12); border-color: rgba(243,106,106,0.4); color: #ffb4b4; }
.notice--success{ background: rgba(74,222,128,0.1); border-color: rgba(74,222,128,0.35); color: #b9f5cd; }
.notice--banner{ background: rgba(6,182,212,0.1); border-color: rgba(6,182,212,0.35); }

.banner{
  background: linear-gradient(90deg, rgba(139,92,246,0.25), rgba(6,182,212,0.2));
  color: var(--text-primary);
  text-align: center;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-soft);
}

/* =========================================================
   Auth screens
   ========================================================= */
.auth-body{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 18px;
  position: relative;
  overflow: hidden;
}

.auth-glow{
  position: absolute;
  width: 60vw;
  height: 60vw;
  max-width: 480px;
  max-height: 480px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}
.auth-glow--violet{ background: var(--accent-primary); top: -10%; left: -20%; }
.auth-glow--cyan{ background: var(--accent-glow); bottom: -15%; right: -15%; }

.auth-card{
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 32px 26px;
}

.auth-brand{ display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-brand__mark{ font-size: 1.4rem; color: var(--accent-primary); text-shadow: 0 0 18px var(--accent-primary); }
.auth-brand__name{ font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; }
.auth-tagline{ color: var(--text-secondary); font-size: 0.9rem; margin: 0 0 22px; }
.auth-form{ display: flex; flex-direction: column; gap: 14px; }
.auth-footnote{ color: var(--text-muted); font-size: 0.78rem; text-align: center; margin: 20px 0 0; }

/* =========================================================
   Fields & buttons
   ========================================================= */
.field{ display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; flex: 1; }
.field--sm{ min-width: 130px; }
.field__label{ font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; }
.field-row{ display: flex; gap: 12px; }
.field-row--wrap{ flex-wrap: wrap; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], textarea, select{
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
  width: 100%;
}
input:focus, textarea:focus, select:focus{
  border-color: var(--accent-primary);
  background: rgba(139,92,246,0.06);
}
input[type="color"]{
  width: 100%; height: 44px; padding: 4px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft); background: rgba(255,255,255,0.04);
}
textarea{ resize: vertical; }

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s ease, filter .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active{ transform: scale(0.97); }
.btn--block{ width: 100%; }
.btn--grow{ flex: 1; }
.btn--small{ padding: 9px 14px; font-size: 0.85rem; }
.btn--primary{
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-glow));
  color: #08090d;
  box-shadow: 0 6px 24px rgba(139,92,246,0.35);
}
.btn--primary:hover{ filter: brightness(1.08); }
.btn--secondary{
  background: rgba(139,92,246,0.14);
  border-color: rgba(139,92,246,0.35);
  color: var(--text-primary);
}
.btn--ghost{
  background: rgba(255,255,255,0.05);
  border-color: var(--border-soft);
  color: var(--text-primary);
}
.btn--danger{
  background: rgba(243,106,106,0.12);
  border-color: rgba(243,106,106,0.35);
  color: #ffb4b4;
}
.upload-btn{ cursor: pointer; margin-top: 4px; }

/* =========================================================
   Studio header / nav
   ========================================================= */
.studio-header{
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(8,9,13,0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-softer);
}
.studio-header__brand{ display: flex; align-items: center; gap: 8px; min-width: 0; max-height: 40px; overflow: hidden; }
.brand-mark{ color: var(--accent-primary); text-shadow: 0 0 14px var(--accent-primary); }
.brand-name{ font-weight: 600; font-size: 1.05rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-header__nav{ display: flex; gap: 8px; }
.icon-btn{
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-soft);
  text-decoration: none;
  font-size: 1rem;
}

/* =========================================================
   Canvas stage
   ========================================================= */
.studio-main{
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  min-height: calc(100dvh - var(--studio-top));
}

.canvas-stage{
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  position: relative;
  min-height: 45vh;
}
.canvas-stage__inner{
  position: relative;
  max-width: 100%;
  max-height: 52vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#previewCanvas{
  max-width: 100%;
  max-height: 52vh;
  width: auto;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  touch-action: pinch-zoom;
}
.canvas-empty{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 20px;
  pointer-events: none;
}
.canvas-stage__zoom{
  position: absolute;
  bottom: 10px;
  right: 16px;
}
.chip{
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
}

/* =========================================================
   Bottom drawer
   ========================================================= */
.drawer{
  min-width: 0;
  border-radius: 24px 24px 0 0;
  padding: 10px 16px 16px;
  position: relative;
}
.drawer__handle{
  width: 40px; height: 4px;
  background: var(--border-soft);
  border-radius: 999px;
  margin: 4px auto 12px;
}
.drawer__tabs{
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.admin-tabs{ margin: 0 0 20px; }
.tab-btn{
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.is-active{
  background: linear-gradient(135deg, rgba(139,92,246,0.9), rgba(6,182,212,0.85));
  color: #08090d;
}
.drawer__panel.is-hidden, .admin-panel.is-hidden{ display: none; }

/* ---------- Template dropdown (collapsible menu) ---------- */
.tpl-dropdown{
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  margin-bottom: 4px;
  overflow: hidden;
}
.tpl-dropdown__trigger{
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-primary); text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.tpl-dropdown__thumb{
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 8px; background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: 1rem; color: var(--text-muted);
}
.tpl-dropdown__thumb img{ width: 100%; height: 100%; object-fit: contain; }
.tpl-dropdown__label{ flex: 1; min-width: 0; font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-dropdown__label small{ display: block; font-weight: 400; font-size: 0.7rem; color: var(--text-muted); }
.tpl-dropdown__chev{ flex-shrink: 0; color: var(--text-secondary); transition: transform .2s ease; font-size: 0.9rem; }
.tpl-dropdown.is-open .tpl-dropdown__chev{ transform: rotate(180deg); }
.tpl-dropdown__menu{ display: none; padding: 0 12px 12px; border-top: 1px solid var(--border-softer); }
.tpl-dropdown.is-open .tpl-dropdown__menu{ display: block; padding-top: 12px; }

/* ---------- Template grid: virtualized (only visible rows exist in the DOM) ---------- */
.template-carousel{
  position: relative;
  height: min(46vh, 340px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  contain: strict;
}
.template-carousel__inner{ position: relative; width: 100%; }
.template-thumb{
  position: absolute; left: 0; top: 0;
  min-width: 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer; color: inherit;
  will-change: transform;
}
.template-thumb__img{
  width: 100%; aspect-ratio: 1 / 1; flex: 0 0 auto;
  border-radius: 8px; background: rgba(255,255,255,0.07);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.template-thumb__img img{ width: 100%; height: 100%; object-fit: contain; }
.template-thumb span.template-thumb__name{
  width: 100%;
  font-size: 0.64rem; color: var(--text-secondary); text-align: center; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.template-thumb.is-active{ border-color: var(--accent-primary); background: rgba(139,92,246,0.14); }
.template-thumb.is-active .template-thumb__name{ color: var(--text-primary); }

.control-row{ margin-bottom: 16px; }
.control-row__label{ display: block; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 8px; }
.control-row--switch{ display: flex; align-items: center; justify-content: space-between; }

.segmented{ display: flex; gap: 6px; flex-wrap: wrap; }
.segmented__item{
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
}
.segmented__item.is-active{
  background: rgba(139,92,246,0.18);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.swatch-row{ display: flex; gap: 10px; flex-wrap: wrap; }
.swatch{
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
  background: var(--sw);
  cursor: pointer;
}
.swatch.is-active{ border-color: #fff; }



.switch{ position: relative; display: inline-block; width: 44px; height: 26px; }
.switch input{ opacity: 0; width: 0; height: 0; position: absolute; }
.switch__track{
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  transition: background .15s ease;
}
.switch__track::before{
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s ease;
}
.switch input:checked + .switch__track{ background: linear-gradient(135deg, var(--accent-primary), var(--accent-glow)); }
.switch input:checked + .switch__track::before{ transform: translateX(18px); }
.switch-inline{ display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-secondary); }

/* =========================================================
   Sticky action bar
   ========================================================= */
.action-bar{
  position: sticky;
  bottom: 0;
  left: 0; right: 0;
  width: 100%; max-width: 100%;
  display: flex;
  gap: 8px;
  padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(8,9,13,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-softer);
  overflow: hidden;
}
/* Every button shares the width equally and shrinks instead of overflowing. */
.action-bar > .btn{
  flex: 1 1 0; min-width: 0; max-width: 100%;
  padding: 12px 6px; margin: 0;
  font-size: clamp(0.74rem, 3.4vw, 0.92rem);
  line-height: 1.1; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  gap: 6px;
}
.action-bar > .btn .btn__label{ min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.action-bar .is-hidden{ display: none !important; }
.btn__count{
  flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: rgba(139,92,246,0.35); font-size: 0.7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn__count:empty{ display: none; }
.upload-btn.is-disabled{ opacity: .5; pointer-events: none; }
.btn:disabled{ opacity: .55; cursor: not-allowed; }

/* =========================================================
   Toast
   ========================================================= */
.toast{
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20,21,31,0.92);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 50;
}
.toast.is-visible{ opacity: 1; transform: translateX(-50%) translateY(0); }

/* =========================================================
   Admin
   ========================================================= */
.admin-main{ max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.card{ padding: 20px; margin-bottom: 18px; }
.card h2{ margin: 0 0 16px; font-size: 1.05rem; }

.list{ display: flex; flex-direction: column; gap: 10px; }
.list-item{
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
}
.list-item__main{ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-item__controls{ display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list-item__controls select, .list-item__controls input[type="text"]{ width: auto; min-width: 120px; }
.list-item__delete{ display: flex; justify-content: flex-end; margin-top: -6px; }

.tag{
  font-size: 0.68rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(139,92,246,0.15);
  color: var(--text-secondary);
  text-transform: capitalize;
}
.tag--muted{ background: rgba(255,255,255,0.06); }

.empty-hint{ color: var(--text-muted); font-size: 0.85rem; }

.template-editor{ border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: rgba(255,255,255,0.03); padding: 10px 12px; }
.template-editor summary{
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
}
.template-editor summary::-webkit-details-marker{ display: none; }
.template-editor__thumb{ width: 34px; height: 34px; object-fit: contain; border-radius: 6px; background: rgba(255,255,255,0.05); }
.template-editor__form{ margin-top: 14px; }

/* =========================================================
   Desktop scale-up
   ========================================================= */
@media (min-width: 860px){
  .studio-main{
    display: grid;
    grid-template-columns: 1fr 380px;
    align-items: stretch;
  }
  .canvas-stage{ min-height: calc(100dvh - var(--studio-top)); }
  .canvas-stage__inner{ max-height: 78vh; }
  #previewCanvas{ max-height: 78vh; }
  .drawer{
    border-radius: 0;
    border-left: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--studio-top));
    overflow-y: auto;
  }
  .drawer__handle{ display: none; }
  .action-bar{
    grid-column: 2;
    position: sticky;
    bottom: 0;
  }
}

/* =========================================================
   Watermark RGB color sliders
   ========================================================= */
.rgb-sliders{ display: flex; flex-direction: column; gap: 8px; }
.rgb-slider-row{ display: flex; align-items: center; gap: 10px; }
.rgb-slider-label{
  width: 18px; flex-shrink: 0; text-align: center;
  font-size: 0.78rem; font-weight: 700;
}
.rgb-slider-label--r{ color: #ff6b6b; }
.rgb-slider-label--g{ color: #4ade80; }
.rgb-slider-label--b{ color: #60a5fa; }
.rgb-slider-row input[type="range"]{ flex: 1; }
.rgb-slider-value{
  width: 32px; flex-shrink: 0; text-align: right;
  font-size: 0.76rem; color: var(--text-secondary); font-variant-numeric: tabular-nums;
}
.wm-color-preview-row{ display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.wm-color-preview{
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  border: 1px solid var(--border-soft); background: #ffffff;
}


/* =========================================================
   Studio: Shop bar, upload button, numeric controls
   ========================================================= */
:root{ --studio-top: 62px; }

.shop-pill{
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px 0 11px;
  border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-glow));
  color: #08090d; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 4px 14px rgba(139,92,246,0.35);
  align-self: center; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.shop-pill:active{ transform: scale(0.96); }
.shop-pill__icon{ font-size: 0.95rem; line-height: 1; }
.studio-header__nav{ align-items: center; }

.action-bar .upload-btn{ margin: 0; white-space: nowrap; padding-left: 14px; padding-right: 14px; }
.action-bar .btn--ghost{ padding-left: 14px; padding-right: 14px; }

.num-field{ display: flex; align-items: center; gap: 8px; }
.num-field input[type="number"]{ width: 110px; max-width: 45%; text-align: center; -moz-appearance: textfield; }
.num-field__unit{ font-size: 0.8rem; color: var(--text-muted); }
.num-field__hint{ font-size: 0.72rem; color: var(--text-muted); }

.control-row--full{ width: 100%; }
.control-row--full input[type="range"]{ display: block; width: 100%; }
.range-head{ display: flex; align-items: center; justify-content: space-between; }
.range-head .control-row__label{ margin-bottom: 8px; }
.range-value{ font-size: 0.78rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }


/* =========================================================
   Search bars — one polished style for every <input type="search">
   ========================================================= */
input[type="search"]{
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 44px;
  padding: 0 40px 0 42px;
  font-size: 0.9rem; line-height: 1.2;
  color: var(--text-primary);
  background-color: rgba(255,255,255,0.05);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a8a6b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 15px center; background-size: 17px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  outline: none;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
input[type="search"]::placeholder{ color: var(--text-muted); opacity: 1; }
input[type="search"]:hover{ border-color: rgba(255,255,255,0.16); }
input[type="search"]:focus{
  border-color: var(--accent-primary);
  background-color: rgba(139,92,246,0.08);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.18);
}
input[type="search"]::-webkit-search-decoration{ -webkit-appearance: none; }
input[type="search"]::-webkit-search-cancel-button{
  -webkit-appearance: none; appearance: none;
  height: 18px; width: 18px; margin-right: -22px; cursor: pointer; opacity: 0.7;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f2f1f7' stroke-width='2.4' stroke-linecap='round'%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3C/svg%3E") center / 12px no-repeat;
  border-radius: 50%; background-color: rgba(255,255,255,0.12);
}
input[type="search"]::-webkit-search-cancel-button:hover{ opacity: 1; }


/* =========================================================
   Lockscreen clock editor (Lockscreen tab)
   ========================================================= */
.drawer__tabs .tab-btn{ font-size: 0.78rem; padding: 10px 4px; white-space: nowrap; }

.ls-hint{ margin: -6px 0 14px; }
.ls-body.is-off{ opacity: 0.45; }
.ls-muted{ color: var(--text-muted); font-weight: 400; }
.ls-gradient-only.is-hidden{ display: none; }
.ls-inline{ display: flex; gap: 8px; align-items: center; }
.ls-inline input{ flex: 1; min-width: 0; }

.ls-group{
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  margin-bottom: 10px;
}
.ls-group > summary{
  list-style: none; cursor: pointer;
  padding: 13px 14px; font-size: 0.86rem; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.ls-group > summary::-webkit-details-marker{ display: none; }
.ls-group > summary::after{ content: "▾"; color: var(--text-secondary); transition: transform .2s ease; }
.ls-group[open] > summary::after{ transform: rotate(180deg); }
.ls-group__body{ padding: 4px 14px 6px; border-top: 1px solid var(--border-softer); padding-top: 14px; }

.ls-slot{
  display: grid; grid-template-columns: 22px 92px 1fr 1fr; gap: 6px; align-items: center;
  margin-bottom: 8px;
}
.ls-slot__n{ font-size: 0.74rem; color: var(--text-muted); text-align: center; }
.ls-slot select, .ls-slot input{ padding: 9px 8px; font-size: 0.82rem; min-width: 0; }
.ls-slot input:disabled{ opacity: 0.4; }

.field-hint{ font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; margin: 0 0 10px; }

/* ---- Custom site logo (replaces the ✦ mark) ---- */
/* Logo is boxed in: whatever is uploaded can never push the header out of shape. */
.brand-logo{ display: block; width: auto; height: auto; max-height: 40px; max-width: min(160px, 38vw); object-fit: contain; border-radius: 8px; flex: 0 1 auto; }
.auth-brand .brand-logo{ max-height: 48px; max-width: 200px; border-radius: 10px; }

/* ---- Lockscreen presets ---- */
.ls-presets{ border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: rgba(255,255,255,0.03); padding: 12px; margin: 0 0 14px; }
.ls-presets__head{ display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ls-presets__slots{ display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ls-preset{
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-soft); background: rgba(255,255,255,0.04);
  color: var(--text-secondary); font-size: 0.8rem; font-family: inherit;
}
.ls-preset__label{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.ls-preset__dot{ width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; border: 1px solid var(--text-muted); }
.ls-preset.is-filled .ls-preset__dot{ background: var(--accent-glow); border-color: var(--accent-glow); box-shadow: 0 0 8px var(--accent-glow); }
.ls-preset.is-active{ border-color: var(--accent-primary); background: rgba(139,92,246,0.16); color: var(--text-primary); }
.ls-presets__name input{
  width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--border-soft);
  color: var(--text-primary); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 0.85rem; outline: none; margin-bottom: 10px;
}
.ls-presets__name input:focus{ border-color: var(--accent-primary); }
.ls-presets__actions{ display: flex; gap: 8px; flex-wrap: wrap; }
.ls-presets__actions .btn{ flex: 1 1 auto; }
.ls-presets__actions .btn:disabled{ opacity: 0.4; cursor: not-allowed; }
.ls-custom-font{
  width: 100%; margin-top: 8px; background: rgba(255,255,255,0.04); border: 1px solid var(--border-soft);
  color: var(--text-primary); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.9rem;
}
#panel-lockscreen select[data-ls="textFont"]{
  width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--border-soft);
  color: var(--text-primary); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.9rem;
}
/* Admin master "select all" switch in its half-selected state */
.switch input:indeterminate + .switch__track{ background: linear-gradient(135deg, rgba(139,92,246,0.55), rgba(6,182,212,0.4)); }


/* =========================================================
   Sliders + − / + steppers (touch friendly, no scroll hijack)
   ========================================================= */
input[type="range"]{
  -webkit-appearance: none; appearance: none;
  flex: 1 1 auto; width: 100%; min-width: 0; height: 36px; margin: 0;
  background: transparent; cursor: pointer;
  touch-action: pan-y;          /* horizontal drags move the thumb; vertical still scrolls */
  -webkit-tap-highlight-color: transparent;
}
input[type="range"]::-webkit-slider-runnable-track{ height: 6px; border-radius: 999px; background: rgba(255,255,255,0.16); }
input[type="range"]::-moz-range-track{ height: 6px; border-radius: 999px; background: rgba(255,255,255,0.16); }
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -10px;
  border-radius: 50%; background: #fff; border: 3px solid var(--accent-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
}
input[type="range"]::-moz-range-thumb{
  width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--accent-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
}
input[type="range"]:focus-visible{ outline: 2px solid var(--accent-primary); outline-offset: 4px; border-radius: 8px; }

.stepper{ display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.stepper__btn{
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border-soft); background: rgba(255,255,255,0.06); color: var(--text-primary);
  font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.stepper__btn:active{ background: rgba(139,92,246,0.35); border-color: var(--accent-primary); }
.rgb-slider-row .stepper{ flex: 1; }
.rgb-slider-row .stepper__btn{ width: 30px; height: 30px; font-size: 1rem; }

/* Dark dropdowns: the open list must stay readable on every OS / browser. */
select, select.dark-select{ color-scheme: dark; background-color: #14151f; color: var(--text-primary); }
select option, select optgroup{ background-color: #14151f; color: #f2f1f7; }
select option:checked{ background-color: #2a2540; color: #fff; }

/* Watermark colour + numeric fields */
.wm-color-top{ display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.wm-color-picker{ flex: 0 0 52px !important; width: 52px !important; height: 44px; padding: 3px; }
.wm-hex{ flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; text-transform: lowercase; }
.wm-hex.is-invalid{ border-color: var(--danger); background: rgba(243,106,106,0.08); }
.num-inline{ display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 0.8rem; }
.num-inline input[type="number"]{ width: 72px; padding: 6px 8px; text-align: center; font-size: 0.85rem; -moz-appearance: textfield; }
.num-inline input[type="number"]::-webkit-outer-spin-button, .num-inline input[type="number"]::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
.range-head .control-row__label{ margin-bottom: 4px; }
.ls-group__body.is-off .co-controls{ opacity: .45; }
.ls-split-only.is-hidden{ display: none; }

/* Canvas loading hint */
.canvas-stage.is-loading #previewCanvas{ opacity: .55; transition: opacity .15s ease; }

/* =========================================================
   Confirmation modal (replaces window.confirm)
   ========================================================= */
.dm-modal{
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(0,0,0,0.7); opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.dm-modal.is-open{ opacity: 1; pointer-events: auto; }
.dm-modal__card{
  width: 100%; max-width: 380px; background: rgba(20,21,31,0.98); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-soft);
  transform: scale(.94); transition: transform .15s ease;
}
.dm-modal.is-open .dm-modal__card{ transform: scale(1); }
.dm-modal__title{ margin: 0 0 8px; font-size: 1.05rem; }
.dm-modal__msg{ margin: 0 0 14px; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.45; }
.dm-modal__list{ max-height: 160px; overflow-y: auto; margin: 0 0 14px; padding: 8px 10px; border-radius: var(--radius-sm); background: rgba(255,255,255,0.04); font-size: 0.8rem; color: var(--text-secondary); }
.dm-modal__list div{ padding: 2px 0; }
.dm-modal__actions{ display: flex; gap: 10px; justify-content: flex-end; }
.dm-modal__actions .btn{ min-width: 92px; }
