:root {
    --bg: #f5f3ef;
    --panel: #ffffff;
    --border: #e7e2d8;
    --border-soft: #f0ece3;
    --text: #241f1a;
    --muted: #8a8175;
    --muted-soft: #b0a898;
    --accent: #7a2e2e;
    --accent-hover: #611f1f;
    --accent-soft: #f7ebe9;
    --ok-bg: #e9f3e4;
    --ok-text: #2f5c2a;
    --warn-bg: #fbf0d9;
    --warn-text: #8a6512;
    --error-bg: #f8e6e2;
    --error-text: #93301f;
    --shadow-sm: 0 1px 2px rgba(36, 31, 26, 0.04), 0 1px 1px rgba(36, 31, 26, 0.03);
    --shadow-md: 0 4px 12px rgba(36, 31, 26, 0.06), 0 1px 3px rgba(36, 31, 26, 0.05);
    --radius: 10px;
    --radius-sm: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Top bar --- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.topbar .brand {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.01em;
    color: var(--accent);
}

.logout-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}

/* --- Tab bar --- */

.tabbar {
    display: flex;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tabbar a {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    border-bottom: 3px solid transparent;
}

.tabbar a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* --- Content --- */

.content {
    padding: 20px 16px 60px;
    max-width: 480px;
    margin: 0 auto;
}

h1 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
h2 {
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 24px 0 10px;
}
p { margin: 0 0 12px; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* --- Flash messages --- */

.flash {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}
.flash-ok { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--error-bg); color: var(--error-text); }

/* --- Tables --- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border-soft);
}

tr:last-child td { border-bottom: none; }

/* --- Cards --- */

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

/* --- Forms --- */

form .field {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

input, select, textarea {
    padding: 10px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    background: white;
    color: var(--text);
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --- Buttons --- */

button, .button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
    text-align: center;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

button:active, .button:active { transform: translateY(1px); }

.button-secondary {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
    margin-top: 8px;
}

.empty {
    color: var(--muted);
    font-style: italic;
    padding: 16px;
    text-align: center;
    background: var(--panel);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.qr-image {
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 20px auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.catalog-price {
    font-weight: 700;
    color: var(--accent);
}
