:root {
  --bg: #f3ece7;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --text: #2b1416;
  --muted: #8a6a68;
  --primary: #8b1f24;
  --primary-dark: #5e1417;
  --accent: #e0b4b1;
  --success: #2f9e44;
  --warning: #e67700;
  --danger: #c92a2a;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(80, 18, 20, 0.06), 0 18px 40px rgba(80, 18, 20, 0.13), 0 40px 80px rgba(80, 18, 20, 0.07);
  --shadow-sm: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(80, 18, 20, 0.05), 0 8px 18px rgba(80, 18, 20, 0.09);
  --shadow-hover: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 4px rgba(80, 18, 20, 0.08), 0 24px 48px rgba(80, 18, 20, 0.18), 0 50px 90px rgba(80, 18, 20, 0.1);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;

  --stat-green: #1f9d57;
  --stat-green-bg: #e5f7ec;
  --stat-blue: #2563eb;
  --stat-blue-bg: #e8f0fe;
  --stat-purple: #7c3aed;
  --stat-purple-bg: #f1e9fe;
  --stat-amber: #d97706;
  --stat-amber-bg: #fdf1e0;
}

* {
  box-sizing: border-box;
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
}

.icon-sm {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.icon-lg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: block;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(139, 31, 36, 0.06), transparent 35%),
    linear-gradient(135deg, #f6efe9 0%, #efe5e1 100%);
}

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

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

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.brand-panel {
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.brand-badge,
.login-tag,
.section-tag,
.panel-badge,
.status-pill {
  display: inline-flex;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(139, 31, 36, 0.12);
  color: var(--primary-dark);
}

.brand-panel h1,
.sidebar h1 {
  margin: 0;
  font-size: clamp(34px, 3vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.brand-panel p,
.login-header p,
.topbar p,
.panel-header p,
.stack-item p,
.sidebar p,
.panel-subheader p {
  margin: 0;
  color: var(--muted);
}

.feature-list {
  display: grid;
  gap: 16px;
}

.feature-card,
.stat-card,
.panel,
.login-card,
.user-form-card,
.user-list-card,
.modal-card {
  /* These are all used as grid/flex items; without min-width:0 a grid/flex
     item won't shrink below its content's min-content size, which forces
     the whole row (and often the whole page) to overflow horizontally. */
  min-width: 0;
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(139, 31, 36, 0.08);
  box-shadow: var(--shadow);
}

.feature-card {
  display: flex;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
}

.feature-card h3,
.panel-header h3,
.panel-subheader h4,
.user-form-card h4 {
  margin: 0 0 6px;
}

.feature-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  width: 100%;
  max-width: 460px;
  padding: 36px;
  border-radius: var(--radius-xl);
}

.login-header h2,
.topbar h2 {
  margin: 12px 0 8px;
  font-size: 34px;
}

.login-form,
.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.login-form label,
.form-grid label {
  font-weight: 600;
}

.login-form input,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(139, 31, 36, 0.16);
  border-radius: 14px;
  background: #fffdfb;
  outline: none;
}

.form-grid textarea {
  min-height: 120px;
  resize: vertical;
}

.login-form input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(139, 31, 36, 0.12);
}

.login-hint,
.login-message {
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}

.login-message.success {
  color: var(--success);
}

.login-message.error {
  color: var(--danger);
}

.primary-button,
.secondary-button {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button {
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 24px rgba(139, 31, 36, 0.22);
}

.primary-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(139, 31, 36, 0.28);
}

.primary-button:active {
  transform: translateY(0);
}

.secondary-button {
  background: rgba(139, 31, 36, 0.1);
  color: var(--primary-dark);
}

.secondary-button:hover {
  background: rgba(139, 31, 36, 0.18);
}

.inline-button {
  padding: 10px 14px;
  font-size: 14px;
}

.topbar-link-button {
  min-width: 160px;
}

.text-button-link {
  text-decoration: none;
}

.danger-button {
  background: rgba(201, 42, 42, 0.12);
  color: var(--danger);
}

.danger-button:hover {
  background: rgba(201, 42, 42, 0.18);
}

.danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sidebar .secondary-button {
  width: 100%;
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar .secondary-button:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.dashboard-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: linear-gradient(180deg, #6f1518 0%, #4a0f12 45%, #2a0809 100%);
}

.sidebar {
  padding: 32px 24px;
  /* The sidebar paints its own maroon gradient fixed to the viewport, so it
     looks identical on every page regardless of how tall the page content is.
     (Previously the gradient came from .dashboard-page and stretched to the
     full page height, making short pages look darker than tall ones.) */
  background-image:
    radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.08), transparent 45%),
    linear-gradient(180deg, #6f1518 0%, #4a0f12 55%, #2a0809 100%);
  background-attachment: scroll, fixed;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

.sidebar p {
  color: rgba(255, 255, 255, 0.75);
}

.brand-mark {
  width: 140px;
  height: 108px;
  background: url('posetopia-logo.png') left center / contain no-repeat;
  margin-bottom: 14px;
  font-size: 0;
  color: transparent;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  margin-top: 36px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding: 11px 14px;
  border-radius: 12px;
  background: transparent;
  font-weight: 500;
  font-size: 14.5px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar-nav a .icon {
  width: 18px;
  height: 18px;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  transform: translateX(2px);
}

.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

.sidebar-nav a.active .icon,
.sidebar-nav a:hover .icon {
  opacity: 1;
}

.dashboard-content {
  /* Grid items default to min-width:auto, which lets the 1fr track grow to
     fit whatever the widest unwrapped descendant needs — min-width:0 lets
     the column (and everything responsive inside it) actually shrink to
     the viewport instead of forcing horizontal overflow on the whole page. */
  min-width: 0;
  padding: 32px 36px;
  background:
    radial-gradient(circle at top right, rgba(139, 31, 36, 0.06), transparent 35%),
    linear-gradient(135deg, #f6efe9 0%, #efe5e1 100%);
  border-radius: 36px 0 0 36px;
  position: relative;
  z-index: 2;
  /* lighter offset band + deep ambient — the layered "sheet over sidebar" effect */
  box-shadow:
    -16px 0 0 rgba(255, 255, 255, 0.07),
    -40px 0 70px rgba(20, 4, 5, 0.45);
  min-height: 100vh;
}

.topbar,
.panel-header,
.stack-item,
.stat-card,
.panel-subheader {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  align-items: center;
  margin-bottom: 24px;
}

/* ===== Hero banner (dashboard) ===== */
.hero-banner {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 34px 34px 92px;
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.14), transparent 42%),
    radial-gradient(circle at 8% 95%, rgba(255, 255, 255, 0.07), transparent 45%),
    linear-gradient(120deg, #7d1a1d 0%, #5a1215 55%, #3a0b0d 100%);
  color: #ffffff;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.hero-banner::after {
  content: '';
  position: absolute;
  right: -70px;
  top: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 36px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.hero-banner::before {
  content: '';
  position: absolute;
  left: 32%;
  bottom: -90px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 26px solid rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.hero-banner h2 {
  color: #ffffff;
}

.hero-banner p {
  color: rgba(255, 255, 255, 0.78);
}

.hero-banner .section-tag,
.hero-banner .status-pill {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-banner .avatar {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(255, 255, 255, 0.25);
}

/* Stat cards float up over the hero for a layered 3D look */
.hero-banner + .stats-grid {
  margin-top: -58px;
  position: relative;
  z-index: 3;
  padding: 0 22px;
}

.topbar-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(139, 31, 36, 0.28), 0 0 0 3px rgba(255, 255, 255, 0.6);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  flex-direction: column;
  padding: 22px;
  border-radius: var(--radius-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.stat-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(139, 31, 36, 0.1);
  color: var(--primary);
  margin-bottom: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 4px 10px rgba(80, 18, 20, 0.1);
}

.stat-card-icon.green {
  background: var(--stat-green-bg);
  color: var(--stat-green);
}

.stat-card-icon.blue {
  background: var(--stat-blue-bg);
  color: var(--stat-blue);
}

.stat-card-icon.purple {
  background: var(--stat-purple-bg);
  color: var(--stat-purple);
}

.stat-card-icon.amber {
  background: var(--stat-amber-bg);
  color: var(--stat-amber);
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.stat-card h3 {
  margin: 8px 0;
  font-size: 30px;
}

.stat-card span {
  color: var(--primary);
  font-size: 14px;
}

/* ===== Revenue summary cards ===== */
.revenue-summary-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}

.rev-summary-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid rgba(139, 31, 36, 0.08);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  box-shadow: var(--shadow-sm);
}

.rev-summary-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid;
}

.rev-summary-icon.green {
  border-color: var(--stat-green);
  color: var(--stat-green);
  background: var(--stat-green-bg);
}

.rev-summary-icon.orange {
  border-color: #e05c2a;
  color: #e05c2a;
  background: #fdeee8;
}

.rev-summary-card h2 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 800;
}

.rev-summary-card p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* ===== Revenue graph panel ===== */
.revenue-graph-panel {
  margin-bottom: 20px;
}

.revenue-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 14px 0 8px;
}

.rev-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.rev-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.revenue-graph-wrap {
  overflow-x: auto;
  padding-bottom: 6px;
}

.revenue-graph-svg {
  width: 100%;
  min-width: 600px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  fill: var(--muted);
}

.revenue-graph-svg .rg-grid {
  stroke: rgba(139, 31, 36, 0.1);
  stroke-width: 1;
  fill: none;
}

.revenue-graph-svg .rg-axis-label {
  fill: var(--muted);
  font-size: 11px;
}

/* ===== Per-booth stats panels ===== */
.booth-stats-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

.booth-stats-card {
  background: var(--surface);
  border: 1px solid rgba(139, 31, 36, 0.08);
  box-shadow: var(--shadow-sm);
}

.booth-stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 18px;
}

.booth-stats-head h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.booth-stats-code {
  font-size: 13px;
  color: var(--muted);
  background: rgba(30, 58, 138, 0.06);
  border: 1px solid rgba(30, 58, 138, 0.12);
  border-radius: 999px;
  padding: 6px 12px;
}

.booth-stats-code {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.booth-stats-code strong {
  color: #1e3a8a;
  letter-spacing: 0.04em;
  margin-left: 4px;
}

.booth-code-copy {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: 4px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #1e3a8a;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.booth-code-copy:hover {
  background: rgba(30, 58, 138, 0.12);
}

.booth-code-copy:active {
  transform: scale(0.9);
}

.booth-code-copy.copied {
  color: var(--stat-green, #22c55e);
  background: rgba(34, 197, 94, 0.14);
}

/* ===== Toast notification ===== */
.app-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #1f2937;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-toast-success {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.app-toast-error {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
}

.app-toast-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}

@media (max-width: 520px) {
  .app-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }
}

.booth-stats-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 1.2fr;
  gap: 18px;
  align-items: stretch;
}

.booth-stats-left {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.booth-stats-left .rev-summary-card {
  flex: 1;
}

.rev-summary-icon.blue {
  border-color: #1e3a8a;
  color: #1e3a8a;
  background: rgba(30, 58, 138, 0.08);
}

.rev-summary-card h2.bs-orange {
  color: #e05c2a;
}

.booth-stats-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid rgba(139, 31, 36, 0.08);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  box-shadow: var(--shadow-sm);
}

.booth-stats-amount {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.booth-stats-amount .bs-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1e3a8a;
  margin-top: 6px;
  flex-shrink: 0;
}

.booth-stats-amount h2 {
  margin: 0 0 2px;
  font-size: 24px;
  font-weight: 800;
  color: #1e3a8a;
}

.booth-stats-amount p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.booth-stats-chart {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bs-sparkline {
  width: 100%;
  height: auto;
  font-family: 'Inter', sans-serif;
}

.bs-sparkline .bs-spark-label {
  fill: var(--muted);
  font-size: 10px;
}

.bs-chart-caption {
  text-align: center;
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .booth-stats-grid {
    grid-template-columns: 1fr;
  }
}

.content-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

.content-grid-simple {
  grid-template-columns: 1fr 1fr;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.panel-large {
  grid-row: span 2;
}

.user-management-panel,
.standalone-page-panel,
.form-page-panel {
  margin-top: 24px;
}

.user-management-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.user-form-card,
.user-list-card,
.modal-card {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.form-actions,
.table-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.two-column-form {
  grid-template-columns: repeat(2, 1fr);
}

.full-width {
  grid-column: 1 / -1;
}

.panel-subheader {
  align-items: center;
  margin-bottom: 14px;
}

.table-wrapper {
  overflow-x: auto;
  margin-top: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 31, 36, 0.4) rgba(139, 31, 36, 0.08);
}

/* When the table is wider than the panel, hint that it can be dragged/slid. */
.table-wrapper.is-scrollable {
  cursor: grab;
}
.table-wrapper.drag-scrolling {
  cursor: grabbing;
  user-select: none;
}

/* Always-visible, styled horizontal scrollbar (affordance for sliding). */
.table-wrapper::-webkit-scrollbar {
  height: 10px;
}
.table-wrapper::-webkit-scrollbar-track {
  background: rgba(139, 31, 36, 0.08);
  border-radius: 6px;
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(139, 31, 36, 0.4);
  border-radius: 6px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 31, 36, 0.6);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(139, 31, 36, 0.1);
  white-space: nowrap;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 14px;
}

.address-cell {
  max-width: 220px;
  white-space: normal;
  line-height: 1.5;
}

.form-grid input[readonly] {
  background: #f4ede6;
  color: var(--muted);
  cursor: not-allowed;
}

.stack-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.stack-item {
  align-items: center;
  padding: 16px;
  border-radius: 16px;
  background: #fffaf6;
  border: 1px solid rgba(139, 31, 36, 0.08);
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.paid,
.status.completed {
  background: rgba(47, 158, 68, 0.12);
  color: var(--success);
}

.status.pending {
  background: rgba(230, 119, 0, 0.12);
  color: var(--warning);
}

.status.failed,
.status.expired,
.status.cancelled {
  background: rgba(201, 42, 42, 0.1);
  color: var(--danger);
}

/* ── Transaction filter bar ─────────────────────────────────── */
.tx-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 12px 0 16px;
  border-bottom: 1px solid rgba(139, 31, 36, 0.1);
  margin-bottom: 12px;
}

.tx-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tx-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 2px;
}

.tx-filter-btn,
.tx-sort-btn,
.tx-voucher-btn,
.tx-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid rgba(139, 31, 36, 0.18);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tx-filter-btn:hover,
.tx-sort-btn:hover,
.tx-voucher-btn:hover,
.tx-status-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tx-filter-btn.active,
.tx-sort-btn.active,
.tx-voucher-btn.active,
.tx-status-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.tx-filter-select {
  padding: 5px 28px 5px 10px;
  border-radius: 20px;
  border: 1.5px solid rgba(139, 31, 36, 0.18);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a6a68' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
}

.tx-filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.tx-filter-date {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid rgba(139, 31, 36, 0.18);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}

.tx-filter-date:focus {
  outline: none;
  border-color: var(--primary);
}

.tx-filter-date-sep {
  color: var(--muted);
  font-size: 13px;
}

/* ── end filter bar ──────────────────────────────────────────── */

.tx-error-msg {
  display: inline-block;
  font-size: 11px;
  font-family: monospace;
  color: var(--danger);
  background: rgba(201, 42, 42, 0.08);
  border: 1px solid rgba(201, 42, 42, 0.18);
  border-radius: 6px;
  padding: 3px 7px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
  vertical-align: middle;
}

.tx-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(139, 31, 36, 0.1);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45, 31, 26, 0.48);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 520px;
}

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

.detail-item {
  padding: 16px;
  border-radius: 16px;
  background: #fffaf6;
  border: 1px solid rgba(139, 31, 36, 0.08);
  display: grid;
  gap: 6px;
}

.detail-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-item strong {
  line-height: 1.5;
  white-space: normal;
  word-break: break-word;
}

.hidden {
  display: none;
}

/* Login / landing brand panel — dark maroon */
.brand-panel {
  background: radial-gradient(circle at 30% 35%, #7d1a1d 0%, #4d1012 45%, #260708 100%);
  color: #ffffff;
}

.brand-logo {
  width: 240px;
  max-width: 70%;
  height: auto;
  filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.45));
}

.brand-panel p {
  color: rgba(255, 255, 255, 0.78);
}

.brand-panel .brand-badge {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.brand-panel .feature-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: none;
  backdrop-filter: none;
}

.brand-panel .feature-card h3 {
  color: #ffffff;
}

.brand-panel .feature-card p {
  color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 1280px) {
  .user-management-grid {
    grid-template-columns: 1fr;
  }

  .two-column-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .auth-page,
  .dashboard-page,
  .content-grid {
    grid-template-columns: 1fr;
  }

  /* Sidebar stacks on top here — scroll the gradient with it instead of
     pinning to the viewport, which avoids fixed-background quirks on mobile. */
  .sidebar {
    background-attachment: scroll, scroll;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-large {
    grid-row: auto;
  }

  /* Sidebar stacks on top: sheet curves up from below it */
  .dashboard-content {
    border-radius: 36px 36px 0 0;
    box-shadow:
      0 -16px 0 rgba(255, 255, 255, 0.07),
      0 -40px 70px rgba(20, 4, 5, 0.45);
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .brand-panel,
  .login-panel,
  .dashboard-content,
  .sidebar {
    padding: 24px;
  }

  .brand-panel h1,
  .sidebar h1 {
    font-size: 42px;
  }

  .login-header h2,
  .topbar h2 {
    font-size: 28px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header,
  .panel-subheader {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions,
  .table-actions,
  .topbar-summary {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-button,
  .primary-button,
  .secondary-button,
  .topbar-link-button {
    width: 100%;
  }

  .modal-backdrop {
    padding: 16px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Form Styling */
.form-container {
  max-width: 800px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.form-group .required {
  color: var(--danger);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(139, 31, 36, 0.15);
  border-radius: 12px;
  font-size: 15px;
  background: var(--surface-strong);
  transition: border-color 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 2px dashed rgba(139, 31, 36, 0.25);
  border-radius: 12px;
  background: rgba(139, 31, 36, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-group input[type="file"]:hover {
  border-color: var(--primary);
  background: rgba(139, 31, 36, 0.06);
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(139, 31, 36, 0.1);
}

.error-message {
  padding: 14px 18px;
  background: rgba(201, 42, 42, 0.08);
  border: 1px solid rgba(201, 42, 42, 0.2);
  border-radius: 12px;
  color: var(--danger);
  margin-top: 20px;
  font-weight: 500;
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-pill.status-active {
  background: rgba(47, 158, 68, 0.12);
  color: var(--success);
}

.status-pill.status-inactive {
  background: rgba(125, 101, 91, 0.12);
  color: var(--muted);
}

/* Booth Management: "Last sync 3 min ago" / warnings under the live status pill */
.booth-sync-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.booth-sync-note.booth-sync-warn {
  margin-top: 3px;
  color: var(--warning);
  font-weight: 600;
}

/* Table Styling */
.table-wrapper {
  overflow-x: auto;
  margin-top: 20px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table thead {
  background: rgba(139, 31, 36, 0.06);
}

.data-table th {
  padding: 16px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-dark);
  border-bottom: 2px solid rgba(139, 31, 36, 0.1);
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(139, 31, 36, 0.06);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: rgba(139, 31, 36, 0.02);
}

.action-buttons {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

/* Stacked action buttons: equal width, icons and labels left-aligned */
.action-buttons .icon-button {
  width: 118px;
  justify-content: flex-start;
  padding: 0 16px;
}

/* Side-by-side action pairs: equal width, centered */
.um-actions .icon-button,
.category-actions .icon-button,
.template-card-actions .icon-button {
  min-width: 96px;
  justify-content: center;
}

.action-button {
  padding: 8px 14px;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.action-button.edit-button {
  background: rgba(139, 31, 36, 0.1);
  color: var(--primary-dark);
}

.action-button.edit-button:hover {
  background: rgba(139, 31, 36, 0.18);
}

.action-button.delete-button {
  background: rgba(201, 42, 42, 0.1);
  color: var(--danger);
}

.action-button.delete-button:hover {
  background: rgba(201, 42, 42, 0.18);
}

/* Compact icon action buttons (booth management) */
.action-icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(139, 31, 36, 0.14);
  border-radius: 11px;
  background: var(--surface-strong);
  color: var(--primary-dark);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.action-icon-btn:hover {
  background: rgba(139, 31, 36, 0.1);
  border-color: rgba(139, 31, 36, 0.28);
}

.action-icon-btn:active {
  transform: scale(0.92);
}

.action-icon-btn.danger {
  color: var(--danger);
  border-color: rgba(201, 42, 42, 0.18);
}

.action-icon-btn.danger:hover {
  background: rgba(201, 42, 42, 0.12);
  border-color: rgba(201, 42, 42, 0.34);
}

/* Booth list header + search */
.booth-list-header {
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.booth-count {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(139, 31, 36, 0.08);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

.booth-search {
  min-width: 300px;
  flex: 0 1 340px;
}

@media (max-width: 720px) {
  .booth-search {
    min-width: 0;
    width: 100%;
    flex-basis: 100%;
  }
}

/* Auth code block inside Booth Info tab */
.ds-authcode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.ds-authcode-label {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ds-authcode {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--primary);
}

.ds-authstatus {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.ds-authstatus small {
  color: var(--muted);
}

/* Modal Styling */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(45, 31, 26, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

/* Message/alert modals must stack above other open modals (e.g. device settings) */
#messageModal,
#deleteModal {
  z-index: 1100;
}

.modal-content {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow);
}

/* ── Multi-select pill widget ── */
.multi-select-box {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  min-height: 42px;
  cursor: text;
}

.multi-select-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,31,36,0.12);
}

.multi-select-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  align-items: center;
}

.multi-select-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  padding: 3px 10px 3px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.multi-select-pill button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
}

.multi-select-pill button:hover { color: #fff; }

.multi-select-search {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  min-width: 120px;
  flex: 1;
  padding: 2px 0;
  color: var(--text);
}

.multi-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}

.multi-select-option {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.multi-select-option:hover,
.multi-select-option.focused {
  background: var(--surface);
}

.multi-select-option.selected {
  color: var(--primary);
  font-weight: 600;
}

.modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid rgba(139, 31, 36, 0.1);
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  margin: 0 0 12px 0;
  line-height: 1.6;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(139, 31, 36, 0.1);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Loading Spinner */
.loading-spinner {
  color: var(--muted);
  font-weight: 500;
}

/* ===== Category Frame ===== */
.tip-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  margin-bottom: 22px;
  border-radius: var(--radius-md);
  background: rgba(139, 31, 36, 0.06);
  border: 1px solid rgba(139, 31, 36, 0.12);
}

.tip-banner p {
  margin: 0;
  color: var(--primary-dark);
}

.tip-icon {
  font-size: 20px;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-empty {
  padding: 48px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.category-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(139, 31, 36, 0.06);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.category-card.dragging {
  opacity: 0.6;
  border: 1px dashed var(--primary);
}

.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 18px;
  user-select: none;
  padding: 4px;
  touch-action: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.category-thumb {
  width: 96px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgba(139, 31, 36, 0.06);
}

.category-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-placeholder {
  font-size: 28px;
  opacity: 0.5;
}

.category-info {
  flex: 1;
  min-width: 0;
}

.category-info h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.category-price {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.category-print {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.category-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.icon-button {
  height: 38px;
  padding: 0 14px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.icon-button.edit {
  background: rgba(139, 31, 36, 0.1);
  color: var(--primary-dark);
}

.icon-button.edit:hover {
  background: rgba(139, 31, 36, 0.18);
}

.icon-button.delete {
  background: rgba(201, 42, 42, 0.1);
  color: var(--danger);
}

.icon-button.delete:hover {
  background: rgba(201, 42, 42, 0.18);
}

.icon-button.settings {
  background: rgba(139, 31, 36, 0.1);
  color: var(--primary-dark);
}

.icon-button.settings:hover {
  background: rgba(139, 31, 36, 0.18);
}

/* Icon buttons rendered as links (e.g. edit navigations) */
a.icon-button {
  text-decoration: none;
}

/* Category form modal */
.category-form-modal {
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.category-form-modal .modal-body {
  overflow-y: auto;
}

.category-form-modal .form-group {
  margin-bottom: 18px;
}

.banner-dropzone {
  width: 100%;
  aspect-ratio: 500 / 375;
  max-height: 280px;
  border: 2px dashed rgba(139, 31, 36, 0.25);
  border-radius: 14px;
  background: rgba(139, 31, 36, 0.03);
  cursor: pointer;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.banner-dropzone:hover {
  border-color: var(--primary);
  background: rgba(139, 31, 36, 0.06);
}

.banner-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 500;
}

.banner-placeholder-icon {
  font-size: 40px;
  opacity: 0.6;
}

.rp-input {
  display: flex;
  align-items: stretch;
}

.rp-input .rp-prefix {
  display: grid;
  place-items: center;
  padding: 0 16px;
  background: rgba(139, 31, 36, 0.06);
  border: 2px solid rgba(139, 31, 36, 0.15);
  border-right: none;
  border-radius: 12px 0 0 12px;
  font-weight: 700;
  color: var(--primary-dark);
}

.rp-input input[type="number"] {
  border-radius: 0 12px 12px 0 !important;
  flex: 1;
}

/* ===== Template Frame ===== */
.template-overview {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 24px;
}

.overview-label {
  display: block;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.overview-total-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(139, 31, 36, 0.05);
  border: 1px solid rgba(139, 31, 36, 0.1);
}

.overview-total-icon {
  font-size: 30px;
}

.overview-total-box h3 {
  margin: 0;
  font-size: 30px;
}

.overview-total-box p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.paper-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.paper-stat {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid rgba(139, 31, 36, 0.08);
}

.paper-stat-head {
  display: flex;
  flex-direction: column;
}

.paper-stat-head strong {
  font-size: 15px;
}

.paper-stat-head span {
  font-size: 12px;
  color: var(--muted);
}

.paper-stat-count {
  font-size: 28px;
  font-weight: 700;
  margin: 10px 0 8px;
}

.paper-stat-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(139, 31, 36, 0.1);
  overflow: hidden;
}

.paper-stat-bar span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.paper-stat-pct {
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 6px;
}

.template-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.template-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.template-filters select {
  padding: 12px 16px;
  border: 2px solid rgba(139, 31, 36, 0.15);
  border-radius: 12px;
  background: var(--surface-strong);
  font-size: 14px;
  min-width: 170px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.template-card {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(139, 31, 36, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.template-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.template-thumb {
  position: relative;
  aspect-ratio: 4 / 5;
  background: rgba(139, 31, 36, 0.06);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.paper-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(43, 20, 22, 0.7);
  color: #fff;
}

.template-card-body {
  padding: 14px 16px;
  flex: 1;
}

.template-card-body h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.template-meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.template-dims {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
}

.template-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 16px 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.template-dropzone {
  aspect-ratio: 4 / 3;
  max-height: 220px;
}

@media (max-width: 900px) {
  .template-overview {
    grid-template-columns: 1fr;
  }
  .paper-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Template Editor ===== */
.editor-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface-strong);
  border-bottom: 1px solid rgba(139, 31, 36, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

.editor-topbar h2 {
  margin: 0;
  font-size: 20px;
  color: var(--primary-dark);
}

.editor-back {
  font-weight: 600;
  color: var(--primary-dark);
}

.editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: 0;
}

.editor-canvas-wrap {
  display: grid;
  place-items: center;
  padding: 32px;
  overflow: auto;
}

.editor-canvas {
  position: relative;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

.editor-frame-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.editor-slot-layer {
  position: absolute;
  inset: 0;
  /* z-index:auto keeps this as a non-stacking context so individual
     .editor-slot z-index values compete with .editor-frame-image */
  z-index: auto;
}

.editor-slot {
  position: absolute;
  background: rgba(232, 122, 45, 0.55);
  /* Crisp inner edge: the slot's outer boundary IS the photo area, so the
     line is drawn fully inside it — nothing bleeds outside the bounds. */
  border: none;
  box-shadow: inset 0 0 0 2px #e8551d;
  display: grid;
  place-items: center;
  cursor: move;
  box-sizing: border-box;
  overflow: visible;
}

.editor-slot.selected {
  box-shadow: inset 0 0 0 2px #2f9e44;
  background: rgba(232, 122, 45, 0.45);
}

.editor-slot-no {
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.editor-slot-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid #2f9e44;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* position each handle */
.editor-slot-handle[data-dir="n"]  { top: 0;    left: 50%;  cursor: n-resize; }
.editor-slot-handle[data-dir="s"]  { top: 100%; left: 50%;  cursor: s-resize; }
.editor-slot-handle[data-dir="e"]  { top: 50%;  left: 100%; cursor: e-resize; }
.editor-slot-handle[data-dir="w"]  { top: 50%;  left: 0;    cursor: w-resize; }
.editor-slot-handle[data-dir="nw"] { top: 0;    left: 0;    cursor: nw-resize; }
.editor-slot-handle[data-dir="ne"] { top: 0;    left: 100%; cursor: ne-resize; }
.editor-slot-handle[data-dir="sw"] { top: 100%; left: 0;    cursor: sw-resize; }
.editor-slot-handle[data-dir="se"] { top: 100%; left: 100%; cursor: se-resize; }

.editor-slot:not(.selected) .editor-slot-handle {
  display: none;
}

/* Rotate handle — sits above the top-centre edge */
.editor-slot-rotate {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  background: #fff;
  border: 2px solid #2f9e44;
  border-radius: 50%;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}

/* Dashed connector line from rotate handle down to slot edge */
.editor-slot-rotate::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 14px;
  border-left: 2px dashed #2f9e44;
}

/* Unicode rotate arrow inside the handle */
.editor-slot-rotate::before {
  content: '↻';
  color: #2f9e44;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.editor-panel {
  background: var(--surface-strong);
  border-left: 1px solid rgba(139, 31, 36, 0.1);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.editor-card {
  border: 1px solid rgba(139, 31, 36, 0.1);
  border-radius: var(--radius-md);
  padding: 16px;
}

.editor-card-title {
  margin: 0 0 14px;
  font-size: 15px;
}

.editor-sublabel {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

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

.editor-card .form-group:last-child {
  margin-bottom: 0;
}

.editor-card select,
.editor-card input,
.editor-card textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid rgba(139, 31, 36, 0.15);
  border-radius: 12px;
  font-size: 14px;
  background: var(--surface-strong);
}

.editor-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  margin-bottom: 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.editor-btn:hover {
  filter: brightness(1.08);
}

.editor-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.editor-btn-remove { background: var(--primary); margin-bottom: 0; }
.editor-btn-photo { background: #1f3a8a; }
.editor-btn-snap { background: #6b21a8; }
.editor-btn-qr { background: #1f9d57; margin-bottom: 14px; }
.editor-btn-save { background: #1f9d57; margin-bottom: 0; }

.editor-btn-row {
  display: flex;
  gap: 10px;
}

.editor-mini-btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s ease;
}

.editor-mini-btn:hover {
  filter: brightness(1.08);
}

.editor-mini-btn.dup { background: #e0a400; }
.editor-mini-btn.back { background: #e8551d; }
.editor-mini-btn.del { background: var(--danger); }

.editor-layer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-layer {
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: #fff;
  cursor: grab;
  user-select: none;
}

.editor-layer.frame-layer { background: #1f3a8a; cursor: grab; }
.editor-layer.photo-layer { background: #1f3a8a; }
.editor-layer.photo-layer.selected { background: #e8551d; }
.editor-layer.layer-dragging { opacity: 0.4; }
.editor-layer.layer-drag-over { outline: 2px dashed #fff; outline-offset: -2px; }

.editor-print-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.editor-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.editor-switch input { display: none; }

.editor-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: 0.2s;
}

.editor-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.editor-switch input:checked + .editor-slider { background: var(--primary); }
.editor-switch input:checked + .editor-slider::before { transform: translateX(20px); }

@media (max-width: 1000px) {
  .editor-body { grid-template-columns: 1fr; }
  .editor-panel { border-left: none; border-top: 1px solid rgba(139, 31, 36, 0.1); }
}

/* ============================================================
   FILTER LIST PAGE
   ============================================================ */

.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
}

.filter-tab {
  padding: 10px 22px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-tab.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.filter-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  font-size: 15px;
}

.filter-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-strong);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.filter-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.filter-card-img-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
}

.filter-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.filter-card:hover .filter-card-img {
  transform: scale(1.04);
}

.filter-card-clickable {
  cursor: pointer;
}

.filter-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 8, 8, 0.62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.2s;
}

.filter-card:hover .filter-card-overlay,
.filter-card-overlay:focus-within {
  opacity: 1;
}

/* Solid, high-contrast buttons over the darkened photo */
.filter-card-overlay .icon-button {
  min-width: 96px;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.filter-card-overlay .icon-button.edit {
  background: #ffffff;
  color: var(--primary-dark);
}

.filter-card-overlay .icon-button.edit:hover {
  background: #f3e2e3;
}

.filter-card-overlay .icon-button.delete {
  background: var(--danger);
  color: #ffffff;
}

.filter-card-overlay .icon-button.delete:hover {
  background: #a82222;
}

.filter-card-name {
  padding: 12px 14px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

/* ============================================================
   FILTER EDITOR PAGE
   ============================================================ */

.fe-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.fe-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 14px 28px;
  background: var(--surface-strong);
  border-bottom: 1px solid rgba(139,31,36,0.1);
  gap: 16px;
}

.fe-topbar h2 {
  margin: 0;
  font-size: 18px;
  text-align: center;
}

.fe-back {
  font-weight: 600;
  color: var(--primary);
  font-size: 14px;
}

.fe-body {
  display: grid;
  grid-template-columns: 380px 1fr;
  flex: 1;
  overflow: hidden;
}

.fe-panel {
  background: var(--surface-strong);
  border-right: 1px solid rgba(139,31,36,0.1);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fe-card {
  border: 1px solid rgba(139,31,36,0.1);
  border-radius: var(--radius-md);
  padding: 16px;
}

.fe-section-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.fe-tabs {
  display: flex;
  /* Pills size to their labels and wrap onto a second row when the sidebar
     is narrow — flex:1 + nowrap used to push "Color Effects" out of the bar. */
  flex-wrap: wrap;
  gap: 3px;
  background: rgba(139,31,36,0.07);
  border-radius: 12px;
  padding: 3px;
}

.fe-tab {
  flex: 1 1 auto;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-align: center;
}

.fe-tab.active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.fe-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.fe-slider-row label {
  width: 100px;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

.fe-num {
  width: 64px;
  padding: 4px 6px;
  border: 1px solid rgba(139,31,36,0.2);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.fe-reset-btn {
  background: none;
  border: 1px solid rgba(139,31,36,0.2);
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.fe-reset-btn:hover { background: rgba(139,31,36,0.07); }

.fe-slider {
  width: 100%;
  margin-bottom: 14px;
  accent-color: #3b82f6;
}

.fe-wb-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 14px;
}

/* Color Mix swatch row */
.fe-swatch-row {
  display: flex;
  gap: 10px;
  margin: 6px 0 16px;
}
.fe-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15) inset;
  transition: transform 0.12s, border-color 0.12s;
}
.fe-swatch:hover { transform: scale(1.08); }
.fe-swatch.active {
  border-color: var(--text, #1f2937);
  box-shadow: 0 0 0 2px #fff inset, 0 0 0 1px rgba(0,0,0,0.15);
}

.fe-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
}

.fe-actions .secondary-button,
.fe-actions .primary-button {
  flex: 1;
  text-align: center;
  padding: 12px;
}

/* Preview column */
.fe-preview-col {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.fe-preview-box {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}

.fe-preview-box + .fe-preview-box {
  border-top: 3px solid var(--bg);
}

.fe-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fe-preview-label {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  z-index: 2;
}

.fe-preview-label.before { background: #3b82f6; }
.fe-preview-label.after  { background: #e8551d; }

.fe-preview-upload-hint {
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  padding: 20px;
  border: 2px dashed rgba(255,255,255,0.25);
  border-radius: 12px;
}

.fe-change-photo {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 12px;
  color: #fff;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  z-index: 2;
}

@media (max-width: 900px) {
  .fe-body { grid-template-columns: 1fr; }
  .fe-panel { border-right: none; border-bottom: 1px solid rgba(139,31,36,0.1); }
}

/* ===== All-tab consistency polish ===== */

/* Status indicators get a leading dot — reads instantly */
.status.paid::before,
.status.completed::before,
.status.pending::before,
.status-pill.status-active::before,
.status-pill.status-inactive::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 7px;
  flex-shrink: 0;
}

/* Frosted modal backdrops */
.modal,
.modal-backdrop {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content,
.modal-card {
  animation: rise-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Tighter display headings across every page */
.topbar h2,
.login-header h2,
.panel-header h3 {
  letter-spacing: -0.02em;
}

/* Input hover affordance before focus */
.login-form input:hover:not(:focus),
.form-grid input:hover:not(:focus),
.form-grid select:hover:not(:focus),
.form-grid textarea:hover:not(:focus),
.form-group input:hover:not(:focus),
.form-group select:hover:not(:focus),
.form-group textarea:hover:not(:focus) {
  border-color: rgba(139, 31, 36, 0.32);
}

/* Table rows: smoother hover + comfortable rhythm */
.data-table tbody tr {
  transition: background 0.15s ease;
}

table tbody tr:hover td {
  background: rgba(139, 31, 36, 0.025);
}

/* ===== Market polish: motion, scrollbar, typography ===== */

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card,
.panel,
.category-card,
.template-card,
.filter-card,
.login-card,
.hero-banner {
  animation: rise-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.12s; }
.stat-card:nth-child(3) { animation-delay: 0.19s; }
.stat-card:nth-child(4) { animation-delay: 0.26s; }
.category-card:nth-child(2),
.template-card:nth-child(2),
.filter-card:nth-child(2) { animation-delay: 0.07s; }
.category-card:nth-child(3),
.template-card:nth-child(3),
.filter-card:nth-child(3) { animation-delay: 0.14s; }
.category-card:nth-child(4),
.template-card:nth-child(4),
.filter-card:nth-child(4) { animation-delay: 0.21s; }

@media (prefers-reduced-motion: reduce) {
  .stat-card,
  .panel,
  .category-card,
  .template-card,
  .filter-card,
  .login-card,
  .hero-banner {
    animation: none;
  }
}

/* Numbers read like a fintech product */
.stat-card h3,
.overview-total-box h3,
.paper-stat-count {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  font-weight: 800;
}

/* Branded scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 31, 36, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 31, 36, 0.38);
  background-clip: content-box;
}

/* Branded text selection */
::selection {
  background: rgba(139, 31, 36, 0.85);
  color: #ffffff;
}

/* Accessible focus ring that matches the theme */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(139, 31, 36, 0.4);
  outline-offset: 2px;
}

/* ============================================================
   REPORT ANALYTIC PAGE
   ============================================================ */

.report-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-month-input {
  padding: 10px 14px;
  border: 1px solid rgba(139, 31, 36, 0.16);
  border-radius: 12px;
  background: var(--surface-strong);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.report-section {
  margin-top: 28px;
}

.report-section-head {
  margin-bottom: 16px;
}

.report-section-head h3 {
  margin: 0 0 4px;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-section-head h3::before {
  content: '';
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), rgba(139, 31, 36, 0.45));
  flex-shrink: 0;
}

.report-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.view-more-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
}

.view-more-link .icon-sm {
  transition: transform 0.15s ease;
}

.view-more-link:hover .icon-sm {
  transform: translateX(3px);
}

/* Delta pills (up/down vs last period) */
.delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.delta-pill.up {
  background: rgba(31, 157, 87, 0.12);
  color: var(--stat-green);
}

.delta-pill.down {
  background: rgba(201, 42, 42, 0.1);
  color: var(--danger);
}

/* Nothing to compare against (no data in the comparison period) */
.delta-pill.flat {
  background: rgba(125, 101, 91, 0.12);
  color: var(--muted);
}

/* Report Analytic: real frame artwork in the Top 3 podium */
.ranking-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.report-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.stat-card-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-card-detail-row span {
  color: var(--muted);
  font-size: 13px;
}

/* Frame Performance: two-column layout */
.frame-performance-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: stretch;
}

/* Report cards: column layout so footers/links pin to the bottom and
   content fills evenly regardless of neighbour height */
.frame-performance-grid .panel,
.report-two-col .panel {
  display: flex;
  flex-direction: column;
}

.frame-performance-grid .view-more-link,
.report-two-col .view-more-link {
  margin-top: auto;
  padding-top: 16px;
}

.frame-rank-list {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.frame-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14.5px;
}

.frame-rank-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.frame-rank-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.frame-rank-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(139, 31, 36, 0.08);
  margin-top: 6px;
  overflow: hidden;
}

.frame-rank-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

/* Ranking podium */
.ranking-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex: 1;
  padding: 12px 4px 4px;
}

.ranking-card {
  flex: 1 1 0;
  min-width: 0;
  max-width: 150px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ranking-card.rank-1 {
  order: 2;
  margin-bottom: 16px;
}

.ranking-card.rank-2 {
  order: 1;
}

.ranking-card.rank-3 {
  order: 3;
}

.ranking-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  background: linear-gradient(150deg, rgba(139, 31, 36, 0.1), rgba(139, 31, 36, 0.03));
  display: grid;
  place-items: center;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
}

.ranking-card.rank-1 .ranking-thumb {
  border-color: #eab308;
  box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.14), var(--shadow);
}

.ranking-badge {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #ffffff;
  background: var(--muted);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.ranking-card.rank-1 .ranking-badge {
  background: #eab308;
}

.ranking-card.rank-3 .ranking-badge {
  background: #b45309;
}

.ranking-name {
  font-weight: 700;
  font-size: 14px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-usage {
  font-size: 12.5px;
  color: var(--muted);
}

.ranking-card.rank-1 .ranking-usage {
  color: #b45309;
  font-weight: 700;
}

/* Traffic by hour bar chart */
.traffic-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 220px;
  margin-top: 20px;
  padding: 0 4px;
  border-top: 1px solid rgba(139, 31, 36, 0.08);
  padding-top: 12px;
  overflow-x: auto;
}

.traffic-bar-col {
  flex: 1 1 16px;
  min-width: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 8px;
}

.traffic-bar {
  width: 100%;
  max-width: 22px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.42), rgba(37, 99, 235, 0.18));
  transition: background 0.15s ease, transform 0.15s ease;
}

.traffic-bar-col:hover .traffic-bar {
  transform: scaleY(1.03);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.6), rgba(37, 99, 235, 0.3));
}

.traffic-bar.peak {
  background: linear-gradient(180deg, #2563eb, #60a5fa);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.28);
}

.traffic-bar-label {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  transform: rotate(0deg);
}

/* Revenue over time line chart */
.revenue-chart-wrap {
  margin-top: 16px;
  flex: 1;
  display: flex;
  align-items: center;
}

.revenue-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.revenue-chart-svg .rc-fill {
  fill: url(#revenueGradient);
}

.revenue-chart-svg .rc-line {
  fill: none;
  stroke: var(--stat-blue);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.revenue-chart-svg .rc-dot {
  fill: #ffffff;
  stroke: var(--stat-blue);
  stroke-width: 2.5;
}

.revenue-chart-svg .rc-grid {
  stroke: rgba(139, 31, 36, 0.08);
  stroke-width: 1;
}

.revenue-chart-svg text {
  fill: var(--muted);
  font-size: 11px;
  font-family: 'Inter', sans-serif;
}

/* Booth revenue list (reuses frame-rank-row structure) */
.booth-revenue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.booth-revenue-amount {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
  text-align: right;
}

.report-two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .frame-performance-grid,
  .report-two-col {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   SEARCH BAR (Booth/Category/Template/Filter/Voucher management)
   ============================================================ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(139, 31, 36, 0.15);
  border-radius: 12px;
  background: var(--surface-strong);
  min-width: 240px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(139, 31, 36, 0.1);
}

.search-bar .icon-sm {
  color: var(--muted);
  flex-shrink: 0;
}

.search-bar input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  width: 100%;
  color: var(--text);
}

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

.search-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

@media (max-width: 720px) {
  .search-bar {
    min-width: 0;
    width: 100%;
  }
}

/* ============================================================
   DEVICE SETTINGS MODAL (Booth Management)
   ============================================================ */
.ds-modal-content {
  max-width: 780px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.ds-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(139, 31, 36, 0.1);
}

.ds-modal-header h3 {
  margin: 0;
}

.ds-close-btn {
  border: none;
  background: rgba(139, 31, 36, 0.08);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ds-close-btn:hover {
  background: rgba(139, 31, 36, 0.16);
  color: var(--primary-dark);
}

/* Pills that wrap onto a second row. An underline strip needed horizontal
   scrolling once the modal grew past six tabs, which left tabs cropped off the
   right edge; wrapping keeps every tab reachable at any width. */
.ds-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(139, 31, 36, 0.1);
  background: linear-gradient(180deg, rgba(224, 180, 177, 0.12), transparent);
}

.ds-tab {
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ds-tab:hover {
  color: var(--primary);
  background: rgba(139, 31, 36, 0.06);
}

.ds-tab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(139, 31, 36, 0.28);
}

.ds-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ds-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.ds-panel .form-group {
  margin-bottom: 16px;
}

.ds-section-title {
  margin: 20px 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.ds-panel > .ds-section-title:first-child {
  margin-top: 0;
}

.ds-card {
  border: 1px solid rgba(139, 31, 36, 0.1);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-strong);
}

.ds-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
}

.ds-toggle-row + .ds-toggle-row {
  margin-top: 14px;
}

.ds-toggle-row label:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.ds-info-icon {
  color: var(--muted);
  cursor: help;
}

.ds-info-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: #fef9c3;
  color: #713f12;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 20px;
}

.ds-inline-link {
  display: inline-flex;
  color: var(--primary);
  vertical-align: middle;
  margin-left: 4px;
}

.ds-position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.ds-position-btn {
  padding: 18px 10px;
  border: 1px solid rgba(139, 31, 36, 0.15);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ds-position-btn:hover {
  border-color: var(--primary);
}

.ds-position-btn.active {
  background: var(--stat-amber-bg);
  border-color: var(--stat-amber);
  color: var(--stat-amber);
}

.ds-upload-block {
  margin-bottom: 20px;
}

.ds-upload-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 8px;
}

.ds-dim-hint {
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}

.ds-branding-dropzone {
  aspect-ratio: auto;
  height: 220px;
  max-height: none;
  text-align: left;
  /* The dropzone is a grid; without a definite row the preview's
     percentage height can't resolve and it overflows + gets clipped. */
  grid-template-rows: 100%;
  justify-items: start;
}

/* Branding uploads are full 16:9 artwork. The box stays full-width, but the
   preview keeps its own aspect ratio at the box height, anchored left — the
   whole design is always visible, never a cropped slice. */
.ds-branding-dropzone .banner-preview {
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

.ds-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.ds-tag-list:empty {
  margin: 0;
}

.ds-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(139, 31, 36, 0.08);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
}

.ds-tag button {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.ds-tag-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(139, 31, 36, 0.15);
  border-radius: 10px;
  background: var(--surface-strong);
  font-size: 14px;
}

/* ============================================================
   RESIZABLE TABLE COLUMNS
   ============================================================ */
.resizable-table th {
  overflow: hidden;
}

.resizable-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  touch-action: none;
}

.col-resize-handle::after {
  content: '';
  position: absolute;
  top: 0;
  right: 1px;
  width: 2px;
  height: 100%;
  background: transparent;
  transition: background 0.12s ease;
}

.col-resize-handle:hover::after,
.col-resize-handle.active::after {
  background: var(--primary);
}

body.col-resizing {
  cursor: col-resize;
  user-select: none;
}

body.col-resizing * {
  cursor: col-resize !important;
}

/* ==========================================================================
   User Management — redesigned table + edit/permission modal
   ========================================================================== */
.um-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.um-search {
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
  display: flex;
  align-items: center;
}

.um-search .icon-sm {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}

.um-search input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border-radius: 12px;
  border: 1px solid rgba(139, 31, 36, 0.14);
  background: var(--surface-strong);
  font: inherit;
  color: var(--text);
}

.um-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 31, 36, 0.12);
}

.um-filter {
  position: relative;
}

.um-filter > .inline-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.um-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: 240px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px solid rgba(139, 31, 36, 0.12);
  box-shadow: var(--shadow-sm);
}

.um-filter-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.um-filter-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.um-filter-item,
.um-booth-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.um-filter-item input,
.um-booth-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.um-add-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Table */
.um-table th {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.um-table td {
  vertical-align: middle;
}

.um-action-col {
  text-align: right;
  width: 120px;
}

.um-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.um-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.um-user-name {
  font-weight: 600;
  color: var(--text);
}

.um-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.um-chip {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 8px;
  background: #f1ebe6;
  color: #5b4a47;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.um-chip-extra {
  background: rgba(139, 31, 36, 0.1);
  color: var(--primary-dark);
}

.um-access {
  display: grid;
  gap: 2px;
}

.um-access-count {
  font-weight: 700;
  color: var(--primary);
}

.um-access-list {
  font-size: 13px;
  color: var(--muted);
}

.um-muted {
  color: var(--muted);
}

.um-actions {
  display: inline-flex;
  gap: 8px;
  justify-content: flex-end;
}

.icon-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.um-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
}

/* Edit / Add modal */
.um-modal {
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.um-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px 16px;
}

.um-modal-header h3 {
  margin: 0;
  font-size: 22px;
}

.um-modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  line-height: 0;
}

.um-modal-close:hover {
  background: rgba(139, 31, 36, 0.08);
  color: var(--text);
}

.um-tabs {
  display: flex;
  gap: 24px;
  padding: 0 26px;
  border-bottom: 1px solid rgba(139, 31, 36, 0.1);
}

.um-tab {
  border: none;
  background: transparent;
  padding: 12px 0;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.um-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

#editForm {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.um-tab-panel {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1;
}

.um-field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.um-section-label {
  margin-top: 20px;
  margin-bottom: 4px;
}

.um-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.um-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(139, 31, 36, 0.14);
  background: var(--surface-strong);
  font: inherit;
  color: var(--text);
  margin-bottom: 16px;
}

.um-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 31, 36, 0.12);
}

.um-password-field {
  position: relative;
  margin-bottom: 16px;
}

.um-password-field .um-input {
  margin-bottom: 0;
  padding-right: 44px;
}

.um-password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
}

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

.um-booth-item {
  padding: 12px 14px;
  border: 1px solid rgba(139, 31, 36, 0.12);
  border-radius: 12px;
  background: #fffaf6;
}

/* Access Permission tab */
.um-permission-groups {
  display: grid;
  gap: 14px;
}

.um-perm-group {
  border: 1px solid rgba(139, 31, 36, 0.1);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-strong);
}

.um-perm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #faf5f1;
}

.um-perm-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
}

.um-perm-title .icon-sm {
  color: var(--primary);
}

.um-perm-rows {
  display: grid;
}

.um-perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid rgba(139, 31, 36, 0.07);
  cursor: pointer;
  font-size: 14px;
}

.um-perm-row input,
.um-perm-header input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.um-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 26px;
  border-top: 1px solid rgba(139, 31, 36, 0.1);
  background: var(--surface-strong);
}

.um-save-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#editFormMessage:not(:empty) {
  padding: 0 26px 16px;
  margin: 0;
}

@media (max-width: 640px) {
  .um-booth-grid {
    grid-template-columns: 1fr;
  }

  .um-add-button {
    margin-left: 0;
  }
}

/* Made with Bob */

/* ═══════════════════════════════════════════════════════════════════════════
   TRANSACTIONS PAGE — redesigned components
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Section title ─────────────────────────────────────────────────────────── */
.tx-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 12px;
}

/* ── Stat cards row ─────────────────────────────────────────────────────────── */
.tx-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 8px;
}

.tx-stat-card {
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
}

.tx-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tx-stat-icon--blue  { background: #e8f0fe; color: var(--stat-blue); }
.tx-stat-icon--green { background: var(--stat-green-bg); color: var(--stat-green); }

.tx-stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.tx-stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-top: 3px;
}

.tx-stat-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

/* ── Payment Breakdown charts ───────────────────────────────────────────────── */
.tx-breakdown-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.tx-chart-card {
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.tx-chart-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.tx-chart-body {
  display: flex;
  align-items: center;
  gap: 24px;
}

.tx-donut-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.tx-donut-wrap canvas {
  width: 140px !important;
  height: 140px !important;
}

.tx-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  pointer-events: none;
}

.tx-chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tx-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.tx-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tx-legend-name {
  color: var(--text);
  font-weight: 500;
  min-width: 60px;
}

.tx-legend-val {
  color: var(--muted);
  font-size: 12px;
}

/* ── Transaction list panel ─────────────────────────────────────────────────── */
.tx-list-panel {
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  padding: 20px 24px 24px;
  box-shadow: var(--shadow-sm);
}

.tx-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tx-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f6f8;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 14px;
  flex: 1;
  max-width: 340px;
  color: var(--muted);
}

.tx-search-wrap input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text);
  width: 100%;
}

.tx-search-wrap input::placeholder { color: var(--muted); }

.tx-filter-pill-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.tx-filter-pill-btn:hover { background: var(--primary-dark); }

.tx-export-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: var(--stat-green);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.tx-export-btn:hover { background: #217a3a; }

/* Collapsible filter bar v2 */
.tx-filter-bar-v2 {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 14px 0 16px;
  border-bottom: 1px solid #f0ebe9;
  margin-bottom: 12px;
}

.tx-filter-bar-v2.hidden { display: none; }

/* ── List header ────────────────────────────────────────────────────────────── */
.tx-list-header,
.tx-list-item {
  display: grid;
  grid-template-columns: 44px 1fr 1fr 60px 110px 110px 110px 100px 60px;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
}

.tx-list-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid #f0ebe9;
  padding-bottom: 10px;
  margin-bottom: 4px;
}

/* ── List item ──────────────────────────────────────────────────────────────── */
.tx-list-item {
  background: var(--surface-strong);
  border: 1px solid #ece8e8;
  border-radius: 14px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
  transition: box-shadow 0.15s;
}

.tx-list-item:hover { box-shadow: 0 2px 12px rgba(80,18,20,0.08); }

/* Column spans shared by header + item */
.tx-col-num    { font-size: 13px; color: var(--muted); }
.tx-col-date   { font-size: 13px; }
.tx-col-booth  { font-weight: 600; }
.tx-col-print  { font-size: 13px; }
.tx-col-price  { font-weight: 600; }
.tx-col-type   { }
.tx-col-voucher { font-size: 13px; color: var(--muted); }
.tx-col-status { }
.tx-col-action { display: flex; justify-content: flex-end; }

/* ── Status badges (colors match the Excel export) ─────────────────────────── */
.tx-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.tx-status-paid      { background: #e6f6ea; color: #2f9e44; }
.tx-status-pending   { background: #fff1e0; color: #e67700; }
.tx-status-expired,
.tx-status-failed,
.tx-status-cancelled { background: #fdecec; color: #c92a2a; }
.tx-status-unknown   { background: #f1eeee; color: var(--muted); }

/* ── Type badges ────────────────────────────────────────────────────────────── */
.tx-type-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.tx-type-cashless {
  background: #e8f0fe;
  color: #2563eb;
}

.tx-type-voucher {
  background: #f1e9fe;
  color: #7c3aed;
}

.tx-type-badge small {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.8;
}

/* ── 3-dot button ───────────────────────────────────────────────────────────── */
.tx-dot-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #e0d9d9;
  border-radius: 9px;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.12s, border-color 0.12s;
}

.tx-dot-btn:hover {
  background: #f5f0f0;
  border-color: #c8c0c0;
  color: var(--text);
}

/* ── 3-dot dropdown menu ────────────────────────────────────────────────────── */
.tx-dot-menu {
  background: var(--surface-strong);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 9000;
  min-width: 120px;
  padding: 4px;
  overflow: hidden;
}

.tx-dot-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.tx-dot-menu-item:hover { background: #f5f0f0; }

/* ── Numbered pagination ────────────────────────────────────────────────────── */
.tx-page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.tx-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e0d9d9;
  border-radius: 9px;
  background: var(--surface-strong);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.tx-page-btn:hover:not(:disabled) {
  background: #f5f0f0;
  border-color: #c8c0c0;
}

.tx-page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

.tx-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.tx-page-ellipsis {
  font-size: 14px;
  color: var(--muted);
  padding: 0 4px;
}

/* ── Detail modal ───────────────────────────────────────────────────────────── */
.tx-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.tx-modal-backdrop.hidden { display: none; }

.tx-modal-card {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.2);
  overflow: hidden;
}

.tx-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0ebe9;
}

.tx-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.tx-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.12s;
}

.tx-modal-close:hover { background: #f5f0f0; color: var(--text); }

.tx-modal-body {
  padding: 8px 0 24px;
}

.tx-detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid #f7f3f3;
}

.tx-detail-row:last-child { border-bottom: none; }

.tx-detail-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--stat-blue, #2563eb);
  white-space: nowrap;
  flex-shrink: 0;
}

.tx-detail-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

.tx-detail-free  { color: #c92a2a !important; }
.tx-detail-price { color: var(--stat-blue, #2563eb) !important; font-size: 16px; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .tx-stat-row      { grid-template-columns: 1fr 1fr; }
  .tx-breakdown-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .tx-stat-row { grid-template-columns: 1fr; }
  .tx-list-header,
  .tx-list-item {
    grid-template-columns: 32px 1fr 1fr 50px 90px 90px 90px 90px 50px;
    font-size: 12px;
  }
}

/* ═══ Galeri Sesi (web admin twin of the desktop gallery) ═══════════════════ */

.wgal-booth-select {
  min-width: 220px;
}

.wgal-filters {
  display: grid;
  grid-template-columns: 1fr repeat(4, minmax(130px, auto));
  gap: 12px;
  margin-bottom: 10px;
}

.wgal-search,
.wgal-select {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(139, 31, 36, 0.18);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.wgal-search:focus,
.wgal-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 31, 36, 0.12);
}

.wgal-result-info {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
}

.wgal-message {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  background: rgba(139, 31, 36, 0.08);
  color: var(--primary-dark);
}

.wgal-message.error {
  background: rgba(201, 42, 42, 0.1);
  color: var(--danger);
  border: 1px solid rgba(201, 42, 42, 0.25);
}

.wgal-message.success {
  background: var(--stat-green-bg);
  color: var(--stat-green);
}

.wgal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  min-height: 200px;
}

.wgal-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.wgal-card {
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.wgal-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

/* Staggered entrance — delay set inline per card */
.wgal-enter {
  opacity: 0;
  animation: wgalFadeUp 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes wgalFadeUp {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.wgal-thumb {
  position: relative;
  aspect-ratio: 2 / 3;
  background: #efe6df;
  overflow: hidden;
}

.wgal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.wgal-thumb img.loaded {
  opacity: 1;
  transform: scale(1);
}

.wgal-card:hover .wgal-thumb img.loaded {
  transform: scale(1.06);
}

.wgal-thumb-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

/* Action buttons over the thumbnail — revealed on hover */
.wgal-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.wgal-card:hover .wgal-actions,
.wgal-card:focus-within .wgal-actions {
  opacity: 1;
  transform: translateY(0);
}

/* Touch devices have no hover — keep the actions visible */
@media (hover: none) {
  .wgal-actions { opacity: 1; transform: none; }
}

.wgal-act {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(80, 18, 20, 0.25);
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.wgal-act:hover  { background: var(--primary); color: #fff; }
.wgal-act:active { transform: scale(0.94); }
.wgal-act:disabled { opacity: 0.45; cursor: not-allowed; }
.wgal-act svg { width: 18px; height: 18px; }

/* Expired flag */
.wgal-flag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(201, 42, 42, 0.92);
  color: #fff;
}

.wgal-meta {
  padding: 12px 14px 14px;
}

.wgal-code {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.wgal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.wgal-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(139, 31, 36, 0.08);
  color: var(--primary-dark);
}

.wgal-badge.live { background: var(--stat-blue-bg);   color: var(--stat-blue); }
.wgal-badge.gif  { background: var(--stat-purple-bg); color: var(--stat-purple); }
.wgal-badge.share   { background: var(--stat-green-bg); color: var(--stat-green); }
.wgal-badge.noshare { background: var(--stat-amber-bg); color: var(--stat-amber); }

.wgal-date {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

/* Pager */
.wgal-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.wgal-pager-btn {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid rgba(139, 31, 36, 0.18);
  background: var(--surface-strong);
  color: var(--primary-dark);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.wgal-pager-btn:hover:not(:disabled) { background: var(--primary); color: #fff; }
.wgal-pager-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.wgal-page-info {
  font-size: 14px;
  color: var(--muted);
}

/* QR modal */
.wgal-qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(43, 20, 22, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: wgalFadeIn 0.2s ease;
}

.wgal-qr-card {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 90vw;
  animation: wgalPop 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes wgalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes wgalPop {
  from { opacity: 0; transform: translateY(12px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.wgal-qr-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 16px;
}

.wgal-qr-img img {
  width: 260px;
  height: 260px;
  border-radius: 12px;
}

.wgal-qr-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 18px;
}

@media (max-width: 980px) {
  .wgal-filters {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Galeri: loading skeletons ── */
.wgal-skeleton {
  pointer-events: none;
}

.wgal-skeleton .wgal-thumb,
.wgal-skel-line {
  background: linear-gradient(100deg,
    rgba(139, 31, 36, 0.06) 40%,
    rgba(139, 31, 36, 0.12) 50%,
    rgba(139, 31, 36, 0.06) 60%);
  background-size: 200% 100%;
  animation: wgalShimmer 1.4s ease-in-out infinite;
}

.wgal-skel-line {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 9px;
}

@keyframes wgalShimmer {
  from { background-position: 120% 0; }
  to   { background-position: -80% 0; }
}

/* ── Galeri: photo lightbox ── */
.wgal-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(26, 10, 11, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1100;
  cursor: zoom-out;
  animation: wgalFadeIn 0.2s ease;
}

.wgal-lightbox img {
  max-width: min(92vw, 640px);
  max-height: 82vh;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: wgalPop 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.wgal-lightbox-cap {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

/* ── Galeri: smoother grid + controls ── */
.wgal-grid {
  transition: opacity 0.25s ease;
}

.wgal-search,
.wgal-select {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wgal-pager-btn {
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.wgal-pager-btn:hover:not(:disabled) { transform: translateY(-1px); }
.wgal-pager-btn:active:not(:disabled) { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .wgal-enter,
  .wgal-card,
  .wgal-thumb img,
  .wgal-qr-modal,
  .wgal-qr-card,
  .wgal-lightbox,
  .wgal-lightbox img {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── Galeri: delete session ── */
.wgal-act-danger { color: var(--danger); }
.wgal-act-danger:hover { background: var(--danger); color: #fff; }

.wgal-delete-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.wgal-delete-confirm {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.wgal-delete-confirm:hover:not(:disabled) {
  background: #a02020;
  color: #fff;
}

.wgal-delete-confirm:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ── Filter editor: built-in sample photos ── */
.fe-sample-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.fe-sample-label {
  font-size: 12px;
  color: var(--muted);
}

.fe-sample-thumb {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid rgba(139, 31, 36, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  background: #fff;
}

.fe-sample-thumb:hover {
  transform: scale(1.08);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* ============================================================
   DEVICE SETTINGS — LIVE VIEW TAB (idle screen preview editor)
   ============================================================ */

/* 16:9 stage standing in for the booth screen. Neutral surface in the admin
   palette so it reads as part of the form, not as a screenshot of the booth. */
.ds-live-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 4px 0 18px;
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
  touch-action: none;
  background-color: var(--bg);
  /* Faint grid, the same visual language as the frame editor canvas */
  background-image:
    linear-gradient(rgba(139, 31, 36, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 31, 36, 0.06) 1px, transparent 1px);
  background-size: 10% 10%, 10% 10%;
  border: 1px solid rgba(139, 31, 36, 0.14);
}

.ds-live-stage-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Stretched like the booth's welcome screen (background-size: 100% 100%),
     so the preview shows exactly what the booth shows — cover would crop. */
  object-fit: fill;
  pointer-events: none;
}

.ds-live-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--primary);
  border-radius: 10px;
  background: rgba(139, 31, 36, 0.12);
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Hints the compositor before the first drag frame, so the grab is smooth */
  will-change: left, top, width, height;
}

.ds-live-box-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  pointer-events: none;
}

/* Drop the fill while dragging — fewer pixels to repaint per frame */
.ds-live-box.is-dragging {
  background: rgba(139, 31, 36, 0.06);
}

.ds-live-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--surface-strong);
  border: 2px solid var(--primary);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(80, 18, 20, 0.25);
}

.ds-live-handle[data-handle='nw'] { top: -6px;    left: -6px;  cursor: nwse-resize; }
.ds-live-handle[data-handle='ne'] { top: -6px;    right: -6px; cursor: nesw-resize; }
.ds-live-handle[data-handle='sw'] { bottom: -6px; left: -6px;  cursor: nesw-resize; }
.ds-live-handle[data-handle='se'] { bottom: -6px; right: -6px; cursor: nwse-resize; }

/* Disabled state — the editor stays visible but reads as inactive */
.ds-live-stage.is-disabled { opacity: 0.5; }
.ds-live-stage.is-disabled .ds-live-box { pointer-events: none; }

/* The editor stage mirrors the Branding tab: welcome logo over the background,
   with the start button in its configured position. Both are inert — they are
   a positioning reference for the live view window, not controls. */
.ds-live-stage-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.ds-live-stage-button {
  position: absolute;
  padding: 6px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #2b1416;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* The nine positions of the Branding grid */
.ds-live-stage-button[data-position^='top-']    { top: 6%; }
.ds-live-stage-button[data-position^='center-'],
.ds-live-stage-button[data-position='center']   { top: 50%; transform: translateY(-50%); }
.ds-live-stage-button[data-position^='bottom-'] { bottom: 6%; }

.ds-live-stage-button[data-position$='-left']   { left: 5%; }
.ds-live-stage-button[data-position$='-right']  { right: 5%; }

.ds-live-stage-button[data-position='top-center'],
.ds-live-stage-button[data-position='bottom-center'] {
  left: 50%;
  transform: translateX(-50%);
}

.ds-live-stage-button[data-position='center'] {
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ── Branding tab: draggable start-text stage + colour inputs ── */

.ds-brand-drag-text {
  position: absolute;
  left: 50%;
  top: 36%;
  transform: translate(-50%, -50%);
  padding: 6px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #2b1416;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: grab;
}

.ds-brand-drag-text.is-dragging {
  cursor: grabbing;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.ds-color-input {
  width: 100%;
  height: 42px;
  padding: 3px;
  border: 1px solid rgba(139, 31, 36, 0.2);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
}
