:root {
    --primary: #00a88f;
    --primary-hover: #008f7a;
    --primary-light: #e6f7f4;
    --blue: #0284c7;
    --blue-hover: #0369a1;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Шапка */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.brand-badge {
    height: 34px;
    width: auto;
    padding: 0 12px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), #059669);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 8px rgba(0, 168, 143, 0.3);
}


.header-right { display: flex; align-items: center; gap: 14px; }
.org-pill {
    background: #f8fafc; border: 1px solid var(--border);
    padding: 6px 14px; border-radius: 99px; font-size: 13px; font-weight: 600; color: #334155;
}

.btn-logout {
    padding: 7px 14px; border-radius: 8px; border: 1px solid #fecaca;
    background: #fef2f2; color: var(--danger); font-size: 13px; font-weight: 600;
    text-decoration: none; transition: 0.15s;
}
.btn-logout:hover { background: #fee2e2; }

/* Контейнеры */
.main-auth { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: var(--shadow); width: 100%; max-width: 480px; padding: 36px;
}
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { font-size: 14px; color: var(--muted); margin-bottom: 24px; }

.container { width: 100%; max-width: 1380px; margin: 0 auto; padding: 24px; flex: 1; }

/* Формы и кнопки */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.form-select, .form-input {
    width: 100%; padding: 11px 14px; border: 1px solid #cbd5e1; border-radius: 9px;
    font-size: 14px; color: var(--text); background: #fff; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-select:focus, .form-input:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 168, 143, 0.14);
}
.form-select:disabled { background: #f8fafc; color: #94a3b8; cursor: not-allowed; }

button { font-family: inherit; cursor: pointer; transition: all 0.15s; border: none; font-weight: 600; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary); color: #fff; padding: 11px 20px; border-radius: 9px; font-size: 14px;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-full { width: 100%; padding: 13px; font-size: 15px; }

.btn-blue { background: var(--blue); color: #fff; padding: 11px 18px; border-radius: 9px; font-size: 14px; }
.btn-blue:hover:not(:disabled) { background: var(--blue-hover); }

.btn-danger { background: var(--danger); color: #fff; padding: 11px 18px; border-radius: 9px; font-size: 14px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-export {
    background: #fff; color: #334155; border: 1px solid #cbd5e1;
    padding: 10px 16px; border-radius: 9px; font-size: 13px;
}
.btn-export:hover:not(:disabled) { background: #f8fafc; border-color: #94a3b8; }

.btn-cancel { background: #f1f5f9; color: #475569; padding: 10px 18px; border-radius: 9px; font-size: 14px; }
.btn-cancel:hover { background: #e2e8f0; }
/* Уведомления и статусы плагина */
.banner { padding: 13px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 18px; display: none; font-weight: 500; }
.banner-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.banner-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }

.status-box {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    border-radius: 10px; font-size: 13px; background: #f8fafc; border: 1px solid var(--border); margin-bottom: 20px;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }
.status-dot.ok { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.status-dot.err { background: var(--danger); }

.consent-box {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px;
    background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 18px;
}
.consent-box input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.consent-box label { font-size: 12px; color: #475569; line-height: 1.45; cursor: pointer; }
.consent-box a { color: var(--primary); text-decoration: underline; }

/* Сетка шагов в кабинете (2 колонки на широком экране) */
.steps-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 900px) { .steps-grid { grid-template-columns: 1fr; } }

.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 20px;
}
.steps-grid .card { margin-bottom: 0; }
.card.disabled { opacity: 0.55; pointer-events: none; }
.card.active { border-color: #99f6e4; }

.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-num {
    width: 26px; height: 26px; border-radius: 50%; background: var(--primary-light);
    color: var(--primary); font-weight: 700; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.step-title { font-size: 16px; font-weight: 700; }
.hint-text { font-size: 12px; color: var(--muted); margin-top: 6px; }
.inline-controls { display: flex; gap: 10px; align-items: center; }

/* Прогресс-бар */
.progress-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 22px; margin-bottom: 20px; display: none; }
.progress-bar { width: 100%; height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), #10b981); transition: width 0.25s; }

/* Панель сканера и счетчики */
.scan-card { background: var(--card); border: 2px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 20px; display: none; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 700px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.stat-box.ok { background: #ecfdf5; border-color: #a7f3d0; }
.stat-box.miss { background: #fef2f2; border-color: #fecaca; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-val { font-size: 26px; font-weight: 800; margin-top: 2px; }
.stat-box.ok .stat-val { color: #059669; }
.stat-box.miss .stat-val { color: var(--danger); }

.scan-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.scan-input {
    flex: 1; min-width: 280px; padding: 13px 16px; font-size: 15px;
    border: 2px solid #cbd5e1; border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.scan-input:focus { outline: none; border-color: var(--primary); background: #f0fdfa; }
.scan-feedback { margin-top: 10px; font-size: 13px; font-weight: 600; min-height: 20px; }

/* Таблица */
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; background: #f1f5f9; padding: 4px; border-radius: 10px; }
.tab-btn { background: transparent; color: #475569; padding: 7px 14px; border-radius: 7px; font-size: 13px; }
.tab-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.table-tools-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-input { width: 260px; padding: 9px 13px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f8fafc; color: #475569; font-weight: 600; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr.row-checked td { background: #f0fdf4; }
tr:hover td { background: #f8fafc; }

.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; word-break: break-all; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-badge.checked { background: #dcfce7; color: #166534; }
.status-badge.missing { background: #fee2e2; color: #991b1b; }

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.page-btns { display: flex; gap: 8px; }

/* Модальные окна */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(2px);
    display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
.modal-box {
    background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
    padding: 28px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); max-height: 92vh; overflow-y: auto;
}
.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.modal-desc { font-size: 13px; color: var(--muted); margin-bottom: 18px; line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Футер */
.footer { text-align: center; padding: 18px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); background: #fff; margin-top: auto; }
.footer a { color: var(--muted); text-decoration: underline; }
