:root {
    --black: #111;
    --white: #fff;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-400: #999;
    --accent: #111;
    --danger: #c0392b;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--gray-100);
    color: var(--black);
    line-height: 1.5;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.site-header {
    background: var(--black);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.brand {
    color: var(--white);
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
}
.brand span { font-weight: 400; opacity: .7; }
.main-nav a {
    color: var(--white);
    text-decoration: none;
    margin-left: 16px;
    font-size: 14px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 6px;
}
.main-nav a:first-child { margin-left: 0; }

main.container { padding-top: 20px; padding-bottom: 40px; }

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 18px; }
.subtitle { color: var(--gray-400); margin-bottom: 20px; font-size: 14px; }

/* Category grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.category-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    text-decoration: none;
    color: var(--black);
    border: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 14px;
}
.category-card:active { background: var(--gray-100); }
.category-card .count {
    display: block;
    font-weight: 400;
    color: var(--gray-400);
    font-size: 12px;
    margin-top: 4px;
}

/* Card / form */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}
.form-group input[type=text],
.form-group input[type=number] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 15px;
    background: var(--gray-100);
}
.form-group input:focus { outline: 2px solid var(--black); background: var(--white); }

.price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 480px) {
    .price-grid { grid-template-columns: 1fr; }
}

.btn {
    display: inline-block;
    background: var(--black);
    color: var(--white);
    border: none;
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn.btn-secondary {
    background: var(--white);
    color: var(--black);
    border: 1px solid var(--gray-200);
}
.btn.btn-danger { background: var(--danger); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6cb; }
.alert-success { background: #eafaf0; color: #1e8449; border: 1px solid #b7ebc6; }

/* Table - mobile friendly via horizontal scroll */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}
table.compare {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 620px;
}
table.compare th, table.compare td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
table.compare th {
    background: var(--gray-100);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #555;
}
table.compare tr:last-child td { border-bottom: none; }
table.compare td.product-name { white-space: normal; font-weight: 600; min-width: 140px; }
table.compare td.best { color: #1e8449; font-weight: 700; }
.actions-col { white-space: nowrap; }
.actions-col a { font-size: 13px; margin-right: 10px; text-decoration: none; color: var(--black); }
.actions-col a.del { color: var(--danger); }

.top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--gray-400);
}
