:root {
  --primary: #8B4513;
  --primary-dark: #5C2E0B;
  --primary-light: #A0522D;
  --accent: #D4AF37;
  --accent-glow: #F3E5AB;
  --bg-canvas: #0F1115;
  --bg-panel: #181B22;
  --bg-card: #222631;
  --bg-card-hover: #2B303E;
  --border: #2E3444;
  --border-focus: #D4AF37;
  --text: #F3F4F6;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-canvas);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Top Navigation Bar */
header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}

.brand-text p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
}

.status-badge.has-draft {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 14px rgba(139, 69, 19, 0.4);
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-publish {
  background: linear-gradient(135deg, #059669, #10B981);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}
.btn-publish:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Main Container (Twin-Screen Split) */
.app-container {
  display: grid;
  grid-template-columns: 56% 44%;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 69px);
}

/* Left Control Panel */
.control-panel {
  padding: 24px 32px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.panel-title h2 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.panel-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.preset-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.preset-selector select {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

/* Section Cards Container */
.section-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.section-card.inactive {
  opacity: 0.55;
  border-style: dashed;
}

.section-card:hover {
  border-color: rgba(212, 175, 55, 0.4);
}

.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-order-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.section-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.section-type-tag {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.section-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-btns {
  display: flex;
  gap: 4px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151;
  transition: .3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--success);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

.section-form-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: #fff;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus {
  border-color: var(--border-focus);
}

.banner-preview-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.banner-thumb {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  position: relative;
}

.banner-thumb img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.banner-thumb span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 10px;
  padding: 4px 6px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right Simulator Panel */
.simulator-panel {
  background: #090B0E;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.simulator-title-bar {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.simulator-title-bar span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* iPhone 16 Pro Frame */
.iphone-frame {
  width: 375px;
  height: 760px;
  background: #000;
  border-radius: 52px;
  box-shadow: 0 0 0 12px #262930, 0 0 0 14px #1A1C22, var(--shadow);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dynamic-island {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 28px;
  background: #000;
  border-radius: 20px;
  z-index: 40;
}

.status-bar {
  height: 48px;
  padding: 12px 24px 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  z-index: 30;
  background: rgba(15, 17, 21, 0.95);
}

.mobile-screen {
  flex: 1;
  background: #121316;
  overflow-y: auto;
  padding: 12px 16px 80px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mobile-screen::-webkit-scrollbar {
  width: 4px;
}
.mobile-screen::-webkit-scrollbar-thumb {
  background: #2E3444;
  border-radius: 4px;
}

.sim-card {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}

.sim-member-card {
  background: linear-gradient(135deg, #7B1113, #D4AF37);
  padding: 16px;
  border-radius: 16px;
  color: #fff;
  position: relative;
  box-shadow: 0 6px 16px rgba(123, 17, 19, 0.35);
  background-size: cover;
  background-position: center;
}

.sim-member-card.has-artwork {
  background-blend-mode: overlay;
}

.sim-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.sim-greeting {
  font-size: 13px;
  opacity: 0.9;
}
.sim-user-name {
  font-size: 18px;
  font-weight: 800;
  margin-top: 2px;
}

.sim-tier-badge {
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.2);
}

.sim-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.sim-points-val {
  font-size: 22px;
  font-weight: 800;
}
.sim-points-label {
  font-size: 10px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sim-qr-btn {
  background: rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
}

.sim-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sim-action-btn {
  background: #1C1F26;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 14px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sim-action-icon {
  font-size: 20px;
}
.sim-action-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.sim-action-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.sim-banner {
  border-radius: 14px;
  overflow: hidden;
  height: 140px;
  position: relative;
  background: #1F232B;
}
.sim-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sim-banner-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.sim-products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.sim-products-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}
.sim-products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sim-product-item {
  background: #1C1F26;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.04);
}
.sim-product-img {
  width: 100%;
  height: 80px;
  background: #282D38;
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.sim-product-name {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sim-product-price {
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
  margin-top: 3px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
