/* ============================================================
   BOX PRINTING HUB — ADMIN PANEL
   Self-contained. Public style.css NOT required.
   ============================================================ */

/* ---------- Reset & tokens ---------- */
*, *::before, *::after { box-sizing: border-box; }

:root{
  --brand:      #1a4e77;
  --brand-dark: #123a59;
  --ink:        #0e2b42;
  --kraft:      #c79a62;
  --paper:      #f3f6f9;
  --white:      #fff;
  --line:       #d6e0e8;
  --text:       #17222c;
  --muted:      #4f6272;
  --danger:     #b3261e;
  --ok:         #1b6b3a;
  --warn:       #b45309;

  --sidebar-w:  250px;
  --topbar-h:   60px;

  --radius:     6px;
  --radius-lg:  10px;

  --shadow-sm:  0 1px 2px rgba(14,43,66,.06);
  --shadow:     0 4px 14px rgba(14,43,66,.08);
  --shadow-lg:  0 16px 40px rgba(14,43,66,.14);

  --font-body:  system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:  ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(.4,.1,.2,1);
}

html, body { margin:0; padding:0; }
body{
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: #eef3f8;
  -webkit-font-smoothing: antialiased;
}
a{ color: var(--brand); text-decoration: none; }
a:hover{ color: var(--brand-dark); }
img{ max-width:100%; display:block; }
h1,h2,h3,h4{ margin: 0 0 8px; color: var(--ink); line-height: 1.25; }
h1{ font-size: 22px; font-weight: 700; }
h2{ font-size: 18px; font-weight: 600; }
h3{ font-size: 15px; font-weight: 600; }
p{ margin: 0 0 12px; }

/* ---------- Login page ---------- */
.admin-login{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:
    radial-gradient(900px 400px at 20% -20%, rgba(26,78,119,.14), transparent 60%),
    linear-gradient(135deg, #0e2b42, #1a4e77);
  padding: 20px;
}
.login-card{
  width: 100%;
  max-width: 400px;
  background:#fff;
  border-radius: 14px;
  padding: 40px 36px 32px;
  box-shadow: 0 24px 60px rgba(14,43,66,.4);
}
.login-card__brand{
  display:flex;
  align-items:center;
  gap:10px;
  justify-content:center;
  margin-bottom: 8px;
}
.login-card__brand img{ height: 40px; }
.login-card__brand-name{
  font-size: 20px;
  font-weight: 800;
  color: var(--brand);
}
.login-card__title{
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  margin: 0 0 6px;
}
.login-card__sub{
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 26px;
}

/* ---------- Layout shell ---------- */
.admin-layout{
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.admin-sidebar{
  background: #0e2b42;
  color: #a9b8c7;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.admin-sidebar__brand{
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h);
}
.admin-sidebar__brand img{ height: 30px; }
.admin-sidebar__brand-name{
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.005em;
}

.admin-sidebar__nav{
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.admin-sidebar__group{
  margin: 12px 0 4px;
  padding: 0 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #5c7a99;
}
.admin-sidebar__link{
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #c7d4e5;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.admin-sidebar__link:hover{
  background: rgba(255,255,255,.06);
  color: #fff;
}
.admin-sidebar__link.is-active{
  background: var(--brand);
  color: #fff;
}
.admin-sidebar__link svg{
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .9;
}
.admin-sidebar__badge{
  margin-left: auto;
  background: #e53e3e;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  line-height: 1;
  min-width: 18px;
  text-align: center;
}
.admin-sidebar__user{
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12.5px;
}
.admin-sidebar__user-name{
  display: block;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}
.admin-sidebar__user-role{
  display: block;
  color: #7a92ab;
  margin-bottom: 10px;
}
.admin-sidebar__user-links{
  display: flex;
  gap: 12px;
}
.admin-sidebar__user-links a{
  color: #c7d4e5;
  font-size: 12.5px;
}
.admin-sidebar__user-links a:hover{ color: #fff; }

/* ---------- Main area ---------- */
.admin-main{
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar{
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar__toggle{
  display: none;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.admin-topbar__toggle:hover{ background: var(--paper); }

.admin-topbar__title{
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.admin-topbar__breadcrumb{
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-topbar__breadcrumb a{ color: var(--muted); }
.admin-topbar__breadcrumb a:hover{ color: var(--brand); }

.admin-topbar__spacer{ flex: 1; }
.admin-topbar__action{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.admin-topbar__action:hover{ background: var(--paper); color: var(--brand); }
.admin-topbar__action--primary{
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.admin-topbar__action--primary:hover{
  background: var(--brand-dark);
  color: #fff;
}

.admin-content{
  flex: 1;
  padding: 26px 22px 40px;
  min-width: 0;
}
.admin-content__wrap{
  max-width: 1280px;
  margin: 0 auto;
}

/* ---------- Page header ---------- */
.page-head{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1{
  font-size: 22px;
  margin: 0 0 4px;
}
.page-head p{
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
}
.page-head__actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Cards ---------- */
.card{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card + .card{ margin-top: 18px; }
.card__head{
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card__head h3{ margin: 0; font-size: 15px; }
.card__body{ padding: 20px; }

/* ---------- Stat grid (dashboard) ---------- */
.stat-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.stat-card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-card__label{
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.stat-card__value{
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card__meta{
  font-size: 12.5px;
  color: var(--muted);
}
.stat-card__meta a{ color: var(--brand); }
.stat-card__icon{
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(26,78,119,.08);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-card__icon svg{ width: 20px; height: 20px; }
.stat-card--danger .stat-card__value{ color: var(--danger); }
.stat-card--danger .stat-card__icon{ background: rgba(179,38,30,.1); color: var(--danger); }

/* ---------- Table ---------- */
.table-wrap{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table{
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td{
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  vertical-align: middle;
}
.table th{
  background: var(--paper);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.table tr:last-child td{ border-bottom: 0; }
.table tbody tr:hover{ background: rgba(26,78,119,.03); }
.table td.actions{
  text-align: right;
  white-space: nowrap;
}
.table .thumb{
  width: 40px; height: 40px;
  border-radius: 6px;
  background: var(--paper);
  object-fit: cover;
  display: block;
}
.table .thumb-empty{
  width: 40px; height: 40px;
  border-radius: 6px;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  color: #b8c7db;
}
.table .title-cell strong{ display: block; color: var(--ink); }
.table .title-cell span{ color: var(--muted); font-size: 12px; }
.table .actions a,
.table .actions button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.table .actions a:hover,
.table .actions button:hover{ background: var(--paper); }
.table .actions .danger{ color: var(--danger); border-color: rgba(179,38,30,.3); }
.table .actions .danger:hover{ background: rgba(179,38,30,.08); }

/* Table toolbar (filters, search) */
.table-toolbar{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex-wrap: wrap;
}
.table-toolbar__search{
  flex: 1;
  min-width: 200px;
  position: relative;
}
.table-toolbar__search input{
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
}
.table-toolbar__search input:focus{
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,78,119,.12);
}
.table-toolbar__search svg{
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.table-toolbar__select{
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  background: #fff;
  cursor: pointer;
}

/* Badges */
.badge{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}
.badge--new      { background: rgba(26,78,119,.1);  color: var(--brand); }
.badge--read     { background: rgba(79,98,114,.1);  color: var(--muted); }
.badge--ok       { background: rgba(27,107,58,.1);  color: var(--ok); }
.badge--warn     { background: rgba(180,83,9,.12);  color: var(--warn); }
.badge--danger   { background: rgba(179,38,30,.1);  color: var(--danger); }

/* ---------- Forms ---------- */
.form-grid{
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px;
  align-items: start;
}
.form-main{ min-width: 0; }
.form-side{ min-width: 0; }

.form-card{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.form-card + .form-card{ margin-top: 18px; }
.form-card__title{
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field:last-child{ margin-bottom: 0; }
.field > label{
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.field > label em{
  font-style: normal;
  color: var(--brand);
}
.field > label .opt{
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field input[type="tel"],
.field input[type="url"],
.field input[type="password"],
.field input[type="date"],
.field select,
.field textarea{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field input:focus,
.field select:focus,
.field textarea:focus{
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,78,119,.12);
}
.field textarea{ resize: vertical; min-height: 90px; }
.field select{
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%234f6272' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
.field .hint{
  font-size: 11.5px;
  color: var(--muted);
}
.field-row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.checkbox{
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 6px 0;
}
.checkbox input{
  margin-top: 2px;
  accent-color: var(--brand);
}

/* Image preview / uploader */
.uploader{
  position: relative;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  background: var(--paper);
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.uploader:hover{
  border-color: var(--brand);
  background: rgba(26,78,119,.04);
}
.uploader input[type="file"]{ display: none; }
.uploader__icon{
  width: 44px; height: 44px;
  border-radius: 12px;
  background: #fff;
  color: var(--brand);
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.uploader__label{
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.uploader__hint{
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}
.uploader__preview{
  margin-top: 14px;
  position: relative;
  display: inline-block;
}
.uploader__preview img{
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.uploader__remove{
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(179,38,30,.9);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  transition: all .15s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn--primary{ background: var(--brand); color: #fff; }
.btn--primary:hover{ background: var(--brand-dark); color: #fff; }
.btn--ghost{ background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover{ background: var(--paper); color: var(--ink); }
.btn--danger{ background: var(--danger); color: #fff; }
.btn--danger:hover{ filter: brightness(.9); color: #fff; }
.btn--sm{ padding: 7px 12px; font-size: 12.5px; }
.btn--block{ width: 100%; }
.btn:disabled{ opacity: .5; cursor: not-allowed; }

/* ---------- Alerts ---------- */
.alert{
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 18px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert__icon{ flex-shrink: 0; }
.alert--ok{ background: #e8f5ee; color: var(--ok); border-left: 3px solid var(--ok); }
.alert--err{ background: #fcecec; color: var(--danger); border-left: 3px solid var(--danger); }
.alert--warn{ background: #fff4e5; color: var(--warn); border-left: 3px solid var(--warn); }

/* ---------- Pagination ---------- */
.pager{
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pager a,
.pager span{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.pager a:hover{ background: var(--paper); color: var(--brand); border-color: var(--brand); }
.pager .is-active{
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.pager .is-disabled{ opacity: .4; cursor: not-allowed; }

/* ---------- Empty state ---------- */
.empty{
  text-align: center;
  padding: 60px 20px;
}
.empty__icon{
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(26,78,119,.07);
  color: var(--brand);
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.empty h3{ margin: 0 0 6px; font-size: 16px; }
.empty p{ color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }

/* ---------- Sidebar overlay for mobile ---------- */
.admin-overlay{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14,43,66,.5);
  z-index: 90;
}
.admin-overlay.is-active{ display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px){
  .form-grid{ grid-template-columns: 1fr; }
  .field-row{ grid-template-columns: 1fr; }
}
@media (max-width: 900px){
  .admin-layout{ grid-template-columns: 1fr; }
  .admin-sidebar{
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
  }
  .admin-sidebar.is-open{ transform: translateX(0); }
  .admin-topbar__toggle{ display: inline-flex; }
  .admin-content{ padding: 20px 16px 40px; }
  .admin-topbar{ padding: 0 16px; }
}
@media (max-width: 600px){
  .page-head{ flex-direction: column; align-items: flex-start; }
  .page-head__actions{ width: 100%; }
  .page-head__actions .btn{ flex: 1; }
  .stat-grid{ grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card{ padding: 14px 14px; }
  .stat-card__value{ font-size: 22px; }
  .stat-card__icon{ width: 32px; height: 32px; top: 12px; right: 12px; }
  .table th, .table td{ padding: 10px 12px; font-size: 12.5px; }
}

/* ============================================================
   DASHBOARD — two-column row below the stat cards
   ============================================================ */
.dash-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 22px;
}
@media (max-width: 1100px){
  .dash-grid{ grid-template-columns: 1fr; }
}

/* Small tweaks for dashboard tables */
.dash-grid .table-wrap .table th:last-child,
.dash-grid .table-wrap .table td:last-child{
  text-align: right;
}
.table code{
  background: rgba(26,78,119,.07);
  color: var(--brand);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .02em;
}

/* Read-only inputs read like fields, but greyed */
.field input[readonly],
.field textarea[readonly]{
  background: #f7fafd;
  color: var(--text);
  cursor: default;
}
.field input[readonly]:focus,
.field textarea[readonly]:focus{
  border-color: var(--line);
  box-shadow: none;
}
/* Uploader input sits inside the label */
.uploader input[type="file"]{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.uploader{ position: relative; }

/* ============================================================
   GALLERY GRID (product edit)
   ============================================================ */
.gallery-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.gallery-item{
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
}
.gallery-item img{
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.gallery-item input[type="checkbox"]{
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
}
.gallery-item__x{
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(179,38,30,.9);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  opacity: 0;
  transition: opacity .15s var(--ease);
  pointer-events: none;
}
.gallery-item input:checked ~ .gallery-item__x{ opacity: 1; }
.gallery-item input:checked ~ img{ opacity: .35; }


/* Segment tabs */
.seg-tabs{
  display: inline-flex;
  gap: 4px;
  background: var(--paper);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.seg-tab{
  padding: 7px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.seg-tab:hover{ color: var(--brand); }
.seg-tab.is-active{
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 2px rgba(14,43,66,.06);
}

/* Logo uploader preview */
.uploader__preview img{
  max-width:180px;
  max-height:100px;
  background:#fff;
  padding:8px;
  border-radius:8px;
  border:1px solid var(--line);
  object-fit:contain;
}

/* Permission picker */
.perm-group{
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.perm-group:last-child{
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.perm-group__title{
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 0 0 10px;
}
.perm-group__items{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}
.checkbox--perm{
  padding: 4px 0;
  font-size: 13px;
}
@media (max-width: 640px){
  .perm-group__items{ grid-template-columns: 1fr; }
}


/* ============================================================
   RICH TEXT EDITOR (TinyMCE)
   ============================================================ */
.tox-tinymce{
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  overflow: hidden;
}
.tox .tox-toolbar-overlord,
.tox .tox-toolbar__primary{
  background: var(--paper) !important;
}
.tox .tox-toolbar__group{
  padding: 4px 6px !important;
}
.tox .tox-tbtn--select{
  border: 1px solid var(--line) !important;
  background: #fff !important;
  border-radius: 6px !important;
}
.tox .tox-tbtn:hover{
  background: #fff !important;
  border-color: var(--brand) !important;
  color: var(--brand) !important;
}
.tox .tox-statusbar{
  background: var(--paper) !important;
  border-top: 1px solid var(--line) !important;
}
.tox .tox-statusbar__branding{display:none !important}

/* Hide the raw textarea while TinyMCE is active */
textarea[data-editor]{
  display:none;
}


/* ============================================================
   PRODUCT GALLERY GRID — with remove buttons
   ============================================================ */
.gallery-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.gallery-item{
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
  transition: opacity .2s ease, filter .2s ease;
}
.gallery-item img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter .2s ease;
}

/* Remove button */
.gallery-item__remove{
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(179, 38, 30, .9);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 2;
}
.gallery-item:hover .gallery-item__remove{
  opacity: 1;
}
.gallery-item__remove:hover{
  background: #b3261e;
  transform: scale(1.08);
}

@media (max-width: 640px){
  .gallery-grid{ grid-template-columns: repeat(3, 1fr); }
  .gallery-item__remove{ opacity: 1; }  /* always visible on touch */
}

/* ============================================================
   DASHBOARD — Quick Actions
   ============================================================ */
.quick-actions{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.quick-action{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: block;
  color: var(--ink);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.quick-action:hover{
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(14,43,66,.08);
  border-color: transparent;
  color: var(--brand);
}
.quick-action strong{
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.quick-action span{
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.quick-action:hover span{ color: var(--brand); }

/* ============================================================
   SETTINGS — sub navigation tabs
   ============================================================ */
.settings-tabs{
  display: flex;
  gap: 4px;
  background: var(--paper);
  padding: 5px;
  border-radius: 10px;
  margin-bottom: 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.settings-tabs::-webkit-scrollbar{ display: none; }

.settings-tab{
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.settings-tab:hover{ color: var(--brand); }
.settings-tab.is-active{
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 2px rgba(14,43,66,.06);
}

.settings-form{ margin: 0; }

@media (max-width: 640px){
  .settings-tabs{ padding: 4px; gap: 2px; }
  .settings-tab{ padding: 8px 14px; font-size: 12.5px; }
}