/* ===== GOOGLE FONTS — Urbanist (matches THIM app) ===== */
@import url('https://fonts.googleapis.com/css2?family=Urbanist:wght@400;500;600;700;800&display=swap');

/* ===== CSS VARIABLES — THIM brand ===== */
:root {
  --primary:      #006CE5;
  --primary-dark: #0056BD;
  --primary-light:#E9F2FC;
  --dark:         #0F1830;
  --success:      #19A463;
  --success-dark: #0E7A45;
  --info:         #3389EA;
  --warning:      #F5A623;
  --warning-dark: #B5710F;
  --danger:       #E5484D;
  --danger-dark:  #C2333A;
  --body-bg:      #F6F7F9;
  --surface:      #ffffff;
  --border:       #E5E7EB;
  --border-light: #F0F1F4;
  --text:         #111827;
  --text-muted:   #6B7280;
  --text-light:   #9CA3AF;
  --card-shadow:  0 2px 8px rgba(15,24,48,0.06);
  --card-radius:  12px;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Urbanist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--body-bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  background: var(--dark);
  border-right: none;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 2px 0 12px rgba(28,34,96,0.18);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.logo-text {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  letter-spacing: 0.02em;
}
.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s;
  font-size: 14px;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item:hover svg { stroke: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(0,108,229,0.35); }
.nav-item.active svg { stroke: #fff; }
.nav-group { margin-top: 10px; }
.nav-group-label {
  padding: 6px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  user-select: none;
}
.nav-item.sub {
  padding-left: 22px;
  font-size: 13px;
}
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-info {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px; margin: -8px;
  background: none; border: none; border-radius: 10px;
  cursor: pointer; text-align: left; font: inherit;
  transition: background 0.12s;
}
.user-info:hover { background: rgba(255,255,255,0.06); }
.user-info-chevron { color: rgba(255,255,255,0.35); flex-shrink: 0; transition: transform 0.12s, color 0.12s; }
.user-info:hover .user-info-chevron { color: rgba(255,255,255,0.7); transform: translateX(2px); }
.logout-btn {
  flex-shrink: 0; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 9px;
  color: rgba(255,255,255,0.45); cursor: pointer; transition: background 0.12s, color 0.12s;
}
.logout-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.user-avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  border: 2px solid rgba(255,255,255,0.18);
}
.user-name { font-weight: 600; font-size: 13px; color: #fff; }
.user-email { color: rgba(255,255,255,0.5); font-size: 11px; }

/* ===== MAIN ===== */
.main-content { flex: 1; overflow-y: auto; }
.page { display: none; }
.page.active { display: block; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 9;
}
.page-header-left { display: flex; flex-direction: column; gap: 2px; }
.page-breadcrumb {
  font-size: 11px; font-weight: 500;
  color: var(--text-muted); letter-spacing: 0.02em;
  margin-bottom: 3px; display: flex; align-items: center; gap: 4px;
}
.page-breadcrumb .bc-sep { color: var(--border); }
.page-breadcrumb .bc-current { color: var(--primary); font-weight: 600; }
.page-title {
  font-size: 21px; font-weight: 700;
  color: var(--text); letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-subtitle {
  color: var(--text-muted); font-size: 12px;
  margin-top: 2px; font-weight: 400; line-height: 1.4;
}

/* ===== SCORECARD ===== */
.scorecard-row { display: flex; gap: 16px; padding: 24px 28px 20px; }
.scorecard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 20px;
  flex: 1;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.15s;
}
.scorecard:hover { box-shadow: 0 4px 16px rgba(28,34,96,0.10); }
.scorecard-label {
  color: var(--text-muted); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.scorecard-value {
  font-size: 26px; font-weight: 700; color: var(--text);
  margin-top: 6px; letter-spacing: -0.02em; line-height: 1;
}
.scorecard-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.scorecard.blue   { border-left: 4px solid var(--primary); }
.scorecard.green  { border-left: 4px solid var(--success); }
.scorecard.orange { border-left: 4px solid var(--warning); }
.scorecard.red    { border-left: 4px solid var(--danger); }

/* ===== TOOLBAR ===== */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 20px 28px 16px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; max-width: 320px; }
.search-box input {
  width: 100%; padding: 9px 12px 9px 36px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); font-size: 14px; outline: none;
  color: var(--text); font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,108,229,0.12); }
.search-box::before { content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; pointer-events: none; }
.filter-select {
  padding: 9px 36px 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); font-size: 14px; outline: none; cursor: pointer;
  color: var(--text); font-family: inherit;
  transition: border-color 0.15s;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}
.filter-select:focus { border-color: var(--primary); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none; transition: all 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(0,108,229,0.28); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(0,108,229,0.36); }
.btn-secondary { background: var(--surface); color: var(--primary); border: 1.5px solid var(--primary); }
.btn-secondary:hover { background: var(--primary-light); }
.btn-draft { background: var(--surface); color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-draft:hover { background: var(--body-bg); border-color: var(--text-muted); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 2px 8px rgba(229,72,77,0.25); }
.btn-danger:hover { background: var(--danger-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--body-bg); color: var(--text); border-color: var(--text-muted); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
/* White bordered ✕ delete button (Figma list-row delete) */
.btn-x {
  justify-content: center; background: var(--surface); color: #ff7076;
  border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 6px 12px; font-size: 13px; line-height: 1;
}
.btn-x:hover { background: #fff0f0; border-color: #ffbdbd; color: var(--danger-dark); }

/* ===== TABLE ===== */
/* When table follows header directly (e.g. Categories — no toolbar/scorecard in between) */
.page-header + .table-container { margin-top: 24px; }
.table-container {
  margin: 0 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--body-bg); }
th {
  padding: 12px 16px; text-align: left;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: none;
  letter-spacing: normal; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable a { cursor: pointer; }
th.sortable:hover, th.sort-active { color: var(--primary); }
td { padding: 13px 16px; border-top: 1px solid var(--border-light); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #F1F6FE; }
.table-empty { text-align: center; padding: 56px; color: var(--text-light); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-blue   { background: #E9F2FC; color: var(--primary); }
.badge-green  { background: #ECFAE7; color: var(--success-dark); }
.badge-orange { background: #FEF4E7; color: var(--warning-dark); }
.badge-red    { background: #FFECEC; color: var(--danger-dark); }
.badge-gray   { background: var(--border-light); color: var(--text-muted); }
.badge-purple { background: #F0ECFF; color: #6B44CC; }

/* ===== PARTNER LOGO ===== */
.partner-logo { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.cell-with-logo { display: flex; align-items: center; gap: 10px; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(17,43,74,0.45); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay.hidden { display: none; }
.modal-container {
  background: var(--surface); border-radius: 14px;
  width: 600px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(28,34,96,0.20);
}
.modal-container.wide { width: 820px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-light); line-height: 1; padding: 4px; transition: color 0.1s; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border-light); }

/* ===== FORM ===== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.form-label .req, .req { color: var(--danger); }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; outline: none;
  background: var(--surface); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,108,229,0.12); }
input.form-control:read-only, textarea.form-control:read-only, input.form-control[readonly], textarea.form-control[readonly] { background: var(--body-bg); color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; line-height: 1.5; }
select.form-control {
  cursor: pointer;
  padding-right: 36px;
  appearance: none; -webkit-appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-hint.warn-orange { color: var(--warning-dark); }
.char-count { font-size: 11px; color: var(--text-muted); text-align: right; margin-top: 2px; }
.char-count.over { color: var(--danger); font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 10px; font-weight: 700;
  color: var(--primary); text-transform: uppercase;
  letter-spacing: 0.10em; margin-bottom: 14px;
  padding-bottom: 8px; border-bottom: 2px solid var(--primary-light);
  display: flex; align-items: center; gap: 8px;
}
.form-section-title::before {
  content: ''; display: inline-block;
  width: 3px; height: 12px;
  background: var(--primary); border-radius: 2px; flex-shrink: 0;
}

/* ===== RADIO CARD (selectable option row) ===== */
.radio-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.radio-card:hover { border-color: var(--primary); }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.radio-card input { margin-top: 1px; accent-color: var(--primary); flex-shrink: 0; }
.radio-card .rc-title { display: block; font-weight: 600; font-size: 14px; color: var(--text); }
.radio-card .rc-sub { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== LANG TABS ===== */
.lang-tabs { display: flex; gap: 6px; flex-wrap: nowrap; margin-bottom: 16px; align-items: center; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.lang-tabs::-webkit-scrollbar { height: 3px; }
.lang-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.lang-tab {
  padding: 5px 12px; border-radius: 6px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all 0.15s; color: var(--text-muted);
}
.lang-tab:hover { border-color: var(--primary); color: var(--primary); }
.lang-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.lang-tab-add {
  padding: 5px 10px; border-radius: 6px;
  border: 1.5px dashed var(--border); background: var(--surface);
  font-size: 13px; cursor: pointer; color: var(--primary); font-family: inherit;
  transition: all 0.15s;
}
.lang-tab-add:hover { background: var(--primary-light); border-color: var(--primary); }
.lang-panel { display: none; }
.lang-panel.active { display: block; }

/* ===== LANG DROPDOWN ===== */
.lang-dropdown { position: relative; display: inline-block; }
.lang-dropdown-menu {
  position: fixed;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(28,34,96,0.14);
  z-index: 9999; min-width: 200px; padding: 4px;
  display: none;
}
.lang-dropdown-menu.open { display: block; }
.lang-dropdown-item { padding: 8px 12px; font-size: 13px; cursor: pointer; border-radius: 6px; color: var(--text); }
.lang-dropdown-item:hover:not(.added) { background: var(--primary-light); color: var(--primary); }
.lang-dropdown-item.added { color: var(--text-light); cursor: default; }

/* ===== UPLOAD ===== */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 20px; text-align: center; cursor: pointer;
  transition: all 0.15s; background: var(--body-bg);
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-zone input[type=file] { display: none; }
.upload-icon { font-size: 24px; margin-bottom: 6px; line-height: 1; }
.upload-text { font-size: 13px; color: var(--text-muted); }
.upload-text strong { color: var(--primary); }
.upload-hint { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.upload-preview { display: inline-block; margin-top: 10px; position: relative; }
.upload-preview img { max-width: 120px; max-height: 120px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); display: block; }
.upload-preview .remove-btn {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; background: var(--danger);
  color: #fff; border-radius: 50%; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; line-height: 1;
}

/* ===== UPLOAD ZONE — SVG icon ===== */
.upload-zone .upload-icon { line-height: 1; margin-bottom: 8px; }

/* ===== CROP OVERLAY ===== */
#crop-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 3000; display: flex; align-items: center; justify-content: center; }
.crop-dialog { background: var(--surface); border-radius: 16px; padding: 24px; width: 500px; box-shadow: 0 24px 64px rgba(0,0,0,0.28); }
#crop-vp { position: relative; width: 452px; height: 300px; background: #111; border-radius: 8px; overflow: hidden; cursor: grab; user-select: none; }
#crop-img { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; max-width: none; }
.crop-svg { position: absolute; top: 0; left: 0; pointer-events: none; }

/* ===== TAGS (CATEGORIES) ===== */
.tags-options-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-option {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: 6px;
  border: 1.5px solid var(--border); font-size: 13px;
  cursor: pointer; transition: all 0.12s; user-select: none;
  color: var(--text-muted);
}
.tag-option:hover { border-color: var(--primary); color: var(--primary); }
.tag-option.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== PROGRESS BAR ===== */
.progress-bar { height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border-light); }
.pagination-info { font-size: 13px; color: var(--text-muted); }
.pagination-btns { display: flex; gap: 4px; }
.page-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text); transition: all 0.15s;
}
.page-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== DETAIL PAGE ===== */
.detail-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 6px rgba(28,34,96,0.06);
}
.back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--body-bg); border: 1px solid var(--border);
  cursor: pointer; color: var(--primary);
  width: 32px; height: 32px; border-radius: 8px;
  font-size: 16px; transition: all 0.15s; flex-shrink: 0;
}
.back-btn:hover { background: var(--primary-light); border-color: var(--primary); }
.detail-header-text { flex: 1; min-width: 0; }
.detail-title {
  font-size: 15px; font-weight: 700;
  color: var(--text); letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.detail-title-sub {
  font-size: 12px; color: var(--text-muted);
  font-weight: 400; margin-top: 1px;
}
.detail-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--card-radius); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--card-shadow);
}
.detail-card-title {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-light);
}
.detail-row { display: flex; margin-bottom: 12px; gap: 12px; }
.detail-row:last-child { margin-bottom: 0; }
.detail-key { font-weight: 600; color: var(--text-muted); font-size: 13px; min-width: 140px; flex-shrink: 0; }
.detail-val { color: var(--text); font-size: 13px; }

/* ===== STATS ===== */
.stats-row { display: flex; gap: 16px; padding: 24px 0 0; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--card-radius); padding: 16px 20px; flex: 1;
  box-shadow: var(--card-shadow);
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; color: var(--text); }

/* ===== CSV ===== */
.csv-result {
  background: #ECFAE7; border-radius: 8px; padding: 10px 14px; margin-top: 10px;
  font-size: 13px; font-weight: 600; color: var(--success-dark);
  display: flex; align-items: center; gap: 8px;
  border: 1px solid #C5EAB8;
}

/* ===== ORDERING ARROWS (legacy, kept for reference) ===== */
.order-arrows { display: flex; flex-direction: column; gap: 2px; }
.order-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 4px; width: 22px; height: 22px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-muted); transition: all 0.15s;
}
.order-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.order-btn:disabled { opacity: 0.3; cursor: default; }
.order-btns { display: flex; flex-direction: column; gap: 3px; align-items: center; }

/* ===== DRAG-AND-DROP REORDER ===== */
.dnd-handle {
  display: flex; align-items: center; justify-content: center;
  width: 28px; flex-shrink: 0;
  color: var(--text-muted); cursor: grab; font-size: 16px;
  user-select: none; opacity: 0.5;
}
.dnd-handle:hover { opacity: 1; color: var(--primary); }
[draggable=true] { cursor: grab; }
[draggable=true]:active { cursor: grabbing; }
.dnd-row-over-top { border-top: 2px solid var(--primary) !important; }
.dnd-logo-over { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 50%; }

/* ===== NATIVE COLOR WHEEL INPUT ===== */
input[type="color"] { -webkit-appearance: none; appearance: none; border: none; background: none; padding: 0; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; border-radius: 50%; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }

/* ===== ACTION CELL ===== */
.action-cell { display: flex; gap: 6px; align-items: center; }

/* ===== DUP WARNING ===== */
.dup-warning { color: var(--danger); font-size: 12px; margin-top: 4px; display: none; }
.dup-warning.show { display: block; }

/* ===== SWITCH ===== */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { display: none; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 22px; transition: 0.3s; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; box-shadow: 0 1px 3px rgba(0,0,0,0.18); }
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(18px); }

/* ===== MINI COUPON LIST ===== */
.mini-coupon-list { display: flex; flex-direction: column; gap: 8px; }
.mini-coupon-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; background: var(--body-bg);
  border-radius: 8px; cursor: pointer;
  transition: background 0.1s; border: 1px solid var(--border-light);
}
.mini-coupon-item:hover { background: var(--primary-light); border-color: var(--primary); }

/* ===== PHONE PREVIEW (COUPON DETAIL — FIXED BOTTOM RIGHT) ===== */
#coupon-phone-fixed {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 200; pointer-events: none;
  filter: drop-shadow(0 8px 32px rgba(28,34,96,0.22));
}
.pf-device {
  width: 256px; background: #fff;
  border-radius: 40px; border: 8px solid var(--text);
  overflow: hidden; font-family: 'Urbanist', sans-serif;
}
.pf-statusbar {
  background: #fff; display: flex; justify-content: space-between;
  padding: 10px 16px 4px; font-size: 9px; font-weight: 700; color: var(--text);
}
.pf-navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 14px 8px; font-size: 11px; background: #fff;
}
.pf-nav-title { font-weight: 700; font-size: 12px; }
.pf-back, .pf-share { font-size: 14px; color: var(--text); }
.pf-scroll { max-height: 440px; overflow-y: auto; scrollbar-width: none; }
.pf-scroll::-webkit-scrollbar { display: none; }
.pf-hero {
  width: 100%; height: 108px;
  background: linear-gradient(135deg, var(--primary), #3389EA);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.pf-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-pad { padding: 10px 12px 4px; }
.pf-reward-tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: #FFECEC; color: var(--danger-dark);
  padding: 2px 8px; border-radius: 20px;
  font-size: 9px; font-weight: 700; margin-bottom: 5px;
}
.pf-ctitle { font-size: 14px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.pf-valid { font-size: 9px; color: var(--danger); font-weight: 600; margin-bottom: 6px; }
.pf-line { border-top: 1px solid var(--border-light); margin: 8px 0; }
.pf-partner-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pf-plogo {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
  overflow: hidden; background-size: cover; background-position: center;
}
.pf-pname { font-size: 11px; font-weight: 700; color: var(--text); }
.pf-pdesc { font-size: 9px; color: var(--text-muted); }
.pf-sec { font-size: 11px; font-weight: 700; margin: 8px 0 4px; color: var(--text); }
.pf-body-txt { font-size: 9px; color: #555; line-height: 1.5; margin-bottom: 6px; white-space: pre-line; }
.pf-how { font-size: 9px; color: var(--text); display: flex; gap: 4px; margin-bottom: 2px; line-height: 1.4; }
.pf-check { color: var(--success); flex-shrink: 0; }
.pf-terms { font-size: 9px; color: var(--text-muted); display: flex; justify-content: space-between; border-top: 1px solid var(--border-light); padding-top: 8px; margin-top: 4px; font-weight: 600; }
.pf-collect-btn {
  background: var(--primary); color: #fff;
  text-align: center; padding: 11px;
  font-size: 12px; font-weight: 700;
  border-radius: 24px; margin: 8px 12px 16px;
  letter-spacing: 0.3px;
}
.pf-preview-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 6px; text-align: center;
}

/* ===== BANNER PREVIEW ===== */
.banner-preview-phone {
  width: 240px; background: var(--body-bg);
  border-radius: 32px; border: 7px solid var(--text);
  overflow: hidden; box-shadow: 0 8px 24px rgba(28,34,96,0.25);
}

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--dark); color: #fff;
  padding: 12px 20px; border-radius: 8px; font-size: 14px;
  z-index: 4000; box-shadow: 0 4px 20px rgba(28,34,96,0.28);
  font-weight: 500;
}
.toast.success { background: var(--success-dark); }
.toast.error { background: var(--danger-dark); }
.toast.hidden { display: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== CTA PLACEMENT SELECTOR ===== */
.placement-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.placement-option {
  padding: 6px 14px; border: 1.5px solid var(--border);
  border-radius: 6px; cursor: pointer; font-size: 12px;
  transition: all 0.1s; color: var(--text-muted); font-family: inherit;
}
.placement-option:hover { border-color: var(--primary); color: var(--primary); }
.placement-option.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== FEATURED PAGE ===== */
.featured-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 16px 20px; margin-bottom: 10px;
  box-shadow: var(--card-shadow);
}
.featured-card .fc-pos { font-size: 22px; font-weight: 800; color: var(--primary); min-width: 36px; text-align: center; }
.featured-thumb {
  width: 56px; height: 56px; border-radius: 8px;
  background: var(--border-light); overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-light);
}

input[type=date].form-control, input[type=datetime-local].form-control { cursor: pointer; }

/* ===== FILTER CHIPS ===== */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 14px; border-radius: 20px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--text-muted); transition: all 0.15s; font-family: inherit;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== MULTI-SELECT FILTER ===== */
.ms-filter { position: relative; display: inline-block; }
.ms-filter-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  color: var(--text-muted); transition: border-color 0.15s; white-space: nowrap;
}
.ms-filter-btn:hover, .ms-filter-btn.open { border-color: var(--primary); color: var(--primary); }
.ms-filter-btn.has-selection { border-color: var(--primary); color: var(--primary); background: #E9F2FC; }
.ms-filter-btn .ms-count {
  background: var(--primary); color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center;
}
.ms-filter-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 400;
  background: #fff; border: 1.5px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12); min-width: 180px; padding: 6px 0;
  display: none;
}
.ms-filter-menu.open { display: block; }
.ms-filter-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--text);
  transition: background 0.1s;
}
.ms-filter-item:hover { background: var(--body-bg); }
.ms-filter-item input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.ms-filter-item.checked { color: var(--primary); font-weight: 600; }
/* selected chips row */
.ms-chips-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 0; align-items: center; }
.ms-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 12px; border-radius: 20px;
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 600;
}
/* secondary chip: white bg, blue text, blue border — for category filters */
.ms-chip-cat {
  background: #fff; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.ms-chip-x {
  cursor: pointer; font-size: 14px; line-height: 1;
  opacity: 0.75; margin-left: 2px;
}
.ms-chip-x:hover { opacity: 1; }

/* ===== CUSTOM SEARCHABLE FILTER ===== */
.cs-filter { position: relative; display: inline-block; flex-shrink: 0; }
.cs-filter-btn {
  padding: 9px 36px 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  font-size: 14px; font-family: inherit; cursor: pointer; color: var(--text);
  white-space: nowrap; outline: none; transition: border-color 0.15s;
  display: block; width: 100%;
}
.cs-filter-btn:hover { border-color: var(--primary); }
.cs-filter-btn.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.cs-filter-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 500;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(28,34,96,0.14); min-width: 200px; display: none;
}
.cs-filter-menu.open { display: block; }
.cs-filter-search { padding: 8px 8px 4px; }
.cs-filter-search input {
  width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; font-family: inherit; outline: none; box-sizing: border-box;
}
.cs-filter-search input:focus { border-color: var(--primary); }
.cs-filter-list { max-height: 220px; overflow-y: auto; padding: 4px; }
.cs-filter-item {
  padding: 8px 12px; border-radius: 7px; font-size: 13px;
  cursor: pointer; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.cs-filter-item:hover { background: var(--primary-light); color: var(--primary); }
.cs-filter-item.cs-selected { color: var(--primary); font-weight: 600; }
.cs-filter-clear {
  padding: 8px 12px; border-top: 1px solid var(--border-light);
  font-size: 12px; font-weight: 600; color: var(--danger);
  cursor: pointer; text-align: center;
}
.cs-filter-clear:hover { background: #fff5f5; }

/* ===== VIEW FIELD (read-only display) ===== */
.view-field {
  background: var(--body-bg); border: 1px solid var(--border-light);
  border-radius: 8px; padding: 9px 12px; font-size: 14px;
  min-height: 38px; color: var(--text);
}

/* ===== TRANSLATE HINT ===== */
.translate-hint { margin-bottom: 10px; }

/* ===== PHONE PREVIEW — body styles ===== */
.pf-notch { width: 80px; height: 20px; background: var(--text); border-radius: 0 0 14px 14px; margin: 0 auto; position: relative; z-index: 1; }
.pf-body { padding: 8px 12px 4px; }
.pf-title { font-size: 13px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; color: var(--text); }
.pf-section-label { font-size: 9px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.pf-details { font-size: 9px; color: #555; line-height: 1.5; margin-top: 2px; }
.pf-divider { border-top: 1px solid var(--border-light); margin: 6px 0; }

/* ===== BANNER PHONE PREVIEW ===== */
.banner-phone-wrap { display: flex; flex-direction: column; align-items: center; }
.banner-pf-device {
  width: 220px; background: #fff;
  border-radius: 32px; border: 7px solid var(--text);
  overflow: hidden; box-shadow: 0 8px 24px rgba(28,34,96,0.18);
  font-family: 'Urbanist', sans-serif;
}
.banner-pf-status { height: 20px; background: var(--body-bg); }
.banner-pf-header { padding: 4px 12px 6px; background: #fff; border-bottom: 1px solid var(--border-light); }
.banner-pf-carousel { margin: 8px 12px; height: 90px; border-radius: 10px; overflow: hidden; background: var(--border-light); }
.banner-pf-tag {
  position: absolute; top: 8px; left: 10px;
  background: #ffcf00; color: var(--text);
  font-size: 7px; font-weight: 800; padding: 2px 6px; border-radius: 4px;
}
.banner-pf-nav {
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 6px 12px; border-top: 1px solid var(--border-light); margin-top: 8px;
}

/* ===== FEATURED ROW ===== */
.featured-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.featured-row:last-child { border-bottom: none; }
.featured-row:hover { background: var(--primary-light); }
.featured-row.active { background: var(--primary-light); border-left: 3px solid var(--primary); padding-left: 17px; }
.featured-rank { font-size: 18px; font-weight: 800; color: var(--primary); min-width: 32px; text-align: center; }

/* ===== EDITOR LAYOUT (create/edit full-page with right preview) ===== */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 268px;
  height: 100vh;
  overflow: hidden;
}
.editor-main { overflow-y: auto; padding-bottom: 80px; }
.editor-preview {
  border-left: 1px solid var(--border);
  background: var(--body-bg);
  overflow-y: auto;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.preview-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 14px; width: 100%; text-align: center;
}

/* App-preview layout: two columns on desktop; collapses to a hamburger-
   toggled drawer on small screens (see the 768px media query below). */
.preview-layout { display: grid; grid-template-columns: 1fr 300px; gap: 0; align-items: stretch; }
.preview-fab, .preview-backdrop, .preview-close { display: none; }

/* ===== COUPON PHONE PREVIEW (in right panel) ===== */
.cpv-wrap { width: 220px; flex-shrink: 0; }
.cpv-notch { width: 70px; height: 18px; background: var(--text); border-radius: 0 0 12px 12px; margin: 0 auto; }
.cpv-topbar { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px 2px; }
.cpv-back { font-size: 14px; color: var(--primary); font-weight: 700; }
.cpv-share { font-size: 14px; color: var(--primary); }
.cpv-hero { width: 100%; height: 90px; background: linear-gradient(135deg,var(--primary),#3389EA); overflow: hidden; flex-shrink: 0; }
.cpv-hero img { width: 100%; height: 100%; object-fit: cover; }
.cpv-body { padding: 8px 10px 6px; }
.cpv-reward { display: inline-block; background: #FFECEC; color: var(--danger-dark); font-size: 8px; font-weight: 800; padding: 2px 7px; border-radius: 20px; margin-bottom: 4px; letter-spacing: .02em; }
.cpv-title { font-size: 12px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; color: var(--text); }
.cpv-detail-img { width: 100%; height: 48px; object-fit: cover; border-radius: 5px; margin-bottom: 6px; }
.cpv-collect { background: var(--primary); color: #fff; text-align: center; font-size: 10px; font-weight: 700; padding: 7px; border-radius: 18px; margin: 0 0 8px; letter-spacing: .02em; }
.cpv-partner { display: flex; align-items: center; gap: 5px; margin-bottom: 5px; }
.cpv-partner-logo { width: 18px; height: 18px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 7px; font-weight: 700; color: #fff; overflow: hidden; flex-shrink: 0; }
.cpv-partner-name { font-size: 9px; font-weight: 600; color: var(--text); }
.cpv-divider { border-top: 1px solid var(--border-light); margin: 5px 0; }
.cpv-valid { font-size: 8px; color: var(--danger); font-weight: 600; margin-bottom: 5px; }
.cpv-sec-label { font-size: 8px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.cpv-sec-text { font-size: 8px; color: #555; line-height: 1.5; }

/* ===== EXPLORE PHONE PREVIEW (banners/featured right panel) ===== */
.epv-wrap { width: 220px; flex-shrink: 0; }
.epv-notch { width: 70px; height: 18px; background: var(--text); border-radius: 0 0 12px 12px; margin: 0 auto; }
.epv-header { padding: 4px 12px 6px; background: #fff; }
.epv-greeting { font-size: 8px; color: var(--text-light); margin-bottom: 1px; }
.epv-title { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.epv-search { background: var(--body-bg); border-radius: 20px; padding: 5px 10px; font-size: 8px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.epv-carousel-wrap { position: relative; margin: 8px 10px 4px; }
.epv-carousel { height: 80px; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg,var(--primary),#3389EA); position: relative; }
.epv-carousel img { width: 100%; height: 100%; object-fit: cover; }
.epv-banner-tag { position: absolute; top: 6px; left: 8px; background: #ffcf00; color: var(--text); font-size: 7px; font-weight: 800; padding: 1px 5px; border-radius: 3px; }
.epv-banner-name { position: absolute; bottom: 22px; left: 8px; color: #fff; font-size: 9px; font-weight: 700; max-width: 120px; line-height: 1.2; }
.epv-banner-cta { position: absolute; font-size: 7px; font-weight: 700; padding: 3px 8px; border-radius: 10px; background: #fff; color: var(--primary); }
.epv-banner-cta.bl { bottom: 6px; left: 8px; }
.epv-banner-cta.bc { bottom: 6px; left: 50%; transform: translateX(-50%); }
.epv-banner-cta.br { bottom: 6px; right: 8px; }
.epv-dots { display: flex; justify-content: center; gap: 3px; margin: 5px 0; }
.epv-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); }
.epv-dot.active { background: var(--primary); width: 12px; border-radius: 3px; }
.epv-carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); display: flex; justify-content: space-between; width: 100%; pointer-events: none; }
.epv-carousel-btn { width: 20px; height: 20px; background: rgba(255,255,255,.75); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; cursor: pointer; pointer-events: all; border: none; color: var(--text); }
.epv-featured-label { padding: 4px 10px 3px; font-size: 9px; font-weight: 700; color: var(--text); }
.epv-featured-row { display: flex; gap: 5px; padding: 0 10px 6px; overflow: hidden; }
.epv-feat-card { flex: 1; background: var(--body-bg); border-radius: 7px; padding: 5px 6px; min-width: 0; border: 1px solid var(--border-light); }
.epv-feat-reward { font-size: 7px; font-weight: 700; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epv-feat-name { font-size: 6px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epv-nav { display: flex; justify-content: space-around; padding: 6px 6px 10px; border-top: 1px solid var(--border-light); }
.epv-nav-item { text-align: center; }
.epv-nav-item svg { display: block; margin: 0 auto 1px; }
.epv-nav-item span { font-size: 6px; font-weight: 600; display: block; color: var(--text-muted); }
.epv-nav-item.active span { color: var(--primary); }

/* ===== LEAVE CONFIRMATION MODAL ===== */
#leave-modal .modal-container { max-width: 400px; }
.leave-modal-body { padding: 32px 28px; text-align: center; }
.leave-modal-icon { font-size: 36px; margin-bottom: 16px; }
.leave-modal-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.leave-modal-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }
.leave-modal-btns { display: flex; gap: 10px; justify-content: center; }

/* ===== CATEGORY TAG (colored dot + name) ===== */
.cat-tag { display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:600; padding:3px 10px 3px 8px; border-radius:20px; background:#F3F4F8; color:#111827; border:1px solid #E4E7F0; margin:2px; white-space:nowrap; }

/* Translation row language badge + remove ✕ (category form) */
.lang-pill { display:inline-flex; align-items:center; justify-content:center; height:24px; padding:0 8px; border-radius:6px; background:#F3F4F8; color:#6B7280; border:1px solid #E4E7F0; font-size:11px; font-weight:600; white-space:nowrap; flex-shrink:0; }
.cat-lang-remove { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; flex-shrink:0; border-radius:6px; border:1px solid #E4E7F0; background:#fff; color:#6B7280; font-size:16px; line-height:1; cursor:pointer; transition:background .12s,color .12s,border-color .12s; }
.cat-lang-remove:hover { background:#FFF0F0; color:#ff7076; border-color:#FFBDBD; }

/* ===== COUNT CHIP (prominent coupon count) ===== */
.count-chip { display:inline-block; font-size:15px; font-weight:700; color:#006CE5; background:#E9F2FC; padding:3px 14px; border-radius:20px; min-width:36px; text-align:center; }

/* ===== COLOR PICKER (category) ===== */
.color-swatch-row { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.color-swatch { width:28px; height:28px; border-radius:50%; cursor:pointer; border:2px solid transparent; flex-shrink:0; transition:transform 0.12s, border-color 0.12s; }
.color-swatch:hover { transform:scale(1.15); border-color:#fff; box-shadow:0 0 0 2px #006CE5; }
.color-swatch.active { border-color:#fff; box-shadow:0 0 0 2px #006CE5; transform:scale(1.1); }
.color-input-row { display:flex; align-items:center; gap:8px; }
.color-preview-dot { width:32px; height:32px; border-radius:50%; border:2px solid #E5E7EB; flex-shrink:0; transition:background 0.15s; }
.color-hex-prefix { font-size:14px; font-weight:600; color:#6B7280; }

/* ===== CROP HANDLES ===== */
.crop-handle {
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border: 2px solid #006CE5;
  border-radius: 3px;
  cursor: nwse-resize;
  z-index: 10;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(28,34,96,0.18);
  transition: background 0.1s;
}
.crop-handle:hover { background: #006CE5; }

/* ===== BANNER FULL-PAGE LIST ===== */
.banner-list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.banner-list-row:last-child { border-bottom: none; }
.banner-list-row:hover { background: var(--primary-light); cursor: pointer; }
.banner-list-row.active { background: var(--primary-light); border-left: 3px solid var(--primary); padding-left: 17px; }
.banner-rank { font-size: 18px; font-weight: 800; color: var(--primary); min-width: 32px; text-align: center; }
.banner-list-layout { display: grid; grid-template-columns: 1fr 268px; height: 100vh; overflow: hidden; }
.banner-list-main { overflow-y: auto; padding-bottom: 40px; }

/* ===== FEATURED SECTION IN COUPON ===== */
.featured-section {
  background: #FFFBEC; border: 1.5px solid #F5CC60;
  border-radius: 10px; padding: 16px 18px; margin-bottom: 18px;
}
.featured-section .featured-section-title {
  font-size: 13px; font-weight: 700; color: #7A5900;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.featured-img-note {
  font-size: 11px; color: #7A5900;
  background: rgba(245,198,96,.18); border-radius: 6px;
  padding: 6px 10px; margin-top: 8px; line-height: 1.5;
}

/* ===== QUOTA CSV AREA ===== */
.quota-box {
  background: var(--body-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.quota-count { font-size: 22px; font-weight: 700; color: var(--primary); }
.quota-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== SCORECARD SPACING (merged above) ===== */

/* ===== TURN OFF BUTTON ===== */
.btn-turn-off {
  background: #FFF0F0; color: var(--danger-dark);
  border: 1.5px solid #FFBDBD;
}
.btn-turn-off:hover { background: #FFE0E0; border-color: var(--danger); }
.btn-danger-ghost {
  background: transparent; color: var(--danger-dark);
  border: 1.5px solid #FFBDBD;
}
.btn-danger-ghost:hover { background: #FFF0F0; border-color: var(--danger); }

/* ========================================
   RESPONSIVE — TABLET & MOBILE
   ======================================== */

/* ── Tablet (≤ 1024px) ────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 180px; }
  .editor-layout { grid-template-columns: 1fr 220px; }
  .banner-list-layout { grid-template-columns: 1fr 220px; }
  .scorecard-row { gap: 10px; }
  .toolbar { flex-wrap: wrap; gap: 8px; }
}

/* ── Mobile (≤ 768px) ─────────────────── */
@media (max-width: 768px) {
  /* Layout */
  body { flex-direction: column; height: auto; min-height: 100vh; overflow: auto; }

  /* Sidebar → bottom navigation bar */
  .sidebar {
    width: 100%; height: auto; flex-direction: row;
    box-shadow: 0 -2px 12px rgba(28,34,96,0.18);
    order: 2; flex-shrink: 0;
  }
  .sidebar-logo { display: none; }
  .sidebar-nav {
    flex-direction: row; flex: 1; padding: 0;
    justify-content: space-around; overflow-x: auto;
  }
  .nav-item {
    flex-direction: column; padding: 8px 10px; gap: 3px;
    font-size: 10px; min-width: 52px; text-align: center;
  }
  .nav-item svg { width: 20px; height: 20px; }
  .sidebar-footer { display: none; }

  /* Main */
  .main-content { height: auto; overflow: auto; flex: 1; order: 1; }
  .page { height: auto; overflow: visible; }

  /* Page header */
  .page-header {
    flex-direction: column; align-items: flex-start; gap: 10px;
    padding: 16px 16px 12px; position: relative;
  }
  .page-header .btn { align-self: stretch; text-align: center; }

  /* Editor layout → single column */
  .editor-layout { grid-template-columns: 1fr; height: auto; }
  .editor-preview { border-left: none; border-top: 1px solid var(--border-light); }
  .editor-main { overflow: visible; }
  .detail-header {
    flex-wrap: wrap; padding: 12px 16px; gap: 8px; position: relative;
  }
  .detail-header-text { flex: 1; min-width: 0; }
  .detail-header > div:last-child { width: 100%; justify-content: flex-end; }

  /* Banner/featured list layout */
  .banner-list-layout { grid-template-columns: 1fr; height: auto; }
  .banner-list-main { overflow: visible; }

  /* Scorecards */
  .scorecard-row { flex-wrap: wrap; padding: 16px 16px 12px; gap: 8px; }
  .scorecard { flex: 1 1 calc(50% - 4px); min-width: 120px; }

  /* Stats row */
  .stats-row { flex-wrap: wrap; padding: 16px 16px 0; gap: 8px; }
  .stat-card { flex: 1 1 calc(50% - 4px); min-width: 100px; }

  /* Toolbar */
  .toolbar { flex-wrap: wrap; padding: 12px 16px; gap: 8px; }
  .search-box { max-width: 100%; }

  /* Tables */
  .table-container { margin: 16px 0 0 !important; border-radius: 0; border-left: none; border-right: none; }
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }
  /* Hide less critical columns on mobile */
  table th:nth-child(3), table td:nth-child(3) { display: none; }

  /* Cards */
  .detail-card { padding: 14px 16px; }
  .detail-card-title { font-size: 13px; }
  .form-row { flex-direction: column; }

  /* Banner list rows */
  .banner-list-row { padding: 12px 14px; gap: 10px; }

  /* Modals */
  .modal-container { width: calc(100vw - 24px); max-width: 100% !important; border-radius: 14px; }
  .modal-body { padding: 16px; }
  .leave-modal-body { padding: 24px 18px; }
  .leave-modal-btns { flex-direction: column; }
  .leave-modal-btns .btn { width: 100%; }

  /* Crop modal */
  .crop-dialog { padding: 16px; }
  #crop-vp { overflow-x: auto; }

  /* Category lang rows */
  .cat-lang-row { flex-wrap: wrap; }
  .cat-lang-row > div:first-child { width: 100%; margin-bottom: 4px; }

  /* Editor padding */
  .editor-main > div[style*="padding"] { padding: 12px 16px 60px !important; }
  .editor-preview { padding: 16px; }

  /* Page subtitle hidden on small screens */
  .page-subtitle { display: none; }

  /* Breadcrumb compact */
  .page-breadcrumb { font-size: 10px; }
  .page-title { font-size: 17px; }

  /* Count chip smaller */
  .count-chip { font-size: 13px; padding: 2px 10px; }

  /* App preview → hamburger-toggled slide-in drawer */
  .preview-layout { grid-template-columns: 1fr; }
  .preview-layout .editor-preview {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(320px, 86vw);
    border-left: 1px solid var(--border-light); border-top: none;
    background: var(--body-bg);
    transform: translateX(100%); transition: transform .25s ease;
    z-index: 1050; overflow-y: auto !important;
    box-shadow: -8px 0 30px rgba(15, 24, 48, .18);
  }
  .preview-layout.preview-open .editor-preview { transform: translateX(0); }
  /* Inside the drawer the sticky offset is irrelevant */
  .preview-layout .editor-preview > div[style*="sticky"] { position: static !important; top: auto !important; }

  .preview-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(15, 24, 48, .45);
    opacity: 0; visibility: hidden; transition: opacity .25s ease; z-index: 1040;
  }
  .preview-layout.preview-open .preview-backdrop { opacity: 1; visibility: visible; }

  .preview-fab {
    display: inline-flex; align-items: center; gap: 7px;
    position: fixed; right: 16px; bottom: 74px; z-index: 1030;
    background: var(--primary); color: #fff; border: none;
    border-radius: 26px; padding: 10px 15px;
    font-family: inherit; font-size: 13px; font-weight: 700;
    box-shadow: 0 6px 20px rgba(0, 108, 229, .4); cursor: pointer;
  }
  .preview-layout.preview-open .preview-fab { display: none; }

  .preview-close {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 8px; right: 10px; z-index: 3;
    width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid var(--border-light); background: #fff;
    font-size: 20px; line-height: 1; color: var(--text-muted); cursor: pointer;
  }
}

/* ── Small mobile (≤ 480px) ───────────── */
@media (max-width: 480px) {
  .scorecard { flex: 1 1 100%; }
  .stat-card  { flex: 1 1 100%; }
  .nav-item { font-size: 9px; padding: 6px 6px; min-width: 44px; }
  .page-header { padding: 12px 12px 10px; }
  .toolbar { padding: 10px 12px; }
  .detail-header { padding: 10px 12px; }
  th, td { padding: 6px 8px; font-size: 11px; }
  .banner-list-row { padding: 10px 12px; gap: 8px; }
  .featured-rank { font-size: 15px; min-width: 26px; }
}

/* ── Coupon preview resize handle ─────────────────────────────────────────── */
.preview-resize-handle {
  width: 6px;
  background: transparent;
  cursor: col-resize;
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  transition: background .15s;
}
.preview-resize-handle::after {
  content: '';
  position: absolute;
  left: 2px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 40px;
  background: #E5E7EB;
  border-radius: 2px;
  transition: background .15s;
}
.preview-resize-handle:hover::after,
.preview-resize-handle:active::after {
  background: #006CE5;
}

/* ── Phone mockup scrollable ──────────────────────────────────────────────── */
#pv-phone-screen::-webkit-scrollbar { width: 3px; }
#pv-phone-screen::-webkit-scrollbar-track { background: transparent; }
#pv-phone-screen::-webkit-scrollbar-thumb { background: #E5E7EB; border-radius: 3px; }

/* Mobile responsive: hide resize handle, stack preview */
@media (max-width: 768px) {
  .editor-layout { grid-template-columns: 1fr !important; }
  .preview-resize-handle { display: none; }
}

/* ── iPhone 15 Pro Max frame ──────────────────────────────────────────────── */
.iphone-frame {
  position: relative;
  width: 230px;
  margin: 0 auto;
  background: #1A1A1C;
  border-radius: 44px;
  padding: 12px;
  box-shadow:
    0 0 0 1px #3A3A3C,
    0 0 0 3px #2C2C2E,
    0 20px 60px rgba(0,0,0,.45),
    inset 0 0 0 1px rgba(255,255,255,.06);
}
.iphone-side-vol {
  position: absolute;
  left: -3px; top: 76px;
  width: 3px; height: 52px;
  background: #3A3A3C;
  border-radius: 2px 0 0 2px;
  box-shadow: 0 22px 0 #3A3A3C, 0 44px 0 #3A3A3C;
}
.iphone-side-power {
  position: absolute;
  right: -3px; top: 100px;
  width: 3px; height: 60px;
  background: #3A3A3C;
  border-radius: 0 2px 2px 0;
}
.iphone-screen-bezel {
  background: #000;
  border-radius: 34px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.iphone-dynamic-island {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 68px;
  height: 22px;
  background: #000;
  border-radius: 20px;
  z-index: 20;
  box-shadow: 0 0 0 2px #1A1A1A;
}
.iphone-status-bar {
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 14px 5px;
  position: relative;
  z-index: 10;
  color: #0F1830;
}
.iphone-scroll-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #F8F9FE;
  max-height: 400px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  word-break: break-word;
  overflow-wrap: break-word;
}
.iphone-scroll-content::-webkit-scrollbar { width: 2px; }
.iphone-scroll-content::-webkit-scrollbar-track { background: transparent; }
.iphone-scroll-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 2px; }
.iphone-home-bar {
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 0 8px;
}
.iphone-home-bar::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  background: #0F1830;
  border-radius: 3px;
  opacity: .2;
}

/* ── Phone section blocks ────────────────────────────────────── */
.pv-section {
  background: #fff;
  border-top: 1px solid #F0F1F7;
  padding: 10px 12px 8px;
}
.pv-section-label {
  font-size: 9px;
  font-weight: 700;
  color: #006CE5;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.pv-section-body {
  font-size: 10px;
  line-height: 1.55;
  color: #444;
  word-break: break-word;
  overflow-wrap: break-word;
  overflow-x: hidden;
}
