:root {
    color-scheme: light;
    --bg: #f7f8fa;
    --surface: #ffffff;
    --line: #d9dde3;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b91c1c;
    --warning: #92400e;
    --ok: #166534;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
}

.top-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
}

.top-nav a,
.admin-sidebar a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 10px;
    color: var(--text);
    border-radius: 6px;
}

.top-nav a:hover,
.admin-sidebar a:hover {
    background: #eef2f7;
    text-decoration: none;
}

.page {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 18px 14px 32px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 0;
}

.admin-sidebar {
    min-height: calc(100vh - 60px);
    padding: 14px 10px;
    background: #ffffff;
    border-right: 1px solid var(--line);
}

.admin-sidebar a {
    display: flex;
    margin-bottom: 4px;
}

.admin-page {
    width: 100%;
    max-width: 1240px;
}

.page-title {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

h1,
h2,
h3 {
    margin: 0 0 12px;
    line-height: 1.3;
}

h1 {
    font-size: 1.55rem;
}

h2 {
    font-size: 1.2rem;
}

h3 {
    font-size: 1rem;
}

.panel,
.card,
.login-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.panel {
    padding: 16px;
    margin-bottom: 16px;
}

.login-box {
    width: min(420px, 100%);
    margin: 44px auto;
    padding: 22px;
}

.grid {
    display: grid;
    gap: 14px;
}

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

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

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

.card {
    overflow: hidden;
}

.card-body {
    padding: 12px;
}

.product-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #f3f4f6;
    border-bottom: 1px solid var(--line);
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.9rem;
}

.metric {
    padding: 14px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric strong {
    display: block;
    font-size: 1.8rem;
    line-height: 1.1;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

input,
select,
textarea,
button,
.btn {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 9px 10px;
    color: var(--text);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

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

input[type="checkbox"] {
    width: auto;
    min-height: 0;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 14px;
    color: #ffffff;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover,
button:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.btn.secondary,
button.secondary {
    color: var(--text);
    background: #ffffff;
    border-color: #cbd5e1;
}

.btn.secondary:hover,
button.secondary:hover {
    background: #eef2f7;
}

.btn.danger,
button.danger {
    background: var(--danger);
    border-color: var(--danger);
}

.btn.small-btn {
    min-height: 34px;
    padding: 5px 9px;
    font-size: 0.9rem;
}

.table-wrap {
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 9px 10px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #edf0f4;
}

th {
    background: #f3f5f8;
    font-weight: 700;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 2px 8px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 999px;
    background: #e5e7eb;
}

.status-new {
    color: #075985;
    background: #e0f2fe;
}

.status-checking {
    color: #3730a3;
    background: #e0e7ff;
}

.status-preparing {
    color: #92400e;
    background: #fef3c7;
}

.status-shipped {
    color: #0f766e;
    background: #ccfbf1;
}

.status-done {
    color: #166534;
    background: #dcfce7;
}

.status-hold {
    color: #854d0e;
    background: #fef9c3;
}

.status-cancel {
    color: #991b1b;
    background: #fee2e2;
}

.alert {
    margin-bottom: 14px;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
}

.alert.error {
    border-color: #fecaca;
    background: #fef2f2;
}

.alert.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    gap: 16px;
}

.detail-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #f3f4f6;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.cart-total {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    font-weight: 700;
}

.inline-form {
    display: inline;
}

.nowrap {
    white-space: nowrap;
}

@media (max-width: 820px) {
    .admin-shell {
        display: block;
    }

    .admin-sidebar {
        display: flex;
        min-height: 0;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .admin-sidebar a {
        white-space: nowrap;
    }

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

@media (max-width: 430px) {
    body {
        font-size: 15px;
    }

    .site-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .page {
        padding: 14px 10px 28px;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 12px;
    }
}

