:root {
    --navy: #07111f;
    --navy-2: #12243d;
    --blue: #1d4e9f;
    --red: #e10600;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e6ebf2;
    --bg: #f3f6fb;
    --card: #ffffff;
    --ok: #0f9f6e;
    --warn: #d97706;
    --bad: #dc2626;
    --info: #2563eb;
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
    --font: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
}
a { color: var(--blue); }
button, input, select, textarea { font-family: inherit; }

.brand-line {
    position: fixed;
    inset: 0 0 auto 0;
    height: 4px;
    z-index: 80;
    background: linear-gradient(90deg, #1d4e9f 0 58%, #e10600 58% 100%);
}

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 280px;
    flex: 0 0 280px;
    background: #fff;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    padding: 18px 14px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--line);
}
.brand {
    display: block;
    text-decoration: none;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px 12px 12px;
    margin-bottom: 18px;
}
.brand img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 10px;
}
.brand strong { display: block; font-size: 16px; letter-spacing: -0.02em; color: #0f172a; }
.brand span { display: block; color: #64748b; font-size: 12px; font-weight: 650; margin-top: 2px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.side-nav a, .group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
    text-decoration: none;
    border-radius: 12px;
    padding: 11px 12px;
    font-weight: 750;
}
.side-nav a i, .group-title i { font-size: 17px; width: 22px; color: #64748b; }
.side-nav a:hover, .group-title:hover { background: #f8fafc; color: #0f172a; }
.side-nav a.active, .group-title.active {
    background: #fff1f2;
    color: #9f1239;
    box-shadow: inset 3px 0 0 var(--red);
}
.side-nav a.active i, .group-title.active i { color: var(--red); }
.side-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px; padding-left: 8px; }
.side-sub a { font-size: 13.5px; font-weight: 700; padding: 8px 10px 8px 14px; }
.side-foot {
    margin-top: auto;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 8px 0;
}
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 28px 8px;
}
.top-title { flex: 1; min-width: 0; }
.top-title p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.top-title h1 { margin: 2px 0 0; font-size: 28px; letter-spacing: -0.04em; font-weight: 800; }
.top-user { display: flex; align-items: center; gap: 10px; }
.top-user strong, .top-user span { display: block; text-align: right; }
.top-user strong { font-size: 14px; }
.top-user span { color: var(--muted); font-size: 12px; }
.menu-btn, .backdrop { display: none; }
.content { flex: 1; padding: 12px 28px 28px; }
.site-footer {
    border-top: 1px solid var(--line);
    background: #fff;
    text-align: center;
    padding: 16px 20px 18px;
}
.site-footer a {
    color: #475569;
    text-decoration: none;
    font-weight: 650;
    font-size: 13.5px;
    letter-spacing: .01em;
}
.site-footer a:hover { color: var(--blue); }
.heart {
    display: inline-block;
    color: #e11d48;
    margin: 0 .4rem;
    transform-origin: center;
    animation: heartbeat 2.8s ease-in-out infinite;
    font-size: 1.02em;
    line-height: 1;
    vertical-align: -1px;
}
@keyframes heartbeat {
    0%, 64%, 100% { transform: scale(1); }
    12% { transform: scale(1.14); }
    24% { transform: scale(1); }
    36% { transform: scale(1.08); }
}

.panel {
    background: var(--card);
    border: 1px solid rgba(15, 23, 42, .05);
    border-radius: 22px;
    box-shadow: var(--shadow);
}
.panel-pad { padding: 20px; }
.view-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.view-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--line);
    color: #334155;
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 800;
    font-size: 13.5px;
}
.view-tabs a b {
    background: #f1f5f9;
    color: #0f172a;
    border-radius: 999px;
    min-width: 24px;
    text-align: center;
    padding: 1px 7px;
    font-size: 12px;
}
.view-tabs a.active { background: #10203a; border-color: #10203a; color: #fff; }
.view-tabs a.active b { background: rgba(255,255,255,.16); color: #fff; }
.page-actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.page-actions p { margin: 0; color: var(--muted); font-weight: 600; }

.btn { border-radius: 12px; font-weight: 750; }
.btn-brand {
    background: linear-gradient(180deg, #ef2b22 0%, #c10500 100%);
    color: #fff;
    border: 0;
    box-shadow: 0 10px 18px rgba(225, 6, 0, .18);
    padding: .7rem 1.05rem;
}
.btn-brand:hover { color: #fff; filter: brightness(1.06); }
.btn-soft {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--navy);
    padding: .55rem .8rem;
}
.btn-soft:hover { background: #f8fafc; color: var(--navy); }
.btn-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--navy);
}
.btn-icon:hover { border-color: #cbd5e1; color: var(--blue); }
.btn-icon.danger:hover { color: var(--bad); background: #fff5f5; border-color: #fecaca; }
.icon-form { display: inline; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
    background: #fff;
    border-radius: 22px;
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(15,23,42,.05);
    text-decoration: none;
    color: inherit;
    display: block;
    min-height: 132px;
}
.stat:hover { transform: translateY(-2px); color: inherit; }
.stat .ico {
    width: 42px; height: 42px; border-radius: 14px;
    display: grid; place-items: center; color: #fff; margin-bottom: 14px; font-size: 18px;
}
.stat b { display: block; font-size: 30px; letter-spacing: -0.04em; line-height: 1; }
.stat span { color: var(--muted); font-weight: 700; font-size: 13px; }
.ico.blue { background: #1d4e9f; }
.ico.red { background: #e10600; }
.ico.amber { background: #d97706; }
.ico.green { background: #0f9f6e; }
.ico.rose { background: #be123c; }
.top-logo { display: none; text-decoration: none; }

.name-link { color: var(--navy); font-weight: 800; text-decoration: none; }
.name-link:hover { color: var(--red); }
.mini-table small { display: block; color: var(--muted); font-weight: 700; }
.empty-note { margin: 0; color: var(--muted); font-weight: 650; }
.dash-intro {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
}
.dash-intro p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.dash-intro h2 { margin: 4px 0 10px; font-size: 28px; letter-spacing: -.04em; font-weight: 800; }
.intro-pills, .summary-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.intro-actions { display: flex; gap: 8px; }
.period-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.period {
    display: block;
    background: #fff;
    border-radius: 20px;
    padding: 16px 16px 14px 18px;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(15,23,42,.06);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.period::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(#1d4e9f, #e10600);
}
.period span { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.period strong { display: block; font-size: 34px; letter-spacing: -.05em; line-height: 1.1; margin-top: 8px; }
.period em { font-style: normal; color: #64748b; font-weight: 700; font-size: 12.5px; }
.period:hover { transform: translateY(-2px); color: inherit; }
.watch-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.watch {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 18px;
    padding: 14px;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(15,23,42,.06);
    box-shadow: var(--shadow);
}
.watch i {
    width: 40px; height: 40px; border-radius: 14px;
    display: grid; place-items: center; color: #fff; font-size: 18px; flex: 0 0 auto;
}
.watch b { display: block; font-size: 22px; letter-spacing: -.04em; line-height: 1; }
.watch span { color: var(--muted); font-size: 12px; font-weight: 750; }
.watch.rose i { background: #be123c; }
.watch.amber i { background: #d97706; }
.watch.blue i { background: #1d4e9f; }
.watch.navy i { background: #10203a; }
.watch.green i { background: #0f9f6e; }
.watch:hover { transform: translateY(-2px); color: inherit; }
.dossier { display: grid; grid-template-columns: 300px 1fr; gap: 16px; margin-bottom: 16px; }
.dossier-side h2 { margin: 14px 0 2px; font-size: 24px; letter-spacing: -.04em; font-weight: 800; }
.sicil { color: var(--muted); font-weight: 750; margin-bottom: 10px; }
.avatar {
    width: 76px; height: 76px; border-radius: 24px;
    background: linear-gradient(160deg, #10203a, #1d4e9f);
    color: #fff; display: grid; place-items: center;
    font-size: 26px; font-weight: 800;
}
.meta-list { margin-top: 18px; }
.meta-list div {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid #eef2f6; font-size: 14px;
}
.meta-list span { color: var(--muted); font-weight: 750; }
.meta-list b { text-align: right; }
.dossier-main { display: flex; flex-direction: column; gap: 14px; }
.dossier-stats { margin-bottom: 0; grid-template-columns: repeat(4, 1fr); }
.summary-lead { margin: 0 0 10px; font-weight: 650; }
.summary-text { margin: 12px 0 0; color: #334155; line-height: 1.55; }
.history-head { padding: 16px 12px 0; }
.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; margin-bottom: 16px; }
.bar-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.bar { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #1d4e9f, #e10600); border-radius: 99px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-title h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.03em; }
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table th, .mini-table td { padding: 10px 0; border-bottom: 1px solid #eef2f6; font-size: 13.5px; }
.mini-table th { color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.pill.ok { background: #e8f8f1; color: #047857; }
.pill.warn { background: #fff6e8; color: #b45309; }
.pill.bad { background: #feefef; color: #b91c1c; }
.pill.info { background: #eaf1ff; color: #1d4ed8; }
.pill.muted { background: #f1f5f9; color: #64748b; }

.filter-grid, .form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }
.field label, .filter-grid label, .form-grid label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 800;
    color: #334155;
}
.form-control, .form-select {
    min-height: 46px;
    border-radius: 12px;
    border-color: #dbe3ee;
    box-shadow: none;
}
textarea.form-control { min-height: 110px; padding-top: 12px; }
.form-control:focus, .form-select:focus {
    border-color: #1d4e9f;
    box-shadow: 0 0 0 4px rgba(29, 78, 159, .12);
}
.help { color: var(--muted); font-size: 12px; margin-top: 6px; }
.date-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.date-pair span { color: var(--muted); font-weight: 800; }
.filter-actions { display: flex; gap: 8px; align-items: end; }

.select2-container--bootstrap-5 .select2-selection {
    min-height: 46px !important;
    border-radius: 12px !important;
    border-color: #dbe3ee !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 44px !important;
    font-weight: 650;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #1d4e9f !important;
    box-shadow: 0 0 0 4px rgba(29, 78, 159, .12) !important;
}
.select2-container--bootstrap-5 .select2-dropdown { border-radius: 12px; overflow: hidden; }
.select2-invalid { border-color: #dc2626 !important; }

.table-card { padding: 8px 8px 4px; overflow: hidden; }
table.dataTable { margin-top: 0 !important; }
table.dataTable thead th {
    background: #f8fafc;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #475569;
    white-space: nowrap;
    border-bottom: 1px solid var(--line) !important;
}
table.dataTable tbody td {
    vertical-align: top;
    font-size: 13.5px;
    border-color: #eef2f6 !important;
}
.clip {
    max-width: 320px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal !important;
}
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 6px; }
.dt-buttons .btn { border-radius: 10px; font-weight: 800; }
.app-alert { border: 0; border-radius: 14px; font-weight: 700; }

.person-card {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: #f8fafc;
    border: 1px dashed #d5deea;
    border-radius: 16px;
    padding: 14px;
}
.person-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.person-card strong { display: block; margin-top: 3px; }
.kalan-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
}
.kalan-box em { display: block; font-style: normal; color: var(--muted); font-size: 12px; font-weight: 800; }
.kalan { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.kalan.ok { color: var(--ok); }
.kalan.warn { color: var(--warn); }
.kalan.bad { color: var(--bad); }
.kalan.info { color: var(--info); }
.kalan.muted { color: var(--muted); }

.def-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; }
.def-nav { display: flex; flex-direction: column; gap: 6px; }
.def-nav a {
    text-decoration: none;
    color: var(--ink);
    font-weight: 800;
    padding: 12px 14px;
    border-radius: 12px;
}
.def-nav a.active, .def-nav a:hover { background: #f8fafc; color: var(--red); }
.plain-table { width: 100%; border-collapse: collapse; }
.plain-table th, .plain-table td { padding: 12px 10px; border-bottom: 1px solid #eef2f6; text-align: left; }
.plain-table th { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.inactive td { color: #94a3b8; }
.check-line { display: flex; align-items: center; gap: 8px; min-height: 46px; font-weight: 700; }

.login-page { min-height: 100vh; display: flex; flex-direction: column; background: #eef3f9; }
.login-grid { flex: 1; display: grid; grid-template-columns: 1.15fr .85fr; min-height: 0; }
.login-hero {
    background:
        radial-gradient(circle at 12% 18%, rgba(225, 6, 0, .08), transparent 26%),
        radial-gradient(circle at 80% 80%, rgba(29, 78, 159, .1), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
    color: #0f172a;
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.logo-plaque {
    width: min(520px, 100%);
    background: #fff;
    border: 1px solid #e6ebf2;
    border-radius: 24px;
    padding: 18px 22px;
    margin-bottom: 28px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .06);
}
.logo-plaque img {
    width: 100%;
    height: auto;
    display: block;
}
.login-hero h1 { font-size: 46px; line-height: 1.05; letter-spacing: -0.045em; font-weight: 800; max-width: 640px; color: #0f172a; }
.login-hero p { color: #475569; font-size: 17px; max-width: 520px; }
.hero-points { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.hero-points div { display: flex; gap: 10px; align-items: center; font-weight: 700; color: #334155; }
.hero-points i { color: #e10600; }
.login-panel { display: grid; place-items: center; padding: 32px 24px; }
.login-card { width: min(440px, 100%); background: #fff; border-radius: 28px; padding: 32px; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 6px; font-weight: 800; letter-spacing: -0.04em; }
.login-card .lead { color: var(--muted); margin-bottom: 22px; }
.input-wrap { position: relative; }
.input-wrap .js-eye {
    position: absolute; right: 8px; top: 6px; border: 0; background: transparent; color: #64748b; height: 34px; width: 34px;
}
.demo-card {
    margin-top: 18px;
    background: #f8fafc;
    border: 1px solid #e6ebf2;
    border-radius: 16px;
    padding: 14px 16px;
}
.demo-card span {
    display: block;
    margin-bottom: 8px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.demo-card div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
}
.demo-card b { color: #334155; font-weight: 700; }
.demo-card code {
    background: #fff;
    border: 1px solid #e6ebf2;
    border-radius: 8px;
    padding: 3px 8px;
    color: #0f172a;
    font-weight: 800;
}
.login-page .site-footer { background: transparent; border-top-color: transparent; }

@media (max-width: 1100px) {
    .stats, .filter-grid, .form-grid, .person-card, .period-grid, .dossier-stats { grid-template-columns: repeat(2, 1fr); }
    .watch-grid { grid-template-columns: repeat(3, 1fr); }
    .split, .def-layout, .login-grid, .dossier { grid-template-columns: 1fr; }
    .span-2, .span-4 { grid-column: span 2; }
    .login-hero { padding: 32px 24px; }
    .login-hero h1 { font-size: 34px; }
}
@media (max-width: 860px) {
    .top-logo {
        display: flex;
        align-items: center;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 4px 8px;
    }
    .top-logo img { height: 32px; width: 148px; object-fit: contain; object-position: left center; }
    .menu-btn {
        display: inline-flex; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
        background: #fff; align-items: center; justify-content: center; font-size: 22px;
    }
    .sidebar {
        position: fixed; z-index: 60; transform: translateX(-110%); transition: transform .2s ease; height: 100vh;
    }
    .sidebar.open { transform: none; }
    .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(7,17,31,.45); z-index: 50; }
    .top-user span, .top-user strong { display: none; }
    .content, .topbar { padding-left: 16px; padding-right: 16px; }
    .dash-intro { flex-direction: column; align-items: flex-start; }
    .dossier-stats { grid-template-columns: repeat(2, 1fr); }
    .filter-grid, .form-grid, .person-card { grid-template-columns: 1fr; }
    .span-2, .span-4 { grid-column: auto; }
    .top-title h1 { font-size: 22px; }
}
@media (max-width: 640px) {
    .stats, .period-grid, .watch-grid, .dossier-stats { grid-template-columns: 1fr; }
}
