@font-face {
  font-family: "MADE Tommy";
  src: url("/fonts/MADETommy-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "MADE Tommy";
  src: url("/fonts/MADETommy-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Bebas Neue";
  src: url("/fonts/BebasNeue-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --blue: #1b6ec2;
  --blue-dark: #124e8c;
  --navy: #071422;
  --navy-soft: #10263d;
  --red: #e31b23;
  --red-dark: #b8141a;
  --paper: #e8eef5;
  --ink: #122033;
  --muted: #66758a;
  --card: #ffffff;
  --line: #d7e2ee;
  --shadow: 0 18px 40px rgba(12, 27, 46, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "MADE Tommy", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
button, input, select { font-family: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

body.app {
  font-family: var(--font);
  font-weight: 400;
  background:
    radial-gradient(1200px 480px at 8% -10%, rgba(27, 110, 194, 0.16), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(227, 27, 35, 0.08), transparent 50%),
    var(--paper);
  color: var(--ink);
  overflow-x: clip;
}

body.login {
  font-family: var(--font);
  font-weight: 400;
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: var(--navy);
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(27, 110, 194, 0.55), transparent 38%),
    radial-gradient(circle at 88% 88%, rgba(227, 27, 35, 0.38), transparent 34%),
    linear-gradient(160deg, #06111d 0%, #0c2138 55%, #081624 100%);
  animation: loginGlow 8s ease-in-out infinite alternate;
}

.login-bg::after {
  content: "";
  position: absolute;
  inset: auto -20% -18% -20%;
  height: 42%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(80, 170, 255, 0.18), transparent 60%);
  filter: blur(8px);
}

@keyframes loginGlow {
  from { filter: saturate(1); }
  to { filter: saturate(1.18) brightness(1.06); }
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(430px, calc(100vw - 32px));
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  padding: 34px 28px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(16px);
  animation: riseIn 0.55s var(--ease);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin-bottom: 22px;
}

.login-logo {
  width: 168px;
  height: auto;
  margin-bottom: 10px;
  filter: drop-shadow(0 8px 16px rgba(12, 27, 46, 0.18));
}

.login-brand b {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.login-brand h1 {
  margin: 4px 0 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field span {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select {
  width: 100%;
  min-width: 0;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: #f4f7fb;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}
.field input:hover, .field select:hover {
  border-color: #b9c9db;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(27, 110, 194, 0.16);
}
.field input[type="date"] {
  padding-right: 12px;
}
.field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
}

.btn {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  height: 48px;
  padding: 0 16px;
  background: linear-gradient(180deg, #2b84dc 0%, var(--blue) 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 18px rgba(27, 110, 194, 0.28);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), filter 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,0.28) 48%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.5s var(--ease);
  pointer-events: none;
}
.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 12px 24px rgba(27, 110, 194, 0.34);
}
.btn:hover::after { transform: translateX(120%); }
.btn:active { transform: translateY(0); }
.btn.red {
  background: linear-gradient(180deg, #f03a40 0%, var(--red) 100%);
  box-shadow: 0 8px 18px rgba(227, 27, 35, 0.28);
}
.btn.red:hover { box-shadow: 0 12px 24px rgba(227, 27, 35, 0.38); }
.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: 0 4px 10px rgba(16, 38, 61, 0.06);
}
.btn.ghost:hover {
  border-color: #9eb4cc;
  background: #f7fbff;
  box-shadow: 0 10px 20px rgba(16, 38, 61, 0.1);
}
.btn.ghost.danger { color: var(--red); }
.btn.ghost.danger:hover {
  border-color: #f3b4b6;
  background: #fff5f5;
}
.btn.full { width: 100%; }
.btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}
.btn:disabled::after { display: none; }

.alert {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fdecec;
  color: #9f1d22;
  font-family: var(--font);
  font-size: 13px;
  animation: riseIn 0.25s var(--ease);
}
.alert.show { display: block; }

.topbar {
  min-height: 72px;
  background: linear-gradient(180deg, rgba(10, 24, 40, 0.96), rgba(7, 20, 34, 0.94));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 30px rgba(7, 20, 34, 0.22);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  min-width: 0;
  transition: transform 0.2s var(--ease);
}
.topbar .brand:hover { transform: translateY(-1px); }
.brand-logo {
  width: 132px;
  height: auto;
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 7px 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  border-left: 1px solid rgba(255,255,255,0.18);
  padding-left: 12px;
}
.topbar .brand strong {
  font-size: 16px;
  font-weight: 700;
}
.topbar .brand span {
  color: #9fb4cc;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
}
.topbar .right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  justify-content: flex-end;
}
.topbar .layout-btn {
  height: 42px;
  font-weight: 400;
}
.account-menu { position: relative; }
.account-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px 0 16px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.account-trigger:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.28);
  transform: translateY(-1px);
}
.account-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s var(--ease);
}
.account-menu.open .account-caret {
  transform: rotate(225deg) translateY(-1px);
}
.account-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  padding: 8px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 22px 50px rgba(7, 20, 34, 0.28);
  z-index: 30;
  animation: riseIn 0.2s var(--ease);
}
.account-menu.open .account-dropdown { display: flex; flex-direction: column; gap: 4px; }
.account-dropdown button {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0 14px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
}
.account-dropdown button:hover { background: #f3f7fc; }
.account-dropdown button.logout { color: var(--red); }
.account-dropdown button.logout:hover { background: #fff4f4; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

[hidden] { display: none !important; }

.workspace {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  grid-template-areas:
    "panel preview"
    "items sheets";
}

.panel {
  grid-area: panel;
  background: rgba(255,255,255,0.86);
  border-right: 1px solid var(--line);
  padding: 22px;
  backdrop-filter: blur(10px);
}

.preview-wrap {
  grid-area: preview;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 18px 24px;
  min-height: 100%;
}

.preview-sticky {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  z-index: 5;
}

.preview-stage {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.18)),
    #d4deea;
  border-radius: 22px;
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 18px 40px rgba(16, 38, 61, 0.1);
  transform: scale(0.82);
  transform-origin: top center;
  margin-bottom: -40px;
}

.preview-caption {
  text-align: center;
  margin-top: 14px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.templates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.tpl {
  min-width: 0;
  border: 2px solid var(--line);
  background: #f7f9fc;
  border-radius: 16px;
  padding: 8px;
  text-align: left;
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.tpl:hover {
  transform: translateY(-3px);
  border-color: #9eb4cc;
  box-shadow: 0 12px 24px rgba(16, 38, 61, 0.1);
}
.tpl img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 8px;
  display: block;
  transition: transform 0.35s var(--ease);
}
.tpl:hover img { transform: scale(1.05); }
.tpl b { display: block; font-size: 15px; line-height: 1.2; }
.tpl small { color: var(--muted); font-family: var(--font); font-size: 11px; }
.tpl.active {
  border-color: var(--blue);
  background: #eef5fd;
  box-shadow: 0 0 0 4px rgba(27, 110, 194, 0.12);
}

.row2,
.row-price,
.row-meta {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.row2 { grid-template-columns: 1fr 1fr; }
.row-price { grid-template-columns: minmax(0, 1fr) 86px; }
.row-meta { grid-template-columns: minmax(0, 1fr) 92px; }

.field-kurus input,
.field-copy input {
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 18px;
}
.actions .btn {
  min-width: 0;
  width: 100%;
}
.actions .btn.red { grid-column: 1 / -1; height: 52px; font-size: 20px; }

.history { display: flex; flex-direction: column; gap: 6px; }
.history button {
  text-align: left;
  border: 1px solid #d5dee8;
  background: #f7fafc;
  border-radius: 8px;
  padding: 8px 10px;
}
.history button:hover { border-color: var(--blue); }
.history b { display: block; font-size: 14px; }
.history small { color: var(--muted); font-family: var(--font); font-size: 11px; }

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 20, 34, 0.55);
  z-index: 40;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}
.modal.open { display: grid; }
.modal-card {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 24px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  box-shadow: 0 30px 80px rgba(7, 20, 34, 0.28);
  animation: riseIn 0.32s var(--ease);
}
.modal-card h2 { margin: 0 0 12px; }
.user-list { margin: 12px 0 18px; display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  font-family: var(--font);
  font-size: 14px;
  background: #f8fbff;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.user-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(16, 38, 61, 0.08);
}

.label-frame {
  width: 148mm;
  height: 97mm;
  position: relative;
  overflow: hidden;
  background: #fff;
}

.label-frame .bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.label-frame .title {
  position: absolute;
  top: 2.6mm;
  left: 6mm;
  width: 136mm;
  height: 24.4mm;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: "MADE Tommy", sans-serif;
  font-weight: 700;
  font-size: 16.2mm;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 0.9;
}

.price-box {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: #fff;
  font-family: "Bebas Neue", sans-serif;
  line-height: 0.82;
}

.price-box .num {
  font-size: 18mm;
  letter-spacing: -0.02em;
}

.price-box .cur {
  display: flex;
  flex-direction: column;
  margin-left: 1.1mm;
  padding-top: 1.4mm;
}

.price-box .tl {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 5.6mm;
  line-height: 0.9;
}

.price-box .kurus {
  font-size: 5.4mm;
  letter-spacing: 0.01em;
}

.stamp-kg {
  position: absolute;
  top: 27.8mm;
  left: 46.2mm;
  width: 55.6mm;
  height: 24.8mm;
  transform: rotate(-0.8deg);
  overflow: hidden;
  gap: 1.4mm;
  justify-content: center;
  align-items: center;
  padding-left: 0;
}

.stamp-kg .kg {
  font-family: "Bebas Neue", sans-serif;
  font-size: 9mm;
  color: #fff;
  margin-right: 0.6mm;
  margin-top: 1.6mm;
}

.stamp-kg .num {
  font-size: 21.6mm;
}

.stamp-kg .cur {
  padding-top: 1.2mm;
}

.stamp-kg .tl { font-size: 6.6mm; }
.stamp-kg .kurus { font-size: 6.4mm; }

.stamp-kg,
.stamp-old {
  align-items: center;
}

.deal-copy {
  position: absolute;
  top: 54.2mm;
  left: 10.4mm;
  width: 54mm;
  height: 28mm;
  display: flex;
  align-items: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 14.6mm;
  line-height: 0.86;
  color: #fff;
  white-space: pre-line;
}

.deal-price {
  position: absolute;
  top: 52.8mm;
  left: 62mm;
  width: 80mm;
  height: 31.2mm;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #fff;
}

.deal-price .num {
  font-size: 31.2mm;
  letter-spacing: -0.04em;
}

.deal-price .cur {
  padding-top: 1.6mm;
}

.deal-price .tl { font-size: 9.6mm; }
.deal-price .kurus { font-size: 9.2mm; }

.unit-vertical {
  position: absolute;
  left: 13.2mm;
  top: 60.5mm;
  font-family: "Bebas Neue", sans-serif;
  font-size: 17.4mm;
  color: #6f6f6f;
  letter-spacing: -0.03em;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
}

.stamp-old {
  position: absolute;
  top: 29.2mm;
  left: 22.8mm;
  width: 39.2mm;
  height: 22mm;
  transform: rotate(-13deg);
}

.stamp-old .num { font-size: 13.6mm; }
.stamp-old .tl { font-size: 4.6mm; }
.stamp-old .kurus { font-size: 4.4mm; }

.strike {
  position: absolute;
  left: 6%;
  right: 4%;
  top: 47%;
  height: 1.55mm;
  background: #1c1c1c;
  transform: rotate(-6deg);
  border-radius: 1px;
}

.main-price {
  position: absolute;
  top: 42mm;
  left: 40mm;
  width: 102mm;
  height: 47mm;
  color: #2f2f2f;
  justify-content: flex-end;
  align-items: center;
  padding-right: 3.6mm;
}

.main-price .num {
  font-size: 54mm;
  letter-spacing: -0.05em;
}

.main-price .cur { padding-top: 9.2mm; }
.main-price .tl { font-size: 15mm; color: #2f2f2f; }
.main-price .kurus { font-size: 14.4mm; color: #2f2f2f; }

.footer-text {
  position: absolute;
  right: 4.15mm;
  bottom: 2.62mm;
  height: 7.2mm;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.35mm;
  color: #fff;
  background: #e11332;
  font-family: "MADE Tommy", sans-serif;
  font-weight: 400;
  line-height: 1;
  padding: 0 0 0 10mm;
  text-align: right;
}

.footer-text span:first-child {
  font-size: 2.45mm;
}

.footer-text span:last-child {
  font-size: 2.3mm;
}

.label-kampanya .unit-vertical,
.label-kampanya .stamp-old,
.label-kampanya .main-price,
.label-kampanya .bg-normal { display: none; }

.label-normal .stamp-kg,
.label-normal .deal-copy,
.label-normal .deal-price,
.label-normal .bg-kampanya { display: none; }

.label-normal .stamp-old.hidden { visibility: hidden; }

.inspector {
  width: 148mm;
  margin: 16px auto 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  font-family: var(--font);
  box-shadow: var(--shadow);
}
.inspector-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.inspector-head b { flex: 1; font-family: "MADE Tommy", sans-serif; font-size: 18px; }
.inspector-head .btn { height: 38px; width: auto; padding: 0 12px; }
.inspector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.inspector-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.inspector-grid label span {
  display: block;
}
.inspector-grid input {
  height: 40px;
  border: 1px solid #d7e0ea;
  border-radius: 10px;
  padding: 0 10px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
}
.inspector p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

body.editing .editable {
  cursor: move;
}
body.editing .editable.selected {
  outline: 2px dashed #124e8c;
  outline-offset: 1px;
}

.view-home, .view-group { min-height: calc(100vh - 72px); }
.home-box { max-width: 1120px; margin: 0 auto; padding: 28px 24px 56px; }
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
  padding: 32px;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 18%, rgba(227, 27, 35, 0.34), transparent 32%),
    radial-gradient(circle at 12% 90%, rgba(27, 110, 194, 0.45), transparent 42%),
    linear-gradient(135deg, #0b1c30 0%, #12365c 58%, #0d243d 100%);
  box-shadow: 0 24px 50px rgba(12, 27, 46, 0.18);
  overflow: hidden;
  position: relative;
}
.home-hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -50px auto;
  width: 220px;
  height: 220px;
  border: 18px solid rgba(255,255,255,0.05);
  border-radius: 50%;
  pointer-events: none;
}
.home-hero-copy { position: relative; z-index: 1; max-width: 640px; }
.home-hero .section-title { color: #9cc2e8; }
.home-hero h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.home-lead {
  margin: 12px 0 22px;
  color: #c5d6e8;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  max-width: 520px;
}
.home-hero .btn.red { min-width: 220px; }
.home-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: center;
}
.home-stat {
  min-width: 120px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
}
.home-stat b {
  display: block;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}
.home-stat span {
  display: block;
  margin-top: 6px;
  color: #9fb8d0;
  font-size: 13px;
  font-weight: 400;
}
.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}
.group-card {
  position: relative;
  overflow: hidden;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.8);
  background: linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 12px 28px rgba(16, 38, 61, 0.08);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.group-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 24px 44px rgba(16, 38, 61, 0.16);
}
.group-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.group-card-top b {
  margin: 0;
  min-width: 0;
}
.group-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  background: #eaf3fc;
  border-radius: 999px;
  padding: 5px 10px;
}
.group-card b { display: block; font-size: 22px; margin-bottom: 6px; font-weight: 700; }
.group-card small { color: var(--muted); font-family: var(--font); font-weight: 400; }
.group-card .card-actions { display: flex; gap: 8px; margin-top: 16px; }
.group-card .btn { height: 40px; width: auto; font-size: 14px; flex: 1; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 24px;
  border: 1.5px dashed #c5d3e2;
  border-radius: 24px;
  background: rgba(255,255,255,0.7);
  color: var(--muted);
  font-family: var(--font);
}
.empty-state strong {
  display: block;
  color: var(--ink);
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.empty-state p { margin: 0; font-weight: 400; }

.editor-groupbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.editor-groupbar .group-name { width: 100%; }
.editor-groupbar .btn { width: 100%; }
.group-name {
  flex: 1;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  font-family: var(--font);
  font-size: 20px;
  font-weight: 400;
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.group-name:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(27, 110, 194, 0.14);
}
.group-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}
.group-items-panel {
  background: #fff;
  border: 1px solid #dce4ee;
  border-radius: 16px;
  padding: 14px;
}
.item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: #f7f9fc;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.item-card:hover {
  border-color: #b7c8da;
  box-shadow: 0 6px 14px rgba(16, 38, 61, 0.08);
}
.item-card.active {
  border-color: var(--blue);
  background: #eef5fd;
  box-shadow: 0 0 0 3px rgba(27, 110, 194, 0.12);
}
.item-card-info {
  min-width: 0;
  flex: 1;
}
.item-card b {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-card small { color: var(--muted); font-family: var(--font); font-size: 11px; }
.item-card .card-actions {
  display: flex;
  gap: 6px;
  margin-top: 0;
  flex-shrink: 0;
}
.item-card .btn { height: 30px; width: auto; font-size: 12px; padding: 0 9px; }

.group-items-col {
  grid-area: items;
  align-self: start;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 104px);
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.94);
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
  padding: 16px 16px 12px;
  overflow: hidden;
}
.group-items-head {
  flex-shrink: 0;
  margin-bottom: 10px;
}
.group-items-head .section-title { margin-bottom: 6px; }
.group-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
}
#groupItemCount {
  letter-spacing: 0;
  text-transform: none;
  color: var(--blue);
}
.item-search {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #f4f7fb;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
}
.item-search:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(27, 110, 194, 0.14);
}
#groupItems {
  overflow: auto;
  min-height: 0;
  flex: 1;
  padding-right: 4px;
}

.print-preview-block {
  grid-area: sheets;
  width: 100%;
  max-width: none;
  padding: 22px 18px 40px;
  border-top: 1px solid var(--line);
}
.print-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.print-preview-head .section-title { margin: 0; }
.print-preview-head .btn { height: 42px; min-width: 140px; }
.group-sheets {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  align-content: flex-start;
}

.sheet-scale {
  width: calc(210mm * 0.38);
  height: calc(297mm * 0.38);
  overflow: hidden;
  background: #cfd8e3;
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(15, 30, 50, 0.14);
  transition: transform 0.22s var(--ease);
}
.sheet-scale:hover { transform: translateY(-4px); }
.a4-sheet {
  width: 210mm;
  height: 297mm;
  background: #fff;
  display: grid;
  grid-template-columns: 97mm 97mm;
  grid-template-rows: 148mm 148mm;
  justify-content: center;
  align-content: start;
  column-gap: 0;
  row-gap: 0;
  overflow: hidden;
}
.sheet-scale .a4-sheet {
  transform: scale(0.38);
  transform-origin: top left;
}
.a4-slot {
  width: 97mm;
  height: 148mm;
  position: relative;
  overflow: hidden;
  background: #fff;
  contain: strict;
}
.a4-slot .label-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
}
.a4-slot .editable { outline: none !important; cursor: default; pointer-events: none; }

.print-host { display: none; }

@media print {
  @page {
    size: 210mm 297mm;
    margin: 0;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    width: 210mm !important;
    min-height: 0 !important;
    height: auto !important;
  }

  body.app {
    background: #fff !important;
    overflow: visible !important;
  }

  body.app > *:not(.print-host) {
    display: none !important;
  }

  .print-host {
    display: block !important;
    width: 210mm;
    margin: 0;
    padding: 0;
  }

  .print-host .a4-sheet {
    width: 210mm;
    height: 297mm;
    max-width: 210mm;
    max-height: 297mm;
    overflow: hidden;
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-host .a4-sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .label-frame {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .editable.selected,
  body.editing .editable {
    outline: none !important;
    cursor: default !important;
  }
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "panel"
      "preview"
      "items"
      "sheets";
  }
  .preview-sticky { position: static; top: auto; }
  .group-items-col {
    position: relative;
    top: auto;
    max-height: 46vh;
  }
  .preview-stage { transform: scale(0.72); transform-origin: top center; }
  .brand-text { display: none; }
  .brand-logo { width: 96px; }
  .home-hero {
    grid-template-columns: 1fr;
    padding: 24px;
  }
  .home-stats { grid-template-columns: 1fr 1fr; }
}
