:root {
  --bg-page: #0c0e14;
  --surface: #141821;
  --text-primary: #f4f6fa;
  --text-secondary: #949ba6;
  --text-nav: #d8dee9;
  --text-quiet-btn: #e5e8ee;
  --nav-bg: rgba(255, 255, 255, 0.06);
  --nav-bg-hover: rgba(255, 255, 255, 0.10);
  --quiet-bg: rgba(255, 255, 255, 0.07);
  --quiet-bg-hover: rgba(255, 255, 255, 0.11);
  --tab-active-bg: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-nav {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(12, 14, 20, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  flex-wrap: wrap;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  border: none;
  border-radius: 10px;
  background: var(--nav-bg);
  color: var(--text-nav);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  transition: background-color 150ms ease, transform 120ms ease;
}

.back-btn:hover {
  background: var(--nav-bg-hover);
}

.back-btn:active {
  transform: scale(0.985);
}

.back-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(244, 246, 250, 0.32);
}

.sheet-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: none;
  border-radius: 11px;
  background: var(--surface);
}

.sheet-tab {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.sheet-tab:hover {
  color: var(--text-primary);
}

.sheet-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(244, 246, 250, 0.32);
}

.sheet-tab.active {
  background: var(--tab-active-bg);
  border: none;
  box-shadow: none;
  color: var(--text-primary);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 15px;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-size: 13.5px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 150ms ease, transform 120ms ease;
}

.action-btn:active {
  transform: scale(0.985);
}

.action-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(244, 246, 250, 0.32);
}

.action-btn.secondary {
  border: none;
  background: var(--quiet-bg);
  color: var(--text-quiet-btn);
  font-weight: 500;
}

.action-btn.secondary:hover {
  background: var(--quiet-bg-hover);
}

.action-btn.primary {
  border: none;
  box-shadow: none;
  background: var(--text-primary);
  color: var(--bg-page);
  font-weight: 600;
}

.action-btn.primary:hover {
  background: #ffffff;
}

.sheets-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.auto-detect-note {
  margin: 0 0 14px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--text-secondary);
}

.sheet-card {
  margin: 0 auto;
  padding: 0;
  border: none;
  background: transparent;
}

.sheet-svg-holder {
  background: #ffffff;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.sheet-svg-holder svg {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 760px) {
  .print-toolbar {
    padding: 14px 16px 10px;
    gap: 10px;
  }

  .sheet-switcher {
    order: 2;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .sheet-tab {
    text-align: center;
    padding: 9px 10px;
  }

  .toolbar-actions {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .action-btn {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    font-size: 14px;
  }
}

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

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: 297mm !important;
    height: 210mm !important;
    background: #ffffff !important;
    background-image: none !important;
    overflow: hidden !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-toolbar,
  .auto-detect-note {
    display: none !important;
  }

  .sheets-wrap {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .sheet-card,
  .sheet-svg-holder {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  .sheet-svg-holder svg {
    width: 297mm !important;
    height: 210mm !important;
  }
}
