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

:root {
  --p-bg:             #f1f2f3;
  --p-surface:        #ffffff;
  --p-surface-sub:    #f7f7f7;
  --p-border:         #e3e3e3;
  --p-border-input:   #8c9196;
  --p-text:           #202223;
  --p-text-sub:       #6d7175;
  --p-link:           #2c6ecb;
  --p-green:          #008060;
  --p-green-hov:      #006e52;
  --p-badge-bg:       #d3f5e2;
  --p-badge-text:     #108043;
  --p-warn-bg:        #fff5ea;
  --p-warn-text:      #b98900;
  --p-danger-bg:      #fff4f4;
  --p-danger-text:    #d82c0d;
  --p-gray-bg:        #f0f0f0;
  --p-gray-text:      #6d7175;
  --p-shadow:         0 0 0 1px rgba(63,63,68,.05), 0 1px 3px rgba(63,63,68,.12);
  --r:                4px;
  --r-sm:             4px;
  --r-lg:             8px;
  --p-blue:           #2c6ecb;
  --p-red:            #d82c0d;
  --p-surface-hover:  #f5f5f5;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--p-text);
  background: var(--p-bg);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Top bar ── */
header {
  background: #1a1a1a;
  color: #fff;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 10;
}
.header-home-link {
  display: flex;
  align-items: center;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  padding: 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.header-home-link:hover { color: #fff; background: rgba(255,255,255,.1); }
.header-nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.header-nav-link:hover { color: #fff; background: rgba(255,255,255,.1); }
.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}
.header-store { font-size: 12px; opacity: .55; font-family: monospace; }
.header-version {
  font-size: 11px; font-weight: 600; font-family: monospace;
  padding: 3px 8px; border-radius: 10px;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.6);
  white-space: nowrap;
}
.header-db-status {
  font-size: 11px; font-weight: 600; font-family: monospace;
  padding: 3px 8px; border-radius: 10px;
  white-space: nowrap; cursor: default;
  display: inline-flex; align-items: center; gap: 5px;
}
.header-db-status::before {
  content: ''; display: inline-block;
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.header-db-status--ok { background: rgba(34,197,94,.15); color: rgba(134,239,172,.9); }
.header-db-status--ok::before { background: #22c55e; box-shadow: 0 0 4px #22c55e; }
.header-db-status--offline { background: rgba(234,179,8,.15); color: rgba(253,224,71,.9); }
.header-db-status--offline::before { background: #eab308; box-shadow: 0 0 4px #eab308; }

/* ── Dev ribbon ── */
.dev-ribbon {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: #c0392b; color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 7px 16px; letter-spacing: 0.02em;
  z-index: 9; flex-shrink: 0;
  transition: background .25s;
}
.dev-ribbon.dev-ribbon-on { background: #1e8449; }
.dev-write-toggle {
  font-size: 11px; font-weight: 700; font-family: inherit;
  padding: 3px 10px; border-radius: 5px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.45);
  background: rgba(255,255,255,.15); color: #fff;
  transition: background .15s; white-space: nowrap; flex-shrink: 0;
}
.dev-write-toggle:hover { background: rgba(255,255,255,.28); }

/* ── Layout ── */
.layout { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--p-surface);
  border-right: 1px solid var(--p-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.tabs { display: flex; border-bottom: 1px solid var(--p-border); }
.tab {
  flex: 1;
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--p-text-sub);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color .15s;
}
.tab:hover { color: var(--p-text); }
.tab.active { color: var(--p-green); border-bottom-color: var(--p-green); }

.filter-panel { padding: 14px; display: flex; flex-direction: column; gap: 16px; }
.filter-panel.hidden { display: none; }
.filter-group { display: flex; flex-direction: column; gap: 6px; }

.filter-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--p-text);
}

.select {
  width: 100%;
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--p-border-input);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--p-text);
  background: var(--p-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238c9196' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.select:focus { border-color: var(--p-link); box-shadow: 0 0 0 2px rgba(44,110,203,.2); }
.select:disabled { opacity: .5; cursor: default; }

.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-group label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.radio-group input[type="radio"] { width: 15px; height: 15px; accent-color: var(--p-green); cursor: pointer; }

.tag-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--p-border);
  border-radius: var(--r);
  padding: 8px;
  background: var(--p-surface-sub);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tag-list label { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; cursor: pointer; line-height: 1.4; }
.tag-list input[type="checkbox"] { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; accent-color: var(--p-green); cursor: pointer; }
.tag-list-empty { font-size: 12px; color: var(--p-text-sub); font-style: italic; }

.btn-primary {
  padding: 8px 16px;
  background: var(--p-green);
  color: #fff;
  border: 1px solid var(--p-green);
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--p-green-hov); border-color: var(--p-green-hov); }
.btn-primary:disabled { opacity: .5; cursor: default; }

.btn-secondary {
  padding: 7px 16px;
  background: var(--p-surface);
  color: var(--p-text);
  border: 1px solid var(--p-border-input);
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0,0,0,.05);
  transition: background .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-secondary:hover { background: var(--p-surface-sub); }
.btn-secondary:disabled { opacity: .5; cursor: default; }

/* ── Filter actions (search + reset row) ── */
.filter-actions { display: flex; flex-direction: column; gap: 6px; }
.filter-error { font-size: 12px; color: #e05c4b; margin: 4px 0 0; }

/* ── Tags & options column ── */
.col-tags { max-width: 220px; }
.tag-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 10px; margin: 2px 2px 2px 0;
  background: rgba(43,170,177,.15); color: #2baab1;
  white-space: nowrap;
}
.option-names { font-size: 11px; color: var(--p-text-sub); margin-top: 3px; }
.tag-badge-link { cursor: pointer; transition: opacity .15s; }
.tag-badge-link:hover { opacity: .7; }
.opt-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 10px; margin: 2px 2px 2px 0;
  background: rgba(139,92,246,.12); color: #7c3aed;
  white-space: nowrap;
}
.opt-badge-link { cursor: pointer; transition: opacity .15s; }
.opt-badge-link:hover { opacity: .7; }
.tag-more {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px; margin: 2px 0;
  background: var(--p-surface-sub); border: 1px solid var(--p-border);
  color: var(--p-text-sub); cursor: pointer; white-space: nowrap;
}
.tag-more:hover { background: var(--p-border); color: var(--p-text); }
.active-filters-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 12px; margin-bottom: 4px;
  background: var(--p-surface-sub); border: 1px solid var(--p-border); border-radius: 8px;
}
.active-filters-bar.hidden { display: none; }
.active-filters-label { font-size: 12px; font-weight: 600; color: var(--p-text-sub); }
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 10px;
  background: rgba(43,170,177,.15); color: #2baab1;
  border: 1px solid rgba(43,170,177,.3);
}
.filter-chip-opt { background: rgba(139,92,246,.12); color: #7c3aed; border-color: rgba(139,92,246,.3); }
.chip-remove {
  background: none; border: none; cursor: pointer; font-size: 14px;
  line-height: 1; padding: 0; color: inherit; opacity: .6;
}
.chip-remove:hover { opacity: 1; }
.dim { color: var(--p-text-sub); }
.tags-checklist {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 180px; overflow-y: auto;
  padding: 8px 10px; margin-top: 6px;
  background: var(--p-surface-sub); border: 1px solid var(--p-border); border-radius: 6px;
}
.tags-checklist-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--p-text); cursor: pointer; padding: 2px 0;
}
.tags-checklist-item input[type="checkbox"] { cursor: pointer; }
.action-info-warn { background: #fff8e1; border-color: #ffe082; color: #7a5800; }
.option-values-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.option-value-row { display: flex; align-items: center; gap: 10px; }
.option-value-current { font-size: 13px; font-weight: 600; color: var(--p-text); min-width: 80px; }
.option-value-arrow { color: var(--p-text-sub); font-size: 14px; }
.btn-reset {
  background: none;
  border: none;
  color: var(--p-text-sub);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  padding: 4px;
  text-decoration: underline;
  transition: color .15s;
}
.btn-reset:hover { color: var(--p-text); }

/* ── Main ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 16px 16px;
  gap: 8px;
}

/* ── Cache bar ── */
.cache-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--r);
  flex-shrink: 0;
  font-size: 12px;
}
.cache-info { color: var(--p-text-sub); flex: 1; }
.btn-refresh-cache {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: none;
  border: 1px solid var(--p-border-input);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--p-text-sub);
  cursor: pointer;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.btn-refresh-cache:hover { color: var(--p-text); background: var(--p-surface-sub); }
.btn-refresh-cache.spinning svg { animation: spin .65s linear infinite; }

/* ── Results header ── */
.results-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 0 2px;
}
#resultCount { font-size: 14px; font-weight: 600; }
.results-hint { font-size: 13px; color: var(--p-text-sub); }
.results-spacer { flex: 1; }

/* ── Column visibility ── */
.col-vis-wrap { position: relative; }
.btn-col-vis {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--p-surface);
  border: 1px solid var(--p-border-input);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--p-text-sub);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.btn-col-vis:hover { color: var(--p-text); background: var(--p-surface-sub); }

.col-vis-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  padding: 8px 0;
  min-width: 160px;
  z-index: 50;
}
.col-vis-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.col-vis-item:hover { background: var(--p-surface-sub); }
.col-vis-item input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--p-green);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Bulk bar ── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: #e8f4fd;
  border: 1px solid #b8d9f5;
  border-radius: var(--r-lg);
  flex-shrink: 0;
  animation: slideDown .15s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.bulk-count { font-size: 13px; font-weight: 600; color: #1a5276; margin-right: 4px; }

.btn-bulk-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--p-green);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-bulk-action:hover { background: var(--p-green-hov); }

.btn-bulk-link {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--p-link);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}

/* ── States ── */
.empty-state, .loading-state, .error-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--p-text-sub);
  background: var(--p-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--p-shadow);
  text-align: center;
}
.empty-state p { font-size: 14px; }
.error-state { color: var(--p-danger-text); }
.hidden { display: none !important; }

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--p-border);
  border-top-color: var(--p-green);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Table wrap ── */
#tableWrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--p-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--p-shadow);
  border: 1px solid var(--p-border);
  overflow: hidden;
}

.table-scroll { flex: 1; overflow: auto; }

/* ── Product table ── */
.product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 820px;
}

.product-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--p-surface-sub);
  border-bottom: 1px solid var(--p-border);
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--p-text-sub);
  white-space: nowrap;
  user-select: none;
}
.product-table th.sortable { cursor: pointer; }
.product-table th.sortable:hover { color: var(--p-text); background: #efefef; }
.product-table th .sort-icon { margin-left: 4px; opacity: .4; font-style: normal; }
.product-table th.sort-asc .sort-icon,
.product-table th.sort-desc .sort-icon { opacity: 1; color: var(--p-green); }
.product-table th.num { text-align: right; }

/* Checkbox column */
.col-check { width: 40px; padding: 0 8px 0 12px !important; }
.col-check-head { width: 40px; }

/* Actions column */
.col-actions-head { width: 60px; }

.product-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--p-border);
  vertical-align: top;
  color: var(--p-text);
  line-height: 1.4;
}
.product-table tr:last-child td { border-bottom: none; }
.product-table tbody tr:hover td { background: #fafafa; }
.product-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Row checkbox */
.row-check, .head-check {
  width: 15px; height: 15px;
  accent-color: var(--p-green);
  cursor: pointer;
}

/* Product cell */
.product-name-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--p-link);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.product-name-btn:hover { text-decoration: underline; }

.variant-subtitle {
  font-size: 11px;
  color: var(--p-text-sub);
  margin-top: 3px;
  line-height: 1.4;
}

/* Variant price rows (multiple variants, different prices) */
.variant-rows { display: flex; flex-direction: column; gap: 4px; }
.variant-row-item { display: flex; align-items: flex-start; gap: 5px; }
.v-name {
  font-size: 11px;
  color: var(--p-text-sub);
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 1px;
}

/* Out-of-stock variant (subtitle + price rows) */
.v-oos {
  color: var(--p-danger-text);
  text-decoration: line-through;
}

/* ── Combined price cell ── */
.price-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.price-original {
  color: var(--p-text-sub);
  text-decoration: line-through;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.price-sale {
  color: var(--p-danger-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.price-regular {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.price-disc-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  background: var(--p-badge-bg);
  color: var(--p-badge-text);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 1px;
}
.no-val { color: #c4c4c4; }

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-active   { background: var(--p-badge-bg);  color: var(--p-badge-text); }
.status-draft    { background: var(--p-gray-bg);   color: var(--p-gray-text); }
.status-archived { background: var(--p-warn-bg);   color: var(--p-warn-text); }

/* Stock */
.stock-val { font-variant-numeric: tabular-nums; font-weight: 500; }
.stock-out  { color: var(--p-danger-text); }
.stock-low  { color: var(--p-warn-text); }
.stock-ok   { color: var(--p-text); }

.date-val { color: var(--p-text-sub); font-size: 12px; white-space: nowrap; }

/* Edit button in row */
.btn-edit-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: none;
  border: 1px solid var(--p-border);
  border-radius: var(--r);
  font-size: 11px;
  color: var(--p-text-sub);
  cursor: pointer;
  text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}
.btn-edit-row:hover {
  color: var(--p-link);
  border-color: var(--p-link);
  background: #f0f5ff;
}

/* ── Pagination ── */
.pagination {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--p-border);
  background: var(--p-surface-sub);
  flex-shrink: 0;
}
#loadMoreCount { font-size: 12px; color: var(--p-text-sub); }

/* ── Modal backdrop ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Modal base ── */
.modal {
  background: var(--p-surface);
  border-radius: var(--r-lg);
  width: 580px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 32px rgba(0,0,0,.22);
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex;
  align-items: center;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--p-border);
  gap: 12px;
}
.modal-header h2 { font-size: 16px; font-weight: 600; flex: 1; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--p-text-sub);
  padding: 4px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
}
.modal-close:hover { background: var(--p-border); color: var(--p-text); }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; flex: 1; min-height: 0; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--p-border);
  background: var(--p-surface-sub);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  flex-shrink: 0;
}
.apply-wrap { display: flex; align-items: center; gap: 8px; }
.btn-apply { display: flex; align-items: center; gap: 6px; }
.btn-apply:disabled { opacity: .45; cursor: not-allowed; }

/* ── Progress panel ── */
.progress-panel {
  padding: 16px 20px 4px;
  border-top: 1px solid var(--p-border);
  flex-shrink: 0;
}
.progress-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.progress-title { font-size: 13px; font-weight: 600; color: var(--p-text); }
.progress-fraction { font-size: 12px; color: var(--p-text-sub); font-variant-numeric: tabular-nums; }
.progress-track {
  height: 6px; border-radius: 3px;
  background: var(--p-border);
  overflow: hidden; margin-bottom: 10px;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  background: var(--p-green);
  transition: width .25s ease;
}
.progress-fill.has-errors { background: var(--p-danger-text); }
.progress-log {
  max-height: 140px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
  padding-bottom: 8px;
}
.progress-log::-webkit-scrollbar { width: 4px; }
.progress-log::-webkit-scrollbar-thumb { background: var(--p-border); border-radius: 2px; }
.log-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--p-text-sub); line-height: 1.4;
}
.log-row.log-ok  .log-icon { color: var(--p-green); }
.log-row.log-err .log-icon { color: var(--p-danger-text); }
.log-row.log-err .log-name { color: var(--p-danger-text); }
.log-icon { font-size: 12px; flex-shrink: 0; }
.log-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-err-msg { font-size: 10px; color: var(--p-danger-text); margin-left: 18px; }

/* ── Revert bar ── */
.revert-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 400;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  padding: 10px 14px;
  display: flex; align-items: center;
  animation: revertSlideUp .3s ease;
  min-width: 340px; max-width: 520px;
}
@keyframes revertSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.revert-inner {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font-size: 13px; color: var(--p-text-sub);
}
.revert-inner svg { flex-shrink: 0; color: var(--p-text-sub); }
#revertDesc { flex: 1; font-size: 12px; }
.btn-revert {
  flex-shrink: 0; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 6px;
  background: var(--p-surface-sub); border: 1px solid var(--p-border);
  color: var(--p-text); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-revert:hover { background: var(--p-border); }
.revert-dismiss {
  background: none; border: none; cursor: pointer;
  color: var(--p-text-sub); font-size: 14px; padding: 2px 4px;
  line-height: 1; border-radius: 4px;
}
.revert-dismiss:hover { background: var(--p-border); }

/* ── History modal ── */
.history-modal { width: 620px; }
.history-empty {
  padding: 40px 24px; text-align: center;
  font-size: 13px; color: var(--p-text-sub);
}
.history-list { display: flex; flex-direction: column; }
.history-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--p-border);
  transition: background .1s;
}
.history-row:last-child { border-bottom: none; }
.history-row:hover { background: var(--p-surface-sub); }

/* Top row: badges on left, datetime on right */
.history-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.history-left {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.history-action-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 10px; white-space: nowrap;
}
.badge-discount { background: #fff0ee; color: #c44d00; }
.badge-remove   { background: #f0f8f0; color: #108043; }
.badge-price    { background: #f0f4ff; color: #2c6ecb; }
.badge-status   { background: #faf5ff; color: #8a3fd1; }
.history-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 18px; padding: 0 6px;
  background: var(--p-border); border-radius: 9px;
  font-size: 11px; font-weight: 700; color: var(--p-text-sub);
}

/* Datetime block — prominent */
.history-datetime {
  display: flex; align-items: baseline; gap: 5px; flex-shrink: 0;
}
.history-date {
  font-size: 13px; font-weight: 700; color: var(--p-text);
}
.history-time-val {
  font-size: 12px; color: var(--p-text-sub);
}

/* Reverted banner */
.history-reverted-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: #108043; font-weight: 600;
  background: #f0f8f0; border-radius: 6px; padding: 3px 8px;
  width: fit-content;
}

/* Bottom row: expand toggle + revert action */
.history-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.history-expand-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--p-text-sub); background: none; border: none;
  cursor: pointer; padding: 2px 0;
  transition: color .15s;
}
.history-expand-btn:hover { color: var(--p-text); }
.expand-chevron {
  transition: transform .2s;
}

/* Expanded product list */
.history-product-list {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: 4px; padding: 8px 10px;
  background: var(--p-surface-sub); border-radius: 6px;
  border: 1px solid var(--p-border);
}
.history-product-list.hidden { display: none; }
.history-product-item {
  font-size: 12px; color: var(--p-text);
  padding: 3px 0; border-bottom: 1px solid var(--p-border);
}
.history-product-item:last-child { border-bottom: none; }

/* Revert / reverted chip */
.btn-history-revert {
  flex-shrink: 0; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 6px;
  background: var(--p-surface-sub); border: 1px solid var(--p-border);
  color: var(--p-text); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn-history-revert:hover { background: var(--p-border); }
.btn-reverted-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: #108043;
  background: #f0f8f0; border-radius: 6px; padding: 5px 10px;
  border: 1px solid #c9e8d1;
}

/* ── Results panel ── */
.results-panel { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.results-summary-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px 10px; border-bottom: 1px solid var(--p-border); flex-shrink: 0;
}
.results-icon { font-size: 18px; font-weight: 700; line-height: 1; }
.results-icon-ok   { color: var(--p-green); }
.results-icon-warn { color: var(--p-warn-text); }
.results-summary-text { font-size: 14px; font-weight: 600; color: var(--p-text); }
.results-product-list {
  overflow-y: auto; flex: 1;
  display: flex; flex-direction: column;
  padding: 4px 0 8px;
}
.results-product-list::-webkit-scrollbar { width: 4px; }
.results-product-list::-webkit-scrollbar-thumb { background: var(--p-border); border-radius: 2px; }
.result-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 20px; font-size: 12px;
  border-bottom: 1px solid var(--p-border);
}
.result-row:last-child { border-bottom: none; }
.result-name { color: var(--p-text); font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-change { color: var(--p-text-sub); white-space: nowrap; flex-shrink: 0; }
.result-arrow { color: var(--p-text-sub); margin: 0 4px; }

/* ── Bulk modal action tabs ── */
.bulk-modal { width: 620px; }

.action-tabs {
  display: flex;
  border-bottom: 1px solid var(--p-border);
  background: var(--p-surface-sub);
  overflow-x: auto;
  flex-shrink: 0;
}
.action-tab {
  flex-shrink: 0;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--p-text-sub);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color .15s;
  white-space: nowrap;
}
.action-tab:hover { color: var(--p-text); }
.action-tab.active { color: var(--p-green); border-bottom-color: var(--p-green); }

.action-panel { display: flex; flex-direction: column; gap: 16px; }
.action-panel.hidden { display: none; }

.action-info-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--p-warn-bg);
  border: 1px solid #f0d080;
  border-radius: var(--r);
  font-size: 13px;
  color: var(--p-warn-text);
}
.action-info-box svg { flex-shrink: 0; margin-top: 1px; }

/* ── Form elements (modal) ── */
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; }
.label-optional { font-size: 12px; color: var(--p-text-sub); font-weight: 400; }

.form-input {
  padding: 8px 10px;
  border: 1px solid var(--p-border-input);
  border-radius: var(--r);
  font-size: 14px;
  color: var(--p-text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.form-input:focus { border-color: var(--p-link); box-shadow: 0 0 0 2px rgba(44,110,203,.2); }

.input-addon { display: flex; align-items: stretch; max-width: 160px; }
.input-addon .form-input { border-right: none; border-radius: var(--r) 0 0 var(--r); flex: 1; }
.addon-text {
  padding: 8px 12px;
  background: var(--p-surface-sub);
  border: 1px solid var(--p-border-input);
  border-radius: 0 var(--r) var(--r) 0;
  font-size: 14px;
  color: var(--p-text-sub);
  display: flex;
  align-items: center;
}

.date-range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.date-field { display: flex; flex-direction: column; gap: 4px; }
.date-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--p-text-sub); }
.date-sep { color: var(--p-text-sub); font-size: 16px; margin-top: 20px; }
.date-field .form-input { font-size: 13px; }
.date-time-pair { display: flex; gap: 6px; align-items: center; }
.date-time-pair .date-part { width: 110px; }
.date-time-pair .hour-select { width: 82px; }

/* Schedule toggle */
.schedule-toggle-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--p-text); cursor: pointer; user-select: none;
}
.schedule-toggle-label input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: var(--p-green); cursor: pointer; flex-shrink: 0;
}
.schedule-period-fields { margin-top: 4px; }

/* Schedule page link in toolbar */
.btn-schedule-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--p-text-sub);
  background: none; border: 1px solid var(--p-border); border-radius: 6px;
  padding: 5px 10px; cursor: pointer; text-decoration: none;
  transition: color .15s, border-color .15s;
}
.btn-schedule-link:hover { color: var(--p-text); border-color: var(--p-text-sub); }

.form-hint { font-size: 12px; color: var(--p-text-sub); }

/* ── Preview box ── */
.preview-box {
  background: var(--p-surface-sub);
  border: 1px solid var(--p-border);
  border-radius: var(--r-lg);
  padding: 14px;
}
.preview-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--p-text-sub);
  margin-bottom: 10px;
}
.preview-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--p-border);
  gap: 8px;
  font-size: 13px;
}
.preview-item:last-child { border-bottom: none; padding-bottom: 0; }
.preview-name { font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-prices { display: flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0; }
.preview-old { color: var(--p-text-sub); text-decoration: line-through; font-size: 12px; }
.preview-arrow { color: var(--p-text-sub); }
.preview-new { font-weight: 600; color: var(--p-green); }
.preview-badge { font-size: 11px; font-weight: 700; color: var(--p-badge-text); background: var(--p-badge-bg); padding: 1px 6px; border-radius: 8px; }

/* ── Quick view modal ── */
.qv-modal {
  width: 720px;
  max-height: calc(100vh - 48px);
}

.qv-body {
  display: flex;
  gap: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.qv-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.qv-images {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--p-border);
  background: var(--p-surface-sub);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  overflow-y: auto;
}
.qv-img-main {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: var(--r);
  background: #fff;
  border: 1px solid var(--p-border);
}
.qv-img-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: var(--r);
  background: #fff;
  border: 1px solid var(--p-border);
  opacity: .7;
}
.qv-no-image {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--p-bg);
  border-radius: var(--r);
  border: 1px dashed var(--p-border);
  color: var(--p-text-sub);
  font-size: 12px;
}

.qv-info {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qv-meta { display: flex; flex-direction: column; gap: 6px; }
.qv-meta-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.qv-meta-label { color: var(--p-text-sub); min-width: 54px; font-size: 12px; }

.qv-variants-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--p-text-sub);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--p-border);
}
.qv-variant-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.qv-variant-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--p-text-sub);
  padding: 4px 6px;
  border-bottom: 1px solid var(--p-border);
}
.qv-variant-table th.r, .qv-variant-table td.r { text-align: right; }
.qv-variant-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--p-border);
  color: var(--p-text);
  font-variant-numeric: tabular-nums;
}
.qv-variant-table tr:last-child td { border-bottom: none; }
.qv-variant-table tr:hover td { background: var(--p-surface-sub); }
.qv-oos { color: var(--p-danger-text); }

/* ═══════════════════════════════════════════════════════════════════════════
   HOME / DASHBOARD PAGE
═══════════════════════════════════════════════════════════════════════════ */
body.home-page {
  overflow: auto;
}

.home-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── Section ── */
.home-section { display: flex; flex-direction: column; gap: 14px; }
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--p-text);
  margin: 0;
}
.section-count { font-size: 13px; font-weight: 400; color: var(--p-text-sub); }
.section-hint  { font-size: 12px; color: var(--p-text-sub); flex: 1; }

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--r-lg);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, transform .15s;
  cursor: pointer;
}
.stat-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  transform: translateY(-2px);
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: var(--stat-color, var(--p-text));
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 12px;
  color: var(--p-text-sub);
  font-weight: 500;
}

/* skeleton shimmer */
.stat-skeleton {
  height: 88px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  pointer-events: none;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Quick links ── */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.quick-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--p-text);
  text-decoration: none;
  transition: box-shadow .15s, border-color .15s;
}
.quick-link:hover {
  border-color: var(--p-border-input);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.ql-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ql-green { background: var(--p-badge-bg);  color: var(--p-green); }
.ql-gray  { background: var(--p-gray-bg);   color: var(--p-gray-text); }
.ql-red   { background: var(--p-danger-bg); color: var(--p-danger-text); }
.ql-warn  { background: var(--p-warn-bg);   color: var(--p-warn-text); }

/* ── Collection search ── */
.collection-search {
  padding: 6px 12px;
  border: 1px solid var(--p-border-input);
  border-radius: 999px;
  font-size: 13px;
  color: var(--p-text);
  outline: none;
  width: 220px;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.collection-search:focus {
  border-color: var(--p-link);
  box-shadow: 0 0 0 2px rgba(44,110,203,.2);
}

/* ── Collections grid (round tiles) ── */
.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
}

.col-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--p-text);
  cursor: pointer;
  padding: 8px 4px;
  border-radius: var(--r-lg);
  transition: background .15s;
}
.col-tile:hover { background: var(--p-surface); }
.col-tile:hover .col-tile-img { transform: scale(1.05); box-shadow: 0 4px 20px rgba(0,0,0,.15); }

.col-tile-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--p-border);
  background: var(--p-surface-sub);
  transition: transform .2s, box-shadow .2s;
  display: block;
}
.col-tile-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  border: none;
}
.col-tile-name {
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
  max-width: 96px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.col-tile-count {
  font-size: 11px;
  color: var(--p-text-sub);
  text-align: center;
}

/* ── Drill-down tile indicator ── */
.col-tile-img-wrap { position: relative; display: inline-block; }
.col-tile-drill-badge {
  position: absolute;
  bottom: 2px; right: 2px;
  background: var(--p-green);
  color: #fff;
  font-size: 10px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  pointer-events: none;
}
.col-tile-drill:hover .col-tile-drill-badge { background: var(--p-green-hov); }

/* ── Drill-down backdrop ── */
.dd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.dd-backdrop.dd-open { display: flex; animation: ddFadeIn .2s ease; }
@keyframes ddFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Panel ── */
.dd-panel {
  background: #fff;
  width: 100%;
  max-height: 92dvh;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,0,.1,1);
  overflow: hidden;
}
.dd-panel.dd-panel-open { transform: translateY(0); }

@media (min-width: 700px) {
  .dd-backdrop { align-items: center; padding: 24px; }
  .dd-panel {
    max-width: 900px;
    max-height: 85dvh;
    border-radius: 16px;
    transform: translateY(20px);
    opacity: 0;
    transition: transform .3s cubic-bezier(.32,0,.1,1), opacity .3s ease;
  }
  .dd-panel.dd-panel-open { transform: translateY(0); opacity: 1; }
}

/* drag handle (mobile) */
.dd-handle {
  width: 40px; height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}
@media (min-width: 700px) { .dd-handle { display: none; } }

/* ── Header ── */
.dd-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  gap: 12px;
}
.dd-header-left { display: flex; align-items: center; gap: 14px; }
.dd-emoji { font-size: 42px; line-height: 1; flex-shrink: 0; }
.dd-title { font-size: 20px; font-weight: 700; color: var(--p-text); margin: 0 0 3px; }
.dd-tagline { font-size: 13px; color: var(--p-text-sub); margin: 0; line-height: 1.4; }

.dd-close {
  background: var(--p-surface-sub);
  border: none; border-radius: 50%;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--p-text-sub);
  flex-shrink: 0; margin-top: 2px;
  transition: background .15s, color .15s;
}
.dd-close:hover { background: var(--p-border); color: var(--p-text); }

/* ── Body ── */
.dd-body {
  overflow-y: auto;
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  -webkit-overflow-scrolling: touch;
}

.dd-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--p-text-sub);
  margin: 0 0 10px;
}

/* ── Subcategory grid ── */
.dd-subcats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 480px)  { .dd-subcats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 700px)  { .dd-subcats { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 860px)  { .dd-subcats { grid-template-columns: repeat(6, 1fr); } }

.dd-card {
  background: #f7f8f9;
  border: 1.5px solid #e8e8e8;
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-decoration: none;
  color: inherit;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .18s;
  cursor: pointer;
  min-height: 110px;
}
.dd-card:hover {
  background: #f0fdf8;
  border-color: var(--p-green);
  box-shadow: 0 4px 18px rgba(0,128,96,.12);
  transform: translateY(-2px);
}
.dd-card:active { transform: translateY(0); box-shadow: none; }

.dd-card-emoji {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 2px;
  display: block;
}
.dd-card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--p-text);
  line-height: 1.3;
}
.dd-card-hint {
  font-size: 11px;
  color: var(--p-text-sub);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Brands row ── */
.dd-brands-wrap { display: flex; flex-direction: column; }
.dd-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dd-brand-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--p-text);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.dd-brand-chip:hover {
  border-color: var(--p-green);
  background: #f0fdf8;
  color: var(--p-green);
}

/* ── Footer CTA ── */
.dd-footer {
  padding: 14px 20px 20px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.dd-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: var(--p-green);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: background .15s;
}
.dd-cta:hover { background: var(--p-green-hov); }
.dd-cta strong { font-weight: 800; }

/* ── Drill-down: featured products ── */
.dd-featured-wrap { margin-top: 4px; }

/* Skeleton loading */
.dd-feat-loading {
  display: flex; gap: 10px; overflow: hidden;
  padding: 2px 0 10px;
}
.dd-feat-loading span {
  flex-shrink: 0; width: 130px; height: 180px;
  border-radius: 10px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: featShimmer 1.3s infinite;
}
@keyframes featShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.dd-feat-empty { font-size: 13px; color: var(--p-text-sub); padding: 4px 0 10px; }

/* Horizontal scroll row */
.dd-feat-scroll {
  display: flex; gap: 10px;
  overflow-x: auto; padding: 2px 0 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.dd-feat-scroll::-webkit-scrollbar { height: 4px; }
.dd-feat-scroll::-webkit-scrollbar-thumb { background: var(--p-border); border-radius: 2px; }

/* Product card */
.dd-feat-card {
  flex-shrink: 0; width: 130px;
  display: flex; flex-direction: column;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--p-border);
  text-decoration: none; color: inherit;
  background: #fff;
  transition: box-shadow .15s, transform .15s;
  scroll-snap-align: start;
}
.dd-feat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); }

.dd-feat-img-wrap { position: relative; width: 100%; aspect-ratio: 1/1; background: #f9f9f9; overflow: hidden; }
.dd-feat-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dd-feat-img-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; color: #bbb; background: #f3f3f3;
}
.dd-feat-badge {
  position: absolute; top: 6px; right: 6px;
  background: #d82c0d; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 20px;
  letter-spacing: .3px;
}

.dd-feat-info {
  padding: 8px 9px 10px;
  display: flex; flex-direction: column; gap: 4px; flex: 1;
}
.dd-feat-title {
  font-size: 12px; font-weight: 500; color: var(--p-text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dd-feat-price { display: flex; flex-direction: column; gap: 1px; margin-top: auto; }
.dd-feat-was { font-size: 11px; color: var(--p-text-sub); text-decoration: line-through; }
.dd-feat-now { font-size: 13px; font-weight: 700; color: #d82c0d; }

@media (min-width: 700px) {
  .dd-feat-card { width: 148px; }
}

/* CONNETIX spotlight banner */
.dd-spotlight {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(120deg, #e8f5e0, #d6f0ff);
  border: 1px solid #b8ddb8; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px;
}
.dd-spotlight-inner { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dd-spotlight-badge {
  font-size: 11px; font-weight: 600; color: #2d6a2d;
  background: rgba(0,128,0,.1); border-radius: 20px;
  padding: 2px 8px; display: inline-block; width: fit-content; margin-bottom: 2px;
}
.dd-spotlight-name { font-size: 14px; font-weight: 700; color: var(--p-text); }
.dd-spotlight-desc {
  font-size: 12px; color: var(--p-text-sub); margin: 0; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dd-spotlight-btn {
  flex-shrink: 0; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: #008060;
  background: #fff; border: 1px solid #008060;
  border-radius: 6px; padding: 6px 12px;
  text-decoration: none; transition: background .15s, color .15s;
}
.dd-spotlight-btn:hover { background: #008060; color: #fff; }

/* ── Accordion (All collections) ── */
.accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--r-lg);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--p-text);
  transition: background .15s, border-color .15s;
  text-align: left;
  font-family: inherit;
}
.accordion-toggle:hover { background: var(--p-surface-sub); border-color: var(--p-border-input); }
.accordion-toggle[aria-expanded="true"] { border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom-color: transparent; }

.accordion-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.accordion-count { font-size: 13px; font-weight: 400; color: var(--p-text-sub); }

.accordion-chevron {
  color: var(--p-text-sub);
  transition: transform .25s ease;
  display: flex;
}
.accordion-toggle[aria-expanded="true"] .accordion-chevron { transform: rotate(180deg); }

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}
.accordion-toggle[aria-expanded="true"] + .accordion-body {
  /* max-height set by JS */
}

.accordion-inner {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DEVBOARD PAGE
═══════════════════════════════════════════════════════════════════════════ */

.header-nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.15);
}

body.devboard-page { overflow: auto; }

.devboard-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.db-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.db-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--p-text);
  margin: 0;
}

/* ── Toolbar ── */
.db-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.db-filter-select { width: auto; min-width: 130px; flex-shrink: 0; }
.db-search        { flex: 1; min-width: 180px; max-width: 320px; }

/* ── Issue list ── */
.db-issue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.db-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--p-text-sub);
  font-size: 14px;
}

.db-empty-sub {
  color: var(--p-text-sub);
  font-size: 13px;
  font-style: italic;
}

/* ── Issue card ── */
.db-issue-card {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.db-issue-card:hover {
  border-color: var(--p-blue);
  background: var(--p-surface-hover);
}

.db-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.db-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--p-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-card-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.db-card-meta {
  font-size: 12px;
  color: var(--p-text-sub);
  white-space: nowrap;
}

.db-card-date {
  font-size: 11px;
  color: var(--p-text-sub);
  white-space: nowrap;
}

/* ── Badge ── */
.db-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Detail modal ── */
.db-detail-modal { width: 820px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); }

.db-detail-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.db-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.db-btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.db-section { display: flex; flex-direction: column; gap: 8px; }

.db-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--p-text-sub);
  border-bottom: 1px solid var(--p-border);
  padding-bottom: 6px;
}

.db-description {
  font-size: 14px;
  color: var(--p-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.db-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.db-meta-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--p-text-sub);
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ── Timeline ── */
.db-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.db-timeline-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-left: 2px solid var(--p-border);
  margin-left: 4px;
  padding-left: 14px;
  position: relative;
}

.db-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  position: absolute;
  left: -6px;
  top: 10px;
}

.db-timeline-content { flex: 1; }

.db-timeline-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 500;
}

.db-timeline-arrow { color: var(--p-text-sub); }

.db-timeline-by   { font-size: 11px; color: var(--p-text-sub); }
.db-timeline-date { font-size: 11px; color: var(--p-text-sub); margin-left: auto; }

.db-timeline-resolution {
  font-size: 12px;
  color: var(--p-text-sub);
  margin-top: 4px;
  font-style: italic;
}

/* ── Effort badge (kanban card) ── */
.db-effort-badge { font-size: 11px; font-weight: 600; }

/* ── AI Summary ── */
.db-ai-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: #7c3aed; color: #fff;
  border-radius: 4px; padding: 1px 5px; margin-left: 6px;
  vertical-align: middle;
}
.db-ai-summary-box {
  background: #7c3aed0d;
  border: 1px solid #7c3aed30;
  border-left: 3px solid #7c3aed;
  border-radius: var(--r-lg);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--p-text);
  white-space: pre-line;
}
.db-et-summary-box {
  background: #0596690d;
  border-color: #05966930;
  border-left-color: #059669;
}

/* ── Collapsible section labels ── */
.db-section-label--collapsible {
  display: flex;
  align-items: center;
  gap: 6px;
}
.db-section-label--collapsible span:first-child { flex: 1 1 auto; }
.db-section-toggle {
  background: none;
  border: 1px solid var(--p-border);
  border-radius: var(--r);
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--p-text-sub);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.db-section-toggle:hover { color: var(--p-link); border-color: var(--p-link); }

/* ── Relations ── */
.db-relation-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--p-border);
  font-size: 13px;
}
.db-relation-row:last-child { border-bottom: none; }
.db-relation-type-label {
  font-size: 11px; font-weight: 600; color: var(--p-text-sub);
  min-width: 80px; text-transform: uppercase; letter-spacing: .03em;
}
.db-relation-link { font-weight: 600; color: var(--p-primary); text-decoration: none; }
.db-relation-link:hover { text-decoration: underline; }
.db-relation-title { color: var(--p-text); flex: 1; }
.db-add-relation {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
}
.db-relation-type-select { width: 130px; font-size: 12px; }
.db-relation-input { flex: 1; font-size: 12px; }

.db-timeline-edit-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--p-text-sub);
  background: var(--p-surface-sub);
  border-radius: 4px;
  padding: 1px 6px;
}

.db-timeline-resolution--edit {
  font-style: normal;
  white-space: pre-line;
}

.db-date-filter {
  width: 130px;
  font-size: 12px;
  padding: 5px 8px;
}

/* ── Comments ── */
.db-comment-list { display: flex; flex-direction: column; gap: 10px; }

.db-comment {
  background: var(--p-bg);
  border: 1px solid var(--p-border);
  border-radius: var(--r-lg);
  padding: 10px 14px;
}
.db-comment--private {
  background: #fffbeb;
  border-color: #fbbf2460;
}

.db-comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.db-comment-header strong { color: var(--p-text); font-size: 13px; }

.db-private-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fbbf2460;
  border-radius: 4px;
  padding: 1px 6px;
}

.db-comment-body {
  font-size: 13px;
  color: var(--p-text);
  word-break: break-word;
  max-height: 220px;
  overflow: hidden;
  position: relative;
}
.db-comment-body--clipped::after {
  content: '';
  display: block;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--p-bg));
  pointer-events: none;
}
.db-comment--private .db-comment-body--clipped::after { background: linear-gradient(transparent, #fffbeb); }
.db-comment-body--expanded {
  max-height: none;
  overflow: visible;
}
.db-comment-body--expanded::after { display: none; }

.db-comment-expand {
  background: none;
  border: none;
  color: var(--p-link);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
  margin-top: 2px;
}
.db-comment-expand:hover { text-decoration: underline; }

.db-comment-edited {
  font-size: 10px;
  color: var(--p-text-sub);
  font-style: italic;
}

.db-comment--editing { border-color: var(--p-link) !important; }
.db-comment--editing .db-comment-toolbar {
  padding: 6px 10px;
  background: var(--p-surface-sub);
  border-bottom: 1px solid var(--p-border);
}
.db-comment-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--p-surface-sub);
  border-top: 1px solid var(--p-border);
}
.db-comment-edit-hint {
  flex: 1;
  font-size: 11px;
  color: var(--p-text-sub);
  font-style: italic;
}

.db-comment-edit-btn {
  opacity: 0;
  transition: opacity .15s;
  padding: 2px 5px;
  font-size: 11px;
  margin-left: auto;
}
.db-comment:hover .db-comment-edit-btn { opacity: 1; }

.db-comment-privacy-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  border-radius: var(--r);
  cursor: pointer;
  color: var(--p-text-sub);
  display: inline-flex;
  align-items: center;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.db-comment:hover .db-comment-privacy-btn { opacity: 1; }
.db-comment-privacy-btn--on {
  opacity: 1;
  color: #b45309;
}
.db-comment-privacy-btn:hover { color: #b45309; }

/* ── Code blocks inside comments ── */
.db-code-block {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 6px 0;
  position: relative;
}
.db-code-block code { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace; white-space: pre; }
.db-code-lang {
  position: absolute;
  top: 6px; right: 10px;
  font-size: 10px;
  font-weight: 700;
  color: #89b4fa;
  text-transform: uppercase;
  letter-spacing: .06em;
  pointer-events: none;
}

/* ── Comment editor ── */
.db-comment-editor {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
  border: 1px solid var(--p-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.db-comment-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--p-surface-sub);
  border-bottom: 1px solid var(--p-border);
}
.db-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--p-border);
  border-radius: var(--r);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--p-text-sub);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.db-toolbar-btn:hover { color: var(--p-text); border-color: var(--p-text-sub); }

.db-comment-textarea {
  border: none !important;
  border-radius: 0 !important;
  resize: vertical;
  min-height: 72px;
}
.db-comment-textarea:focus { outline: none; box-shadow: none; }

.db-comment-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 10px;
  background: var(--p-surface-sub);
  border-top: 1px solid var(--p-border);
}

.db-private-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--p-border);
  border-radius: var(--r);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--p-text-sub);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.db-private-toggle:hover { color: #b45309; border-color: #fbbf24; background: #fffbeb; }
.db-private-toggle--on {
  color: #b45309;
  border-color: #fbbf24;
  background: #fef3c7;
  font-weight: 600;
}

.db-add-comment {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 8px;
}

/* ── Attachments ── */
.db-attachment-list { display: flex; flex-direction: column; gap: 6px; }

.db-attachment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.db-attachment-link {
  color: var(--p-blue);
  text-decoration: none;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-attachment-link:hover { text-decoration: underline; }

.db-add-attachment {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.db-file-input   { display: none; }
.db-file-label   { cursor: pointer; }
.db-file-name    { font-size: 12px; color: var(--p-text-sub); }

/* ── Delete button (tiny ×) ── */
.db-delete-btn {
  background: none;
  border: none;
  color: var(--p-text-sub);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  margin-left: auto;
  opacity: .6;
  transition: opacity .15s, color .15s;
}

.db-delete-btn:hover { opacity: 1; color: var(--p-red); }

/* ── Form helpers ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.form-error {
  color: var(--p-red);
  font-size: 12px;
  padding: 6px 10px;
  background: rgba(239,68,68,.08);
  border-radius: var(--r-sm);
  border: 1px solid rgba(239,68,68,.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   KANBAN BOARD
═══════════════════════════════════════════════════════════════════════════ */

.db-kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1200px) {
  .db-kanban { grid-template-columns: repeat(2, 1fr); }
}

/* ── Column ── */
.db-col {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  min-height: 120px;
  overflow: hidden;
}

.db-col--terminal { opacity: .85; }

.db-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 9px;
  gap: 6px;
  border-bottom: 1px solid var(--p-border);
}

.db-col-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--p-text-sub);
  flex: 1;
}

.db-col-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}

.db-col-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.db-col-empty {
  text-align: center;
  padding: 16px 0;
  color: var(--p-border);
  font-size: 18px;
}

/* ── Kanban card ── */
.db-kcard {
  background: var(--p-bg);
  border: 1px solid var(--p-border);
  border-radius: 8px;
  padding: 9px 11px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.db-kcard:hover {
  border-color: var(--p-blue);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.db-kcard--terminal {
  opacity: .7;
}
.db-kcard--terminal:hover { opacity: 1; }

.db-kcard-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.db-kcard-type {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.db-kcard-key {
  font-size: 10px;
  font-weight: 700;
  color: var(--p-text-sub);
  letter-spacing: .3px;
  font-family: monospace;
}

.db-kcard-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--p-text);
  line-height: 1.35;
  word-break: break-word;
}

.db-kcard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
}

.db-kcard-reporter {
  font-size: 11px;
  color: var(--p-text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Detail modal header with key ── */
.db-detail-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.db-issue-key {
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  color: var(--p-text-sub);
  letter-spacing: .5px;
}

.db-copy-link-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--p-border);
  border-radius: 6px;
  color: var(--p-text-sub);
  font-size: 12px;
  padding: 4px 9px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.db-copy-link-btn:hover { border-color: var(--p-blue); color: var(--p-blue); }

/* ═══ ACCOUNT DROPDOWN ═══ */
.header-account { position: relative; margin-left: 8px; }

.header-account-btn {
  display: flex; align-items: center; gap: 7px;
  background: none; border: 1px solid rgba(255,255,255,.2);
  color: #fff; padding: 5px 11px; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .15s;
}
.header-account-btn:hover { background: rgba(255,255,255,.12); }

.header-account-badge {
  font-size: 10px; background: rgba(255,255,255,.15);
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .05em;
}

.header-account-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.15);
  min-width: 190px; z-index: 200; overflow: hidden;
}

.header-account-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; font-size: 13px; color: var(--p-text);
  text-decoration: none; border: none; background: none;
  width: 100%; cursor: pointer; transition: background .1s;
  font-family: inherit;
}
.header-account-item:hover { background: var(--p-surface-hover); }
.header-account-item--danger { color: var(--p-red); }
.header-account-item + .header-account-item { border-top: 1px solid var(--p-border); }

/* ═══ USERS PAGE ═══ */
.users-layout { max-width: 960px; margin: 0 auto; padding: 24px 20px; overflow: auto; }

.users-table {
  width: 100%; border-collapse: collapse;
  background: var(--p-surface); border-radius: 8px;
  overflow: hidden; border: 1px solid var(--p-border);
}
.users-table th, .users-table td {
  padding: 10px 14px; text-align: left; font-size: 13px;
  border-bottom: 1px solid var(--p-border);
}
.users-table th {
  font-weight: 600; color: var(--p-text-sub);
  background: var(--p-surface-sub); font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: var(--p-surface-hover); }

.role-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
}
.role-badge--superadmin    { background: #7c3aed20; color: #7c3aed; }
.role-badge--administrator { background: #2563eb20; color: #2563eb; }
.role-badge--marketing     { background: #05966920; color: #059669; }
.role-badge--manager       { background: #d9770620; color: #d97706; }

/* comment "as" label */
.db-comment-as {
  font-size: 12px; color: var(--p-text-sub);
  white-space: nowrap; flex-shrink: 0; align-self: center;
  font-style: italic;
}

/* ═══ LOGIN PAGE ═══ */
body.login-page {
  height: auto;
  min-height: 100vh;
  overflow: auto;
}
.login-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.login-card {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: 14px;
  padding: 52px 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 4px 28px rgba(0,0,0,.09);
}
@media (max-width: 520px) {
  .login-card { padding: 40px 28px; border-radius: 10px; }
}
.login-brand {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--p-text-sub);
  margin-bottom: 10px;
}
.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--p-text);
  margin-bottom: 40px;
  line-height: 1.15;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 24px;
}
.login-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--p-text);
}
.login-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  color: var(--p-text);
  background: var(--p-surface);
  border: 1.5px solid var(--p-border-input);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-input:focus {
  border-color: var(--p-link);
  box-shadow: 0 0 0 3px rgba(44,110,203,.15);
}
.login-submit {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--p-green);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background .15s;
  margin-top: 4px;
}
.login-submit:hover    { background: var(--p-green-hov); }
.login-submit:disabled { opacity: .5; cursor: default; }
.login-error {
  display: none;
  margin-top: 16px;
  padding: 13px 16px;
  background: var(--p-danger-bg);
  color: var(--p-danger-text);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

/* ═══ CHANGE PASSWORD PAGE ═══ */
.change-pw-layout {
  max-width: 440px; margin: 60px auto; padding: 0 20px;
}
@media (max-width: 520px) {
  .change-pw-layout { margin: 32px auto; }
}
.change-pw-card {
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: 14px; padding: 44px 40px;
  box-shadow: 0 4px 28px rgba(0,0,0,.09);
}
.change-pw-card h1 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.change-pw-subtitle { font-size: 13px; color: var(--p-text-sub); margin-bottom: 24px; }
.change-pw-msg { font-size: 13px; margin-top: 12px; min-height: 18px; }
.change-pw-msg--error   { color: var(--p-red); }
.change-pw-msg--success { color: var(--p-green); }

/* ═══ USER STATUS & ACTIVITY ═══ */
.user-name-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  font-weight: 500; font-size: 14px; color: var(--p-link);
  font-family: inherit; text-align: left;
}
.user-name-btn:hover { text-decoration: underline; }
.user-row--inactive td { opacity: .5; }
.user-status-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
}
.user-status-badge--active   { background: var(--p-badge-bg);   color: var(--p-badge-text); }
.user-status-badge--inactive { background: var(--p-gray-bg);    color: var(--p-gray-text);  }
.user-deact-btn { color: var(--p-red) !important; }

/* Activity timeline */
.act-timeline { display: flex; flex-direction: column; gap: 0; }
.act-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--p-border);
  position: relative;
}
.act-item:last-child { border-bottom: none; }
.act-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  margin-top: 4px;
}
.act-content { flex: 1; min-width: 0; }
.act-label { font-size: 14px; color: var(--p-text); font-weight: 500; }
.act-details { font-weight: 400; color: var(--p-text-sub); }
.act-time { font-size: 12px; color: var(--p-text-sub); margin-top: 3px; }

/* ── Preview-as banner ───────────────────────────────────────────────────────── */
.preview-banner {
  display: flex; align-items: center; gap: 10px;
  background: #92400e; color: #fef3c7;
  font-size: 13px; font-weight: 500;
  padding: 10px 20px;
  position: sticky; top: 0; z-index: 900;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.preview-banner svg { flex-shrink: 0; opacity: .8; }
.preview-banner strong { color: #fff; }
.preview-banner-exit {
  margin-left: auto; background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3); border-radius: 6px;
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 12px; cursor: pointer; transition: background .15s;
}
.preview-banner-exit:hover { background: rgba(255,255,255,.28); }

/* ── Kanban drag and drop ────────────────────────────────────────────────────── */
.db-kcard[draggable="true"] { cursor: grab; }
.db-kcard[draggable="true"]:active { cursor: grabbing; }
.db-kcard--dragging { opacity: .35; }
.db-col-body--dragover {
  background: rgba(99,102,241,.07);
  outline: 2px dashed rgba(99,102,241,.45);
  outline-offset: -4px;
  border-radius: 8px;
  min-height: 60px;
}

/* ── Backlog table section ───────────────────────────────────────────────────── */
.db-backlog-section {
  margin-bottom: 24px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: 10px;
  overflow: hidden;
}
.db-backlog-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--p-border);
}
.db-backlog-label { font-weight: 600; font-size: 13px; color: var(--p-text); }
.db-backlog-header:hover { background: var(--p-surface-sub); }
.db-backlog-chevron { font-size: 10px; color: var(--p-text-sub); margin-left: auto; }
.db-backlog-drop-zone { transition: background .15s; }
.db-backlog-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.db-backlog-table thead th {
  padding: 8px 14px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--p-text-sub);
  border-bottom: 1px solid var(--p-border);
  user-select: none;
}
.db-backlog-th:hover { color: var(--p-text); }
.db-backlog-th--active { color: var(--p-text) !important; }
.db-backlog-row td { padding: 9px 14px; border-bottom: 1px solid var(--p-border); vertical-align: middle; }
.db-backlog-row:last-child td { border-bottom: none; }
.db-backlog-row { cursor: pointer; transition: background .1s; }
.db-backlog-row:hover { background: var(--p-surface-sub); }
.db-backlog-key { color: var(--p-text-sub); font-size: 11px; white-space: nowrap; }
.db-backlog-title { font-weight: 500; }
.db-backlog-empty { padding: 16px 14px !important; color: var(--p-text-sub); font-style: italic; text-align: center; }
.db-backlog-row--dragging { opacity: .35; }

.db-backlog-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--p-border);
}
.db-pag-btn {
  background: var(--p-surface-sub);
  border: 1px solid var(--p-border);
  border-radius: var(--r-md);
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--p-text);
}
.db-pag-btn:hover:not(:disabled) { background: var(--p-border); }
.db-pag-btn:disabled { opacity: .4; cursor: default; }
.db-pag-info { font-size: 12px; color: var(--p-text-sub); }
