* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 0; padding: 1rem; background: #f5f5f5; }
.container { max-width: 900px; margin: 0 auto; }
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.5rem; margin-bottom: 1rem; }
h1 { margin-top: 0; }
.card h1, .card h2 { font-size: 1.5rem; font-weight: 600; margin-top: 0; margin-bottom: 0.5rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f8f9fa; font-weight: 600; }
.btn { display: inline-block; padding: 0.4rem 0.8rem; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9rem; text-decoration: none; }
.btn-primary { background: #0d6efd; color: #fff; }
.btn-success { background: #198754; color: #fff; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-warning { background: #ffc107; color: #000; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
input[type="text"], input[type="password"], input[type="number"] { padding: 0.4rem 0.6rem; border: 1px solid #ccc; border-radius: 4px; width: 100%; max-width: 300px; }
.form-group { margin-bottom: 1rem; }
label { display: block; margin-bottom: 0.25rem; font-weight: 500; }
.nav { margin-bottom: 1rem; }
.nav a { margin-right: 1rem; color: #0d6efd; text-decoration: none; }
.nav a:hover { text-decoration: underline; }
#logout { position: fixed; right: 1rem; top: 1rem; z-index: 100; margin: 0; color: #dc3545; font-weight: 500; }
#logout:hover { color: #b02a37; text-decoration: underline; }
.badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.8rem; }
.badge-pending { background: #ffc107; color: #000; }
.badge-approved { background: #198754; color: #fff; }
.badge-blocked { background: #dc3545; color: #fff; }
.pagination { margin-top: 1rem; }
.pagination button { margin-right: 0.5rem; }
.alert { padding: 0.75rem; border-radius: 4px; margin-bottom: 1rem; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-success { background: #d4edda; color: #155724; }
.hidden { display: none !important; }

/* Toasts: правый верхний угол, едино для всех окон */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; max-width: 360px; pointer-events: none; }
.toast { padding: 0.75rem 1rem; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); font-size: 0.9rem; pointer-events: auto; animation: toastIn 0.2s ease; }
.toast-success { background: #d4edda; color: #155724; }
.toast-error { background: #f8d7da; color: #721c24; }
@keyframes toastIn { from { opacity: 0; transform: translateX(1rem); } to { opacity: 1; transform: translateX(0); } }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal.hidden { display: none !important; }
#modal.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 10; }
#modal.modal.hidden { display: none !important; }

/* Category tree */
.cat-card { background: #fff; border-radius: 6px; border: 1px solid #eee; border-left: 3px solid #0d6efd; padding: 0.6rem 0.9rem; margin-bottom: 0.5rem; }
.cat-card:hover { background: #f8f9fa; }
.cat-card.cat-sub { border-left-color: #6c757d; margin-left: 0; }
.cat-summary { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cat-summary strong { flex: 0 0 auto; }
.cat-summary .cat-meta { color: #666; font-size: 0.9rem; }
.cat-summary .cat-actions { margin-left: auto; display: flex; gap: 0.25rem; flex-wrap: wrap; }
.cat-children { padding-left: 1.25rem; margin-top: 0.5rem; border-left: 1px dashed #dee2e6; }
.cat-children.collapsed { display: none; }
.cat-toggle { background: transparent; border: none; cursor: pointer; padding: 0.2rem 0.4rem; font-size: 0.85rem; color: #6c757d; width: 1.5rem; text-align: left; }
.cat-toggle:hover { color: #0d6efd; }
.cat-toggle-placeholder { display: inline-block; width: 1.5rem; }
.categories-overview .cat-card { border-left-color: #198754; }
.categories-overview .cat-summary .cat-actions { display: none; }
