/* ==========================================================================
   PROPIXEL BY THANH HƯỞNG — 100% SHOTPIK DASHBOARD DESIGN SYSTEM
   Light & Dark Tokens · Mobile-First & Laptop Responsive · Hardware Accelerated
   ========================================================================== */

:root {
  --sp-bg: #f5f5f7;
  --sp-surface: #ffffff;
  --sp-surface-alt: #f9f9fb;
  --sp-ink: #1d1d1f;
  --sp-muted: #6e6e73;
  --sp-faint: #aeaeb2;
  --sp-fill: rgba(118, 118, 128, 0.12);
  --sp-fill-hover: rgba(118, 118, 128, 0.20);
  --sp-hairline: rgba(0, 0, 0, 0.08);
  --sp-border-strong: rgba(0, 0, 0, 0.14);
  --sp-red: #cc2c2c;
  --sp-red-hover: #a92222;
  --sp-red-soft: rgba(204, 44, 44, 0.10);
  --sp-blue: #0a64d8;
  --sp-yellow: #e8a317;
  --sp-green: #16a34a;
  --sp-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.65));
  --sp-glass-border: rgba(255, 255, 255, 0.78);
  --sp-glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 8px 32px rgba(29, 29, 31, 0.08);
  --sp-shadow-pill: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  --sp-shadow-card: 0 2px 10px rgba(0, 0, 0, 0.04);
  --sp-shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.22);
  --sp-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --sp-mono: "Cascadia Code", Consolas, "Courier New", monospace;
}

html.dark body.sp-dash {
  --sp-bg: #111113;
  --sp-surface: #1c1c1f;
  --sp-surface-alt: #242428;
  --sp-ink: #f2f2f4;
  --sp-muted: #9a9aa1;
  --sp-faint: #5c5c63;
  --sp-fill: rgba(255, 255, 255, 0.08);
  --sp-fill-hover: rgba(255, 255, 255, 0.14);
  --sp-hairline: rgba(255, 255, 255, 0.10);
  --sp-border-strong: rgba(255, 255, 255, 0.18);
  --sp-red: #d63a35;
  --sp-red-hover: #e4504a;
  --sp-red-soft: rgba(214, 58, 53, 0.16);
  --sp-glass: linear-gradient(135deg, rgba(38, 38, 42, 0.86), rgba(28, 28, 31, 0.74));
  --sp-glass-border: rgba(255, 255, 255, 0.10);
  --sp-glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --sp-shadow-pill: 0 1px 3px rgba(0, 0, 0, 0.4);
  --sp-shadow-card: 0 4px 14px rgba(0, 0, 0, 0.28);
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sp-font);
  background: var(--sp-bg);
  color: var(--sp-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

img, video, canvas, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Container & Layout */
.sp-container {
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 0 24px;
}

.sp-main {
  padding: 14px 0 calc(72px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 768px) {
  .sp-container {
    padding: 0 12px;
  }
}

/* ==========================================================================
   FLOATING GLASS HEADER (.sp-glass + .sp-header--rows on mobile)
   ========================================================================== */

.sp-header {
  position: sticky;
  top: max(8px, env(safe-area-inset-top, 8px));
  z-index: 90;
  padding: 0 20px;
}

.sp-topbar {
  max-width: 1460px;
  margin: 0 auto;
  background: var(--sp-glass);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--sp-glass-border);
  box-shadow: var(--sp-glass-shadow);
  border-radius: 999px;
  padding: 6px 8px 6px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  overflow: visible;
}

.sp-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-brand-by {
  font-size: 11px;
  font-weight: 600;
  color: var(--sp-muted);
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-nav-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.sp-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.sp-quota-text {
  font-size: 12.5px;
  color: var(--sp-muted);
  font-weight: 500;
  padding: 0 6px;
  white-space: nowrap;
}

.sp-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--sp-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  position: relative;
  transition: background 0.15s ease;
}

.sp-icon-btn:hover {
  background: var(--sp-fill);
}

.sp-badge-dot {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sp-red);
}

.sp-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--sp-surface);
  background: linear-gradient(135deg, #cc2c2c, #881337);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--sp-shadow-pill);
}

.sp-mobile-nav-row {
  display: none;
}

@media (max-width: 960px) {
  .sp-quota-text, .sp-guide-label {
    display: none;
  }
}

@media (max-width: 768px) {
  .sp-header {
    padding: 0 10px;
    top: max(6px, env(safe-area-inset-top, 6px));
  }
  .sp-topbar-nav {
    display: none;
  }
  .sp-mobile-nav-row {
    display: flex;
    width: 100%;
    max-width: 100%;
    margin: 8px auto 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sp-mobile-nav-row::-webkit-scrollbar {
    display: none;
  }
  .sp-quick-create-hdr {
    display: none !important;
  }
  .sp-popover {
    max-width: calc(100vw - 24px);
    right: 0;
  }
}

@media (max-width: 520px) {
  .sp-topbar {
    padding: 5px 6px 5px 12px;
    gap: 6px;
    min-height: 46px;
  }
  .sp-brand {
    font-size: 16px;
    gap: 4px;
  }
  .sp-brand-by {
    font-size: 10px;
  }
  .sp-topbar--detail .sp-brand {
    flex-shrink: 0;
    overflow: visible;
  }
  .sp-topbar--detail .sp-brand-by {
    display: none;
  }
  .sp-back-label-full {
    display: none;
  }
  .sp-back-label-short {
    display: inline !important;
  }
  .sp-header-right {
    gap: 2px;
    flex-shrink: 0;
  }
  .sp-icon-btn {
    width: 30px;
    height: 30px;
    font-size: 13.5px;
  }
  .sp-avatar-btn {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }
  .sp-guide-btn {
    display: none;
  }
  .sp-mobile-nav-row .sp-segmented {
    width: max-content;
  }
  .sp-mobile-nav-row .sp-segmented__item {
    padding: 0 11px;
    font-size: 12px;
    height: 29px;
  }
}

/* Popover & Dropdown Menus */
.sp-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 270px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-hairline);
  border-radius: 18px;
  padding: 8px;
  box-shadow: var(--sp-shadow-modal);
  z-index: 120;
}

.sp-popover-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--sp-hairline);
  margin-bottom: 4px;
}

.sp-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--sp-ink);
  text-align: left;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sp-menu-item:hover {
  background: var(--sp-fill);
}

/* ==========================================================================
   SHOTPIK PILLS & SEGMENTED CONTROLS
   ========================================================================== */

.sp-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.sp-pill:active {
  transform: scale(0.97);
}

.sp-pill--primary {
  background: var(--sp-red);
  color: #ffffff;
}

.sp-pill--primary:hover {
  background: var(--sp-red-hover);
}

.sp-pill--outline {
  background: var(--sp-surface);
  color: var(--sp-ink);
  border-color: var(--sp-hairline);
  box-shadow: var(--sp-shadow-pill);
}

.sp-pill--outline:hover {
  background: var(--sp-surface-alt);
}

.sp-pill--gray {
  background: var(--sp-fill);
  color: var(--sp-ink);
}

.sp-pill--gray:hover {
  background: var(--sp-fill-hover);
}

.sp-pill--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
}

.sp-pill--icon {
  width: 36px;
  padding: 0;
}

.sp-segmented {
  display: inline-flex;
  align-items: center;
  background: var(--sp-fill);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sp-segmented::-webkit-scrollbar {
  display: none;
}

.sp-segmented__item {
  border: none;
  background: transparent;
  color: var(--sp-muted);
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.sp-segmented__item:hover {
  color: var(--sp-ink);
}

.sp-segmented__item--active {
  background: var(--sp-surface);
  color: var(--sp-ink);
  font-weight: 600;
  box-shadow: var(--sp-shadow-pill);
}

/* ==========================================================================
   ALBUMS DASHBOARD PAGE (Exact Match to shotpik.com/dashboard)
   ========================================================================== */

.sp-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.sp-h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.sp-subtitle {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--sp-muted);
}

.sp-head-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sp-search-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  width: 280px;
  background: var(--sp-fill);
  border-radius: 999px;
  padding: 0 14px;
}

.sp-search-pill input {
  border: none;
  background: transparent;
  color: var(--sp-ink);
  font-size: 13.5px;
  width: 100%;
  outline: none;
}

.sp-search-pill input::placeholder {
  color: var(--sp-muted);
}

.sp-select-pill {
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: none;
  background: var(--sp-fill);
  color: var(--sp-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.sp-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

@media (max-width: 768px) {
  .sp-search-pill {
    width: 100%;
  }
  .sp-head-controls {
    width: 100%;
  }
  .sp-toolbar-row {
    overflow-x: auto;
    flex-wrap: wrap;
  }
}

/* Album Grid: 6 cols desktop -> 4 laptop -> 3 tablet -> 2 mobile */
.sp-album-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px 18px;
}

@media (max-width: 1400px) {
  .sp-album-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .sp-album-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sp-album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .sp-album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
}

.sp-album-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
}

.sp-album-thumb {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  overflow: hidden;
  background: var(--sp-fill);
  margin-bottom: 9px;
  box-shadow: var(--sp-shadow-card);
}

.sp-album-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.28s ease;
}

.sp-album-card:hover .sp-album-thumb img {
  transform: scale(1.03);
}

.sp-album-status-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(17, 18, 20, 0.72);
  color: #ffffff;
  backdrop-filter: blur(8px);
}

.sp-album-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--sp-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.sp-album-meta {
  font-size: 12.5px;
  color: var(--sp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-album-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--sp-muted);
  margin-top: 2px;
}

/* Album List View (Dạng nằm ngang) */
.sp-album-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-album-list-row {
  background: var(--sp-surface);
  border: 1px solid var(--sp-hairline);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  box-shadow: var(--sp-shadow-card);
}

.sp-album-list-row:hover {
  border-color: var(--sp-border-strong);
}

.sp-list-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--sp-fill);
}

/* ==========================================================================
   ALBUM DETAIL & CLIENT PROOFING
   ========================================================================== */

.sp-card {
  background: var(--sp-surface);
  border: 1px solid var(--sp-hairline);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--sp-shadow-card);
}

.sp-cover-banner {
  position: relative;
  height: 220px;
  border-radius: 22px;
  overflow: hidden;
  background: #1c1c1f;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  padding: 24px;
}

@media (max-width: 640px) {
  .sp-cover-banner {
    height: 185px;
    padding: 56px 16px 16px;
  }
  .sp-h1 {
    font-size: 26px;
  }
  .sp-pick-check {
    height: 22px;
    padding: 0 6px;
    font-size: 10px;
  }
}

.sp-cover-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sp-cover-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.72) 100%);
}

.sp-cover-title {
  position: relative;
  z-index: 2;
  color: #ffffff;
  font-size: clamp(1.3rem, 2.8vw, 2rem);
  font-weight: 800;
  margin: 0;
}

.sp-cover-change-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(12px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.sp-meta-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.sp-counter-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sp-count-chip {
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--sp-hairline);
  background: var(--sp-surface);
  color: var(--sp-ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sp-count-chip.active {
  background: var(--sp-ink);
  color: var(--sp-surface);
  border-color: var(--sp-ink);
}

.sp-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

@media (max-width: 600px) {
  .sp-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

.sp-photo-card {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 14px;
  overflow: hidden;
  background: var(--sp-fill);
  border: 3px solid transparent;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 220px 275px;
}

.sp-photo-card.is-liked {
  border-color: var(--sp-red);
}

.sp-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sp-photo-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, transparent 32%, transparent 65%, rgba(0,0,0,0.6) 100%);
  pointer-events: none;
}

.sp-photo-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sp-photo-bottom {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.sp-circle-act {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.16);
}

.sp-circle-act.liked {
  background: var(--sp-red);
  color: #ffffff;
}

.sp-circle-act.starred {
  background: var(--sp-yellow);
  color: #111113;
}

.sp-pick-check {
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.6);
  background: rgba(17, 18, 20, 0.55);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.sp-pick-check.checked {
  background: var(--sp-red);
  border-color: var(--sp-red);
}

/* Sticky Client Bottom Bar */
.sp-client-bar {
  position: sticky;
  bottom: 14px;
  z-index: 65;
  max-width: 780px;
  margin: 24px auto 0;
  background: rgba(28, 28, 31, 0.94);
  backdrop-filter: blur(18px);
  color: #ffffff;
  border-radius: 999px;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: var(--sp-shadow-modal);
}

@media (max-width: 600px) {
  .sp-client-bar {
    border-radius: 20px;
    padding: 10px;
  }
}

/* Lightbox */
.sp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(10, 10, 12, 0.96);
  color: #ffffff;
  display: grid;
  grid-template-columns: 1fr 360px;
}

@media (max-width: 960px) {
  .sp-lightbox {
    grid-template-columns: 1fr;
    grid-template-rows: 52vh 1fr;
    overflow-y: auto;
  }
  .sp-lb-stage {
    padding: 54px 44px 12px;
    min-height: 52vh;
    overflow: hidden;
  }
  .sp-lb-media {
    max-height: calc(52vh - 68px);
  }
  .sp-lb-media img {
    max-height: calc(52vh - 68px);
  }
  .sp-lb-side {
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.12);
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .sp-lb-nav {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

.sp-lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 54px;
}

.sp-lb-media {
  position: relative;
  max-width: 100%;
  max-height: 86vh;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sp-lb-media img {
  max-width: 100%;
  max-height: 84vh;
  border-radius: 10px;
}

.sp-brush-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.sp-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.sp-lb-side {
  background: #17171a;
  border-left: 1px solid rgba(255,255,255,0.1);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Before / After Drag Slider */
.ba-container {
  position: relative;
  width: 100%;
  max-width: 780px;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  overflow: hidden;
  user-select: none;
  background: #000;
}

.ba-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ba-before-clip {
  position: absolute;
  inset: 0;
}

.ba-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #fff;
  cursor: ew-resize;
}

.ba-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sp-red);
  color: #fff;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

/* Modals & Forms */
.sp-modal-root {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(6px);
}

.sp-modal-root.open {
  display: flex;
}

.sp-modal-card {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--sp-surface);
  color: var(--sp-ink);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--sp-shadow-modal);
  border: 1px solid var(--sp-hairline);
}

.sp-modal-card.large {
  max-width: 860px;
}

.sp-form-group {
  margin-bottom: 14px;
}

.sp-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.sp-input, .sp-select, .sp-textarea {
  width: 100%;
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid var(--sp-border-strong);
  background: var(--sp-surface);
  color: var(--sp-ink);
  font-size: 13.5px;
  outline: none;
}

.sp-input:focus, .sp-select:focus, .sp-textarea:focus {
  border-color: var(--sp-red);
}

.sp-switch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--sp-hairline);
  font-size: 13.5px;
}

@media (max-width: 600px) {
  .sp-modal-root {
    padding: 10px;
  }
  .sp-modal-card {
    padding: 18px 16px;
    border-radius: 20px;
    max-height: 92vh;
  }
  .sp-switch-row .sp-input,
  .sp-switch-row .sp-select {
    width: 100% !important;
    max-width: 100%;
  }
}

.sp-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sp-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 680px) {
  .sp-grid-2, .sp-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Toasts */
.sp-toast-root {
  position: fixed;
  top: 74px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.sp-toast {
  background: #1c1c1f;
  color: #ffffff;
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--sp-shadow-modal);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sp-toast.success { border-left: 4px solid var(--sp-green); }
.sp-toast.error { border-left: 4px solid var(--sp-red); }

/* Tag & Format chips */
.sp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--sp-fill);
  color: var(--sp-ink);
}

.sp-chip.active {
  background: var(--sp-red-soft);
  color: var(--sp-red);
}

@media print {
  .sp-header, .no-print { display: none !important; }
}
