:root {
    --primary: #ff3f6c;
    --primary-dark: #e0264d;
    --bg: #f5f5f7;
    --border: #e2e2e6;
    --text: #282c3f;
    --muted: #7e818c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

.topbar h1 { font-size: 18px; margin: 0; }
.version { font-size: 11px; color: var(--muted); font-weight: normal; }
.topbar nav a { color: var(--primary); text-decoration: none; font-weight: 600; font-size: 14px; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }
.container-narrow { max-width: 640px; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-warn { background: #fff4e5; border: 1px solid #ffd591; color: #874d00; }
.alert-info { background: #e6f4ff; border: 1px solid #91caff; color: #0958d9; }
.alert a { color: inherit; text-decoration: underline; }

.stats-bar { display: flex; gap: 14px; margin-bottom: 16px; }
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    min-width: 120px;
}
.stat-card strong { font-size: 22px; }
.stat-card span { font-size: 12px; color: var(--muted); margin-top: 2px; }

.topbar nav a.active { color: var(--text); pointer-events: none; }

.category-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.category-tabs button {
    border: 1px solid var(--border); background: #fff; color: var(--text);
    border-radius: 6px; padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.category-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.field.field-advanced { display: none; }
.advanced-toggle-section { padding: 4px 24px 16px; border-bottom: none; }
.advanced-toggle { font-weight: 600; }

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 999;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.toast.toast-success { background: #0f9d58; }
.toast.toast-error { background: #d93025; }

.measurement-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.measurement-table th, .measurement-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.measurement-table th { background: #fafafa; font-weight: 600; }
.measurement-table input { width: 80px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.measurement-table input.invalid { border-color: #d93025; background: #fff8f8; }
.measurement-table td.size-label { font-weight: 600; }

.filter-toggle { display: flex; gap: 4px; }
.filter-toggle button {
    border: 1px solid var(--border); background: #fff; color: var(--text);
    border-radius: 6px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.filter-toggle button.active { background: var(--text); color: #fff; border-color: var(--text); }

.sku-table tbody tr.row-exported { background: #f4fbf6; }
.sku-table tbody tr.row-exported:hover { background: #ecf7ef; }

.size-checklist { display: flex; flex-wrap: wrap; gap: 10px; }
.size-checklist label {
    display: flex; align-items: center; gap: 6px;
    border: 1px solid var(--border); border-radius: 6px;
    padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.size-checklist label:has(input:checked) { border-color: var(--primary); background: #fff0f4; }
.size-checklist label.checked { border-color: var(--primary); background: #fff0f4; }

.bulk-results { padding: 0 24px; }
.bulk-results:empty { display: none; }
.bulk-results table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.bulk-results th, .bulk-results td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.bulk-results .summary { font-weight: 600; color: #0f9d58; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.row-count { margin-left: auto; color: var(--muted); font-size: 13px; }

.btn {
    border: none;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #f7b8c8; cursor: not-allowed; }
.btn-secondary { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-secondary:disabled { color: var(--muted); cursor: not-allowed; }
.btn-plain { background: transparent; color: var(--muted); }

.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: auto; }
.sku-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sku-table th, .sku-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.sku-table th { background: #fafafa; font-weight: 600; position: sticky; top: 0; }
.sku-table .empty { text-align: center; color: var(--muted); padding: 30px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tag-yes { background: #e6f9ee; color: #0f9d58; }
.tag-no { background: #fdeeee; color: #d93025; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 0; margin-right: 10px; }
.link-btn.danger { color: #d93025; }

.pagination { display: flex; gap: 6px; margin-top: 14px; }
.pagination button { border: 1px solid var(--border); background: #fff; border-radius: 4px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; overflow-y: auto; padding: 30px 16px; }
.modal-content { background: #fff; border-radius: 8px; width: 100%; max-width: 900px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }

.form-section { padding: 16px 24px; border-bottom: 1px solid var(--border); }
.form-section h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }

.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field .help { display: block; font-weight: normal; color: var(--muted); font-size: 11px; margin-top: 2px; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.field textarea { resize: vertical; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: #d93025; background: #fff8f8; }
.field-error { color: #d93025; font-size: 11px; margin-top: 3px; }

.autocomplete-wrap { position: relative; }
.autocomplete-list {
    position: absolute; z-index: 20; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid var(--border); border-top: none;
    max-height: 200px; overflow-y: auto; border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,.08);
}
.autocomplete-list div { padding: 8px 10px; cursor: pointer; font-size: 13px; }
.autocomplete-list div:hover, .autocomplete-list div.active { background: #fdeff3; }

.modal-footer { display: flex; align-items: center; gap: 14px; padding: 16px 24px; }
.save-and-new { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-right: auto; }

.form-errors { color: #d93025; font-size: 13px; padding: 0 24px; }
.form-errors:empty { display: none; }

.stacked-form { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.stacked-form label { font-weight: 600; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.stacked-form input, .stacked-form textarea {
    font-weight: normal;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.muted { color: var(--muted); font-weight: normal; font-size: 13px; }
