:root {
    color-scheme: light;
    --ink: #182235;
    --muted: #748096;
    --line: #e7eaf0;
    --blue: #315fe8;
    --blue-dark: #244bd0;
    --surface: #ffffff;
    --canvas: #f5f7fb;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: "DM Sans", "Segoe UI", sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
.topbar {
    height: 72px;
    padding: 0 max(28px, calc((100% - 1180px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.brand-link { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: -.2px; }
.brand-mark {
    width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px;
    background: #eaf0ff; color: var(--blue); font-weight: 800; font-size: 12px;
}
.brand-link small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.top-link { color: var(--blue); font-weight: 600; }
.code-badge, .code-indicator { color: #5f6f67; background: #edf4f0; font-size: 10px; font-weight: 700; letter-spacing: .07em; }
.code-badge { padding: 9px 11px; border: 1px solid #dce8e1; border-radius: 8px; white-space: nowrap; }
.code-indicator { padding: 6px 8px; border-radius: 6px; }
.page-shell { max-width: 1180px; margin: 0 auto; padding: 46px 28px 64px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding: 15px 0 38px; }
.eyebrow { color: #71809b; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; }
h1, h2, h3, p { margin-top: 0; }
.hero h1, .page-heading h1 {
    margin: 12px 0 13px; font-family: Manrope, "Segoe UI", sans-serif;
    font-size: clamp(30px, 4vw, 42px); line-height: 1.16; letter-spacing: -1.7px;
}
.hero p, .page-heading p { max-width: 580px; margin-bottom: 0; color: var(--muted); line-height: 1.65; }
.button {
    min-height: 42px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    border: 1px solid transparent; border-radius: 9px; font-weight: 600; cursor: pointer; transition: .15s ease;
}
.button-primary { background: var(--blue); color: white; }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { background: #f0f4ff; color: var(--blue); border-color: #e0e8ff; }
.button-secondary:hover { background: #e7edff; }
.button-quiet { color: #5d6980; background: white; border-color: var(--line); }
.button-quiet:hover { background: #f8f9fb; }
.button-full { width: 100%; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.section-heading h2, .panel-heading h2, .preview-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.3px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.supplier-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.supplier-card { padding: 21px; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 12px #1e2a3a05; }
.supplier-card-top { display: flex; align-items: center; justify-content: space-between; }
.supplier-avatar {
    width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
    color: #345de0; background: #edf1ff; font-weight: 700; font-size: 16px;
}
.icon-link { color: #8993a5; font-weight: 700; letter-spacing: 2px; }
.supplier-card h3 { margin: 18px 0 5px; font-size: 16px; }
.muted { color: var(--muted); }
.supplier-card .muted { margin-bottom: 20px; font-size: 12px; }
.card-actions { display: grid; gap: 8px; }
.card-actions .button { min-height: 38px; font-size: 12px; }
.empty-state { padding: 58px 20px; text-align: center; background: #fff; border: 1px dashed #d8deea; border-radius: 14px; }
.empty-icon { width: 48px; height: 48px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 15px; background: #edf1ff; color: var(--blue); font-size: 25px; }
.empty-state h2 { margin-bottom: 7px; font-size: 18px; }
.empty-state p { color: var(--muted); margin-bottom: 20px; }
.tip-strip { margin-top: 22px; padding: 13px 15px; display: flex; align-items: center; gap: 11px; border: 1px solid #e4e9f5; background: #f9faff; border-radius: 10px; }
.tip-icon { flex: 0 0 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: #e7edff; color: var(--blue); font-size: 11px; font-weight: 700; }
.tip-strip p { margin: 0; color: #5d6980; font-size: 12px; }
.notice { margin-bottom: 20px; padding: 12px 14px; border: 1px solid; border-radius: 9px; line-height: 1.5; }
.notice.success { color: #21664b; background: #effaf5; border-color: #ccebdc; }
.notice.error { color: #a53d3d; background: #fff4f2; border-color: #f4d6d1; }
.page-heading { margin-bottom: 27px; }
.back-link { display: inline-block; margin-bottom: 26px; color: #66738a; font-size: 12px; }
.back-link:hover { color: var(--blue); }
.page-heading .eyebrow { display: block; }
.page-heading h1 { margin: 8px 0 9px; font-size: 32px; }
.page-heading p { font-size: 13px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .8fr); gap: 20px; align-items: start; }
.editor-main { display: grid; gap: 15px; }
.panel, .preview-panel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.panel-heading { margin-bottom: 19px; }
.panel-heading > div { display: flex; align-items: center; gap: 10px; }
.panel-heading p { margin: 7px 0 0 35px; color: var(--muted); font-size: 12px; }
.step-number { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; background: #edf1ff; color: var(--blue); font-size: 11px; font-weight: 700; }
.form-label { display: grid; gap: 8px; color: #46536a; font-size: 12px; font-weight: 600; }
.text-input { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #dfe4ec; border-radius: 8px; outline: none; color: var(--ink); background: white; }
.text-input:focus { border-color: #8ba5ff; box-shadow: 0 0 0 3px #315fe815; }
.text-input::placeholder { color: #a1aaba; }
.field-list { display: grid; gap: 9px; margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: 22px minmax(100px, 1fr) 120px 72px 32px; align-items: center; gap: 8px; }
.field-handle { color: #a3adbd; text-align: center; font-size: 17px; cursor: grab; }
.field-row input[type="text"], .field-row select { width: 100%; min-width: 0; height: 38px; padding: 0 9px; border: 1px solid #e0e5ed; border-radius: 7px; color: var(--ink); background: white; }
.field-required { display: flex; align-items: center; gap: 5px; color: #69768b; font-size: 10px; white-space: nowrap; }
.remove-field { width: 30px; height: 30px; border: 0; border-radius: 7px; background: #fff1f0; color: #ba5650; font-size: 17px; cursor: pointer; }
.field-note { margin: 10px 0 0; color: #929caf; font-size: 11px; }
.design-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.color-control { grid-template-columns: 1fr 40px; align-items: center; }
.color-control input[type="color"] { width: 38px; height: 34px; padding: 3px; border: 1px solid #dfe4ec; border-radius: 7px; background: white; cursor: pointer; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: #58657b; font-size: 12px; }
.check-row input { accent-color: var(--blue); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; }
.preview-panel { position: sticky; top: 18px; }
.preview-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 17px; }
.preview-heading .eyebrow { display: block; margin-bottom: 5px; }
.preview-heading h2 { font-size: 15px; }
.size-pill { flex: none; padding: 6px 8px; border-radius: 6px; color: #66738a; background: #f1f3f7; font-size: 10px; }
.label-preview {
    width: min(100%, 330px); aspect-ratio: 1; margin: 0 auto; padding: 8%; overflow: hidden;
    display: flex; flex-direction: column; border: 1px solid #e1e5eb; border-radius: 3px;
    background: var(--label-bg, #fff); color: var(--label-color, #172033); font-size: var(--label-font, 14px);
}
.preview-brand { min-height: 1.25em; color: var(--label-accent, #2764e7); font-size: .75em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.preview-title { margin: 7% 0 6%; padding-bottom: 5%; border-bottom: 2px solid var(--label-accent, #2764e7); font-family: Manrope, sans-serif; font-size: 1.25em; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.preview-fields { display: grid; gap: 5%; overflow: hidden; }
.preview-field { display: grid; gap: 2px; min-width: 0; }
.preview-field-name { color: #7d8799; font-size: .72em; }
.preview-value { font-size: 1em; font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
.preview-caption { margin: 12px 0 0; color: #929caf; text-align: center; font-size: 10px; line-height: 1.5; }
.label-entry-layout { grid-template-columns: minmax(0, 1fr) minmax(310px, .85fr); }
.entry-panel { display: grid; gap: 17px; }
.entry-panel .panel-heading { margin-bottom: 0; }
.data-label { gap: 7px; }
.data-input { font-weight: 400; }
.required { color: #dc5951; }
.field-error { color: #b13f3a; font-size: 11px; font-weight: 400; }
.submit-label { margin-top: 2px; }
.print-page { min-height: 100vh; background: #eef1f5; }
.print-toolbar { min-height: 64px; padding: 10px 24px; display: flex; justify-content: center; align-items: center; gap: 12px; background: white; border-bottom: 1px solid var(--line); }
.print-toolbar span { color: var(--muted); font-size: 11px; }
.print-stage { padding: 28px; display: flex; justify-content: center; }
.label-sheet {
    width: min(100%, 330px); height: auto; aspect-ratio: 1; margin: 0 auto; padding: 7%; overflow: hidden; display: flex; flex-direction: column;
    border: 1px solid #d5ded9;
    background: var(--label-bg); color: var(--label-color); font-family: "DM Sans", Arial, sans-serif; font-size: var(--label-font);
}
.print-brand { color: var(--label-accent); font-size: .78em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; overflow-wrap: anywhere; }
.label-sheet h1 { margin: 5mm 0 4mm; padding-bottom: 3mm; border-bottom: 0.6mm solid var(--label-accent); font-family: Manrope, Arial, sans-serif; font-size: 1.35em; line-height: 1.15; overflow-wrap: anywhere; }
.print-fields { display: grid; gap: 4mm; overflow: hidden; }
.print-field { display: grid; gap: 1mm; overflow-wrap: anywhere; }
.print-field-name { color: #737d8e; font-size: .74em; }
.print-value { font-size: 1em; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
@media (max-width: 850px) {
    .editor-layout, .label-entry-layout { grid-template-columns: 1fr; }
    .preview-panel { position: static; }
    .supplier-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .topbar { height: 62px; padding: 0 17px; }
    .page-shell { padding: 28px 16px 44px; }
    .hero { align-items: flex-start; flex-direction: column; padding: 6px 0 28px; }
    .hero .button { width: 100%; }
    .supplier-grid { grid-template-columns: 1fr; }
    .panel, .preview-panel { padding: 17px; }
    .field-row { grid-template-columns: 18px minmax(80px, 1fr) 90px 32px; }
    .field-required { grid-column: 2 / 4; grid-row: 2; }
    .design-grid { grid-template-columns: 1fr; }
    .print-toolbar { flex-wrap: wrap; padding: 10px; }
    .print-toolbar span { flex-basis: 100%; text-align: center; }
}
@page { size: 100mm 100mm; margin: 0; }
@media print {
    html, body, .print-page { width: 100mm; height: 100mm; min-height: 0; margin: 0 !important; padding: 0 !important; background: white; }
    .print-toolbar { display: none !important; }
    .print-stage { display: block; width: 100mm; height: 100mm; margin: 0; padding: 0; }
    .label-sheet { width: 100mm; height: 100mm; aspect-ratio: auto; margin: 0; padding: 7mm; border: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
