:root {
    --bg: #f4f6f8;
    --surface: #fff;
    --text: #111827;
    --muted: #4b5563;
    --line: #e5e7eb;
    --accent: #0f766e;
    --accent-ink: #fff;
    --err-bg: #fef2f2;
    --err: #991b1b;
    --ok-bg: #ecfdf5;
    --ok: #065f46;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}
a { color: var(--accent); }
img { max-width: 100%; }
.th-wrap { width: min(1100px, calc(100% - 32px)); margin: 0 auto; }
.th-top { background: var(--surface); border-bottom: 1px solid var(--line); }
.th-top-row { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.th-brand { font-weight: 700; font-size: 1.25rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.th-nav { display: flex; gap: 14px; align-items: center; }
.th-nav a { text-decoration: none; color: var(--text); font-weight: 600; }
.th-badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; font-size: 12px; }
main.th-wrap { padding: 24px 0 48px; }
.th-hero h1, h1 { margin: 0 0 8px; font-size: 1.7rem; }
.th-hero p, .th-foot { color: var(--muted); }
.th-foot { border-top: 1px solid var(--line); padding: 18px 0 28px; font-size: 14px; }
.th-filters, .th-form, .th-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.th-filters label, .th-form label, .th-qty { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, button {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
}
button, .th-btn {
    background: var(--accent);
    color: var(--accent-ink);
    border: 0;
    border-radius: 8px;
    padding: 9px 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.th-card, .th-variant, .th-product {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.th-card-img { display: block; background: #f9fafb; aspect-ratio: 1; }
.th-card-img img, .th-product img { width: 100%; height: 100%; object-fit: contain; }
.th-card-body, .th-variant { padding: 12px; display: grid; gap: 6px; }
.th-brand-name, .th-code, .th-meta, .th-back { color: var(--muted); font-size: 13px; }
.th-price { font-weight: 700; }
.th-stock.in { color: #047857; }
.th-stock.out { color: #9a3412; }
.th-product { display: grid; grid-template-columns: minmax(180px, 320px) 1fr; gap: 20px; padding: 16px; margin-bottom: 20px; }
.th-product img { background: #f9fafb; border-radius: 8px; }
.th-variants { display: grid; gap: 10px; margin-bottom: 18px; }
.th-variant { grid-template-columns: 1fr auto auto; align-items: center; }
.th-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.th-table th, .th-table td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
.th-table thead th { background: #f3f4f6; color: #111827; }
.num, .th-table .num { text-align: right; }
.th-total { font-size: 1.15rem; }
.th-flash { padding: 10px 12px; border-radius: 8px; margin: 12px 0; }
.th-flash.err { background: var(--err-bg); color: var(--err); }
.th-flash.ok { background: var(--ok-bg); color: var(--ok); }
.th-empty, .th-blocked { padding: 24px 0; }
.th-qty-inp { width: 72px; }
.th-form { display: grid; max-width: 420px; }
.th-pay-hint { color: var(--muted); margin: 0; }
@media (max-width: 720px) {
    .th-product, .th-variant { grid-template-columns: 1fr; }
}
