:root {
    --bg: #f6f4ef;
    --panel: #ffffff;
    --ink: #1f2a2e;
    --accent: #0e7a6d;
    --accent-2: #f0a202;
    --muted: #6a7377;
    --error: #c62828;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 10%, #ffffff 0, #f3efe5 38%, transparent 45%),
        linear-gradient(165deg, #f9f6ee 0%, #ece8df 100%);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: #113338;
    color: #fff;
}
.topbar a { color: #fff; text-decoration: none; margin-left: 12px; }
.brand { font-weight: 700; letter-spacing: 0.5px; }

.container { max-width: 1100px; margin: 18px auto; padding: 0 14px 32px; }
.panel {
    background: var(--panel);
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(17, 51, 56, 0.08);
    padding: 16px;
    margin-bottom: 16px;
}

.row-grid {
    display: grid;
    grid-template-columns: 1.2fr 2fr 90px 40px;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.row-grid input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4d7;
    border-radius: 8px;
}
.row-grid button {
    background: #e9eef0;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    height: 40px;
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.print-options {
    margin: 10px 0 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
}
.print-options label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}
.print-options input,
.print-options select {
    padding: 9px;
    border: 1px solid #ccd3d6;
    border-radius: 8px;
}
button {
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
}
button:hover { filter: brightness(1.05); }

.print-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.label {
    border: 1px dashed #b8bcbc;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-height: 160px;
}
.label .name {
    font-size: 13px;
    line-height: 1.2;
    min-height: 32px;
    max-height: 32px;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.label img {
    width: 92%;
    height: 76px;
    object-fit: contain;
    flex: 0 0 auto;
    margin-top: 2px;
}
.label .ean { font-weight: 700; letter-spacing: 0.7px; }

.flash { padding: 10px; border-radius: 8px; margin-bottom: 10px; }
.flash.error { background: #fdeaea; color: var(--error); }
.flash.ok { background: #e6f4ef; color: #1e6e53; }
.flash.info { background: #e6f0ff; color: #2057af; }

.grid-form { display: grid; gap: 10px; max-width: 620px; }
.grid-form label { display: grid; gap: 6px; }
.grid-form input, .grid-form select {
    padding: 10px;
    border: 1px solid #ccd3d6;
    border-radius: 8px;
}
.check-row { display: flex !important; align-items: center; gap: 8px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #eceff1; padding: 8px; text-align: left; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}
.login-card {
    width: min(420px, 92vw);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    padding: 18px;
    display: grid;
    gap: 10px;
}

.suggest-box {
    position: absolute;
    z-index: 10;
    background: #fff;
    border: 1px solid #cad2d8;
    border-radius: 8px;
    width: 100%;
    max-height: 220px;
    overflow: auto;
    margin-top: 2px;
}
.suggest-item {
    padding: 8px;
    cursor: pointer;
}
.suggest-item:hover { background: #eef5f7; }

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

    .print-options {
        grid-template-columns: 1fr 1fr;
    }
}

@media print {
    .topbar, .actions, .panel:first-child p, .flash { display: none !important; }
    body { background: #fff; }
    .panel { box-shadow: none; border: 0; }
}
