/* ============================================================
   Label Print – Stylesheet
   Same design system as PDF-Generator
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #f0f2f5;
    --color-surface: #ffffff;
    --color-surface-alt: #f7f8fa;
    --color-primary: #2563eb;
    --color-primary-light: #dbeafe;
    --color-primary-hover: #1d4ed8;
    --color-primary-10: rgba(37, 99, 235, .08);
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-text-light: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-hover: #cbd5e1;
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-danger: #ef4444;
    --color-danger-bg: #fef2f2;
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.08);
    --shadow-card: 0 1px 4px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.03);
    --transition: 180ms cubic-bezier(.4,0,.2,1);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Scrollbar --- */
.panel-content::-webkit-scrollbar { width: 6px; }
.panel-content::-webkit-scrollbar-track { background: transparent; }
.panel-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.panel-content::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- Panels --- */
.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-main {
    flex: 1;
    background: var(--color-bg);
    min-width: 0;
}

.panel-settings {
    width: 420px;
    min-width: 360px;
    flex-shrink: 0;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface);
}

.panel-header {
    padding: 0 24px;
    height: 56px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--color-surface);
}

.panel-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-logo {
    height: 22px;
    opacity: 0.85;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px 32px;
}

.panel-main > .panel-content {
    padding: 20px 24px 32px;
}

/* ============================================================
   BADGE
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.empty-state-icon {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 8px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

.empty-state p {
    font-size: 13px;
    color: var(--color-text-muted);
    max-width: 320px;
    line-height: 1.5;
}

.empty-state .btn {
    margin-top: 8px;
}

/* Disabled radio/checkbox options */
.disabled-option {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.badge-muted {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    background: var(--color-border);
    color: var(--color-text-muted);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.02em;
}

/* ============================================================
   VK LIST / TABLE
   ============================================================ */
.vk-list-container {
    width: 100%;
}

.vk-header-row {
    display: grid;
    grid-template-columns: 40px 1fr 100px 1fr 80px 80px 70px 140px 40px;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1.5px solid var(--color-border);
    position: sticky;
    top: -20px;
    background: var(--color-bg);
    z-index: 5;
    margin-top: -2px;
}

.vk-row {
    display: grid;
    grid-template-columns: 40px 1fr 100px 1fr 80px 80px 70px 140px 40px;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    transition: all var(--transition);
    animation: cardIn 300ms cubic-bezier(.22, 1, .36, 1) both;
}

.vk-row:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 12px rgba(37, 99, 235, .08);
}

.vk-row.vk-row-unchecked {
    opacity: 0.5;
    background: var(--color-surface-alt);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(6px) scale(.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* VK Row columns */
.vk-col-check {
    display: flex;
    align-items: center;
    justify-content: center;
}

.vk-col-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

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

.vk-col-pin {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.vk-col-pin input {
    width: 100%;
    padding: 5px 7px;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface-alt);
    outline: none;
    transition: all var(--transition);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.vk-col-pin input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-10);
}

.vk-col-ma {
    min-width: 0;
}

.vk-col-ma select,
.vk-col-ma input {
    width: 100%;
    padding: 6px 8px;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface-alt);
    outline: none;
    transition: all var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.vk-col-ma select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2364748b' d='M2 3.5L5 7l3-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    padding-right: 24px;
    cursor: pointer;
}

.vk-col-ma select:focus,
.vk-col-ma input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-10);
}

.vk-col-pers,
.vk-col-mapin {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.vk-col-pers input,
.vk-col-mapin input {
    width: 100%;
    padding: 5px 7px;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface-alt);
    outline: none;
    transition: all var(--transition);
    text-align: center;
}

.vk-col-pers input:focus,
.vk-col-mapin input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-10);
}

.vk-col-devices {
    display: flex;
    align-items: center;
    justify-content: center;
}

.vk-col-devices input[type="number"] {
    width: 56px;
    padding: 5px 4px;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface-alt);
    outline: none;
    text-align: center;
    transition: all var(--transition);
    -moz-appearance: textfield;
}

.vk-col-devices input[type="number"]::-webkit-inner-spin-button,
.vk-col-devices input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.vk-col-devices input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-10);
}

.vk-col-preview {
    display: flex;
    align-items: center;
    justify-content: center;
}

.vk-col-actions {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-vk {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--color-text-light);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-delete-vk:hover {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

/* ============================================================
   LABEL MINI PREVIEW
   ============================================================ */
.label-mini-preview {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 7px;
    line-height: 1.3;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition);
    max-width: 130px;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
    text-align: center;
    width: fit-content;
}

.label-mini-preview:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .12);
    transform: scale(1.05);
}

.label-mini-preview .label-line-name {
    font-weight: 700;
    color: var(--color-text);
}

.label-mini-preview .label-line-pin {
    color: var(--color-text-muted);
}

.label-mini-preview .label-line-ma {
    color: var(--color-text-light);
    font-size: 6px;
}

/* ============================================================
   ADD VK FORM
   ============================================================ */
.add-vk-form {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-col {
    flex: 1;
    min-width: 0;
}

.form-col label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 5px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.form-col input[type="text"] {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    outline: none;
    transition: all var(--transition);
}

.form-col input[type="text"]:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-10);
}

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

.form-hint {
    font-size: 11px;
    color: var(--color-text-light);
    margin-right: auto;
    font-style: italic;
}

/* ============================================================
   SETTINGS CARDS
   ============================================================ */
.settings-card {
    background: linear-gradient(135deg, #f0f4ff 0%, #eef1fb 100%);
    border: 1px solid rgba(37, 99, 235, .08);
    border-radius: var(--radius-xl);
    padding: 14px 14px 12px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(37, 99, 235, .04);
    position: relative;
    overflow: visible;
    animation: cardIn 300ms cubic-bezier(.22, 1, .36, 1) both;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.settings-card:hover {
    box-shadow: 0 4px 16px rgba(37, 99, 235, .06);
    border-color: rgba(37, 99, 235, .14);
}

.settings-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.card-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
    margin-bottom: 14px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group > label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.form-group select:hover {
    border-color: var(--color-border-hover);
}

.form-group select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-10);
}

/* ============================================================
   INFO TOOLTIP
   ============================================================ */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    cursor: help;
    vertical-align: middle;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(37, 99, 235, .1);
    color: var(--color-primary);
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    font-family: 'Inter', serif;
    line-height: 1;
    transition: all var(--transition);
    border: 1px solid rgba(37, 99, 235, .15);
}

.info-tooltip:hover .info-icon,
.info-tooltip:focus .info-icon {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.info-tooltip-text {
    display: none;
    position: fixed;
    background: var(--color-text);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    font-style: normal;
    line-height: 1.45;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: normal;
    width: 240px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    z-index: 10000;
    pointer-events: none;
    animation: tooltipIn 150ms ease;
}

.info-tooltip-text::after {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--color-text);
}

.info-tooltip:hover .info-tooltip-text,
.info-tooltip:focus .info-tooltip-text {
    display: block;
}

@keyframes tooltipIn {
    from { opacity: 0; transform: translateX(4px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   FILE INPUT BOX
   ============================================================ */
.file-input-box {
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    background: linear-gradient(135deg, #fafbfd 0%, #f4f6f9 100%);
    transition: all var(--transition);
    text-align: center;
}

.file-input-box:hover {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, #f0f4ff 0%, #eef1fb 100%);
}

.file-input-box input[type="file"] {
    font-size: 12px;
    font-family: inherit;
    color: var(--color-text-muted);
    cursor: pointer;
    width: 100%;
}

.file-input-box input[type="file"]::file-selector-button {
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 5px 12px;
    margin-right: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

.file-input-box input[type="file"]::file-selector-button:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ============================================================
   UPLOAD STATUS
   ============================================================ */
.upload-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    transition: all 200ms ease;
}

.upload-status.status-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.upload-status.status-error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.upload-status.status-info {
    background: linear-gradient(135deg, #eff6ff 0%, #e0ecff 100%);
    color: var(--color-primary);
}

.upload-status .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(37, 99, 235, .2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   PEEL TAB CARD
   ============================================================ */
.peel-tab-card {
    margin-top: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(37, 99, 235, .04) 0%, rgba(37, 99, 235, .08) 100%);
    border: 1px solid rgba(37, 99, 235, .12);
    border-radius: var(--radius);
    animation: fadeIn 250ms ease;
}

.peel-tab-card .checkbox-label {
    font-weight: 600;
}

.peel-tab-card .control-hint {
    margin-top: 4px;
    margin-left: 28px;
}

/* ============================================================
   CHECKBOX / TOGGLE
   ============================================================ */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    padding: 4px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.control-full {
    margin-bottom: 10px;
}

.control-full:last-child {
    margin-bottom: 0;
}

.control-hint {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: var(--color-text-light);
    font-style: italic;
    line-height: 1.5;
}

/* ============================================================
   RADIO GROUP
   ============================================================ */
.radio-group {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, .6);
    border: 1px solid rgba(37, 99, 235, .08);
    border-radius: 10px;
    padding: 3px;
    overflow: hidden;
}

.radio-group-vertical {
    flex-direction: column;
    gap: 0;
}

.radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 200ms cubic-bezier(.22, 1, .36, 1);
    text-align: center;
    white-space: nowrap;
}

.radio-group-vertical .radio-option {
    justify-content: flex-start;
    text-align: left;
    white-space: normal;
}

.radio-option:hover {
    color: var(--color-text);
    background: rgba(255,255,255,.5);
}

.radio-option:has(input:checked) {
    background: #fff;
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(37, 99, 235, .12), 0 0 0 1px rgba(37, 99, 235, .06);
}

.radio-option input[type="radio"] {
    display: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--color-surface);
    color: var(--color-text);
}

.btn:hover {
    border-color: var(--color-border-hover);
    background: #f8fafc;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-accent {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: transparent;
}

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

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    width: 100%;
    padding: 13px 20px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
    letter-spacing: 0.01em;
    margin-top: 12px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(37, 99, 235, .2);
}

.btn-primary:disabled {
    background: #94a3b8;
    border-color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: .7;
}

.btn-primary-sm {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    padding: 6px 16px;
    font-size: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(37, 99, 235, .2);
}

.btn-primary-sm:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 16px;
    font-weight: 700;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--color-surface-alt);
    color: var(--color-primary);
}

/* ============================================================
   PRINTER STATUS
   ============================================================ */
.printer-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.printer-status-row .printer-status {
    flex: 1;
}

.btn-icon-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-alt);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-icon-sm:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    filter: brightness(1.1);
}

.printer-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    margin-bottom: 12px;
}

/* Network settings panel */
.network-settings {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 14px;
    animation: fadeIn .2s ease;
}

.network-settings .form-group {
    margin-bottom: 10px;
}

.network-settings input[type="text"] {
    font-size: 13px;
    padding: 6px 10px;
}

.form-actions-inline {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.status-unknown {
    background: var(--color-warning);
    box-shadow: 0 0 6px rgba(245, 158, 11, .4);
    animation: pulse 2s infinite;
}

.status-dot.status-found {
    background: var(--color-success);
    box-shadow: 0 0 6px rgba(22, 163, 74, .4);
}

.status-dot.status-error {
    background: var(--color-danger);
    box-shadow: 0 0 6px rgba(239, 68, 68, .4);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

/* ============================================================
   PRINT SUMMARY
   ============================================================ */
.print-summary {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-top: 12px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 3px 0;
}

.summary-line span {
    color: var(--color-text-muted);
}

.summary-line strong {
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   MAPPING FIELDS
   ============================================================ */
.mapping-field {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.mapping-field:last-child {
    margin-bottom: 0;
}

.mapping-field-label {
    flex: 0 0 140px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
}

.mapping-field-label .required {
    color: var(--color-danger);
}

.mapping-field select {
    flex: 1;
    padding: 7px 10px;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2364748b' d='M2 3.5L5 7l3-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    transition: all var(--transition);
}

.mapping-field select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-10);
}

/* ============================================================
   PREVIEW OVERLAY / MODAL
   ============================================================ */
.preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayIn 200ms ease;
}

.preview-overlay.hidden {
    display: none;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.preview-modal {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 0;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .2);
    min-width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow: hidden;
    animation: modalIn 300ms cubic-bezier(.22, 1, .36, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.preview-modal-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.preview-modal-body {
    padding: 24px 20px;
    overflow-y: auto;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* ============================================================
   PRINT PREVIEW BUTTON
   ============================================================ */
.btn-preview {
    width: 100%;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    margin-top: 12px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0ecff 100%);
    color: var(--color-primary);
    border: 1.5px solid rgba(37, 99, 235, .2);
    letter-spacing: 0.01em;
}

.btn-preview:hover:not(:disabled) {
    background: linear-gradient(135deg, #e0ecff 0%, #d0dfff 100%);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .15);
}

.btn-preview:disabled {
    background: var(--color-surface-alt);
    color: #94a3b8;
    border-color: var(--color-border);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================================
   FULL PRINT PREVIEW MODAL
   ============================================================ */
.preview-modal-wide {
    min-width: 600px;
    max-width: 95vw;
    max-height: 90vh;
}

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

.preview-modal-info {
    padding: 10px 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.pv-info-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pv-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #fff;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    white-space: nowrap;
}

/* -- Section per VK -- */
.pv-section {
    width: 100%;
    margin-bottom: 20px;
}

.pv-section:last-child {
    margin-bottom: 0;
}

.pv-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

/* -- Strip preview (horizontal tape) -- */
.pv-strip {
    display: inline-flex;
    align-items: stretch;
    background: #fff;
    border: 2px solid var(--color-text);
    border-radius: 3px;
    overflow-x: auto;
    max-width: 100%;
}

.pv-strip .label-preview-large {
    border: none;
    border-radius: 0;
    flex-shrink: 0;
}

.pv-halfcut {
    width: 1px;
    background: repeating-linear-gradient(
        to bottom,
        var(--color-text-muted) 0px,
        var(--color-text-muted) 3px,
        transparent 3px,
        transparent 6px
    );
    flex-shrink: 0;
    margin: 2px 0;
}

/* -- Individual labels grid -- */
.pv-individual-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pv-individual-label {
    display: inline-flex;
    align-items: stretch;
}

.pv-individual-label .label-preview-large {
    flex-shrink: 0;
}

/* -- Peel tab visualization -- */
.pv-peel-tab {
    width: 12px;
    flex-shrink: 0;
    background: repeating-linear-gradient(
        -45deg,
        #f0f0f0 0px,
        #f0f0f0 2px,
        #e0e0e0 2px,
        #e0e0e0 4px
    );
    border: 2px solid var(--color-text);
    border-left: none;
    border-radius: 0 3px 3px 0;
    position: relative;
}

.pv-peel-tab::after {
    content: '';
    position: absolute;
    left: -1px;
    top: 25%;
    bottom: 25%;
    width: 1px;
    background: repeating-linear-gradient(
        to bottom,
        var(--color-text-muted) 0px,
        var(--color-text-muted) 2px,
        transparent 2px,
        transparent 4px
    );
}

/* ============================================================
   LABEL PREVIEW (large, in modal)
   ============================================================ */
.label-preview-large {
    background: #fff;
    border: 2px solid var(--color-text);
    border-radius: 2px;
    padding: 2px 6px;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    width: fit-content;
    white-space: nowrap;
}

.label-preview-large .label-line-name {
    font-weight: 700;
    color: #000;
    line-height: 1.3;
}

.label-preview-large .label-line-pin {
    color: #333;
    line-height: 1.3;
}

.label-preview-large .label-line-ma {
    color: #555;
    line-height: 1.3;
}

/* Box label preview */
.label-preview-box {
    background: #fff;
    border: 2px solid var(--color-text);
    border-radius: 2px;
    padding: 2px 8px;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: fit-content;
    white-space: nowrap;
}

.label-preview-box .label-line-name {
    font-weight: 800;
    color: #000;
}

/* ============================================================
   PRINT CONTAINER (only visible when printing)
   ============================================================ */
.print-container {
    display: none;
}

@page {
    margin: 0;
    size: auto;
}

@media print {
    body > *:not(.print-container) {
        display: none !important;
    }

    .print-container {
        display: block !important;
    }

    .print-label {
        font-family: 'Inter', sans-serif;
        page-break-inside: avoid;
        padding: 1mm 2mm;
        border: none;
        text-align: center;
        width: fit-content;
        white-space: nowrap;
        color: #000;
    }

    /* Strip: remove visible border & separator lines */
    .print-strip {
        border: none !important;
        margin: 0 !important;
    }

    .print-strip > div:not(.print-label) {
        background: transparent !important;
    }

    /* Individual mode: each label = separate cut */
    .print-individual-wrapper {
        page-break-after: always;
    }
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden {
    display: none !important;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .vk-header-row,
    .vk-row {
        grid-template-columns: 36px 1fr 90px 1fr 70px 70px 60px 40px;
    }

    .vk-col-preview {
        display: none;
    }
}

@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .panel-settings {
        width: 100%;
        min-width: 0;
        border-left: none;
        border-top: 1px solid var(--color-border);
    }

    .panel-settings .panel-content {
        overflow: visible;
        padding: 16px 16px 32px;
    }

    .panel-main > .panel-content {
        overflow: visible;
        padding: 16px;
    }

    .vk-header-row,
    .vk-row {
        grid-template-columns: 32px 1fr 80px 1fr 60px 60px 50px 36px;
        gap: 4px;
        font-size: 11px;
    }

    .vk-col-preview {
        display: none;
    }

    .vk-col-pers,
    .vk-col-mapin {
        display: none;
    }

    .vk-header-row {
        position: static;
    }
}

@media (max-width: 600px) {
    .vk-header-row {
        display: none;
    }

    .vk-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }

    .vk-col-check {
        order: 1;
    }

    .vk-col-name {
        order: 2;
        flex: 1;
        font-size: 14px;
    }

    .vk-col-actions {
        order: 3;
    }

    .vk-col-pin {
        order: 4;
        flex: 0 0 100%;
        font-size: 13px;
    }

    .vk-col-ma {
        order: 5;
        flex: 0 0 100%;
    }

    .vk-col-pers,
    .vk-col-mapin {
        display: block;
        order: 6;
        flex: 0 0 45%;
    }

    .vk-col-devices {
        order: 7;
        flex: 0 0 100%;
        justify-content: flex-start;
    }

    .vk-col-devices::before {
        content: 'Geräte: ';
        font-size: 12px;
        color: var(--color-text-muted);
        font-weight: 600;
    }

    .panel-header {
        padding: 0 16px;
        height: 48px;
        flex-wrap: wrap;
        height: auto;
        padding: 10px 16px;
        gap: 8px;
    }

    .panel-header-left,
    .panel-header-right {
        flex: 0 0 100%;
    }

    .panel-header-right {
        justify-content: flex-start;
    }

    .form-row {
        flex-direction: column;
    }
}
