:root {
  --primary: #1a56db;
  --primary-dark: #1445b3;
  --primary-light: #eef3ff;
  --ink: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f8fafc;
  --panel: #ffffff;
  --danger: #dc2626;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 1px rgba(15, 23, 42, .03);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .07), 0 2px 6px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 30;
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: var(--ink); display: flex; align-items: center; }
.brand-accent { color: var(--primary); }
.brand-logo { height: 44px; width: auto; display: block; }
.tagline { color: var(--muted); font-size: 14px; }
.app-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.hero {
  background:
    radial-gradient(600px 240px at 12% 0%, var(--primary-light), transparent),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 44px 0 36px;
}
.hero-inner { text-align: center; max-width: 720px; }
.hero-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: .01em;
}
.hero-title {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 12px;
  color: var(--ink);
}
.hero-sub { font-size: 15px; color: var(--muted); margin: 0 auto 20px; max-width: 560px; }
.hero-points {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.hero-point {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.hero-cta-row { display: flex; justify-content: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

.hero-usecase-links { margin: 18px 0 0; font-size: 13px; color: var(--muted); }
.hero-usecase-links a { color: var(--primary); font-weight: 600; text-decoration: none; }
.hero-usecase-links a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .hero-title { font-size: 26px; }
  .site-header .wrap { flex-wrap: wrap; }
}

/* ---------- Use-case landing pages ---------- */

.usecase-section { padding: 44px 20px 8px; }
.usecase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.usecase-card h2 { font-size: 16px; margin: 0 0 8px; }
.usecase-card .sub { margin: 0; }

.cta-band {
  margin-top: 48px;
  padding: 48px 20px;
  background:
    radial-gradient(600px 240px at 88% 0%, var(--primary-light), transparent),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
  border-top: 1px solid var(--border);
  text-align: center;
}
.cta-band-inner { max-width: 560px; margin: 0 auto; }
.cta-band h2 { font-size: 24px; margin: 0 0 8px; letter-spacing: -.01em; }
.cta-band .sub { margin: 0 auto; }

.layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.panel h1 { font-size: 20px; margin: 0 0 4px; }
.panel h2 { font-size: 17px; margin: 0 0 4px; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }

.field-divider {
  grid-column: 1 / -1;
  margin: 6px 0 -2px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.field input, .field select {
  font-weight: 400;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
}
.field input, .field select { transition: border-color .15s ease, box-shadow .15s ease; }
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-row { display: flex; gap: 6px; }
.input-row input { flex: 1; }

.hint { color: var(--muted); font-weight: 400; min-height: 14px; }
.hint.error { color: var(--danger); }

.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 13px;
}

.actions { margin-top: 18px; display: flex; gap: 10px; }

button { cursor: pointer; font-family: inherit; transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(26, 86, 219, .25);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-primary.small { padding: 6px 12px; font-size: 12px; }

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.btn-ghost:hover:not(:disabled) { border-color: #cbd5e1; background: #f9fafb; }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost.small { padding: 6px 10px; font-size: 12px; }

.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecaca;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.btn-danger:hover:not(:disabled) { background: #fef2f2; }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }

.preview-header { display: flex; justify-content: space-between; align-items: center; }

.label-preview {
  border: 2px dashed #d7dee8;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  background: #fafbfc;
}

.label-inner {
  background: #fff;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 8px 10px;
  text-align: center;
  width: 260px;
  box-shadow: var(--shadow-sm);
}

.l-company { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.l-name { font-size: 14px; font-weight: 700; margin: 2px 0; word-break: break-word; }
.l-barcode { max-width: 100%; height: 36px; margin: 4px 0; }
.l-value { font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.l-row { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; gap: 8px; }
.l-price { font-weight: 700; }
.l-mrp { color: var(--muted); }
.l-meta { font-size: 10px; color: var(--muted); }

/* Template-driven previews (reprint.php) group fields into rows via row/align
   position data instead of the fixed .l-row/.l-meta layout above. */
.l-line { width: 100%; table-layout: fixed; font-size: 12px; margin-top: 2px; border-collapse: collapse; }
.l-left, .l-center, .l-right { width: 33.33%; overflow: hidden; }
.l-left { text-align: left; }
.l-center { text-align: center; }
.l-right { text-align: right; }
/* Rows with content in only one zone (e.g. the product name) span the full
   label width instead of being squeezed into a 33% column. */
td.l-full { width: 100%; }
.l-logo { max-height: 24px; margin: 0 auto 2px; display: block; }

.list-section { margin-top: 28px; padding-bottom: 60px; }
.list-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.list-actions { display: flex; gap: 10px; }
.session-note { color: var(--muted); font-size: 13px; }
.session-note a { color: var(--primary); font-weight: 600; text-decoration: none; }

.product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.product-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, transform .15s ease;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.product-card .pc-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.product-card .pc-remove:hover { color: var(--danger); }
.product-card .pc-edit {
  position: absolute;
  top: 8px;
  right: 52px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.product-card .pc-edit:hover { color: var(--primary); }
.product-card .pc-copy {
  position: absolute;
  top: 8px;
  right: 30px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.product-card .pc-copy:hover { color: var(--primary); }
.product-card .pc-qty {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 8px;
  font-weight: 700;
}
.product-card img { width: 100%; height: 44px; object-fit: contain; margin: 18px 0 4px; }
.product-card .pc-name { font-size: 13px; font-weight: 700; }
.product-card .pc-sub { font-size: 11px; color: var(--muted); }

.empty-state { color: var(--muted); font-size: 14px; padding: 30px 0; text-align: center; }

.print-sheet { display: none; }

/* Base (on-screen) styling for .print-label — the print-only rules further
   down duplicate/override these for @media print, but the "Generated preview"
   panel needs the same look while just sitting on the page normally. */
.print-label {
  display: inline-block;
  border: 1px solid #000;
  padding: 6px 8px;
  text-align: center;
  margin: 3mm;
  background: #fff;
  page-break-inside: avoid;
}
.print-label img { height: 45px; }
.print-label .l-logo { height: 18px; margin-bottom: 2px; }
.print-label .l-name { font-size: 12px; font-weight: 700; }
.print-label .l-value { font-size: 9px; color: #444; }
.print-label .l-row { font-size: 10px; display: flex; justify-content: space-between; gap: 6px; }
.print-label .l-line { width: 100%; table-layout: fixed; font-size: 10px; border-collapse: collapse; }
.print-label .l-left, .print-label .l-center, .print-label .l-right { width: 33.33%; overflow: hidden; }
.print-label .l-left { text-align: left; }
.print-label .l-center { text-align: center; }
.print-label .l-right { text-align: right; }
/* Rows with content in only one zone (e.g. the product name) span the full
   label width instead of being squeezed into a 33% column. */
.print-label td.l-full { width: 100%; }
.print-label .l-price { font-weight: 700; }
.print-label .l-company { font-size: 9px; color: #666; text-transform: uppercase; }

.generate-preview-wrap { margin-top: 20px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.generate-preview-wrap h3 { margin: 0 0 12px; font-size: 14px; color: var(--ink); }
.generate-preview { display: flex; flex-wrap: wrap; gap: 4px; max-height: 500px; overflow-y: auto; padding: 8px; background: #fafafa; border-radius: 8px; }

#print-gate-hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
#print-gate-hint.stale { color: #b45309; font-weight: 600; }
#print-gate-hint.ready { color: #16a34a; font-weight: 600; }

@media print {
  /* Hide everything on the page except the dynamically-built #print-sheet,
     regardless of which page (dashboard, products, reprint, …) triggered print. */
  body * { visibility: hidden !important; }
  .print-sheet, .print-sheet * { visibility: visible !important; }
  .print-sheet {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .print-sheet .print-label {
    display: inline-block;
    border: 1px solid #000;
    padding: 6px 8px;
    text-align: center;
    margin: 3mm;
    page-break-inside: avoid;
  }
  .print-sheet .print-label img { height: 32px; }
  .print-sheet .print-label .l-logo { height: 18px; margin-bottom: 2px; }
  .print-sheet .print-label .l-name { font-size: 12px; font-weight: 700; }
  .print-sheet .print-label .l-value { font-size: 9px; color: #444; }
  /* Each template field lands in a row via buildLabelHtml()'s renderRowsHtml(),
     laid out as a 3-zone table (left/center/right) — mirrors api/pdf.php. */
  .print-sheet .print-label .l-line { width: 100%; table-layout: fixed; font-size: 10px; border-collapse: collapse; }
  .print-sheet .print-label .l-left,
  .print-sheet .print-label .l-center,
  .print-sheet .print-label .l-right { width: 33.33%; overflow: hidden; }
  .print-sheet .print-label .l-left { text-align: left; }
  .print-sheet .print-label .l-center { text-align: center; }
  .print-sheet .print-label .l-right { text-align: right; }
  .print-sheet .print-label td.l-full { width: 100%; }
  .print-sheet .print-label .l-price { font-weight: 700; }
  .print-sheet .print-label .l-company { font-size: 9px; color: #666; text-transform: uppercase; }
  /* Free-print (index.php) builds its own simpler fixed markup, not template
     driven — still needs its own print rule for the SKU/price row. */
  .print-sheet .print-label .l-row { font-size: 10px; display: flex; justify-content: space-between; gap: 6px; }
}

/* ---------- Authed area ---------- */

.app-header-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.brand a { color: inherit; text-decoration: none; }

.app-nav { display: flex; gap: 18px; align-items: center; }
.app-nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; padding: 4px 0; border-bottom: 2px solid transparent; }
.app-nav a:hover { color: var(--ink); }
.app-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

.app-nav-dropdown { position: relative; }
.app-nav-dropdown-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 14px; font-weight: 600; font-family: inherit;
  padding: 4px 0; border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 4px;
}
.app-nav-dropdown-toggle:hover { color: var(--ink); }
.app-nav-dropdown-toggle.active { color: var(--primary); border-bottom-color: var(--primary); }
.app-nav-dropdown-caret { font-size: 10px; }
.app-nav-dropdown-menu {
  display: none;
  position: absolute; top: 100%; left: 0; margin-top: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  min-width: 160px; padding: 6px; z-index: 20;
}
.app-nav-dropdown.open .app-nav-dropdown-menu { display: block; }
.app-nav-dropdown-menu a {
  display: block; padding: 8px 10px; border-radius: 6px; border-bottom: none;
  font-size: 13px; white-space: nowrap;
}
.app-nav-dropdown-menu a:hover { background: var(--bg); color: var(--ink); }
.app-nav-dropdown-menu a.active { background: #eef2ff; color: var(--primary); }

.app-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

.trial-banner {
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  padding: 8px 0;
}
.trial-banner a { color: #92400e; font-weight: 700; margin-left: 6px; }
.trial-banner-locked { background: #fef2f2; border-bottom-color: #fecaca; color: var(--danger); }
.trial-banner-locked a { color: var(--danger); }
.trial-banner-pending { background: #eff6ff; border-bottom-color: #bfdbfe; color: #1e40af; }

/* ---------- Plans / payment ---------- */

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 20px; }
.plan-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 22px; position: relative; }
.plan-card.plan-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.plan-card.plan-popular { border-color: #f59e0b; }
.plan-badge { position: absolute; top: -11px; left: 20px; background: #f59e0b; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: .03em; }
.plan-current-badge { position: absolute; top: -11px; right: 20px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.plan-name { font-size: 17px; font-weight: 700; margin: 4px 0 2px; }
.plan-price { font-size: 26px; font-weight: 800; color: var(--ink); }
.plan-price span { font-size: 13px; font-weight: 500; color: var(--muted); }
.plan-price-annual { font-size: 13px; color: var(--muted); margin-top: 2px; }
.plan-price-annual .plan-save { color: #16a34a; font-weight: 600; }
.plan-features { list-style: none; padding: 0; margin: 14px 0; font-size: 13px; color: var(--ink); }
.plan-features li { padding: 4px 0; }
.plan-features li::before { content: '✓ '; color: #16a34a; font-weight: 700; }
.cycle-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 3px; margin: 16px 0; }
.cycle-toggle a { padding: 6px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--muted); }
.cycle-toggle a.active { background: var(--primary); color: #fff; }

.pricing-preview { padding: 32px 20px 60px; }
.pricing-preview-title { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; }
.pricing-preview .plan-card { padding: 18px; }
.pricing-note { margin: 16px 0 0; text-align: center; }

.pay-box { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; margin-top: 16px; }
.pay-qr { text-align: center; }
.pay-qr img { width: 220px; height: 220px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: #fff; }
.pay-amount { font-size: 28px; font-weight: 800; margin: 10px 0 2px; }
.pay-vpa { font-family: monospace; background: #f3f4f6; padding: 4px 8px; border-radius: 6px; font-size: 13px; }
.pay-instructions { flex: 1; min-width: 260px; }
.pay-instructions ol { padding-left: 20px; font-size: 14px; line-height: 1.7; }

.admin-table-wrap { overflow-x: auto; margin-top: 16px; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; font-size: 13px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: #f9fafb; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.btn-approve { background: #16a34a; color: #fff; border: none; padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-reject { background: #fff; color: var(--danger); border: 1px solid #fecaca; padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }

/* ---------- Bulk printing / import / team ---------- */

.bulk-bar { position: sticky; bottom: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin-top: 16px; box-shadow: 0 -2px 12px rgba(0,0,0,.04); }
.bulk-bar-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.bulk-grid-field { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.bulk-grid-field input { padding: 5px 6px; border: 1px solid var(--border); border-radius: 6px; }
.bulk-grid-field select {
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.bulk-grid-field select:hover { border-color: #cbd5e1; }
.bulk-grid-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.import-steps { display: flex; gap: 10px; margin: 16px 0; font-size: 13px; color: var(--muted); }
.import-steps span.done { color: #16a34a; font-weight: 700; }
.import-table-wrap { overflow-x: auto; margin: 16px 0; max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.import-row-error { background: #fef2f2; }
.import-row-error td { color: var(--danger); }

.team-table-wrap { overflow-x: auto; margin-top: 16px; }
.role-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 700; text-transform: uppercase; }
.role-owner { background: #eef2ff; color: var(--primary); }
.role-manager { background: #ecfdf5; color: #059669; }
.role-staff { background: #fef3c7; color: #92400e; }
.status-invited { color: var(--muted); font-style: italic; font-size: 12px; }

/* ---------- Label templates ---------- */

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.checkbox-field { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); }

.field-position-table-wrap { overflow-x: auto; }
.field-position-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.field-position-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 4px 8px; }
.field-position-table td { padding: 4px 8px; border-top: 1px solid var(--border); }
.field-position-table select { padding: 3px 4px; border: 1px solid var(--border); border-radius: 6px; }
.field-position-table input[type="number"] { padding: 3px 4px; border: 1px solid var(--border); border-radius: 6px; }
.field-position-table .fixed-field-row { background: #f9fafb; }
.field-position-table .fixed-field-row td { color: var(--muted); }

.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.template-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.template-card-name { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.template-card-fields { display: flex; flex-wrap: wrap; gap: 4px; min-height: 20px; }
.template-card-actions { margin-top: 12px; display: flex; gap: 12px; font-size: 13px; flex-wrap: wrap; align-items: center; }
.template-card-actions a { color: var(--primary); text-decoration: none; font-weight: 600; }
.template-card-actions button:not(.link-danger) { background: none; border: none; padding: 0; color: var(--primary); font-weight: 600; font-size: 13px; cursor: pointer; }
.template-card-default { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.badge-default { background: var(--primary); color: #fff; }

.l-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 10px; color: var(--muted); margin-top: 2px; }

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 16px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-value-sm { font-size: 16px; }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.btn-disabled { opacity: .45; pointer-events: none; }

.search-row { display: flex; gap: 10px; margin: 16px 0; max-width: 500px; }
.search-row input { flex: 1; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }

.product-table-wrap { overflow-x: auto; margin-top: 12px; }
.product-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: 13px; }
.product-table th, .product-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.product-table th { background: #f9fafb; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.product-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 10px; }
.row-actions a, .row-actions form { display: inline; }
.link-danger { background: none; border: none; color: var(--danger); font-size: 13px; cursor: pointer; padding: 0; font-weight: 600; }
.link-danger:disabled { opacity: .4; cursor: not-allowed; }

.badge { font-size: 10px; background: #eef2ff; color: var(--primary); padding: 2px 6px; border-radius: 4px; margin-left: 4px; }

.auth-wrap { padding: 40px 20px 60px; display: flex; justify-content: center; }
.auth-panel { max-width: 560px; width: 100%; }
.auth-panel-narrow { max-width: 380px; }
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ---------- Site footer ---------- */

.site-footer { margin-top: 48px; border-top: 1px solid var(--border); background: var(--panel); }
.site-footer-inner {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 32px;
  padding: 40px 20px 28px;
}
.footer-brand .brand-logo { height: 34px; margin-bottom: 10px; }
.footer-brand .sub { max-width: 320px; margin: 0; }
.footer-col h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 12px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--ink); font-size: 14px; text-decoration: none; font-weight: 500; }
.footer-col a:hover { color: var(--primary); }
.footer-col .footer-text { color: var(--muted); font-size: 14px; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .site-footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .site-footer-inner { grid-template-columns: 1fr; gap: 24px; }
}
