/* DIMA Label Studio — Light Industrial Logistics & Print Workbench */
:root {
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --bg: #f9fafb;
  --surface: #ffffff;
  --stage: #edf0f4;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-soft: #fff7ed;
  --accent-border: #fdba74;
  --radius: 8px;
  --radius-sm: 6px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body.lp-body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.lp-wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.lp-mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.lp-strong {
  font-weight: 600;
  color: var(--ink);
}

.lp-mt-sm { margin-top: 8px; }
.lp-mt-xs { margin-top: 6px; }

/* Header — guaranteed single line on desktop and 375px mobile */
.lp-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.lp-header-in {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lp-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.lp-brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--ink);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lp-brand-sub {
  font-weight: 500;
  color: var(--muted);
}

.lp-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.lp-nav-link {
  text-decoration: none;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
}

.lp-nav-link:hover {
  color: var(--ink);
  background: var(--bg);
}

.lp-lang-btn {
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: border-color 0.12s, color 0.12s;
}

.lp-lang-btn:hover {
  border-color: var(--ink);
}

/* Hero & Mode Tabs */
.lp-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 0 0;
}

.lp-pill-local {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 10px;
}

.lp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  flex-shrink: 0;
}

.lp-hero h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.lp-sub {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
  max-width: 820px;
}

.lp-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: -1px;
}

.lp-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, background 0.12s;
}

.lp-tab:hover {
  color: var(--ink);
  background: var(--bg);
}

.lp-tab.is-active {
  color: var(--accent);
  background: var(--bg);
  border-color: var(--border);
  border-bottom-color: var(--bg);
  box-shadow: inset 0 2px 0 var(--accent);
}

.lp-tab-short { display: none; }

/* Workbench Grid */
.lp-bench-sec {
  padding: 20px 0 24px;
}

.lp-grid-2 {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.lp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lp-controls {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Dropzone */
.lp-dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 20px 16px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.lp-dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lp-drop-icon {
  color: var(--ink-2);
  margin-bottom: 6px;
}

.lp-drop-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.lp-drop-sub {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.lp-drop-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.lp-filebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.lp-filebar-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.lp-filebar-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp-filebar-meta {
  font-size: 11px;
  color: var(--muted);
}

/* Form Controls */
.lp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lp-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: -0.01em;
}

.lp-input, .lp-select, .lp-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.lp-textarea {
  resize: vertical;
  line-height: 1.45;
}

.lp-input:focus, .lp-select:focus, .lp-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.16);
}

.lp-hint-sm {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.lp-spec-strip {
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
}

/* Chips & Segmented Controls */
.lp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lp-chip {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  cursor: pointer;
  transition: all 0.12s;
}

.lp-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.lp-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.lp-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.lp-seg-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.12s;
}

.lp-seg-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
}

.lp-seg-sm .lp-seg-btn {
  padding: 4px 6px;
  font-size: 11.5px;
}

/* Sliders */
.lp-sliders-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.lp-slider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.lp-slider-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.lp-slider-item span {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lp-slider-item strong {
  color: var(--ink);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

.lp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lp-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.lp-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lp-checks-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.lp-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.lp-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Buttons */
.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.lp-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.lp-btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.lp-btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.lp-btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.lp-btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--ink);
}

.lp-btn-sm {
  padding: 5px 9px;
  font-size: 12px;
}

.lp-btn-lg {
  padding: 11px 16px;
  font-size: 14px;
}

.lp-btn-full {
  width: 100%;
}

.lp-mini-btn {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  padding: 3px 9px;
  cursor: pointer;
  transition: all 0.12s;
}

.lp-mini-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.lp-status {
  font-size: 12.5px;
  color: var(--ink-2);
  min-height: 18px;
}

.lp-status.is-ok { color: #15803d; font-weight: 600; }
.lp-status.is-err { color: #b91c1c; font-weight: 600; }

/* Stage / Preview Area */
.lp-stage-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lp-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

.lp-stage-meta {
  font-size: 12px;
  color: var(--ink-2);
}

.lp-pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lp-pager-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  min-width: 44px;
  text-align: center;
}

.lp-canvas-wrap {
  min-height: 540px;
  padding: 20px;
  background-color: var(--stage);
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.lp-empty-stage {
  text-align: center;
  color: var(--muted);
  max-width: 340px;
  padding: 36px 20px;
}

.lp-empty-stage p {
  margin: 10px 0 0;
  font-size: 13px;
}

/* Interactive Crop Frame */
.lp-crop-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
  box-shadow: 0 6px 20px rgba(17, 24, 39, 0.14);
  background: #ffffff;
  user-select: none;
  touch-action: none;
  max-width: 100%;
}

#cropCanvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.lp-crop-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.lp-crop-box {
  position: absolute;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(17, 24, 39, 0.44);
  cursor: move;
  pointer-events: auto;
  touch-action: none;
}

.lp-box-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
}

.lp-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid var(--accent);
  border-radius: 2px;
  pointer-events: auto;
  touch-action: none;
}

.lp-h-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.lp-h-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.lp-h-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.lp-h-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.lp-h-n  { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.lp-h-s  { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.lp-h-w  { left: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.lp-h-e  { right: -6px; top: calc(50% - 6px); cursor: ew-resize; }

/* Sheet Preview Canvas */
.lp-sheet-wrap {
  min-height: 600px;
}

.lp-sheet-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(17, 24, 39, 0.14);
  cursor: pointer;
}

/* AdSense Band */
.lp-ad-band {
  padding: 12px 0;
}

/* Guide, Reference Table, FAQ */
.lp-section {
  padding: 28px 0;
  border-top: 1px solid var(--border);
}

.lp-h2 {
  margin: 0 0 14px;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.lp-sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.lp-sec-head .lp-h2 {
  margin-bottom: 4px;
}

.lp-sec-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.lp-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.lp-guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.lp-guide-card h3 {
  margin: 0 0 6px;
  font-size: 14.5px;
  color: var(--ink);
}

.lp-guide-card p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}

/* Spec Table */
.lp-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 760px;
}

.lp-table th, .lp-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.lp-table thead th {
  background: var(--bg);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

.lp-table tbody tr:last-child td {
  border-bottom: 0;
}

.lp-table tbody tr:hover {
  background: #fafafa;
}

.lp-td-act {
  text-align: right;
}

.lp-btag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.lp-btag-formtec { background: #f3f4f6; color: #111827; border: 1px solid #d1d5db; }
.lp-btag-avery   { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.lp-btag-thermal { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

/* FAQ */
.lp-faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lp-faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}

.lp-faq-item summary {
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lp-faq-item summary::-webkit-details-marker {
  display: none;
}

.lp-faq-item summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.lp-faq-item[open] summary::after {
  content: "−";
  color: var(--accent);
}

.lp-faq-item p {
  margin: 0;
  padding: 0 16px 14px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
}

/* Footer */
.lp-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.lp-footer-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.lp-footer a {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 600;
}

.lp-footer a:hover {
  color: var(--accent);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .lp-grid-2 {
    grid-template-columns: 1fr;
  }
  .lp-guide-grid {
    grid-template-columns: 1fr;
  }
  .lp-canvas-wrap, .lp-sheet-wrap {
    min-height: 360px;
  }
}

@media (max-width: 600px) {
  .lp-wrap {
    padding: 0 14px;
  }
  .lp-header-in {
    height: 50px;
    gap: 8px;
  }
  .lp-brand {
    font-size: 14px;
    gap: 7px;
  }
  .lp-brand-mark {
    width: 26px;
    height: 26px;
  }
  .lp-nav {
    gap: 6px;
  }
  .lp-nav-link {
    font-size: 12px;
    padding: 5px 6px;
  }
  .lp-lang-btn {
    padding: 4px 8px;
    font-size: 11.5px;
  }
  .lp-hero {
    padding-top: 14px;
  }
  .lp-hero h1 {
    font-size: 19px;
  }
  .lp-sub {
    font-size: 13px;
    margin-bottom: 14px;
  }
  .lp-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .lp-tab {
    justify-content: center;
    padding: 10px 8px;
    font-size: 13px;
  }
  .lp-tab-full { display: none; }
  .lp-tab-short { display: inline; }
  .lp-controls {
    padding: 14px;
  }
  .lp-two-col {
    grid-template-columns: 1fr;
  }
  .lp-slider-grid {
    grid-template-columns: 1fr;
  }
  .lp-canvas-wrap, .lp-sheet-wrap {
    padding: 12px;
    min-height: 280px;
  }
}
