/* ============================================================
   1Click — дизайн-система
   Бренд: технологичный, чистый, премиальный. Light/Dark.
   ============================================================ */

:root {
    /* Бренд 1Click — глубокий индиго + электрик-циан акцент */
    --brand-50:  #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --accent:    #06b6d4;
    --accent-600:#0891b2;

    --success: #10b981;
    --warning: #f59e0b;
    --danger:  #ef4444;
    --info:    #3b82f6;

    /* Поверхности (light) */
    --bg:        #f6f7fb;
    --bg-soft:   #eef1f7;
    --surface:   #ffffff;
    --surface-2: #fbfcfe;
    --border:    #e5e8f0;
    --border-strong: #d6dae6;

    --text:      #0f172a;
    --text-soft: #475569;
    --text-mut:  #94a3b8;

    /* Алиасы для единой номенклатуры дизайн-системы (используются наравне с --brand-*) */
    --primary: var(--brand-600);
    --primary-hover: var(--brand-700);
    --surface-elevated: var(--surface);
    --text-secondary: var(--text-soft);

    --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
    --shadow:    0 4px 16px rgba(15,23,42,.08);
    --shadow-lg: 0 18px 48px rgba(15,23,42,.14);

    --radius:    14px;
    --radius-sm: 10px;
    --radius-lg: 22px;

    --grad: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-500) 45%, var(--accent) 130%);
    --grad-soft: linear-gradient(135deg, var(--brand-50), #ecfeff);

    --sidebar-w: 250px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
    --bg:        #0b0f1a;
    --bg-soft:   #0f1524;
    --surface:   #121829;
    --surface-2: #161d31;
    --surface-elevated: #182140;
    --border:    #232c44;
    --border-strong: #2f3a57;

    --text:      #eef2fb;
    --text-soft: #aab6cf;
    --text-mut:  #6b7793;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow:    0 6px 22px rgba(0,0,0,.45);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.6);

    --grad-soft: linear-gradient(135deg, #131a2e, #0e1b24);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:#0b0f1a; --bg-soft:#0f1524; --surface:#121829; --surface-2:#161d31; --surface-elevated:#182140;
        --border:#232c44; --border-strong:#2f3a57;
        --text:#eef2fb; --text-soft:#aab6cf; --text-mut:#6b7793;
        --shadow-sm:0 1px 2px rgba(0,0,0,.4); --shadow:0 6px 22px rgba(0,0,0,.45); --shadow-lg:0 24px 60px rgba(0,0,0,.6);
        --grad-soft: linear-gradient(135deg, #131a2e, #0e1b24);
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
img { max-width: 100%; }
h1,h2,h3,h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 750; }
p { margin: 0 0 1rem; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 460px; }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font-weight: 600; font-size: .95rem; font-family: inherit;
    padding: .7rem 1.25rem; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer; transition: all .18s ease;
    white-space: nowrap; text-decoration: none; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(79,70,229,.35); }
.btn-primary:hover { color:#fff; filter: brightness(1.06); box-shadow: 0 10px 26px rgba(79,70,229,.45); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--brand-400); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { color:#fff; filter: brightness(1.05); }
.btn-sm { padding: .45rem .8rem; font-size: .85rem; }
.btn-lg { padding: .95rem 1.8rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Формы ---------- */
.field { margin-bottom: 1.1rem; }
.label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .4rem; color: var(--text-soft); }
.input, .select, .textarea {
    width: 100%; padding: .72rem .85rem; font-size: .95rem; font-family: inherit;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
.textarea { resize: vertical; min-height: 96px; }
.hint { font-size: .8rem; color: var(--text-mut); margin-top: .35rem; }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .35rem; }
.input-error { border-color: var(--danger); }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ---------- Карточки ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.4rem; }
.card-head { padding: 1.15rem 1.4rem; border-bottom: 1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.card-head h3 { margin: 0; font-size: 1.05rem; }

/* ---------- Бейджи ---------- */
.badge { display:inline-flex; align-items:center; gap:.35rem; padding:.25rem .6rem; border-radius:999px; font-size:.75rem; font-weight:600; }
.badge-green { background: rgba(16,185,129,.14); color: #059669; }
.badge-gray  { background: var(--bg-soft); color: var(--text-soft); }
.badge-red   { background: rgba(239,68,68,.14); color: #dc2626; }
.badge-amber { background: rgba(245,158,11,.16); color: #d97706; }
.badge-blue  { background: rgba(59,130,246,.14); color: #2563eb; }
.badge-brand { background: var(--brand-50); color: var(--brand-700); }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; padding: .8rem 1rem; color: var(--text-mut); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }

/* ---------- Утилиты ---------- */
.flex { display:flex; } .items-center { align-items:center; } .justify-between { justify-content:space-between; }
.gap-1{gap:.5rem} .gap-2{gap:1rem} .gap-3{gap:1.5rem}
.grid { display:grid; }
.text-mut { color: var(--text-mut); } .text-soft { color: var(--text-soft); }
.text-sm { font-size:.85rem } .text-xs{font-size:.75rem}
.fw-600{font-weight:600} .fw-700{font-weight:700}
.mt-1{margin-top:.5rem} .mt-2{margin-top:1rem} .mt-3{margin-top:1.5rem} .mt-4{margin-top:2rem}
.mb-0{margin-bottom:0} .mb-2{margin-bottom:1rem} .mb-3{margin-bottom:1.5rem}
.hidden { display:none !important; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width: 260px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.divider { height:1px; background: var(--border); margin: 1.2rem 0; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 9999; display:flex; flex-direction:column; gap:.6rem; }
.toast { background: var(--surface); color: var(--text); border:1px solid var(--border); border-left: 4px solid var(--brand-500);
    box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); padding: .85rem 1.1rem; min-width: 240px; max-width: 360px;
    animation: toastIn .25s ease; font-size:.9rem; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform:none; } }

/* ---------- Модалки ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(8,11,20,.55); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 9000; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; animation: modalIn .22s ease; }
@keyframes modalIn { from { opacity:0; transform: translateY(16px) scale(.98);} to {opacity:1; transform:none;} }
.modal-head { padding: 1.2rem 1.4rem; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal-body { padding: 1.4rem; }
.modal-foot { padding: 1.1rem 1.4rem; border-top:1px solid var(--border); display:flex; gap:.6rem; justify-content:flex-end; }
.modal-close { background:none; border:none; font-size:1.5rem; cursor:pointer; color: var(--text-mut); line-height:1; }

/* ---------- Empty / skeleton ---------- */
.empty { text-align:center; padding: 3rem 1.5rem; color: var(--text-mut); }
.empty svg { opacity:.5; margin-bottom: 1rem; }
.skeleton { background: linear-gradient(90deg, var(--bg-soft) 25%, var(--surface-2) 37%, var(--bg-soft) 63%);
    background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0%{background-position:100% 0} 100%{background-position:-100% 0} }

/* ---------- Логотип ---------- */
.logo { display:inline-flex; align-items:center; gap:.5rem; font-weight:800; font-size:1.25rem; color: var(--text); letter-spacing:-.02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display:inline-flex; align-items:center; justify-content:center;
    color:#fff; font-weight:800; font-size:.95rem; box-shadow: 0 4px 12px rgba(79,70,229,.4); }
.logo b { color: var(--brand-600); }

.progress { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.progress > span { display:block; height:100%; background: var(--grad); border-radius:999px; }

@media (max-width: 640px) {
    body { font-size: 14.5px; }
    .card-pad { padding: 1.1rem; }
}

/* ---------- Dropdown-панели (язык, пользователь) ---------- */
.dropdown-wrap { position: relative; }
.dropdown-panel {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px;
    background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); padding: .4rem; z-index: 300;
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.dropdown-panel.show { opacity: 1; visibility: visible; transform: none; }
.dropdown-panel a, .dropdown-panel button {
    display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .7rem; border-radius: 8px;
    color: var(--text); font-size: .88rem; text-decoration: none; background: none; border: none; cursor: pointer; text-align: left; font-family: inherit;
}
.dropdown-panel a:hover, .dropdown-panel button:hover { background: var(--bg-soft); color: var(--text); }
.dropdown-panel .dd-divider { height: 1px; background: var(--border); margin: .3rem 0; }
.dropdown-panel .dd-label { padding: .4rem .7rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mut); }
.dropdown-panel .dd-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
:root[data-theme="dark"] .dropdown-panel .dd-active { background: rgba(99,102,241,.15); color: var(--brand-300); }
