/* TopDir.ru — Base Styles */
:root {
    --primary: #1a237e; --primary-light: #283593; --accent: #ffca28; --accent-dark: #f9a825;
    --success: #2e7d32; --danger: #c62828; --warning: #ef6c00;
    --text: #1a1a1a; --text-secondary: #666; --text-muted: #999;
    --bg: #f5f5f5; --bg-white: #fff; --border: #e0e0e0;
    --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--bg); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
a { color: var(--primary); }

/* Header */
.header { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.header-inner { display: flex; align-items: center; height: 56px; gap: 24px; }
.logo { font-size: 22px; font-weight: 700; color: #fff; text-decoration: none; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 4px; }
.nav a { color: rgba(255,255,255,0.85); text-decoration: none; padding: 8px 14px; border-radius: var(--radius); font-size: 14px; transition: background 0.15s; }
.nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.burger { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.burger span { display: block; width: 20px; height: 2px; background: #fff; margin: 4px 0; }
.btn { display: inline-flex; align-items: center; padding: 8px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 500; text-decoration: none; border: none; cursor: pointer; transition: all 0.15s; }
.btn-primary { background: var(--accent); color: var(--primary); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.4); }
.btn-outline:hover { border-color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }

/* Hero */
.hero { background: var(--primary-light); color: #fff; padding: 48px 0; text-align: center; }
.hero h1 { font-size: 28px; margin-bottom: 12px; }
.hero-sub { color: rgba(255,255,255,0.8); margin-bottom: 24px; }
.hero-sm { padding: 28px 0; }
.hero-sm h1 { font-size: 22px; margin-bottom: 16px; }
.search-hero { max-width: 600px; margin: 0 auto; display: flex; }
.search-hero input { flex: 1; padding: 12px 16px; font-size: 15px; border: none; border-radius: var(--radius) 0 0 var(--radius); outline: none; }
.search-hero button { background: var(--accent); color: var(--primary); border: none; padding: 12px 28px; font-size: 15px; font-weight: 600; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; }

/* Cards & Sections */
.section { padding: 28px 0; }
.card { background: var(--bg-white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2 { font-size: 18px; margin-bottom: 16px; color: var(--primary); }
.card h3 { font-size: 16px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Upload */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px; text-align: center; cursor: pointer; transition: all 0.15s; }
.upload-zone:hover { border-color: var(--primary); background: #f8f9ff; }
.upload-zone input { display: none; }
.upload-icon { font-size: 32px; color: var(--text-muted); margin-bottom: 8px; }

/* Forms */
.form-page { max-width: 480px; margin: 0 auto; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; transition: border-color 0.15s; }
.form-group input:focus, .form-group select:focus { border-color: var(--primary); outline: none; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-footer { text-align: center; margin-top: 16px; font-size: 14px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: var(--bg); font-weight: 500; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; background: var(--bg); color: var(--text-secondary); }
.badge-v2 { background: #e8eaf6; color: #1a237e; }
.badge-pr { background: #e0f2f1; color: #004d40; }
.badge-st { background: #fce4ec; color: #880e4f; }
.badge-pi { background: #fff3e0; color: #e65100; }
.badge-okpd { background: #e8f5e9; color: #1b5e20; }
.badge-active { background: #e8f5e9; color: var(--success); }
.badge-hidden { background: #fff3e0; color: var(--warning); }
.badge-sold { background: var(--bg); color: var(--text-muted); }
.badge-count { background: var(--bg); padding: 1px 8px; border-radius: 10px; font-size: 12px; margin-left: 4px; }
.badge-red { background: var(--danger); color: #fff; }

/* Cabinet layout */
.cabinet-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.sidebar { background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; position: sticky; top: 72px; }
.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.sidebar-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; }
.sidebar-nav { padding: 8px 0; }
.sidebar-nav a { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; text-decoration: none; color: var(--text); font-size: 14px; transition: background 0.15s; }
.sidebar-nav a:hover { background: var(--bg); }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.cabinet-main { min-width: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-header h1 { font-size: 22px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-item { text-align: center; padding: 12px; }
.stat-value { font-size: 24px; font-weight: 600; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* Products list */
.product-card { display: flex; gap: 16px; padding: 16px; border-bottom: 1px solid var(--border); background: var(--bg-white); }
.product-card:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.product-card:last-child { border-radius: 0 0 var(--radius) var(--radius); border-bottom: none; }
.product-photo { width: 80px; height: 80px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: var(--bg); }
.product-photo img { width: 100%; height: 100%; object-fit: cover; }
.no-photo { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 11px; }
.product-info { flex: 1; min-width: 0; }
.product-info h3 { font-size: 15px; margin-bottom: 4px; }
.product-meta { font-size: 13px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
.product-meta .price { color: var(--success); font-weight: 600; }
.product-group { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.product-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* Messages */
.message-item { display: flex; gap: 12px; padding: 14px; background: var(--bg-white); border-bottom: 1px solid var(--border); }
.message-item.unread { background: #f3f4ff; }
.message-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 500; flex-shrink: 0; }
.message-body { flex: 1; }
.message-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.message-body p { font-size: 14px; color: var(--text-secondary); }

/* Balance */
.balance-block { display: flex; align-items: center; justify-content: space-between; }
.balance-value { font-size: 28px; font-weight: 600; color: var(--primary); margin-left: 8px; }

/* Favorites */
.favorite-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-white); }

/* Search inline */
.search-inline { display: flex; gap: 8px; }
.search-inline input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination a { padding: 8px 14px; border-radius: var(--radius); text-decoration: none; color: var(--text); background: var(--bg-white); border: 1px solid var(--border); font-size: 14px; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination a:hover:not(.active) { background: var(--bg); }

/* Tags */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 12px; border-radius: 16px; background: var(--bg); font-size: 13px; color: var(--text-secondary); text-decoration: none; transition: all 0.15s; }
.tag:hover { background: var(--primary); color: #fff; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin: 12px 0; font-size: 14px; background: #e3f2fd; color: #1565c0; }
.alert-danger { background: #ffebee; color: var(--danger); }
.alert-success { background: #e8f5e9; color: var(--success); }

/* Footer */
.footer { background: var(--primary); color: rgba(255,255,255,0.7); padding: 20px 0; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13px; }
.footer-links a:hover { color: #fff; }

/* Utility */
.mt-1 { margin-top: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
    .cabinet-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .nav { display: none; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0; background: var(--primary); padding: 8px; }
    .nav.open { display: flex; }
    .burger { display: block; }
    .header-actions .btn-outline, .header-actions .btn-link { display: none; }
    .hero h1 { font-size: 22px; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
