:root{
  --bg:#f5f6f8; --text:#222; --card-bg:#fff; --border:#e5e5e5;
  --header-1:#b00000; --header-2:#e00000; --nav-bg:#fff; --nav-border:#ddd;
  --input-bg:#fff; --input-border:#ccc; --muted:#667085; --th-bg:#f7f7f7;
  --nav-link-bg:#f0f0f0; --image-card-bg:#fafafa;
}
[data-theme="dark"]{
  --bg:#14161a; --text:#e8e8ea; --card-bg:#1d2025; --border:#33373d;
  --header-1:#7a0000; --header-2:#a30000; --nav-bg:#1d2025; --nav-border:#33373d;
  --input-bg:#22262b; --input-border:#3a3f46; --muted:#9aa0a8; --th-bg:#22262b;
  --nav-link-bg:#2a2e34; --image-card-bg:#22262b;
}
*{box-sizing:border-box}
body{font-family:Arial,Helvetica,sans-serif;margin:0;background:var(--bg);color:var(--text)}
header{background:linear-gradient(90deg,var(--header-1),var(--header-2));color:white;padding:18px 26px;display:flex;justify-content:space-between;gap:15px;flex-wrap:wrap}
header h1{font-size:23px;margin:0} header a{color:white}
nav{background:var(--nav-bg);border-bottom:1px solid var(--nav-border);padding:10px 24px;display:flex;gap:10px;flex-wrap:wrap}
nav a,.btn,button{display:inline-flex;align-items:center;justify-content:center;padding:10px 14px;border-radius:8px;text-decoration:none;border:0;background:#333;color:white;cursor:pointer;font-size:14px;min-height:42px;white-space:nowrap}
nav a{background:var(--nav-link-bg);color:var(--text)}.red{background:#c90000!important}.green{background:#118849!important}.blue{background:#1264a3!important}.gray{background:#666!important}
main{padding:22px;max-width:1380px;margin:0 auto}.card{background:var(--card-bg);padding:22px;border-radius:14px;box-shadow:0 2px 12px rgba(0,0,0,.08);margin-bottom:20px;overflow-x:auto}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:18px 22px;align-items:end}.grid>div{display:flex;flex-direction:column;min-width:0}
label{font-weight:bold;margin-bottom:6px}input,select,textarea{width:100%;max-width:100%;min-width:0;padding:10px 12px;border:1px solid var(--input-border);border-radius:8px;font-size:14px;background:var(--input-bg);color:var(--text)}
input[type=checkbox]{width:22px;height:22px}.login{max-width:450px;margin:50px auto}.big{font-size:30px;font-weight:bold}.muted{color:var(--muted)}
table{width:100%;border-collapse:collapse;background:var(--card-bg);min-width:780px}th,td{padding:10px;border-bottom:1px solid var(--border);text-align:left;vertical-align:top}th{background:var(--th-bg)}
.flash{background:#fff8d7;border-left:5px solid #e0b000;padding:10px;margin-bottom:12px;border-radius:8px;color:#222}.badge{padding:4px 8px;border-radius:999px;font-size:12px;display:inline-block}.ok{background:#e5f7ed;color:#08763c}.warn{background:#fff2cc;color:#8a5a00}.bad{background:#ffe0e0;color:#a00000}
.video{width:100%;max-width:500px;border-radius:10px}.table-wrap{overflow-x:auto}
.barcode-page table{min-width:0;width:100%;border-collapse:separate;border-spacing:0 8px}.barcode-page th{background:#c90000;color:white}.barcode-page td{background:var(--card-bg);border-top:1px solid var(--border);border-bottom:1px solid var(--border);padding:8px 10px;vertical-align:middle}.barcode-page td:first-child{border-left:1px solid var(--border);border-radius:8px 0 0 8px;width:90px;text-align:center;font-weight:bold}.barcode-page td:nth-child(2){width:38%;font-weight:600}.barcode-page td:nth-child(3){width:160px;text-align:center}.barcode-page td:last-child{border-right:1px solid var(--border);border-radius:0 8px 8px 0}.barcode-label{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;padding:4px 6px;background:white;border:1px solid #ddd;border-radius:6px;min-width:145px;min-height:55px;page-break-inside:avoid}.barcode-canvas{width:135px;max-width:100%;height:auto;display:block}.barcode-number{font-size:11px;margin-top:2px;line-height:1}
@media(max-width:900px){main{padding:12px}.grid{grid-template-columns:1fr}table{min-width:680px}}
@media print{header,nav,.no-print{display:none}main{max-width:none;padding:6mm}.card{box-shadow:none}.barcode-page table{border-spacing:0 4px;font-size:11px}.barcode-page th,.barcode-page td{padding:4px 6px}.barcode-label{min-width:120px;min-height:45px;padding:2px 4px}.barcode-canvas{width:115px}.barcode-number{font-size:9px}}
@page{margin:8mm}


.product-gallery{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:16px;
}

.product-image-card{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  background:var(--image-card-bg);
}

.product-image-card img{
  width:100%;
  height:180px;
  object-fit:contain;
  background:white;
  border-radius:8px;
  display:block;
}

.image-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}

.image-actions form{
  margin:0;
}

.theme-toggle{
  position:fixed;
  top:12px;
  right:12px;
  z-index:1000;
  width:42px;
  height:42px;
  min-height:42px;
  padding:0;
  border-radius:50%;
  background:var(--card-bg);
  color:var(--text);
  border:1px solid var(--border);
  box-shadow:0 2px 8px rgba(0,0,0,.15);
  font-size:18px;
}
@media print{.theme-toggle{display:none}}

.tour-highlight{
  position:relative;
  z-index:10001;
  border-radius:8px;
  box-shadow:0 0 0 4px var(--card-bg), 0 0 0 6px #c90000, 0 0 0 6000px rgba(0,0,0,.55);
}
.tour-tip{
  position:absolute;
  z-index:10002;
  max-width:320px;
  background:var(--card-bg);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:10px;
  box-shadow:0 8px 30px rgba(0,0,0,.35);
  padding:16px 18px;
}
.tour-tip-progress{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--muted);
  margin-bottom:6px;
}
.tour-tip h4{ margin:0 0 8px; font-size:16px; }
.tour-tip p{ margin:0 0 14px; font-size:14px; line-height:1.4; }
.tour-tip-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.tour-tip-actions button{ padding:8px 12px; min-height:auto; font-size:13px; }
