/* ПФУ v1.0 — стили в духе otmena.myarbitr.kz */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f3f4f8;
    color: #1f2430;
    font-size: 15px;
    line-height: 1.5;
}
a { color: #3b82f6; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Шапка ===== */
.topbar {
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(109, 40, 217, .35);
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.brand-shield { font-size: 26px; line-height: 1; }
.brand-name {
    color: #fff; font-weight: 800; font-size: 19px; letter-spacing: .5px;
}
.brand-name:hover { text-decoration: none; opacity: .9; }
.brand-divider { width: 1px; height: 24px; background: rgba(255,255,255,.45); }
.brand-app { color: rgba(255,255,255,.92); font-size: 15px; font-weight: 600; }
.brand-app:hover { text-decoration: none; color: #fff; }
.topnav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbtn {
    color: #fff; background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.35);
    padding: 6px 14px; border-radius: 9px; font-size: 14px; font-weight: 600;
}
.topbtn:hover { background: rgba(255,255,255,.26); text-decoration: none; }
.topbtn.active { background: rgba(255,255,255,.3); }
.topbtn-exit { background: rgba(220,38,38,.25); border-color: rgba(255,255,255,.4); }
.topuser { text-align: right; line-height: 1.2; margin: 0 4px; }
.topuser-name { display: block; font-weight: 700; font-size: 14px; }
.topuser-role { display: block; font-size: 12px; opacity: .85; }

/* ===== Контейнер и карточки ===== */
.container { max-width: 1280px; margin: 22px auto 40px; padding: 0 20px; }
.card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(31, 41, 55, .07);
    padding: 20px 22px;
    margin-bottom: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 18px; }
.card h3 { margin: 18px 0 10px; font-size: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 24px; }
.page-head-right { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Кнопки ===== */
.btn {
    display: inline-block; border: none; cursor: pointer;
    background: #3b82f6; color: #fff; font-weight: 600; font-size: 14px;
    padding: 8px 16px; border-radius: 9px; text-decoration: none;
    transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; color: #fff; }
.btn-green { background: #16a34a; }
.btn-red { background: #dc2626; }
.btn-gray { background: #6b7280; }
.btn-outline { background: #fff; color: #3b82f6; border: 1px solid #3b82f6; }
.btn-outline:hover { background: #eff6ff; color: #3b82f6; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===== Бейджи ===== */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-gray { background: #e5e7eb; color: #4b5563; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-violet { background: #ede9fe; color: #6d28d9; }

/* ===== Таблицы ===== */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 8px 10px; border-bottom: 1px solid #eef0f4; text-align: left; vertical-align: top; }
table.tbl th { background: #f8f9fc; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: #6b7280; }
table.tbl tr:hover td { background: #fafbff; }
table.tbl tr.row-overdue td { background: #fff5f5; }
table.tbl td.num, table.tbl th.num { text-align: right; white-space: nowrap; }
table.tbl tfoot td { font-weight: 700; background: #f8f9fc; }

/* ===== Формы ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
label.fld { display: block; font-size: 13px; font-weight: 600; color: #4b5563; }
label.fld span { display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=number], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #d4d8e0; border-radius: 8px;
    font: inherit; background: #fff; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c4b5fd; border-color: #7c3aed; }
textarea { min-height: 80px; resize: vertical; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.inline-input { padding: 4px 6px; font-size: 13px; }

/* ===== Алерты ===== */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.alert-warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }

/* ===== Статистика дашборда ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 14px; box-shadow: 0 2px 10px rgba(31,41,55,.07); padding: 16px 20px; }
.stat-card .stat-num { font-size: 30px; font-weight: 800; }
.stat-card .stat-label { color: #6b7280; font-size: 13.5px; }
.stat-red .stat-num { color: #dc2626; }
.stat-orange .stat-num { color: #ea580c; }
.stat-blue .stat-num { color: #3b82f6; }
.stat-violet .stat-num { color: #7c3aed; }

/* ===== Карточки дел ===== */
.cases-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.case-card { background: #fff; border-radius: 14px; box-shadow: 0 2px 10px rgba(31,41,55,.07); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.case-card .cc-title { font-weight: 700; font-size: 16px; }
.case-card .cc-meta { color: #6b7280; font-size: 13px; }
.case-card .cc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; flex-wrap: wrap; }

/* ===== Вкладки ===== */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 2px solid #e5e7eb; padding-bottom: 0; }
.tabs a {
    padding: 9px 16px; border-radius: 10px 10px 0 0; color: #4b5563; font-weight: 600; font-size: 14px;
    border: 1px solid transparent; border-bottom: none;
}
.tabs a:hover { text-decoration: none; background: #ede9fe; color: #6d28d9; }
.tabs a.active { background: #fff; color: #6d28d9; border-color: #e5e7eb; box-shadow: 0 -2px 6px rgba(31,41,55,.05); position: relative; top: 2px; }

/* ===== Drag&drop загрузка ===== */
.dropzone {
    border: 2px dashed #a5b4fc; border-radius: 12px; padding: 28px 18px;
    text-align: center; color: #6b7280; background: #fafaff; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone.dragover { border-color: #7c3aed; background: #f3efff; color: #6d28d9; }
.dropzone .dz-icon { font-size: 34px; }
.upload-progress { margin-top: 10px; display: none; }
.upload-progress .bar { height: 8px; background: #e5e7eb; border-radius: 6px; overflow: hidden; }
.upload-progress .bar > div { height: 100%; width: 0; background: #3b82f6; transition: width .2s; }
.file-row .ai-summary { background: #f8f9fc; border-radius: 8px; padding: 8px 10px; margin-top: 6px; font-size: 13px; color: #374151; white-space: pre-wrap; }

/* ===== Двухколоночные описания ===== */
dl.desc { display: grid; grid-template-columns: 240px 1fr; gap: 6px 16px; margin: 0; }
dl.desc dt { color: #6b7280; font-size: 13.5px; }
dl.desc dd { margin: 0; font-weight: 500; }

/* ===== Подвал ===== */
.footer { border-top: 1px solid #e5e7eb; padding: 16px 0; color: #9ca3af; font-size: 13px; }
.footer-inner { margin: 0 auto; }

/* ===== Страница входа ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
    padding: 34px 32px; width: 100%; max-width: 400px; }
.login-card .brand-login { text-align: center; margin-bottom: 22px; }
.login-card .brand-login .shield { font-size: 44px; }
.login-card .brand-login h1 { font-size: 20px; margin: 8px 0 2px; color: #4c1d95; }
.login-card .brand-login .sub { color: #6b7280; font-size: 13.5px; }
.login-card .fld { margin-bottom: 14px; }
.login-card .btn { width: 100%; padding: 11px; font-size: 15px; }
.login-foot { text-align: center; margin-top: 16px; color: #9ca3af; font-size: 12.5px; }

/* ===== Утилиты ===== */
.muted { color: #6b7280; }
.small { font-size: 13px; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none; }

/* ===== Адаптив ===== */
@media (max-width: 760px) {
    .topbar-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
    .topnav { width: 100%; }
    .topuser { text-align: left; }
    dl.desc { grid-template-columns: 1fr; gap: 2px; }
    dl.desc dd { margin-bottom: 8px; }
    .container { padding: 0 12px; }
    .card { padding: 14px; }
    .page-head h1 { font-size: 20px; }
    table.tbl { font-size: 13px; }
    table.tbl th, table.tbl td { padding: 6px 6px; }
}
