*, *::before, *::after { box-sizing: border-box; }

:root {
    --sidebar-bg: #0f172a;
    --sidebar-text: #d1d5db;
    --sidebar-active: #2563eb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border: #dbe3ec;
    --text: #0f172a;
    --text-muted: #5f6c7b;
    --accent: #1d4ed8;
    --accent-hover: #1e40af;
    --shadow: 0 12px 30px rgba(2, 23, 56, 0.08);
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #eef3f8;
    color: var(--text);
    margin: 0;
    min-height: 100vh;
}

header {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #111c33 0%, #0f172a 100%);
    border-right: 1px solid #18233f;
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 100;
}

.logo-link {
    display: block;
    margin: 0;
}

.site-logo {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
}

header nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

header nav a {
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

header nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

header nav a.active {
    background: rgba(37, 99, 235, 0.24);
    border-color: rgba(96, 165, 250, 0.45);
    color: #dbeafe;
}

.container {
    margin-left: 260px;
    max-width: 1200px;
    padding: 32px;
}

.page-header {
    margin-bottom: 22px;
}

.page-header h2 {
    margin: 0 0 6px;
    font-size: 36px;
    font-weight: 900;
    letter-spacing: -0.4px;
}

.page-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card h3 {
    margin: 0 0 14px;
    font-size: 21px;
    font-weight: 700;
    padding-bottom: 10px;
    border-bottom: 1px solid #e7edf5;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 7px;
    color: #1f2937;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #0f172a;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[type="color"] {
    width: 100%;
    height: 40px;
    padding: 2px 4px;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.42;
}

#psCommand {
    min-height: 62px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    background: var(--surface-muted);
}

.form-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 8px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 12px;
}

.checkbox-group {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 14px;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 14px 0 18px;
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    text-align: center;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #d4dde7;
}

.btn-secondary:hover { background: #e7edf4; }

.output {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.empty-state {
    color: #6b7280;
    font-size: 14px;
    padding: 22px 0;
}

.item-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.item {
    border: 1px solid #d7e0eb;
    border-radius: 10px;
    padding: 14px;
    background: #fcfdff;
}

.item-label {
    font-size: 13px;
    color: #475569;
    margin-bottom: 8px;
    font-weight: 700;
}

.barcode-container,
.qr-canvas-wrapper {
    border: 1px solid #dde5ef;
    border-radius: 10px;
    background: #fff;
    padding: 14px !important;
}

.download-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e3ebf4;
}

.alert {
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
}

@media (max-width: 1100px) {
    .options-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 860px) {
    header {
        position: static;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid #23304f;
    }

    header nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .container {
        margin-left: 0;
        padding: 18px;
    }

    .page-header h2 {
        font-size: 28px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .btn-group .btn {
        width: 100%;
    }
}
