/* Yuval' Studios — система друку бирок */

:root {
    --ink: #171310;
    --ink-2: #4a423b;
    --ink-3: #857a70;
    --line: #e2dcd4;
    --line-2: #efeae3;
    --bg: #f7f4f0;
    --panel: #ffffff;
    --gold: #a8834a;
    --gold-soft: #f3ead9;
    --green: #2f7d54;
    --green-soft: #e6f3ec;
    --red: #b3372f;
    --red-soft: #fbeae8;
    --amber: #9a6b12;
    --amber-soft: #fdf1da;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(23, 19, 16, .05), 0 8px 24px -12px rgba(23, 19, 16, .18);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Атрибут hidden має перемагати будь-який display із наших стилів,
   інакше приховані рядки (наприклад незаповнені поля бирки) лишаються видимими. */
[hidden] { display: none !important; }

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; }

/* ---------- Каркас ---------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: var(--ink);
    color: #f4efe8;
    position: sticky;
    top: 0;
    z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: grid; place-items: center;
    width: 32px; height: 32px;
    border-radius: 9px;
    background: linear-gradient(145deg, #cfa768, var(--gold));
    color: #201a13; font-weight: 800; font-size: 15px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { display: flex; align-items: baseline; gap: 7px; }
.brand-text strong { font-size: .9rem; }
/* Приписка поруч із назвою — звичайним накресленням, щоб не сперечалася з нею. */
.brand-suffix { font-size: .78rem; font-weight: 400; color: #a89c8d; white-space: nowrap; }
.brand-text small { font-size: .72rem; color: #a89c8d; }

.topnav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
/* Усі пункти меню виглядають однаково — з підкладкою; активний просто світліший. */
.topnav a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .07);
    color: #d9d0c4;
    font-size: .875rem;
    font-weight: 500;
}
.topnav a:hover { background: rgba(255, 255, 255, .14); text-decoration: none; color: #fff; }
.topnav a.active { background: rgba(255, 255, 255, .2); color: #fff; }
.topnav a.accent { background: var(--gold); color: #1d1710; }
.topnav a.accent:hover { background: #bd9457; }

/* ---------- Меню користувача ---------- */

.usermenu { position: relative; }
.usermenu > summary {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: #d9d0c4; font-size: .82rem;
    cursor: pointer; list-style: none; user-select: none;
    max-width: 200px; white-space: nowrap;
}
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.usermenu[open] > summary { background: rgba(255, 255, 255, .12); color: #fff; }
.usermenu > summary svg { flex: none; opacity: .8; }
.usermenu-caret { transition: transform .15s ease; }
.usermenu[open] .usermenu-caret { transform: rotate(180deg); }
.username-name { overflow: hidden; text-overflow: ellipsis; }

.usermenu-list {
    position: absolute; right: 0; top: calc(100% + 6px);
    min-width: 232px; z-index: 50;
    display: flex; flex-direction: column;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: 0 14px 34px -12px rgba(23, 19, 16, .45);
}
.usermenu-list a,
.usermenu-list button {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    padding: 9px 11px;
    border: 0; border-radius: 6px;
    background: transparent;
    font: inherit; font-size: .875rem; text-align: left;
    color: var(--ink); cursor: pointer;
}
.usermenu-list a:hover,
.usermenu-list button:hover { background: var(--line-2); text-decoration: none; }
.usermenu-list a.active { color: var(--gold); font-weight: 600; }
.usermenu-list form { margin-top: 4px; padding-top: 5px; border-top: 1px solid var(--line-2); }
.usermenu-list button svg { margin-left: auto; opacity: .6; }

/* Кнопка лише з іконкою: квадратна, без тексту. */
.btn-icon { padding: 6px; line-height: 0; }
.btn-icon svg { display: block; }

.main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
.main-bare { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

/* ---------- Компоненти ---------- */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin: -20px -20px 16px; padding: 14px 20px;
    border-bottom: 1px solid var(--line-2);
}
.card-head h2 { margin-right: auto; }

.page-head {
    display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-head > div:first-child { margin-right: auto; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); font-size: .875rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--ink); color: #fff;
    font: inherit; font-size: .875rem; font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: #2c2520; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: #1d1710; }
.btn-primary:hover { background: #bd9457; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { background: #fff; border-color: var(--ink-3); }
.btn-ghost { background: transparent; color: inherit; border-color: rgba(255, 255, 255, .22); }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.btn-danger { background: transparent; color: var(--red); border-color: #e8c6c2; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 11px; font-size: .8rem; }
.btn-lg { padding: 12px 22px; font-size: .95rem; }
.btn-block { width: 100%; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Діалог підтвердження та повідомлення ---------- */

.btn-solid-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-solid-danger:hover { background: #9c2f28; }

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(23, 19, 16, .45);
    animation: modal-fade .12s ease-out;
}

.modal {
    width: 100%;
    max-width: 420px;
    padding: 22px;
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: 0 18px 50px -12px rgba(23, 19, 16, .5);
    animation: modal-rise .14s ease-out;
}

.modal-text {
    margin: 0 0 18px;
    font-size: .95rem;
    line-height: 1.45;
    white-space: pre-line;
}

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }

/* Довгі підписи не тиснуться в ряд — кнопки стають стовпчиком. */
.modal-actions-stack { flex-direction: column; align-items: stretch; }
.modal-actions-stack .btn { flex: none; }

.modal-head { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 6px; }
.modal-title { margin: 0 0 4px; font-weight: 650; font-size: 1.02rem; }
.modal-note { margin: 0; font-size: .9rem; line-height: 1.45; color: var(--ink-2); }
.modal-overlay[hidden] { display: none; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#toast-area {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 110;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(420px, calc(100vw - 32px));
}

.toast {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    line-height: 1.4;
    color: #fff;
    background: var(--ink);
    box-shadow: 0 10px 30px -8px rgba(23, 19, 16, .5);
    animation: toast-in .16s ease-out;
}
.toast-error { background: var(--red); }
.toast-success { background: var(--green); }
.toast.is-out { opacity: 0; transition: opacity .4s; }

@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Кнопка з підказкою ---------- */

.btn-hint-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.btn-hint-row .btn { flex: 1; }

.hint { position: relative; display: inline-flex; flex: none; outline: none; }
.hint-mark {
    display: grid; place-items: center;
    width: 21px; height: 21px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: #fff;
    color: var(--ink-3);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 13px; font-style: italic; font-weight: 700;
    line-height: 1;
    cursor: help;
    user-select: none;
    transition: color .12s, border-color .12s, background .12s;
}
.hint:hover .hint-mark,
.hint:focus .hint-mark,
.hint:focus-within .hint-mark {
    color: var(--gold);
    border-color: var(--gold);
    background: var(--gold-soft);
}

.hint-bubble {
    position: absolute;
    bottom: calc(100% + 9px);
    right: -3px;
    width: max-content;
    max-width: 250px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: #f2ece4;
    font-size: .78rem;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: 0 6px 20px -6px rgba(23, 19, 16, .45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity .14s, transform .14s, visibility .14s;
    pointer-events: none;
    z-index: 50;
}
.hint-bubble strong { color: #fff; font-weight: 620; }
.hint-bubble::after {
    content: "";
    position: absolute;
    top: 100%; right: 9px;
    border: 5px solid transparent;
    border-top-color: var(--ink);
}
.hint:hover .hint-bubble,
.hint:focus .hint-bubble,
.hint:focus-within .hint-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

label, .label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 5px;
}

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=search], input[type=file], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    font: inherit;
    font-size: 15px; /* 16px і менше на iOS уникає автозуму — 15px безпечно з appearance */
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--gold);
    outline-offset: -1px;
    border-color: var(--gold);
}
input:disabled, select:disabled {
    background: #f6f3ef;
    color: var(--ink-3);
    cursor: not-allowed;
}
textarea { resize: vertical; min-height: 68px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23857a70' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.field { margin-bottom: 14px; }
.field-hint { font-size: .75rem; color: var(--ink-3); margin-top: 4px; }
.field-error { font-size: .78rem; color: var(--red); margin-top: 4px; }

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

.check { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--gold); flex: none; }
.check label, .check span {
    margin: 0; text-transform: none; letter-spacing: 0;
    font-size: .875rem; font-weight: 450; color: var(--ink);
}

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: .875rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--green-soft); color: #1f5c3c; border-color: #c4e2d1; }
.alert-error { background: var(--red-soft); color: #8c2b24; border-color: #edc9c5; }
.alert-warning { background: var(--amber-soft); color: #7a5410; border-color: #f0dcb4; }
.alert-info { background: var(--gold-soft); color: #6e5528; border-color: #e6d5b8; }

/* Кількість бирок: вузьке поле вводу і швидкі кнопки поруч. */
.count-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
/* Селектор із класом усередині рядка — інакше базове правило
   input[type="number"] { width: 100% } виявляється специфічнішим. */
.count-row input.count-input { width: 92px; flex: none; text-align: center; font-weight: 600; }
.count-quick { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.count-quick .btn { padding: 6px 9px; min-width: 42px; }
/* Зворотне посилання над заголовком сторінки. */
.back-link {
    display: inline-block; margin-bottom: 6px;
    font-size: .82rem; font-weight: 500; color: var(--ink-3);
}
.back-link:hover { color: var(--gold); text-decoration: none; }

/* ---------- Калькулятор сітки ---------- */

.calc {
    margin: 0 0 20px;
    padding: 14px 16px 16px;
    background: #faf7f2;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
}
.calc-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}
.calc-title {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-3); font-weight: 650;
}
.calc-head .btn { background: #fff; }
.calc-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.calc-size { display: flex; align-items: center; gap: 8px; }
.calc-size span { color: var(--ink-3); }
/* Кнопки калькулятора стоять просторніше за типовий ряд: вони роблять
   різні речі, і їх не варто плутати одну з одною. */
.calc .btn-row { gap: 16px; }
.calc .btn-row .calc-result { margin-left: 8px; }

.calc-result {
    margin: 0; align-self: center; flex: 1; min-width: 220px;
    font-size: .82rem; color: var(--ink-3); line-height: 1.4;
}
.calc-result.is-error { color: var(--red); }

@media (max-width: 720px) {
    .calc-fields { grid-template-columns: minmax(0, 1fr); }
}

/* Підказка замість схованих кнопок, поки зміни не збережені. */
.needs-save-hint {
    margin: 0; align-self: center;
    font-size: .82rem; color: var(--ink-3); max-width: 430px; line-height: 1.4;
}
.needs-save-hint[hidden] { display: none; }

/* Пресет, що збігається з поточним значенням поля. */
.btn-preset-on { border-color: var(--gold); color: var(--gold); font-weight: 650; }

.btn-ghost-quiet {
    background: transparent; border-color: transparent; color: var(--ink-3);
}
.btn-ghost-quiet:hover { background: var(--line-2); color: var(--ink); }

/* Дата оновлення товарної бази над формою нової партії:
   ледь помітна підкладка, щоб рядок не губився, але й не сперечався з формою. */
.base-freshness {
    /* Саме блок, а не flex: інакше крапка й дужки стають окремими
       flex-елементами й розлітаються з інтервалами. */
    margin: 0 0 14px;
    padding: 8px 12px;
    background: #faf7f2;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
}
.base-freshness a { color: var(--gold); font-weight: 650; margin-left: 4px; }

/* Попередження зі знаком уваги та дією праворуч. */
.alert-attention { display: flex; align-items: center; gap: 11px; }
.alert-attention .alert-icon { flex: none; }
.alert-attention .alert-body { flex: 1; min-width: 0; }
.alert-attention .btn { flex: none; background: #fff; border-color: currentColor; color: inherit; }
.alert-attention .btn:hover { background: #fff; border-color: currentColor; }

@media (max-width: 720px) {
    .alert-attention { align-items: flex-start; flex-wrap: wrap; }
    .alert-attention .btn { margin-left: 33px; }
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 600;
    background: var(--line-2);
    color: var(--ink-2);
    white-space: nowrap;
}
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-err { background: var(--red-soft); color: var(--red); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--ink-3); font-weight: 650; white-space: nowrap;
}
tbody tr:hover { background: #fbf9f6; }
tr.row-error { background: var(--red-soft); }
tr.row-error:hover { background: #f7ded9; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .82em; }

.muted { color: var(--ink-3); }
.small { font-size: .8rem; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 3px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px;
}
.stat b { display: block; font-size: 1.6rem; font-weight: 650; letter-spacing: -.02em; }
.stat span { font-size: .78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }

/* ---------- Вхід ---------- */

.login-card { width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo img {
    display: block;
    width: 150px;
    height: auto;
    margin: 0 auto 10px;
}
.login-logo p { margin: 0; color: var(--ink-3); font-size: .85rem; }

/* ---------- Редактор бирки ---------- */

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }

.stepper {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 16px; margin-bottom: 14px;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    position: sticky; top: 60px; z-index: 30;
}
.stepper-count { font-weight: 650; font-size: .95rem; }
.stepper-count span { color: var(--ink-3); font-weight: 450; }
.stepper .btn-row { margin-left: auto; }

.dots { display: flex; gap: 4px; flex-wrap: wrap; max-width: 100%; }
.dot {
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: .72rem; font-weight: 600;
    color: var(--ink-3);
}
.dot:hover { border-color: var(--gold); text-decoration: none; color: var(--gold); }
.dot.filled { background: var(--green-soft); border-color: #c4e2d1; color: var(--green); }
.dot.current { background: var(--ink); border-color: var(--ink); color: #fff; }

.autosave {
    font-size: .78rem; color: var(--ink-3);
    display: inline-flex; align-items: center; gap: 6px;
}
.autosave::before {
    content: ""; width: 7px; height: 7px; border-radius: 99px;
    background: var(--line); flex: none;
}
.autosave.saving::before { background: var(--amber); }
.autosave.saved::before { background: var(--green); }
.autosave.failed::before { background: var(--red); }
.autosave.failed { color: var(--red); }

.resolved {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px; padding: 14px;
    background: var(--gold-soft);
    border: 1px solid #e6d5b8;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.resolved.is-error { background: var(--red-soft); border-color: #edc9c5; display: block; }
.resolved.is-empty { background: var(--line-2); border-color: var(--line); display: block; color: var(--ink-3); font-size: .875rem; }
.resolved dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin-bottom: 2px; }
.resolved dd { margin: 0; font-weight: 620; font-size: .95rem; }

.preview-tag {
    background: #fff; border: 1px solid var(--line);
    border-radius: 6px; padding: 10px 11px;
    font-size: 10px; line-height: 1.35;
    width: 100%; max-width: 210px; min-height: 250px;
    margin: 0 auto;
    box-shadow: inset 0 0 0 1px #fff, 0 2px 10px -6px rgba(0, 0, 0, .3);
}
.preview-tag .pt-brand { text-align: center; font-weight: 700; letter-spacing: .06em; font-size: 9px; }
.preview-tag .pt-name { font-weight: 700; font-size: 12px; margin: 7px 0 5px; }
.preview-tag .pt-row { display: flex; justify-content: space-between; gap: 6px; }
.preview-tag .pt-row span:first-child { color: var(--ink-3); }
.preview-tag .pt-note { display: block; }
.preview-tag .pt-price { font-weight: 700; font-size: 12px; margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line-2); }
.preview-tag .pt-date { color: var(--ink-3); margin-top: 4px; font-size: 9px; }
/* Підпис поля — звичайним накресленням і сірим, значення — чорним:
   так само, як вони друкуються на бирці. */
.preview-tag .pt-price span:first-child { font-weight: 500; }
.preview-tag .pt-date span:last-child { color: var(--ink); }

/* ---------- Схема листа ---------- */

.sheet-scroll { overflow-x: auto; padding: 4px; }
.sheet-plan {
    position: relative;
    background:
        linear-gradient(#fff, #fff) padding-box,
        repeating-linear-gradient(45deg, #f4f1ec 0 6px, #fff 6px 12px) border-box;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    margin: 0 auto;
}
.sheet-cell {
    position: absolute;
    border: 1px dashed var(--line);
    border-radius: 3px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-3);
    background: #fff;
    cursor: pointer;
    user-select: none;
    padding: 2px;
    text-align: center;
    line-height: 1.15;
    overflow: hidden;
}
.sheet-cell:hover { border-color: var(--gold); }
.sheet-cell.is-used { background: repeating-linear-gradient(45deg, #f0ebe4 0 4px, #e4ddd3 4px 8px); color: var(--ink-3); border-style: solid; }
.sheet-cell.is-filled { background: var(--gold-soft); border-color: var(--gold); border-style: solid; color: #6e5528; }
.sheet-cell.is-start { outline: 2px solid var(--ink); outline-offset: 1px; }
.sheet-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-3); margin-top: 12px; }
.sheet-legend i { display: inline-block; width: 13px; height: 13px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--line); }
.sheet-legend .l-free { background: #fff; }
.sheet-legend .l-used { background: repeating-linear-gradient(45deg, #f0ebe4 0 4px, #e4ddd3 4px 8px); }
.sheet-legend .l-fill { background: var(--gold-soft); border-color: var(--gold); }

/* ---------- Довідкові блоки ---------- */

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .875rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

details.help { margin-top: 12px; font-size: .85rem; }
details.help summary { cursor: pointer; color: var(--gold); font-weight: 550; }
details.help p, details.help ul { color: var(--ink-2); }

.section-title {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-3); font-weight: 650;
    margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line-2);
}
.section-title:first-child { margin-top: 0; }

/* ---------- Адаптив ---------- */

@media (max-width: 960px) {
    /* На вузькому екрані працівник спершу заповнює поля, а вже під ними
       бачить попередній вигляд бирки. */
    .editor { grid-template-columns: minmax(0, 1fr); }
    .preview-tag { max-width: 240px; min-height: 0; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    body { font-size: 15px; }
    .main { padding: 16px 14px 72px; }
    .topbar { padding: 9px 14px; gap: 10px; flex-wrap: wrap; }
    .brand-text small { display: none; }
    /* На вузькому екрані лишається тільки значок людини зі стрілкою. */
    .username-name { display: none; }
    .topnav { width: 100%; order: 3; margin-left: 0; }
    .topnav a { flex: 1; text-align: center; }
    .card { padding: 16px; border-radius: 10px; }
    .card-head { margin: -16px -16px 14px; padding: 12px 16px; }
    .table-wrap { margin: 0 -16px; padding: 0 16px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .stepper { top: 0; border-radius: 10px; padding: 10px 12px; }
    .stepper .btn-row { width: 100%; margin-left: 0; }
    .stepper .btn-row .btn { flex: 1; }
    h1 { font-size: 1.25rem; }
}

@media print {
    .topbar, .stepper, .btn, .sheet-legend, details.help { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: none; }
}
