/* ai.sodstr.ru — единый стиль в палитре info.sodstr.ru
 * Тёмно-синий + зелёный (СРО), glassmorphism, общий dash-hero.
 */
:root {
    /* SRO-палитра (синхронизировано с info.sodstr.ru) */
    --c-sro-blue:        #0f3460;
    --c-sro-blue-light:  #1d4ed8;
    --c-sro-blue-dark:   #0a223d;
    --c-sro-bg-dark:     #050b1f;
    --c-sro-green:       #22c55e;
    --c-sro-green-dim:   #16a34a;
    --c-sro-green-soft:  rgba(34, 197, 94, .12);

    /* Workplace (chat/admin) */
    --c-bg:        #f4f6fa;
    --c-surface:   #ffffff;
    --c-text:      #0f172a;
    --c-muted:     #64748b;
    --c-border:    #e2e8f0;
    --c-error:     #b8312f;
    --c-warn:      #b97d1e;
    --c-ok:        #15803d;

    /* Геометрия */
    --r-sm:  8px;
    --r-md:  12px;
    --r-lg:  18px;

    --shadow-sm: 0 1px 2px rgba(15, 52, 96, .07), 0 1px 3px rgba(15, 52, 96, .05);
    --shadow-md: 0 6px 24px rgba(15, 52, 96, .10);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Roboto",
                 "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-sans);
    font-size: 15px; line-height: 1.55;
    min-height: 100vh;
}
body { display: flex; flex-direction: column; }
a { color: var(--c-sro-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; line-height: 1.25; color: var(--c-text); margin-top: 1.4em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
main, .main { flex: 1 0 auto; }

/* ───────────── topnav (синяя шапка info-style) ───────────── */
.topnav {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 24px;
    background: linear-gradient(135deg, var(--c-sro-blue) 0%, var(--c-sro-blue-dark) 100%);
    border-bottom: 1px solid rgba(34, 197, 94, .2);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
    position: sticky; top: 0; z-index: 10;
    color: #fff;
}
.topnav .brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.topnav .brand:hover { text-decoration: none; }
.topnav .brand-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
}
.topnav .brand-text {
    font-weight: 800; font-size: 1.1rem;
    background: linear-gradient(120deg, #fff 0%, #c7d2fe 50%, #fff 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
.topnav .brand-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, .6);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-left: 4px;
}
.nav-spacer { flex: 1; }
.nav-link {
    padding: 6px 12px; border-radius: var(--r-sm);
    color: rgba(255, 255, 255, .75); font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    text-decoration: none;
}
.nav-cta {
    background: var(--c-sro-green);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(34, 197, 94, .35);
}
.nav-cta:hover {
    background: var(--c-sro-green-dim);
}
.nav-logout-form { display: inline-flex; }
.nav-logout {
    border: none; background: transparent;
    color: rgba(255, 255, 255, .65);
    cursor: pointer; padding: 6px 12px; border-radius: var(--r-sm);
    font: inherit;
    transition: background .15s, color .15s;
}
.nav-logout:hover { background: rgba(220, 38, 38, .25); color: #fecaca; }

/* ───────────── footer ───────────── */
.footer {
    padding: 22px;
    text-align: center;
    color: var(--c-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
}
.footer-sub { margin-top: 4px; opacity: 0.85; }

/* ───────────── content ───────────── */
.content {
    max-width: 940px;
    margin: 32px auto;
    padding: 0 24px;
}
.content-narrow { max-width: 520px; }

/* ───────────── buttons ───────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--r-sm);
    border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(135deg, var(--c-sro-green) 0%, var(--c-sro-green-dim) 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(34, 197, 94, .35);
}
.btn-primary:hover { box-shadow: 0 8px 24px rgba(34, 197, 94, .45); }
.btn-ghost {
    background: transparent;
    color: var(--c-sro-blue);
    border-color: var(--c-sro-blue);
}
.btn-ghost:hover { background: rgba(15, 52, 96, .08); }
.btn-block { width: 100%; }
.btn-mini {
    padding: 4px 10px; font-size: 0.85rem;
    border-radius: var(--r-sm);
    border: 1px solid var(--c-border);
    background: var(--c-surface); cursor: pointer;
    transition: background .15s;
}
.btn-mini:hover { background: rgba(15, 52, 96, .06); }
.btn-icon {
    width: 32px; height: 32px; border-radius: 50%;
    border: none; background: transparent; cursor: pointer;
    color: var(--c-muted); font-size: 1.4rem; line-height: 1;
    transition: background .15s, color .15s;
}
.btn-icon:hover { background: #fdecec; color: var(--c-error); }

/* ───────────── alerts ───────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--r-sm);
    margin: 16px 0;
    border-left: 4px solid;
}
.alert-error  { background: #fdecec; color: #6e1c1b; border-color: var(--c-error); }
.alert-warn   { background: #fdf3df; color: #7a5715; border-color: var(--c-warn); }
.alert-ok     { background: #dcfce7; color: #14532d; border-color: var(--c-ok); }

/* ───────────── forms ───────────── */
.form-stack, .form-grid {
    display: flex; flex-direction: column; gap: 14px;
    max-width: 480px; margin-top: 16px;
}
.form-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    max-width: 720px; align-items: end;
}
.form-grid button { grid-column: 1 / -1; }
.form-stack label, .form-grid label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 0.9rem; color: var(--c-muted);
}
input[type=text], input[type=email], input[type=password],
select, textarea {
    padding: 9px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    font: inherit;
    color: var(--c-text);
    background: var(--c-surface);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--c-sro-green);
    box-shadow: 0 0 0 3px var(--c-sro-green-soft);
}

/* ───────────── KPI ───────────── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.kpi {
    background: var(--c-surface);
    border-radius: var(--r-md);
    padding: 18px;
    border: 1px solid var(--c-border);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, transform .15s;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-num {
    font-size: 1.85rem; font-weight: 800;
    color: var(--c-sro-blue);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.kpi-lbl {
    font-size: 0.8rem; color: var(--c-muted);
    text-transform: uppercase; letter-spacing: .5px;
    margin-top: 6px;
}

/* ───────────── tables ───────────── */
.kv { width: 100%; border-collapse: collapse; margin-top: 16px; }
.kv th, .kv td { padding: 8px 12px; border-bottom: 1px solid var(--c-border); text-align: left; }
.kv th { color: var(--c-muted); font-weight: 500; width: 30%; }

.data-table {
    width: 100%; border-collapse: collapse; margin-top: 16px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.data-table th, .data-table td {
    padding: 10px 12px; text-align: left;
    border-bottom: 1px solid var(--c-border);
}
.data-table th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--c-muted); font-weight: 600; font-size: 0.85rem;
    text-transform: uppercase; letter-spacing: .5px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: rgba(15, 52, 96, .03); }
.data-table .empty { color: var(--c-muted); text-align: center; padding: 20px; }
.row-disabled { opacity: 0.5; }
.role-admin {
    color: var(--c-sro-green-dim); font-weight: 700;
    background: var(--c-sro-green-soft);
    padding: 2px 8px; border-radius: 4px; font-size: 0.85rem;
}
.role-user  { color: var(--c-muted); }
.inline-form { display: inline; }
