/* ==========================================================================
   London Britches — Admin Panel
   Clean white/navy-blue theme (formerly olive-green, and before that
   black/white — see the --primary variable notes below), Shopify-inspired
   layout & type. No external deps.
   ========================================================================== */

:root {
  /* Brand accent — navy blue (#102A43). Previous accents, for reference:
       olive green : --primary: #55672f;  --primary-soft: #6e8039;
       black/white : --primary: #1a1a1a;  --primary-soft: #303030;
  */
  --primary: #102a43;
  --primary-soft: #1c405f;

  --black: #1a1a1a;
  --black-soft: #303030;
  --grey-900: #303030;
  --grey-700: #616161;
  --grey-600: #6d7175;
  --grey-500: #8a8a8a;
  --grey-300: #d4d4d4;
  --grey-200: #e3e3e3;
  --grey-150: #ececec;
  --grey-100: #f6f6f7;
  --white: #ffffff;

  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --success: #1a7f4b;
  --success-bg: #e3f6ea;
  --warning: #916a00;
  --warning-bg: #fcf1cd;
  --info: #1a4b8c;
  --info-bg: #e4edfb;
  --link: #1f4e79;

  --sidebar-width: 248px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 64px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0,0,0,0.03);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.12);
  --font: "Inter", "Segoe UI Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Dark theme ---------- */

html[data-theme="dark"] {
  /* Brand accent — navy blue, lightened so it reads on dark surfaces.
     Previous dark accents: olive #93ac5e/#a9c078; black/white #f2f2f4/#ffffff. */
  --primary: #4a87c7;
  --primary-soft: #649bd4;

  --black: #f2f2f4;
  --black-soft: #ffffff;
  --grey-900: #dedee2;
  --grey-700: #a8a8b2;
  --grey-600: #8e8e99;
  --grey-500: #77777f;
  --grey-300: #3a3a45;
  --grey-200: #2b2b34;
  --grey-150: #26262f;
  --grey-100: #18181e;
  --white: #1e1e26;

  --danger: #ff7a70;
  --danger-bg: rgba(255, 122, 112, 0.14);
  --success: #3ecf8e;
  --success-bg: rgba(62, 207, 142, 0.14);
  --warning: #f0b429;
  --warning-bg: rgba(240, 180, 41, 0.14);
  --info: #6ea8fe;
  --info-bg: rgba(110, 168, 254, 0.14);
  --link: #7fb0e0;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

html[data-theme="dark"] body { background: #131317; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--grey-100);
  color: var(--black);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4 {
  font-weight: 650;
  letter-spacing: -0.012em;
  margin: 0 0 8px;
  color: var(--black);
}
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 14.5px; }

p { margin: 0 0 12px; color: var(--grey-700); }

svg.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Layout shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  color: var(--black);
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 40;
  border-right: 1px solid var(--grey-200);
  transition: transform 0.25s ease, width 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  margin-bottom: 4px;
}

.sidebar-brand .mark {
  width: 30px; height: 30px;
  background: var(--primary);
  color: var(--white);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: 0;
  flex-shrink: 0;
}
/* When .mark is an <img> logo rather than the "LB" text fallback:
   drop the coloured chip, size by height, let the width follow the artwork. */
.sidebar-brand img.mark {
  width: auto;
  height: 38px;
  background: none;
  border-radius: 0;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand .name {
  font-weight: 650;
  font-size: 13.5px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.3;
  color: var(--black);
}
.sidebar-brand .name small {
  display: block;
  font-size: 11px;
  color: var(--grey-500);
  letter-spacing: 0.02em;
  font-weight: 500;
}

.sidebar-nav {
  padding: 4px 12px 32px;
}

.sidebar-section {
  padding: 16px 8px 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--grey-500);
  font-weight: 650;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  margin: 4px 0;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--grey-900);
}

.sidebar-link .link-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-link svg.icon { color: var(--grey-600); }

.sidebar-link:hover {
  background: var(--grey-100);
  color: var(--black);
}

.sidebar-link.active {
  background: var(--grey-150);
  color: var(--black);
  font-weight: 650;
  border-left: 2px solid var(--primary);
}
.sidebar-link.active svg.icon { color: var(--primary); }

.sidebar-link .count {
  font-size: 11px;
  background: var(--primary);
  padding: 1px 7px;
  border-radius: 20px;
  color: var(--white);
  font-weight: 650;
  flex-shrink: 0;
}

/* ---------- Sidebar accordion groups ---------- */

.sidebar-group-toggle {
  width: 100%;
  background: none;
  border: none;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
}

.sidebar-group-toggle .chevron {
  display: flex;
  color: var(--grey-500);
  transition: transform 0.18s ease;
}
.sidebar-group-toggle .chevron svg { width: 15px; height: 15px; }
.sidebar-group-toggle.open .chevron { transform: rotate(180deg); }
.sidebar-group-toggle.open svg.icon { color: var(--primary); }

.sidebar-submenu {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 0.2s ease;
}
.sidebar-submenu-inner { min-height: 0; overflow: hidden; }
.sidebar-submenu[data-open] {
  grid-template-rows: 1fr;
}

.sidebar-sublink {
  display: block;
  padding: 6px 10px 6px 40px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--grey-600);
  overflow: hidden;
}
.sidebar-sublink:hover { background: var(--grey-100); color: var(--black); }
.sidebar-sublink.active { background: var(--grey-150); color: var(--primary); font-weight: 650; }

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

/* ---------- Desktop icon-only collapsed sidebar ---------- */

.app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
.app-shell.sidebar-collapsed .main { margin-left: var(--sidebar-collapsed-width); }

.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 18px 8px; }
.app-shell.sidebar-collapsed .sidebar-brand .name,
.app-shell.sidebar-collapsed .sidebar-section,
.app-shell.sidebar-collapsed .link-text,
.app-shell.sidebar-collapsed .sidebar-link .count,
.app-shell.sidebar-collapsed .sidebar-group-toggle .chevron {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-link,
.app-shell.sidebar-collapsed .sidebar-group-toggle {
  justify-content: center;
  padding: 10px 0;
}
.app-shell.sidebar-collapsed .sidebar-link .link-label,
.app-shell.sidebar-collapsed .sidebar-group-toggle .link-label {
  justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-submenu {
  grid-template-rows: 0fr !important;
}

/* Hovering a collapsed sidebar flies it out full-width over the content,
   without touching the persisted collapsed state or reflowing .main. */
.app-shell.sidebar-collapsed .sidebar:hover {
  width: var(--sidebar-width);
  box-shadow: var(--shadow-md);
}

.app-shell.sidebar-collapsed .sidebar:hover .sidebar-brand { justify-content: flex-start; padding: 18px 16px; }
.app-shell.sidebar-collapsed .sidebar:hover .sidebar-brand .name,
.app-shell.sidebar-collapsed .sidebar:hover .sidebar-section,
.app-shell.sidebar-collapsed .sidebar:hover .link-text,
.app-shell.sidebar-collapsed .sidebar:hover .sidebar-link .count,
.app-shell.sidebar-collapsed .sidebar:hover .sidebar-group-toggle .chevron {
  display: revert;
}

.app-shell.sidebar-collapsed .sidebar:hover .sidebar-link,
.app-shell.sidebar-collapsed .sidebar:hover .sidebar-group-toggle {
  justify-content: space-between;
  padding: 7px 10px;
}
.app-shell.sidebar-collapsed .sidebar:hover .sidebar-link .link-label,
.app-shell.sidebar-collapsed .sidebar:hover .sidebar-group-toggle .link-label {
  justify-content: flex-start;
}

.app-shell.sidebar-collapsed .sidebar:hover .sidebar-submenu[data-open] {
  grid-template-rows: 1fr !important;
}

.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar .page-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.topbar .subtitle {
  font-size: 12px;
  color: var(--grey-500);
  margin-top: 1px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle, .icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--grey-700);
  flex-shrink: 0;
}
.menu-toggle:hover, .icon-btn:hover { background: var(--grey-100); color: var(--black); }

/* ---------- Theme toggle ---------- */

.theme-icon-dark { display: none; }
html[data-theme="dark"] .theme-icon-light { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: flex; }

/* ---------- User menu dropdown ---------- */

.user-menu { position: relative; }

.user-chip {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.user-chip .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 650;
  font-size: 12px;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 50;
}
.user-dropdown.open { display: block; }

.user-dropdown-header {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--grey-200);
  margin-bottom: 6px;
}
.user-dropdown-header .name { font-weight: 650; font-size: 13.5px; color: var(--black); }
.user-dropdown-header .role { font-size: 12px; color: var(--grey-500); margin-top: 1px; }

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
}
.user-dropdown-item:hover { background: var(--grey-100); }
.user-dropdown-item svg.icon { width: 17px; height: 17px; color: var(--grey-600); }
.user-dropdown-item.danger { color: var(--danger); }
.user-dropdown-item.danger svg.icon { color: var(--danger); }
.user-dropdown-item.danger:hover { background: var(--danger-bg); }
.user-dropdown form { margin: 0; }

.content {
  padding: 24px 28px 40px;
  flex: 1;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 35;
}

/* ---------- Cards / stat tiles ---------- */

.card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--grey-200);
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 20px 20px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grey-100);
  color: var(--grey-600);
}
.stat-card-icon svg.icon { width: 17px; height: 17px; }
.stat-card.dark .stat-card-icon { background: rgba(255,255,255,0.1); color: var(--white); }
.stat-card.warn .stat-card-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.danger .stat-card-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.success .stat-card-icon { background: var(--success-bg); color: var(--success); }

.stat-card .label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--grey-500);
  font-weight: 650;
  margin-bottom: 10px;
  padding-right: 40px;
}

.stat-card .value {
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--black);
}

.stat-card .value small { font-size: 12.5px; color: var(--grey-500); font-weight: 600; }

.stat-card.dark {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.stat-card.dark .label { color: var(--white); opacity: 0.7; }
.stat-card.dark .value { color: var(--white); }

.stat-card .accent-bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary);
}
.stat-card.warn .accent-bar { background: var(--warning); }
.stat-card.danger .accent-bar { background: var(--danger); }
.stat-card.success .accent-bar { background: var(--success); }

/* ---------- Dashboard alert card ---------- */

.dashboard-alert-card { margin-top: 20px; }
.dashboard-alert-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--warning-bg);
  color: var(--warning);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dashboard-alert-icon svg.icon { width: 17px; height: 17px; }

.two-col {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  align-items: start;
}

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

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  border: 1px solid var(--grey-300);
  background: var(--white);
  color: var(--black);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--grey-100); border-color: var(--grey-500); }

.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-soft); border-color: var(--primary-soft); }

.btn-outline { background: transparent; box-shadow: none; }

.btn-danger { border-color: var(--grey-300); color: var(--danger); background: var(--white); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-danger.solid { background: var(--danger); color: var(--white); border-color: var(--danger); }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */

label, .field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  margin-bottom: 6px;
  color: var(--black);
}

.form-group { margin-bottom: 16px; }
.help-text { font-size: 11.5px; color: var(--grey-500); margin-top: 4px; }

.form-control, select.form-control, textarea.form-control,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="datetime-local"],
input[type="url"], input[type="tel"], input[type="file"], select, textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: var(--font);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black);
}

.form-control:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 42, 67, 0.15);
}

textarea.form-control { resize: vertical; }

/* ---------- Rich text (Quill) editor ---------- */

.quill-source-hidden { display: none; }

.quill-editor {
  background: var(--white);
  border-radius: var(--radius-sm);
}
.quill-editor .ql-toolbar.ql-snow {
  border: 1px solid var(--grey-300);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--grey-100);
}
.quill-editor .ql-container.ql-snow {
  border: 1px solid var(--grey-300);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-family: var(--font);
  font-size: 13.5px;
  min-height: 260px;
}
.quill-editor .ql-editor { min-height: 260px; color: var(--black); }
.quill-editor .ql-editor.ql-blank::before { color: var(--grey-500); font-style: normal; }

html[data-theme="dark"] .quill-editor .ql-stroke { stroke: var(--grey-600); }
html[data-theme="dark"] .quill-editor .ql-fill { fill: var(--grey-600); }
html[data-theme="dark"] .quill-editor .ql-picker { color: var(--grey-600); }
html[data-theme="dark"] .quill-editor .ql-picker-options {
  background: var(--white);
  border-color: var(--grey-300) !important;
}
html[data-theme="dark"] .quill-editor button:hover .ql-stroke,
html[data-theme="dark"] .quill-editor button.ql-active .ql-stroke { stroke: var(--primary); }
html[data-theme="dark"] .quill-editor button:hover .ql-fill,
html[data-theme="dark"] .quill-editor button.ql-active .ql-fill { fill: var(--primary); }

.form-check-input { width: auto; margin-right: 8px; accent-color: var(--primary); }
.form-check {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 13px;
}

/* Collections (a CheckboxSelectMultiple field) - Django renders one choice
   per line by default. Flow them into wrapping rows instead, so a handful
   of collections reads as a compact block rather than a tall stacked list. */
#id_collections {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}
#id_collections > div { display: flex; align-items: center; }
#id_collections label {
  display: flex;
  align-items: center;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
#id_collections input[type="checkbox"] { width: auto; margin-right: 8px; accent-color: var(--primary); }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.errorlist {
  list-style: none;
  padding: 8px 12px;
  margin: 0 0 10px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

fieldset { border: 1px solid var(--grey-200); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
legend { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 6px; color: var(--grey-600); }

/* Password field with show/hide toggle */
.password-field { position: relative; }
.password-field input { padding-right: 40px; }
.password-toggle-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--grey-500);
}
.password-toggle-btn:hover { background: var(--grey-100); color: var(--black); }
.password-toggle-btn svg.icon { width: 17px; height: 17px; }
.password-toggle-btn .eye-off { display: none; }

/* Search input with magnifier icon */
.search-input {
  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='%238a8a8a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 36px;
  border-radius: 20px;
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--primary);
  font-weight: 650;
  padding: 11px 18px;
  border-bottom: 1px solid var(--grey-200);
  white-space: nowrap;
  background: var(--grey-100);
}
.data-table thead tr th:first-child { border-top-left-radius: var(--radius); }
.data-table thead tr th:last-child { border-top-right-radius: var(--radius); }

.data-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--grey-150);
  vertical-align: middle;
  color: var(--black);
}

.data-table tbody tr:hover { background: var(--grey-100); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .row-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Checkbox select column */
.data-table th.col-check, .data-table td.col-check { width: 40px; padding-left: 18px; padding-right: 0; }
.data-table input[type="checkbox"].row-check,
.data-table input[type="checkbox"].check-all {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  vertical-align: middle;
}

/* Primary "name" cell: thumbnail + bold linked title */
.cell-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cell-main .cell-thumb {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--grey-150); border: 1px solid var(--grey-200);
  flex-shrink: 0;
}
.cell-main .cell-thumb.round { border-radius: 50%; }
.cell-main .cell-title {
  font-weight: 650;
  color: var(--black);
}
a.cell-title:hover { text-decoration: underline; }

/* Secondary identifier cells (SKU, category, etc.) styled like a subtle link */
.cell-link { color: var(--link); font-weight: 600; }

.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--grey-500);
}
.empty-state h3 { color: var(--grey-700); margin-bottom: 6px; }

/* ---------- Badges / status pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  background: var(--grey-150);
  color: var(--grey-900);
}
.badge-dark { background: var(--primary); color: var(--white); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-outline { background: var(--white); color: var(--grey-700); border: 1px solid var(--grey-300); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Page header (title + subtitle + primary actions) ---------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 21px; font-weight: 700; margin: 0 0 4px; }
.page-head .page-head-sub { font-size: 13px; color: var(--grey-500); margin: 0; }
.page-head-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ---------- Tabbed form sections (product form) ---------- */

.ptab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--grey-200);
  margin-bottom: 20px;
  overflow-x: auto;
}
.ptab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--grey-500);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.ptab:hover { color: var(--black); }
.ptab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.ptab-panel[hidden] { display: none; }

/* ---------- Filters / toolbar ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar .search-input { min-width: 240px; flex: 1; }
.toolbar form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex: 1; }

.filter-bar-wrap {
  padding: 18px 20px 20px;
  border-bottom: 1px solid var(--grey-200);
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.filter-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.filter-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.filter-toolbar-right .search-input { width: 260px; }

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  padding: 7px 30px 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid var(--grey-300);
  border-radius: 20px;
  background-color: var(--white);
  color: var(--black);
  cursor: pointer;
  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='%236d7175' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5 12 15.5 18 9.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.filter-select:hover { border-color: var(--grey-500); }
.filter-select:focus { outline: none; border-color: var(--primary); }
.filter-select.has-icon {
  padding-left: 34px;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%236d7175' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5.5h16L14.5 12.8V19l-5 2v-8.2Z'/%3E%3C/svg%3E"),
    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='%236d7175' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5 12 15.5 18 9.5'/%3E%3C/svg%3E");
  background-position: left 12px center, right 9px center;
  background-repeat: no-repeat, no-repeat;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--grey-150);
  color: var(--grey-900);
  padding: 5px 8px 5px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.filter-pill .pill-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: var(--grey-600);
}
.filter-pill .pill-remove svg.icon { width: 11px; height: 11px; }
.filter-pill .pill-remove:hover { background: var(--grey-300); color: var(--black); }

/* ---------- Table footer / pagination ---------- */

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--grey-200);
}
.table-footer-info { font-size: 12.5px; color: var(--grey-500); }
.table-footer-nav { display: flex; gap: 6px; }

.page-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  color: var(--grey-700);
  background: var(--white);
  cursor: pointer;
}
.page-nav-btn:hover { background: var(--grey-100); border-color: var(--grey-500); }
.page-nav-btn.disabled { opacity: 0.4; pointer-events: none; }
.page-nav-btn svg.icon { width: 16px; height: 16px; }

.pagination {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--grey-200);
}
.pagination a, .pagination span {
  padding: 6px 12px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
}
.pagination .current { background: var(--primary); color: var(--white); border-color: var(--primary); font-weight: 650; }

/* ---------- Messages / alerts ---------- */

.alert {
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(26,127,75,0.18); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(179,38,30,0.18); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(145,106,0,0.18); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: rgba(26,75,140,0.18); }

/* ---------- Login page ---------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grey-100);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: var(--shadow-md);
}

.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand .mark {
  width: 44px; height: 44px; background: var(--primary); color: var(--white); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; margin: 0 auto 14px;
}
/* When .mark is an <img> logo rather than the "LB" text fallback. */
.auth-brand img.mark {
  width: auto;
  height: 72px;
  background: none;
  border-radius: 0;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
}
.auth-brand .name { font-weight: 650; font-size: 15px; color: var(--black); }
.auth-brand .tag { font-size: 11.5px; color: var(--grey-500); margin-top: 3px; }

/* ---------- Misc ---------- */

.muted { color: var(--grey-500); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grey-200); margin-bottom: 18px; }
.tabs a {
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--grey-500);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  padding: 10px 0 10px 20px;
  border-left: 2px solid var(--grey-200);
  position: relative;
  font-size: 13px;
}
.timeline li::before {
  content: "";
  position: absolute; left: -5px; top: 14px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--white);
}
.timeline li:last-child { border-color: transparent; }
.timeline .ts { color: var(--grey-500); font-size: 11.5px; }

.product-thumb {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--grey-150); border: 1px solid var(--grey-200);
}

.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--grey-300); vertical-align: middle; }

/* ---------- Product media gallery (main image + slider images) ---------- */

.media-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.media-tile-wrap {
  display: flex;
  flex-direction: column;
  width: 128px;
  flex: 0 0 128px;
}

.media-tile {
  width: 128px;
  height: 128px;
  min-width: 128px;
  max-width: 128px;
  min-height: 128px;
  max-height: 128px;
  flex-shrink: 0;
  border-radius: var(--radius);
  border: 1px solid var(--grey-200);
  position: relative;
  overflow: hidden;
  background: var(--grey-100);
  cursor: grab;
}
.media-tile.dragging { opacity: 0.35; }
.media-tile.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; }

.media-tile.is-primary {
  border: 2px solid var(--primary);
}

.media-tile .tile-preview {
  display: block;
  width: 100%;
  height: 100%;
}

.media-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.media-tile .tile-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--grey-500);
}

/* The real file input sits invisible over the whole tile so clicking
   anywhere (except the overlay buttons) opens the file picker. !important
   guards against the generic .form-control/input[type=file] rule (which
   also matches, since BootstrapFormMixin adds that class to every field)
   ever winning a box-model property here. */
.media-tile input[type="file"] {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  opacity: 0 !important;
  cursor: pointer;
  z-index: 1;
}

.media-tile .tile-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 13, 13, 0.5);
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 5px;
  padding: 6px;
  z-index: 2;
  pointer-events: none;
}
.media-tile:hover .tile-overlay,
.media-tile:focus-within .tile-overlay { opacity: 1; }

.media-tile .tile-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--black);
  padding: 0;
  pointer-events: auto;
  position: relative;
  z-index: 3;
}
.media-tile .tile-btn svg.icon { width: 14px; height: 14px; }
.media-tile .tile-btn.tile-star.active { background: var(--primary); color: var(--white); }
.media-tile .tile-btn.tile-remove:hover { background: var(--danger); color: var(--white); }

.media-tile .tile-main-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: var(--primary);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 20px;
  display: none;
}
.media-tile.is-primary .tile-main-badge { display: inline-block; }

.media-tile-alt {
  width: 100%;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--grey-200);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--white);
  color: var(--black);
}


.media-tile-add {
  width: 128px;
  height: 128px;
  min-width: 128px;
  max-width: 128px;
  min-height: 128px;
  max-height: 128px;
  flex: 0 0 128px;
  border: 2px dashed var(--grey-300);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--grey-500);
  background: var(--white);
  font-size: 11.5px;
  font-weight: 600;
}
.media-tile-add:hover { border-color: var(--primary); color: var(--primary); }
.media-tile-add svg.icon { width: 22px; height: 22px; }

/* ---------- "Select file" media library modal ---------- */

.media-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 13, 0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.media-modal-backdrop.open { display: flex; }

.media-modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 920px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.media-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--grey-200);
  flex-shrink: 0;
}
.media-modal-header h3 { margin: 0; }

.media-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey-600);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-modal-close:hover { background: var(--grey-100); color: var(--black); }

.media-modal-toolbar {
  padding: 14px 22px;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.media-modal-searchrow {
  display: flex;
  gap: 10px;
  align-items: center;
}
.media-modal-searchrow .search-input { flex: 1; }

.media-modal-pillrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.media-pill-wrap { position: relative; }

.media-sort-btn,
.media-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 20px;
  border: 1px solid var(--grey-300);
  background: var(--white);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--grey-900);
  cursor: pointer;
  white-space: nowrap;
}
.media-sort-btn svg.icon,
.media-filter-pill svg.icon { width: 14px; height: 14px; }
.media-sort-btn:hover,
.media-filter-pill:hover { border-color: var(--grey-500); }
.media-filter-pill.is-filtered {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--grey-100);
}

.media-view-toggle {
  display: flex;
  border: 1px solid var(--grey-300);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.media-view-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: none;
  cursor: pointer;
  color: var(--grey-600);
}
.media-view-btn + .media-view-btn { border-left: 1px solid var(--grey-300); }
.media-view-btn.is-active { background: var(--grey-150); color: var(--black); }
.media-view-btn svg.icon { width: 16px; height: 16px; }

.media-pill-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  min-width: 190px;
}
.media-pill-wrap.open .media-pill-dropdown { display: block; }

.media-pill-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  border: none;
  background: none;
  font-size: 12.5px;
  color: var(--grey-900);
  cursor: pointer;
}
.media-pill-option:hover { background: var(--grey-100); }
.media-pill-option.is-active { color: var(--primary); font-weight: 700; }

.media-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

.media-dropzone {
  border: 2px dashed var(--grey-300);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--grey-500);
  font-size: 12.5px;
  margin-bottom: 20px;
  cursor: pointer;
}
.media-dropzone svg.icon { width: 22px; height: 22px; margin-bottom: 4px; }
.media-dropzone strong { color: var(--black); font-size: 13.5px; }
.media-dropzone:hover,
.media-dropzone.drag-active { border-color: var(--primary); background: var(--grey-100); }

.media-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
}

.media-card {
  position: relative;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--grey-100);
  aspect-ratio: 1 / 1;
}
.media-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-card.selected { outline: 2px solid var(--primary); outline-offset: -2px; }

.media-card .media-card-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid var(--grey-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
}
.media-card.selected .media-card-check { background: var(--primary); border-color: var(--primary); }

.media-card .media-card-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
  border: 1.5px solid var(--grey-300);
  background: rgba(255, 255, 255, 0.95);
  color: var(--grey-700);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.media-card:hover .media-card-delete { opacity: 1; }
.media-card .media-card-delete:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.media-card .media-card-delete svg { width: 13px; height: 13px; }
.media-card.is-list .media-card-delete { position: static; margin-left: 8px; flex-shrink: 0; opacity: 1; }

.media-card .media-card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 13, 13, 0.7);
  color: var(--white);
  font-size: 10px;
  padding: 3px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-modal-grid.is-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.media-card.is-list {
  display: flex;
  align-items: center;
  gap: 12px;
  aspect-ratio: auto;
  padding: 8px 10px;
  background: var(--white);
}
.media-card.is-list .media-card-thumb {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--grey-100);
}
.media-card.is-list .media-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-card.is-list .media-card-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.media-card.is-list .media-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-card.is-list .media-card-sub { font-size: 11.5px; color: var(--grey-600); }
.media-card.is-list .media-card-check {
  position: static;
  margin-left: auto;
  flex-shrink: 0;
}

.media-modal-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--grey-500);
  font-size: 13px;
}

.media-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--grey-200);
  flex-shrink: 0;
}

/* ---------- Product options / variant matrix ---------- */

.option-row {
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--white);
  cursor: grab;
}
.option-row.dragging { opacity: 0.4; }
.option-row.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; }

.option-row-view {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}
.option-row-view .option-name { font-weight: 700; min-width: 90px; }
.option-row-view .option-pills { display: flex; flex-wrap: wrap; gap: 6px; }

.option-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--grey-100);
  border: 1px solid var(--grey-200);
  font-size: 12.5px;
  color: var(--grey-900);
}
.option-pill-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

/* Colour value row: native swatch picker + name field */
.color-value-row .color-value-swatch {
  flex: 0 0 auto;
  width: 40px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
}

/* Size type: preset chips you toggle on/off */
.size-preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.size-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--grey-300);
  background: var(--white);
  color: var(--grey-800);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.size-chip:hover { border-color: var(--grey-500); }
.size-chip.is-picked {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

.option-row-edit { display: flex; flex-direction: column; gap: 10px; }
.option-row-edit label { font-size: 12.5px; font-weight: 600; color: var(--grey-700); }
.option-value-edit-row { display: flex; align-items: center; gap: 8px; }
.option-value-edit-row input { flex: 1; }
.option-value-remove {
  background: none;
  border: none;
  color: var(--grey-500);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.option-value-remove:hover { background: var(--grey-100); color: var(--danger); }
.option-row-edit-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }

.option-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--grey-700);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 2px;
}
.option-add-btn:hover { color: var(--primary); }
.option-add-btn svg.icon { width: 16px; height: 16px; }

.variant-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 12px;
}
.variant-toolbar .group-by-label { font-size: 12.5px; color: var(--grey-700); }
.variant-toolbar select.filter-select { max-width: 160px; }
.variant-filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.variant-table td, .variant-table th { vertical-align: middle; }
.variant-table .variant-group-row { cursor: pointer; background: var(--grey-100); }
.variant-group-row .chevron { display: inline-flex; transition: transform 0.15s ease; margin-right: 6px; }
.variant-group-row.expanded .chevron { transform: rotate(180deg); }
.variant-table .variant-leaf-row td:first-child { padding-left: 40px; }
.variant-table .variant-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--grey-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-500);
  margin-right: 10px;
  flex-shrink: 0;
}
.variant-table .variant-cell-main { display: flex; align-items: center; }
.variant-table input.variant-price, .variant-table input.variant-stock { width: 100px; }
.variant-table input.variant-sku { width: 180px; font-size: 12.5px; }
.variant-table .variant-count { color: var(--grey-500); font-size: 12px; margin-left: 6px; }
.variant-table .variant-avail-cell { text-align: center; }
.variant-table input.variant-available { width: auto; margin: 0; accent-color: var(--primary); cursor: pointer; }
.variant-table .variant-leaf-row.is-unavailable td { opacity: 0.5; }
.variant-table .variant-leaf-row.is-unavailable input.variant-available,
.variant-table .variant-leaf-row.is-unavailable .variant-action-cell { opacity: 1; }

.variant-img-strip { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.variant-img-thumb {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--grey-200);
  flex-shrink: 0;
}
.variant-img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.variant-img-remove {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 15px;
  height: 15px;
  line-height: 13px;
  padding: 0;
  border: none;
  border-radius: 0 0 0 4px;
  background: rgba(13, 13, 13, 0.6);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.variant-img-add {
  width: 34px;
  height: 34px;
  border: 1px dashed var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--grey-500);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.variant-img-add:hover { border-color: var(--primary); color: var(--primary); }
.variant-img-add svg.icon { width: 15px; height: 15px; }

.variant-table .variant-action-cell { text-align: center; }
.variant-row-delete {
  background: none;
  border: none;
  color: var(--grey-400);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.variant-row-delete:hover { color: var(--danger); background: var(--danger-bg); }
.variant-row-delete svg.icon { width: 15px; height: 15px; }

.variant-inventory-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--grey-200);
  font-size: 12.5px;
  color: var(--grey-700);
}

/* ---------- Print (invoice) ---------- */

@media print {
  .no-print { display: none !important; }
  body { background: var(--white); }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .sidebar,
  .app-shell.sidebar-collapsed .sidebar {
    width: var(--sidebar-width);
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .main,
  .app-shell.sidebar-collapsed .main {
    margin-left: 0;
  }
  .app-shell.sidebar-collapsed .sidebar-brand .name,
  .app-shell.sidebar-collapsed .sidebar-section,
  .app-shell.sidebar-collapsed .link-text,
  .app-shell.sidebar-collapsed .sidebar-link .count,
  .app-shell.sidebar-collapsed .sidebar-group-toggle .chevron {
    display: revert;
  }
  .app-shell.sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding: 18px 16px; }
  .app-shell.sidebar-collapsed .sidebar-link,
  .app-shell.sidebar-collapsed .sidebar-group-toggle {
    justify-content: space-between;
    padding: 7px 10px;
  }
  .app-shell.sidebar-collapsed .sidebar-link .link-label,
  .app-shell.sidebar-collapsed .sidebar-group-toggle .link-label {
    justify-content: flex-start;
  }
  .app-shell.sidebar-collapsed .sidebar-submenu[data-open] {
    grid-template-rows: 1fr !important;
  }
  .overlay.show { display: block; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* ---------- Searchable select (progressive enhancement of <select data-searchable>) ---------- */

.ss { position: relative; }
.ss-native.ss-enhanced {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.ss-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: var(--font);
  text-align: left;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black);
  cursor: pointer;
}
.ss-trigger:hover { border-color: var(--grey-500); }
.ss.is-open .ss-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 42, 67, 0.15);
}
.ss-trigger .ss-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-trigger .ss-value.is-placeholder { color: var(--grey-500); }
.ss-trigger .ss-caret { flex-shrink: 0; color: var(--grey-500); transition: transform 0.15s ease; }
.ss.is-open .ss-trigger .ss-caret { transform: rotate(180deg); }

.ss-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.ss-search-wrap { padding: 8px; border-bottom: 1px solid var(--grey-200); }
.ss-search { width: 100%; padding: 7px 10px; font-size: 13px; }

.ss-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 260px;
  overflow-y: auto;
}
.ss-option {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--black);
}
.ss-option.is-active { background: var(--grey-100); }
.ss-option.is-selected { color: var(--primary); font-weight: 650; }
.ss-option[hidden] { display: none; }
.ss-empty {
  padding: 12px 10px;
  font-size: 13px;
  color: var(--grey-500);
  text-align: center;
}

/* ==========================================================================
   Mobile / small-screen refinements
   (Sidebar off-canvas + table scroll are handled in the 900px block above;
   this tightens layout, toolbars and overlays for phones & small tablets.)
   ========================================================================== */

@media (max-width: 768px) {
  .content { padding: 16px 14px 32px; }
  .topbar { padding: 0 14px; }
  .topbar-right { gap: 10px; }

  /* Page header: title on its own line, actions stretch below it */
  .page-head { gap: 12px; margin-bottom: 16px; }
  .page-head-actions { width: 100%; flex-wrap: wrap; }
  .page-head-actions > * { flex: 1 1 auto; justify-content: center; }

  /* Cards */
  .card-header { padding: 14px; }
  .card-body { padding: 16px 14px; }
  .two-col { gap: 14px; }

  /* Stat tiles */
  .stat-grid { gap: 12px; margin-bottom: 18px; }
  .stat-card { padding: 16px 16px 18px; }
  .stat-card .value { font-size: 22px; }

  /* Filter / search toolbars stack full width */
  .filter-bar-wrap { padding: 14px; }
  .filter-toolbar { gap: 8px; }
  .filter-toolbar-left,
  .filter-toolbar-right { width: 100%; margin-left: 0; }
  .filter-toolbar-left > * { flex: 1 1 auto; }
  .filter-toolbar-right .search-input,
  .toolbar .search-input { width: 100%; min-width: 0; }
  .filter-select { width: 100%; }

  /* Tabbed forms (product form) */
  .ptab { padding: 9px 11px; font-size: 12.5px; }

  /* Variant editor */
  .variant-toolbar { flex-wrap: wrap; }
  .variant-toolbar select.filter-select { max-width: none; }

  /* Modals */
  .media-modal-backdrop { padding: 12px; }
  .media-modal { max-height: 92vh; border-radius: 10px; }
  .media-modal-toolbar { padding: 12px 14px; }
  .media-modal-body { padding: 14px; }
  .media-modal-footer { padding: 12px 14px; }

  /* Drawer (merged Categories add/edit) */
  .drawer { width: 100%; max-width: 100vw; }
}

@media (max-width: 480px) {
  .page-head h1 { font-size: 19px; }
  .btn { padding: 8px 12px; }
  .btn-sm { padding: 5px 9px; }

  .auth-card { padding: 28px 20px; }

  .data-table th, .data-table td { padding: 10px 12px; white-space: nowrap; }

  .media-modal-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }

  /* Reorder-by-drag is impractical on touch - reclaim the space */
  .cat-tree .cat-drag { display: none; }
}

/* ==========================================================================
   Navy sidebar (brand colour). The sidebar is a constant dark chrome in
   both light and dark themes; content colours are unaffected.
   ========================================================================== */

:root { --sidebar-bg: #102a43; }

.sidebar {
  background: var(--sidebar-bg);
  color: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .name { color: #fff; }
.sidebar-brand .name small { color: rgba(255, 255, 255, 0.55); }
.sidebar-brand .mark { background: #fff; color: var(--sidebar-bg); }

.sidebar-section { color: rgba(255, 255, 255, 0.45); }

.sidebar-link { color: rgba(255, 255, 255, 0.72); }
.sidebar-link svg.icon { color: rgba(255, 255, 255, 0.6); }
.sidebar-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-link:hover svg.icon { color: #fff; }
.sidebar-link.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-left-color: #fff;
}
.sidebar-link.active svg.icon { color: #fff; }
.sidebar-link .count { background: #fff; color: var(--sidebar-bg); }

.sidebar-group-toggle .chevron { color: rgba(255, 255, 255, 0.55); }
.sidebar-group-toggle.open svg.icon { color: #fff; }

.sidebar-sublink { color: rgba(255, 255, 255, 0.6); }
.sidebar-sublink:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-sublink.active { background: rgba(255, 255, 255, 0.14); color: #fff; }

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
