﻿:root {
  --page-bg: #f5f6f3;
  --panel-bg: #ffffff;
  --paper-bg: #ffffff;
  --text-color: #1d2522;
  --muted-color: #5e6a63;
  --label-color: #3f4c45;
  --border-color: #d7ddd8;
  --input-border: #b8c2bb;
  --button-border: #88978e;
  --button-bg: #ffffff;
  --button-hover-bg: #eef2ef;
  --accent-color: #c45d4a;
  --accent-dark: #9f4b3d;
  --help-bg: #526c60;
  --link-color: #2f6650;
  --workspace-grid: rgba(30, 39, 34, 0.05);
  --shadow-color: rgba(24, 32, 28, 0.12);
  --cut-color: #111714;
  --stitch-color: #35705b;
  --fold-color: #4d6589;
  --mark-color: #b14d3f;
  --pattern-label: #26322d;
  --small-label: #52625a;
  --grid-line-color: #d6ddd7;
  --scale-color: #7f8782;
  color: var(--text-color);
  background: var(--page-bg);
  font-family: "Segoe UI", "Yu Gothic UI", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
}

.panel {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: 18px;
  overflow: auto;
  background: var(--panel-bg);
  border-right: 1px solid var(--border-color);
}

.header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.3;
}

h2 {
  margin: 18px 0 10px;
  font-size: 14px;
}

p {
  margin-top: 6px;
  color: var(--muted-color);
  font-size: 13px;
  line-height: 1.55;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--label-color);
  font-size: 12px;
}

.size-guide-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 12px;
  border: 1px solid var(--border-color);
  background: #fff;
}

.label-row,
.heading-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #fff;
  background: var(--help-bg);
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: help;
}

.help::after {
  content: attr(data-help);
  position: fixed;
  z-index: 50;
  left: var(--help-left, 18px);
  top: var(--help-top, 72px);
  width: var(--help-width, min(300px, calc(100vw - 36px)));
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - var(--help-top, 72px) - 18px);
  overflow: auto;
  padding: 10px 12px;
  color: var(--text-color);
  background: var(--panel-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(20, 28, 24, 0.18);
  white-space: pre-line;
  font-size: 18px;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.help:hover::after,
.help:focus::after {
  opacity: 1;
  transform: translateY(0);
}

input,
select {
  width: 100%;
  height: 34px;
  padding: 5px 8px;
  color: var(--text-color);
  background: var(--button-bg);
  border: 1px solid var(--input-border);
  border-radius: 5px;
}

input[type="color"] {
  width: 42px;
  padding: 2px;
}

.check {
  grid-template-columns: 18px 1fr;
  align-items: center;
  margin-bottom: 8px;
}

.check input {
  width: 16px;
  height: 16px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

.panel-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.panel-footer-inline {
  margin-top: 14px;
}

.panel-footer p {
  margin: 0;
  font-size: 12px;
}

.copyright {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 6px;
}

.admin-dot {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  place-items: center;
  color: var(--accent-dark);
  text-decoration: none;
  font-size: 12px;
  line-height: 1;
}

a {
  color: var(--link-color);
}

.link-button {
  display: grid;
  min-height: 36px;
  place-items: center;
  color: var(--text-color);
  text-decoration: none;
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 6px;
}

.link-button:hover {
  background: var(--button-hover-bg);
}

button {
  min-height: 36px;
  color: var(--text-color);
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  background: var(--button-hover-bg);
}

.workspace {
  overflow: auto;
  padding: 24px;
  background:
    linear-gradient(90deg, var(--workspace-grid) 1px, transparent 1px),
    linear-gradient(var(--workspace-grid) 1px, transparent 1px);
  background-size: 20px 20px;
}

.workspace-actions {
  position: sticky;
  top: 0;
  z-index: 9;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  width: fit-content;
  margin: -8px 0 12px;
  padding: 10px;
  background: var(--page-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.workspace-actions button {
  min-width: 110px;
}

.tips-slot {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 220px;
  max-width: none;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--accent-soft) 45%, #fff);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.tips-label {
  margin: 0;
  color: var(--small-label);
  font-size: 11px;
  line-height: 1.2;
}

.tips-list {
  display: block;
  min-width: 0;
  gap: 4px;
}

.tips-link {
  display: block;
  overflow: hidden;
  color: var(--link-color);
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tips-admin-list {
  display: grid;
  gap: 8px;
}

.tips-admin-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: var(--paper-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.tips-admin-item span,
.small-note {
  color: var(--small-label);
  font-size: 13px;
  line-height: 1.6;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-button {
  min-width: 110px;
}

.tab-button.active {
  color: #fff;
  background: var(--accent-color);
  border-color: var(--accent-dark);
}

.tab-panel {
  display: block;
}

.repeat-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--paper-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.repeat-detail {
  display: grid;
  gap: 10px;
}

.tips-row-main,
.tips-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tips-row-main {
  justify-content: space-between;
}

.tips-row-meta {
  color: var(--small-label);
  font-size: 13px;
  line-height: 1.6;
}

.tips-stats-list {
  display: grid;
  gap: 10px;
}

.tips-stat-group {
  padding: 12px;
  background: var(--paper-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.tips-stat-group h3 {
  margin: 0 0 8px;
  color: var(--accent-dark);
}

.simple-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.simple-stats-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-color);
}

.simple-stats-table td:last-child {
  width: 5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.genkei-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
  color: var(--text-color);
  font-size: 13px;
}

.genkei-results span {
  padding: 4px 6px;
  background: var(--paper-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.neckline {
  fill: none;
  stroke: var(--cut-color);
  stroke-width: 0.7;
  vector-effect: non-scaling-stroke;
}

.brand-text {
  fill: var(--small-label);
  font-size: 8px;
  line-height: 1;
}

.point-debug-label {
  fill: #d71920;
  font-size: 16px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 2px;
}

.point-debug-dot {
  fill: #d71920;
  stroke: #fff;
  stroke-width: 0.6px;
}

.admin-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.admin-home-card {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 16px;
  color: var(--text-color);
  text-decoration: none;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 6px 18px var(--shadow-color);
}

.admin-home-card strong {
  color: var(--accent-dark);
  font-size: 18px;
}

.admin-home-card span {
  color: var(--small-label);
  font-size: 14px;
  line-height: 1.6;
}

.program-list {
  display: grid;
  gap: 12px;
}

.program-item {
  display: grid;
  grid-template-columns: 32px minmax(180px, 1fr) minmax(220px, 1.25fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  background: var(--paper-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.program-key-check {
  align-self: center;
  justify-self: center;
  grid-template-columns: 16px;
  margin: 0;
}

.program-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.program-actions .link-button,
.program-actions button {
  align-self: end;
  min-width: auto;
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
  line-height: 1.2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.danger-button {
  color: #fff;
  background: #b93426;
  border-color: #9f2d21;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(35, 25, 18, 0.4);
}

.modal-panel {
  width: min(480px, 100%);
  padding: 20px;
  color: var(--text-color);
  background: var(--panel-bg);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 18px 36px var(--shadow-color);
}

.modal-panel p {
  line-height: 1.7;
}

.access-key-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(255, 248, 231, 0.92);
}

.access-key-panel {
  width: min(420px, 100%);
  padding: 22px;
  color: var(--text-color);
  background: var(--panel-bg);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 18px 36px var(--shadow-color);
}

.access-key-panel label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.key-output {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  color: var(--text-color);
  background: var(--paper-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 10px;
  font: 14px/1.7 "Yu Gothic", "Yu Gothic UI", Meiryo, sans-serif;
}

#cad {
  display: block;
  min-width: 100%;
  min-height: 100%;
  background: var(--paper-bg);
  box-shadow: 0 8px 24px var(--shadow-color);
}

#cad.fit-view-svg {
  width: 100%;
  height: calc(100vh - 112px);
  min-height: 0;
}

.layout-preview {
  min-height: 100%;
  display: grid;
  place-items: start stretch;
}

.layout-preview-inner {
  width: 100%;
  padding: 0;
  background: var(--paper-bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.layout-preview-text {
  margin: 0 0 8px;
  padding: 0 2px;
  font-size: 14px;
  color: var(--text-color);
}

#layoutPreviewSvg {
  display: block;
  width: 100%;
  aspect-ratio: var(--preview-ratio);
  height: auto;
  max-height: 68vh;
  background: #fff;
  border: 1px solid var(--border-color);
}

.layout-preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  width: fit-content;
  margin: 0 0 8px;
  padding: 10px;
  background: var(--page-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.preview-page-grid,
.preview-page {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 0.48;
  stroke-dasharray: 2.5 1.5;
  vector-effect: non-scaling-stroke;
}

.preview-cut-line {
  fill: none;
  stroke: var(--cut-color);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.preview-stitch-line {
  fill: none;
  stroke: var(--stitch-color);
  stroke-width: 0.75;
  stroke-dasharray: 2.5 1.5;
  vector-effect: non-scaling-stroke;
}

.preview-fold-line {
  fill: none;
  stroke: var(--fold-color);
  stroke-width: 0.7;
  stroke-dasharray: 2 1.5;
  vector-effect: non-scaling-stroke;
}

.preview-grain-line {
  fill: none;
  stroke: var(--mark-color);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.preview-mark-line {
  fill: none;
  stroke: var(--mark-color);
  stroke-width: 1.05;
  vector-effect: non-scaling-stroke;
}

.preview-guide-line {
  fill: none;
  stroke: var(--mark-color);
  stroke-width: 0.7;
  stroke-dasharray: 2 1.5;
  vector-effect: non-scaling-stroke;
}

.preview-page-number {
  fill: var(--accent-color);
  font-size: 10px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  align-items: center;
  margin: -8px 0 16px;
  padding: 10px;
  background: var(--page-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.print-toolbar button {
  min-width: 110px;
}

.toolbar-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-button {
  display: inline-grid;
  min-height: 36px;
  place-items: center;
  padding: 0 12px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  background: var(--accent-color);
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
}

.help-button:hover {
  background: var(--accent-dark);
}

.print-pages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210mm, 210mm));
  align-items: start;
  gap: 16px;
}

.page-sheet {
  width: 210mm;
  height: 297mm;
  background: var(--paper-bg);
  box-shadow: 0 8px 24px var(--shadow-color);
}

.page-svg {
  display: block;
  width: 210mm;
  height: 297mm;
}

.grid-line {
  stroke: var(--grid-line-color);
  stroke-width: 0.55;
  vector-effect: non-scaling-stroke;
}

.tile {
  fill: none;
  stroke: none;
  stroke-width: 0;
  vector-effect: non-scaling-stroke;
}

.trim-line {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 0.48;
  stroke-dasharray: 3.5 2;
  stroke-linejoin: miter;
  stroke-linecap: butt;
  vector-effect: non-scaling-stroke;
}

.trim-corner {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 0.48;
  stroke-linejoin: miter;
  stroke-linecap: square;
  vector-effect: non-scaling-stroke;
}

.trim-note {
  fill: var(--accent-color);
  font-size: 3.2px;
}

.tile-label {
  fill: var(--accent-dark);
  font-size: 4px;
}

.cut {
  fill: rgba(255, 255, 255, 0.78);
  stroke: var(--cut-color);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.genkei-cut {
  fill: none;
  stroke: var(--cut-color);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.genkei-helper-line,
.preview-helper-line {
  fill: none;
  stroke: #79bff2;
  stroke-width: 0.55;
  stroke-dasharray: 2 1.5;
  vector-effect: non-scaling-stroke;
}

.stitch {
  fill: none;
  stroke: var(--stitch-color);
  stroke-width: 0.56;
  stroke-dasharray: 3.5 2.5;
  vector-effect: non-scaling-stroke;
}

.fold {
  fill: none;
  stroke: var(--fold-color);
  stroke-width: 0.56;
  stroke-dasharray: 1.5 2;
  vector-effect: non-scaling-stroke;
}

.mark {
  fill: none;
  stroke: var(--mark-color);
  stroke-width: 0.63;
  vector-effect: non-scaling-stroke;
}

.handle-guide {
  fill: none;
  stroke: var(--mark-color);
  stroke-width: 0.63;
  stroke-dasharray: 1.5 1.5;
  vector-effect: non-scaling-stroke;
}

.gusset-guide {
  fill: none;
  stroke: var(--mark-color);
  stroke-width: 0.63;
  stroke-dasharray: 1.5 1.5;
  vector-effect: non-scaling-stroke;
}

.grain-line {
  fill: none;
  stroke: var(--mark-color);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.handle-position-line {
  fill: none;
  stroke: var(--mark-color);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.label {
  fill: var(--pattern-label);
  font-size: 12px;
}

.title-label {
  fill: var(--pattern-label);
  font-size: 18px;
  font-weight: 700;
}

.compact-title-label {
  fill: var(--pattern-label);
  font-size: 9px;
  font-weight: 700;
}

.small-label {
  fill: var(--small-label);
  font-size: 5px;
}

.safe-label {
  fill: var(--pattern-label);
  font-size: 6px;
  font-weight: 700;
}

.micro-label {
  fill: var(--pattern-label);
  font-size: 2pt;
}

.dimension-label {
  fill: var(--mark-color);
  font-size: 12px;
  font-weight: 700;
}

.brand {
  fill: var(--cut-color);
  font-size: 2pt;
}

.scale-line {
  fill: none;
  stroke: var(--scale-color);
  stroke-width: 0.56;
  vector-effect: non-scaling-stroke;
}

.scale-label {
  fill: var(--scale-color);
  font-size: 3.5px;
}

.rotate-scale {
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(-90deg);
}

.paste-line {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 0.48;
  stroke-dasharray: 2 1.5;
  vector-effect: non-scaling-stroke;
}

.assembly-cell {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 0.45;
  vector-effect: non-scaling-stroke;
}

.assembly-cell.current {
  fill: color-mix(in srgb, var(--accent-color) 14%, transparent);
}

.assembly-number {
  fill: var(--accent-color);
  font-size: 4px;
}

.assembly-number.current {
  font-weight: 700;
}

.assembly-note {
  fill: var(--accent-color);
  font-size: 3.2px;
}

.corner-label {
  fill: var(--accent-color);
  font-size: 2pt;
}

.auth-panel {
  max-width: 420px;
  margin: 12vh auto 0;
  padding: 20px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--shadow-color);
}

.auth-panel form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.auth-error {
  min-height: 18px;
  color: var(--accent-dark);
  font-weight: 700;
}

.admin-app {
  min-height: 100vh;
  padding: 24px;
  background: var(--page-bg);
}

.admin-header {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  max-width: 1160px;
  margin: 0 auto 18px;
}

.admin-header .link-button {
  width: 140px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 640px) minmax(280px, 1fr);
  gap: 18px;
  max-width: 1160px;
  margin: 0 auto;
}

.admin-panel,
.preview-card {
  padding: 18px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--shadow-color);
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.skin-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 10px;
  margin-top: 10px;
}

.skin-field {
  min-width: 0;
}

.color-row {
  display: grid;
  grid-template-columns: 42px 9ch;
  gap: 6px;
  align-items: center;
  justify-content: start;
}

.color-row input[type="text"] {
  width: 9ch;
  padding-inline: 6px;
}

.admin-actions {
  grid-template-columns: repeat(4, 1fr);
}

.backup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.cad-links {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.cad-links h2 {
  margin: 0 0 2px;
}

.file-button {
  display: grid;
  min-height: 36px;
  place-items: center;
  color: var(--text-color);
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 6px;
  cursor: pointer;
}

.file-button:hover {
  background: var(--button-hover-bg);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.status-text {
  min-height: 20px;
  color: var(--accent-dark);
  font-weight: 700;
}

.skin-preview {
  min-width: 0;
}

.preview-card {
  position: sticky;
  top: 18px;
}

.preview-card button {
  margin-top: 14px;
  width: 140px;
}

.preview-paper {
  margin-top: 18px;
  padding: 18px;
  aspect-ratio: 1 / 1.28;
  background: var(--paper-bg);
  border: 1px dashed var(--accent-color);
  box-shadow: 0 8px 24px var(--shadow-color);
}

.preview-pattern {
  display: grid;
  height: 100%;
  place-content: center;
  gap: 8px;
  color: var(--pattern-label);
  border: 2px solid var(--cut-color);
  outline: 1px dashed var(--stitch-color);
  outline-offset: -14px;
  text-align: center;
  font-weight: 700;
}

body.print-mode .app,
body.layout-preview-mode .app {
  grid-template-columns: minmax(0, 1fr);
}

body.print-mode .panel,
body.layout-preview-mode .panel {
  display: none;
}

body.print-mode .workspace-actions,
body.layout-preview-mode .workspace-actions {
  display: none;
}

body.print-mode .workspace,
body.layout-preview-mode .workspace {
  min-height: 100vh;
}

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

  .admin-layout,
  .admin-row,
  .skin-fields,
  .admin-actions,
  .backup-actions {
    grid-template-columns: 1fr;
  }

  .admin-header {
    display: grid;
  }

  .program-item {
    grid-template-columns: 1fr;
  }

  .program-actions {
    justify-content: flex-start;
  }

  .tips-slot {
    display: grid;
    width: 100%;
  }

  .tips-link {
    white-space: normal;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }
}

.help-page {
  max-width: 760px;
  margin: 40px auto;
  padding: 24px;
  color: var(--text-color);
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--shadow-color);
}

.help-page h1 {
  margin-bottom: 16px;
}

.help-page p {
  color: var(--text-color);
  font-size: 16px;
}

.terms-page section {
  margin-top: 22px;
}

.terms-page h2 {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 18px;
}

.terms-page p {
  line-height: 1.8;
}

.help-close-button {
  display: inline-grid;
  min-height: 42px;
  min-width: 140px;
  place-items: center;
  margin-bottom: 18px;
  color: #fff;
  font-weight: 700;
  background: var(--accent-color);
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
}

.help-close-button:hover {
  background: var(--accent-dark);
}

.help-close-bottom {
  margin-top: 18px;
  margin-bottom: 0;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    margin: 0;
    background: #fff;
  }

  body:not(.print-mode) * {
    visibility: hidden;
  }

  body:not(.print-mode) #cad,
  body:not(.print-mode) #cad * {
    visibility: visible;
  }

  body:not(.print-mode) #cad {
    position: fixed;
    inset: 0;
    box-shadow: none;
  }

  body.print-mode .panel,
  body.print-mode .workspace-actions,
  body.print-mode #cad,
  body.print-mode .layout-preview,
  body.print-mode .print-toolbar {
    display: none !important;
  }

  body.print-mode .app,
  body.print-mode .workspace,
  body.print-mode .print-pages {
    display: block;
  }

  body.print-mode .workspace {
    padding: 0;
    overflow: visible;
    background: #fff;
  }

  body.print-mode .page-sheet {
    width: 210mm;
    height: 297mm;
    margin: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  body.print-mode .page-sheet:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}


