/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: #1a1a1a; background: #f4f5f7; line-height: 1.6; }
a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== NAVBAR ===== */
.navbar { background: #1a1a2e; color: #fff; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; height: 52px; position: sticky; top: 0; z-index: 100; }
.nav-brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: #fff; }
.nav-brand a { color: #fff; text-decoration: none; }
.brand-icon { font-size: 20px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link { color: rgba(255,255,255,0.75); padding: 6px 12px; border-radius: 6px; font-size: 13px; transition: all 0.15s; }
.nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.nav-admin { color: #ffd700; }
.nav-logout { color: #ff7777; }
.nav-user { font-size: 12px; color: rgba(255,255,255,0.5); padding-left: 8px; border-left: 1px solid rgba(255,255,255,0.2); margin-left: 4px; }

/* ===== CONTAINER ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }

/* ===== ALERTS ===== */
.alert { padding: 10px 16px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ===== CARDS ===== */
.card { background: #fff; border-radius: 10px; border: 1px solid #e2e4e8; padding: 20px; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0; }
.card-header h2 { font-size: 15px; font-weight: 600; color: #1a1a1a; }
.card-link { font-size: 12px; color: #0066cc; }

/* ===== STAT GRID ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 10px; border: 1px solid #e2e4e8; padding: 14px 16px; }
.stat-label { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.stat-val { font-size: 22px; font-weight: 600; color: #1a1a1a; }
.stat-val-sm { font-size: 13px; }
.text-success { color: #22863a !important; }
.text-danger  { color: #cb2431 !important; }
.text-sm { font-size: 12px; color: #666; }

/* ===== 2-COLUMN LAYOUT ===== */
.row-2col { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
@media (max-width: 768px) { .row-2col { grid-template-columns: 1fr; } }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #444; margin-bottom: 5px; }
.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=password],
.form-group input[type=number],
.form-group input[type=datetime-local],
.form-group select,
.form-group textarea { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; color: #1a1a1a; background: #fff; transition: border 0.15s; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #0066cc; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.section-label { font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; padding-top: 4px; }

/* ===== TOGGLE ===== */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f5f5f5; }
.toggle-row:last-of-type { border-bottom: none; }
.toggle-title { font-size: 14px; font-weight: 500; color: #1a1a1a; }
.toggle-sub { font-size: 12px; color: #888; margin-top: 2px; }
.toggle { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track { position: absolute; inset: 0; background: #d1d5db; border-radius: 11px; cursor: pointer; transition: background 0.2s; }
.toggle input:checked + .toggle-track { background: #22863a; }
.toggle-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }

/* ===== LOT SLIDER ===== */
.lot-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lot-row input[type=range] { flex: 1; }
.lot-display { font-size: 20px; font-weight: 600; min-width: 52px; text-align: right; color: #1a1a1a; }
.lot-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.lot-presets button { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid #d1d5db; background: transparent; cursor: pointer; color: #444; transition: all 0.12s; }
.lot-presets button:hover { background: #f0f4ff; border-color: #0066cc; color: #0066cc; }

/* ===== NEWS TAGS ===== */
.news-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.news-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer; user-select: none; transition: opacity 0.15s; }
.news-tag input[type=checkbox] { display: none; }
.news-red   { background: #fff0f0; border: 1px solid #ffbaba; color: #8b0000; }
.news-orange{ background: #fff8f0; border: 1px solid #ffd0a0; color: #7a4000; }
.news-yellow{ background: #fffde0; border: 1px solid #ffe066; color: #6b5900; }
.news-tag:has(input:not(:checked)) { opacity: 0.4; }

/* ===== NEWS LIST ===== */
.news-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f5f5f5; align-items: flex-start; }
.news-item:last-child { border-bottom: none; }
.news-time { font-size: 12px; color: #888; min-width: 42px; padding-top: 2px; }
.news-title { font-size: 13px; font-weight: 500; color: #1a1a1a; }
.news-cur { font-size: 11px; color: #888; margin-top: 2px; }
.news-item-high .news-time   { color: #cb2431; }
.news-item-medium .news-time { color: #d4820a; }

/* ===== LOG ===== */
.log-item { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #f5f5f5; font-size: 12px; }
.log-item:last-child { border-bottom: none; }
.log-user { font-weight: 500; color: #1a1a1a; min-width: 80px; }
.log-action { color: #444; flex: 1; }
.log-time { color: #aaa; white-space: nowrap; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 6px; border: 1px solid #d1d5db; background: transparent; font-size: 13px; cursor: pointer; font-weight: 500; transition: all 0.12s; color: #1a1a1a; text-decoration: none; }
.btn:hover { background: #f5f6f7; text-decoration: none; }
.btn-primary   { background: #0066cc; color: #fff; border-color: #0052a3; }
.btn-primary:hover { background: #0052a3; color: #fff; }
.btn-danger    { background: #cb2431; color: #fff; border-color: #a01d28; }
.btn-danger:hover { background: #a01d28; color: #fff; }
.btn-success   { background: #22863a; color: #fff; border-color: #1a6b2d; }
.btn-success:hover { background: #1a6b2d; color: #fff; }
.btn-warning   { background: #d4820a; color: #fff; border-color: #b36d08; }
.btn-warning:hover { background: #b36d08; color: #fff; }
.btn-secondary { background: #f0f1f3; color: #444; }
.btn-secondary:hover { background: #e0e2e5; }
.btn-full { width: 100%; justify-content: center; padding: 10px; }
.btn-sm { font-size: 12px; padding: 4px 10px; }
.btn-xs { font-size: 11px; padding: 3px 8px; }

/* ===== BADGES ===== */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.badge-success  { background: #d4edda; color: #155724; }
.badge-danger   { background: #f8d7da; color: #721c24; }
.badge-warning  { background: #fff3cd; color: #856404; }
.badge-secondary{ background: #e9ecef; color: #444; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: #f7f8fa; font-weight: 600; padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e4e8; white-space: nowrap; color: #555; }
.table td { padding: 9px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.table tr:hover td { background: #fafbfc; }
.row-inactive td { opacity: 0.5; }
.action-btns { display: flex; gap: 4px; flex-wrap: wrap; }

/* ===== TOKEN ===== */
.token-box { background: #f7f8fa; border: 1px solid #e2e4e8; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.token-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.token-display { font-family: monospace; font-size: 14px; color: #1a1a1a; background: #fff; border: 1px solid #d1d5db; border-radius: 6px; padding: 8px 12px; margin-bottom: 8px; word-break: break-all; }
.info-box { background: #f0f4ff; border: 1px solid #bfd0ff; border-radius: 8px; padding: 16px; margin-bottom: 12px; }
.info-warning { background: #fff8e1; border-color: #ffe082; }
.info-box h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.info-box code { display: block; font-family: monospace; font-size: 12px; background: rgba(0,0,0,0.05); padding: 8px; border-radius: 4px; margin: 6px 0; word-break: break-all; }
.info-box ol { padding-left: 18px; font-size: 13px; }
.info-box ol li { margin-bottom: 6px; }

/* ===== AUTH PAGES ===== */
.auth-page { background: #1a1a2e; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-card { background: #fff; border-radius: 12px; padding: 32px; width: 100%; max-width: 400px; margin: 20px; }
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-icon { font-size: 40px; display: block; margin-bottom: 8px; }
.auth-header h1 { font-size: 22px; font-weight: 700; color: #1a1a1a; margin-bottom: 4px; }
.auth-header p { color: #888; font-size: 13px; }
.auth-footer { text-align: center; margin-top: 16px; font-size: 13px; color: #888; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal { background: #fff; border-radius: 10px; padding: 24px; width: 100%; max-width: 400px; margin: 16px; }
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* ===== EMPTY ===== */
.empty-msg { font-size: 13px; color: #aaa; text-align: center; padding: 20px 0; }

/* ===== RANGE INPUT ===== */
input[type=range] { -webkit-appearance: none; height: 4px; background: #d1d5db; border-radius: 2px; cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #0066cc; cursor: pointer; }
