:root {
  --navy: #0b1f3a;
  --electric: #1a73ff;
  --electric-dark: #0f57cc;
  --white: #ffffff;
  --gray-100: #f5f7fb;
  --gray-200: #e6ebf3;
  --gray-300: #cfd7e6;
  --gray-500: #6c7788;
  --gray-700: #2b3442;
  --shadow-soft: 0 12px 30px rgba(11, 31, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--gray-700);
  background: var(--gray-100);
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1200px, 94vw);
  margin: 0 auto;
}

.topbar {
  background: linear-gradient(135deg, #0b1f3a 0%, #102a52 45%, #0d1d3f 100%);
  color: var(--white);
  padding: 26px 0 20px;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 28px;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 0;
  color: #c9d3e6;
  font-size: 14px;
}

.badge {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.steps-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.steps-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 0;
}

.step-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
}

.step-index {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--electric);
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: 12px;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 24px;
  padding: 24px 0 48px;
}

.flow-column,
.side-column {
  display: grid;
  gap: 20px;
}

.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.card-header {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.card-step {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: var(--electric);
  color: var(--white);
  font-weight: 700;
  display: grid;
  place-items: center;
}

.card-subtitle {
  margin: 4px 0 0;
  color: var(--gray-500);
  font-size: 13px;
}

h2 {
  margin: 0;
  font-size: 20px;
  color: var(--navy);
}

h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--navy);
}

.meta {
  color: var(--gray-500);
  font-size: 13px;
}

.tip {
  color: var(--electric-dark);
  font-size: 13px;
}

button,
input {
  font-family: inherit;
}

button {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(26, 115, 255, 0.35);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.primary {
  background: var(--electric);
  color: var(--white);
  box-shadow: 0 10px 18px rgba(26, 115, 255, 0.2);
}

.primary:hover {
  background: var(--electric-dark);
}

.secondary {
  background: var(--gray-200);
  color: var(--navy);
}

.ghost {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--navy);
}

.danger-outline {
  background: rgba(255, 71, 87, 0.1);
  color: #b42318;
  border: 1px solid rgba(180, 35, 24, 0.2);
}

.danger {
  background: #b42318;
  color: var(--white);
}

.upload-panel {
  display: grid;
  gap: 8px;
}

.name-field {
  margin-top: 16px;
  display: grid;
  gap: 6px;
}

.name-field label {
  font-size: 13px;
  color: var(--navy);
  font-weight: 600;
}

.name-field input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--gray-300);
  background: var(--white);
}

.canvas-tools {
  margin-top: 16px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--gray-200);
  background: #f6f9ff;
}

.canvas-tools label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-row input[type="range"] {
  flex: 1;
}



.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.size-card {
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: #f9fbff;
}

.size-meta {
  color: var(--gray-500);
  font-size: 12px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-control input[type="number"] {
  width: 70px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--gray-300);
  text-align: center;
  font-size: 15px;
  background: var(--white);
}

.qty-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--gray-300);
}

.row-actions {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.cropper-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.size-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.size-tab {
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  font-size: 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.size-tab[data-active="true"] {
  background: rgba(26, 115, 255, 0.12);
  border-color: rgba(26, 115, 255, 0.3);
}

.size-tab .status {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--gray-200);
}

.size-tab[data-status="ok"] .status {
  background: #e7f8ef;
  color: #16794f;
  border-color: rgba(22, 121, 79, 0.2);
}

.cropper-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 16px;
}

.cropper-area {
  position: relative;
  min-height: 420px;
  background: #0b1f3a;
  border-radius: 14px;
  overflow: hidden;
}


.cropper-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  text-align: center;
  padding: 20px;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04) 10px, rgba(255, 255, 255, 0.08) 10px, rgba(255, 255, 255, 0.08) 20px);
  z-index: 2;
}

.cropper-placeholder.hidden {
  display: none;
}

.cropper-area img {
  display: block;
  max-width: 100%;
}

.center-guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.center-guide::before,
.center-guide::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.65);
}

.center-guide::before {
  width: 1px;
  top: 10%;
  bottom: 10%;
  left: 50%;
}

.center-guide::after {
  height: 1px;
  left: 10%;
  right: 10%;
  top: 50%;
}

.cropper-sidebar {
  display: grid;
  gap: 12px;
  align-content: start;
}

.preview-box {
  border: 1px dashed var(--gray-300);
  border-radius: 12px;
  background: var(--white);
  width: 100%;
  aspect-ratio: 27 / 33;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slider-group {
  display: grid;
  gap: 6px;
}

input[type="range"] {
  width: 100%;
}

.queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

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

.queue-item {
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  background: var(--white);
  align-items: center;
  box-shadow: 0 8px 20px rgba(11, 31, 58, 0.05);
}

.queue-item img {
  width: 100%;
  aspect-ratio: 27 / 33;
  object-fit: cover;
  border-radius: 10px;
}

.queue-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--navy);
}

.name-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(26, 115, 255, 0.1);
  color: var(--navy);
  font-size: 12px;
  margin-bottom: 8px;
}

.queue-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.chip {
  background: rgba(26, 115, 255, 0.1);
  border: 1px solid rgba(26, 115, 255, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--navy);
}

.queue-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.download-panel {
  display: grid;
  gap: 10px;
}

.layout-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-500);
}

.summary-chip {
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--white);
  font-size: 12px;
  color: var(--navy);
}

.layout-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 6px;
}

.page-preview {
  position: relative;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(11, 31, 58, 0.06);
  overflow: hidden;
}

.page-label {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(26, 115, 255, 0.1);
  color: var(--navy);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  z-index: 3;
}

.tile-preview {
  position: absolute;
  border: 1px solid rgba(26, 115, 255, 0.25);
  background: #e9f0ff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.tile-preview span {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  color: rgba(11, 31, 58, 0.6);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  padding: 1px 4px;
}

.label-tile {
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 10px;
  color: var(--navy);
  background: var(--white);
  border: 1px dashed rgba(26, 115, 255, 0.4);
  padding: 4px;
}

.pdf-status {
  font-size: 13px;
  color: var(--gray-500);
}

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

@media (max-width: 720px) {
  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .cropper-layout {
    grid-template-columns: 1fr;
  }

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

.crop-actions {
  width: 100%;
}

.crop-actions button {
  flex: 1;
}
