:root {
    --bg: #eef3ef;
    --surface: #fcfdfb;
    --surface-alt: #e9f0ea;
    --text: #173026;
    --muted: #667c72;
    --primary: #1f6b57;
    --primary-dark: #134537;
    --accent: #d58a3a;
    --border: #cddbd1;
    --danger: #b54848;
    --success: #24815c;
    --shadow: 0 18px 40px rgba(24, 60, 46, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(213, 138, 58, 0.16), transparent 24%),
        radial-gradient(circle at left top, rgba(31, 107, 87, 0.08), transparent 28%),
        linear-gradient(180deg, #f9fcfa 0%, var(--bg) 100%);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    background: rgba(249, 252, 250, 0.88);
    border-bottom: 1px solid rgba(205, 219, 209, 0.8);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 18px 0;
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.nav {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--muted);
    font-weight: 600;
}

.page-content {
    padding: 28px 0 56px;
}

.hero,
.card,
.stats-grid .stat-card,
.table-card,
.login-card {
    background: var(--surface);
    border: 1px solid rgba(205, 219, 209, 0.85);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.hero {
    padding: 28px;
    margin-bottom: 24px;
}

.hero h1,
.section-header h2,
.card h2,
.login-card h1 {
    margin-top: 0;
}

.hero p,
.section-header p,
.muted {
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary,
button,
.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: rgba(233, 240, 234, 0.9);
    color: var(--primary-dark);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin: 24px 0 16px;
}

.product-grid,
.stats-grid,
.two-column {
    display: grid;
    gap: 20px;
}

.product-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 24px;
}

.two-column {
    grid-template-columns: 1.05fr 1fr;
    align-items: start;
}

.card,
.table-card,
.login-card,
.stat-card {
    padding: 22px;
}

.table-card {
    overflow-x: auto;
}

.search-card {
    margin-bottom: 24px;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.search-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 1.8rem;
}

.product-card img,
.thumb {
    width: 100%;
    height: 210px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid rgba(216, 201, 176, 0.8);
    background: var(--surface-alt);
}

.product-card h3 {
    margin-bottom: 8px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(31, 107, 87, 0.11);
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 700;
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-weight: 600;
}

.alert-success {
    background: rgba(36, 129, 92, 0.12);
    color: var(--success);
}

.alert-error {
    background: rgba(181, 72, 72, 0.12);
    color: var(--danger);
}

form {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(216, 201, 176, 0.7);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.95rem;
}

.inline-form {
    display: inline;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.login-wrapper {
    min-height: calc(100vh - 160px);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(480px, 100%);
}

.forgot-toggle {
    margin-top: 24px;
    width: 100%;
}

.forgot-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(216, 201, 176, 0.7);
}

.empty-state {
    padding: 24px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: rgba(233, 240, 234, 0.5);
}

.admin-tabs-card {
    padding-top: 16px;
}

.tabs-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(205, 219, 209, 0.8);
}

.tab-button {
    background: var(--surface-alt);
    color: var(--primary-dark);
}

.tab-button.is-active {
    background: var(--primary);
    color: #fff;
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

.tab-panel-header {
    margin-bottom: 18px;
}

.tab-panel-header h3 {
    margin: 0 0 6px;
}

.tab-panel-header p {
    margin: 0;
    color: var(--muted);
}

.stock-edit-card {
    margin-bottom: 24px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

.admin-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.admin-product-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(205, 219, 209, 0.8);
    border-radius: 18px;
    background: rgba(252, 253, 251, 0.98);
}

.admin-product-card__top {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
}

.admin-product-card__top h4 {
    margin: 0;
    font-size: 1.05rem;
}

.admin-product-card__code,
.admin-product-card__description {
    margin: 0;
}

.admin-product-card__code {
    color: var(--accent);
    font-weight: 700;
}

.admin-product-card__description {
    color: var(--muted);
    line-height: 1.5;
}

.admin-product-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.admin-action-form {
    display: inline-flex !important;
    gap: 0 !important;
    margin: 0;
}

.admin-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 110px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1;
}

.admin-action-btn--edit {
    background: transparent;
    border: 1px solid rgba(205, 219, 209, 0.95);
    color: var(--primary-dark);
}

.admin-action-btn--edit:hover {
    background: var(--surface-alt);
}

.admin-action-btn--toggle {
    background: #375534;
    color: #fff;
}

.admin-action-btn--delete {
    background: rgba(181, 72, 72, 0.1);
    color: var(--danger);
    border: 1px solid rgba(181, 72, 72, 0.18);
}

.admin-action-btn--delete:hover {
    background: rgba(181, 72, 72, 0.16);
}

@media (max-width: 800px) {
    .header-inner,
    .section-header {
        align-items: start;
        flex-direction: column;
    }

    .two-column {
        grid-template-columns: 1fr;
    }

    .tabs-nav {
        flex-direction: column;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .nav {
        width: 100%;
    }

    .nav a {
        display: inline-flex;
        padding: 10px 0;
    }

    .product-meta {
        flex-direction: column;
        align-items: start;
    }

    .table-card {
        padding: 18px;
    }

    table {
        min-width: 680px;
    }
}

@media (max-width: 560px) {
    .container {
        width: min(100% - 20px, 1120px);
    }

    .page-content {
        padding: 20px 0 40px;
    }

    .hero,
    .card,
    .table-card,
    .login-card,
    .stat-card {
        border-radius: 16px;
        padding: 18px;
    }

    .brand {
        font-size: 1.05rem;
    }

    .nav {
        gap: 10px;
    }

    .nav a {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid rgba(216, 201, 176, 0.8);
        border-radius: 12px;
        background: rgba(255, 253, 248, 0.85);
    }

    .actions,
    .search-actions,
    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn,
    button {
        width: 100%;
    }

    .admin-product-card__actions,
    .admin-action-form {
        display: grid;
    }

    .admin-action-btn {
        width: 100%;
    }

    .product-card img,
    .thumb {
        height: 180px;
    }

    .stats-grid,
    .product-grid {
        gap: 16px;
    }

    .stat-card strong {
        font-size: 1.5rem;
    }

    input,
    textarea,
    select {
        padding: 11px 12px;
    }
}
