:root{
    --primary:#ef3136;
    --primary-dark:#c51f23;
    --bg:#f4f6f8;
    --bg-dark:#12151c;
    --card:#ffffff;
    --text:#1f2937;
    --muted:#6b7280;
    --border:#e5e7eb;
    --success:#16a34a;
    --error:#dc2626;
    --shadow:0 20px 45px rgba(17,24,39,.08);
    --radius:18px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:Inter,Segoe UI,Arial,sans-serif;color:var(--text);background:var(--bg)}
a{text-decoration:none;color:inherit}
img{max-width:100%;display:block}
h1,h2,h3,p{margin:0}
code{background:#fff3f3;padding:2px 6px;border-radius:8px}

.login-body{
    min-height:100vh;
    background:
        radial-gradient(circle at top left, rgba(239,49,54,.18), transparent 28%),
        linear-gradient(135deg, #111827 0%, #1f2937 60%, #111827 100%);
}
.login-wrap{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:28px;
}
.login-card{
    width:min(100%, 560px);
    background:rgba(255,255,255,.98);
    border-radius:28px;
    padding:32px;
    box-shadow:0 30px 60px rgba(0,0,0,.18);
}
.install-card{width:min(100%, 720px)}
.login-brand{
    display:flex;
    gap:18px;
    align-items:center;
    margin-bottom:24px;
}
.login-brand img{
    width:120px;
    height:auto;
}
.login-brand h1{font-size:28px;font-weight:800}
.login-brand p{margin-top:6px;color:var(--muted);line-height:1.5}
.login-help{
    margin-top:18px;
    color:var(--muted);
    line-height:1.7;
    font-size:14px;
}
.install-box{
    background:#f8fafc;
    border:1px solid var(--border);
    border-radius:18px;
    padding:18px;
    margin-bottom:18px;
}
.install-list{margin:10px 0 0 18px;padding:0;line-height:1.8}

.app-shell{
    display:grid;
    grid-template-columns:280px 1fr;
    min-height:100vh;
}
.sidebar{
    background:linear-gradient(180deg, #111827 0%, #161b22 100%);
    color:#fff;
    padding:24px 20px;
    display:flex;
    flex-direction:column;
    gap:24px;
    position:sticky;
    top:0;
    height:100vh;
}
.brand{
    display:flex;
    gap:14px;
    align-items:center;
}
.brand-logo{
    width:76px;
    border-radius:14px;
    background:rgba(255,255,255,.05);
    padding:8px;
}
.brand-name{font-weight:800;font-size:20px}
.brand-sub{font-size:13px;color:rgba(255,255,255,.75)}
.menu{display:flex;flex-direction:column;gap:8px}
.menu-link{
    display:flex;
    align-items:center;
    gap:12px;
    color:rgba(255,255,255,.88);
    padding:14px 16px;
    border-radius:16px;
    transition:.2s ease;
}
.menu-link:hover,.menu-link.active{
    background:rgba(239,49,54,.18);
    color:#fff;
    transform:translateX(2px);
}
.sidebar-footer{
    margin-top:auto;
    padding:16px;
    border:1px solid rgba(255,255,255,.1);
    border-radius:18px;
    background:rgba(255,255,255,.04);
}
.strong{font-weight:700}
.small{font-size:12px}
.muted{color:var(--muted)}

.main{
    padding:28px;
}
.topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
    margin-bottom:20px;
}
.topbar h1{font-size:30px;font-weight:800}
.topbar-right{
    display:flex;
    gap:14px;
    align-items:center;
}
.user-chip{
    display:flex;
    gap:10px;
    align-items:center;
    background:var(--card);
    padding:8px 12px;
    border:1px solid var(--border);
    border-radius:999px;
    box-shadow:var(--shadow);
}
.user-avatar{
    width:38px;height:38px;border-radius:50%;
    display:grid;place-items:center;
    font-weight:800;color:#fff;
    background:linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.menu-toggle{
    display:none;
    border:0;
    background:var(--card);
    border-radius:12px;
    width:44px;height:44px;
    font-size:20px;cursor:pointer;
    box-shadow:var(--shadow);
}
.content{display:flex;flex-direction:column;gap:20px}
.grid{display:grid;gap:20px}
.cards-4{grid-template-columns:repeat(4,1fr)}
.two-col{grid-template-columns:1.15fr .85fr}
.card{
    background:var(--card);
    border:1px solid rgba(17,24,39,.06);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    padding:22px;
}
.form-card{max-width:1000px}
.card-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin-bottom:18px;
}
.card-header h2{font-size:21px;font-weight:800}
.stat-card .stat-label{color:var(--muted);font-size:14px;margin-bottom:8px}
.stat-card .stat-value{font-size:34px;font-weight:900;letter-spacing:-.03em}
.stat-card.highlight{
    background:linear-gradient(135deg, rgba(239,49,54,.08), rgba(239,49,54,.02));
    border-color:rgba(239,49,54,.14);
}
.pipeline-list,.activity-list{display:flex;flex-direction:column;gap:14px}
.pipeline-head{
    display:flex;justify-content:space-between;gap:10px;
    margin-bottom:8px;font-size:14px
}
.progress{
    width:100%;height:12px;background:#edf0f4;border-radius:999px;overflow:hidden
}
.progress-bar{
    height:100%;
    border-radius:999px;
    background:linear-gradient(90deg,var(--primary),#ff6b6f);
}
.activity-item{
    display:flex;gap:12px;align-items:flex-start;
    padding-bottom:12px;border-bottom:1px solid var(--border)
}
.activity-item:last-child{border-bottom:0;padding-bottom:0}
.activity-dot{
    width:12px;height:12px;border-radius:50%;background:var(--primary);margin-top:5px;flex:none
}
.empty-state,.table-empty{
    color:var(--muted);text-align:center;padding:20px 10px
}
.table-responsive{overflow:auto}
.table{
    width:100%;
    border-collapse:collapse;
    min-width:760px;
}
.table th,.table td{
    padding:14px 12px;
    border-bottom:1px solid var(--border);
    text-align:left;
    vertical-align:top;
}
.table th{
    color:var(--muted);
    font-size:13px;
    text-transform:uppercase;
    letter-spacing:.04em;
}
.badge{
    display:inline-flex;
    padding:6px 10px;
    border-radius:999px;
    background:#fff4f4;
    color:var(--primary-dark);
    font-size:12px;
    font-weight:700;
    text-transform:capitalize;
}
.badge-stage{background:#fff0f0}
.table-actions,.actions-row{
    display:flex;gap:10px;align-items:center;flex-wrap:wrap
}
.align-end{align-self:end}
.btn,.btn-link{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    border-radius:14px;
    font-weight:700;
    transition:.2s ease;
}
.btn{
    border:0;
    cursor:pointer;
    min-height:44px;
    padding:0 16px;
}
.btn-primary{
    color:#fff;
    background:linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow:0 12px 20px rgba(239,49,54,.22);
}
.btn-primary:hover{transform:translateY(-1px)}
.btn-outline{
    background:#fff;
    border:1px solid var(--border);
    color:var(--text);
}
.btn-full{width:100%}
.btn-link{
    color:var(--primary-dark);
    padding:4px 0;
}
.btn-link.danger{color:var(--error)}
.alert{
    padding:14px 16px;
    border-radius:16px;
    border:1px solid transparent;
    font-weight:600;
}
.alert-success{
    background:#f0fdf4;border-color:#bbf7d0;color:#166534;
}
.alert-error{
    background:#fef2f2;border-color:#fecaca;color:#991b1b;
}
.filters{
    display:grid;
    grid-template-columns:2fr 1fr auto;
    gap:16px;
    margin-bottom:16px;
}
.filters-3{
    grid-template-columns:1fr 1fr auto;
}
.form-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:18px;
}
.form-group{
    display:flex;
    flex-direction:column;
    gap:8px;
}
.form-group.full,.form-actions.full{grid-column:1 / -1}
.form-group label{
    font-weight:700;
    font-size:14px;
}
input,select,textarea{
    width:100%;
    min-height:48px;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:14px;
    background:#fff;
    color:var(--text);
    outline:none;
    transition:.2s ease;
}
textarea{min-height:auto;resize:vertical}
input:focus,select:focus,textarea:focus{
    border-color:rgba(239,49,54,.45);
    box-shadow:0 0 0 4px rgba(239,49,54,.08);
}
.form-actions{
    display:flex;justify-content:flex-end;gap:12px
}
.checkbox-group{justify-content:flex-end}
.checkbox-group label{
    display:flex;gap:10px;align-items:center;
    min-height:48px
}
.checkbox-group input{
    width:18px;height:18px;min-height:18px;padding:0
}

@media (max-width: 1200px){
    .cards-4{grid-template-columns:repeat(2,1fr)}
    .two-col{grid-template-columns:1fr}
}
@media (max-width: 900px){
    .app-shell{grid-template-columns:1fr}
    .sidebar{
        position:fixed;left:-100%;top:0;bottom:0;z-index:30;width:280px;transition:.25s ease
    }
    .sidebar.open{left:0}
    .menu-toggle{display:inline-grid;place-items:center}
    .main{padding:20px}
    .topbar{align-items:flex-start}
}
@media (max-width: 760px){
    .filters,.filters-3,.form-grid,.cards-4{grid-template-columns:1fr}
    .topbar{flex-wrap:wrap}
    .topbar-right{width:100%;justify-content:space-between}
    .login-card{padding:24px}
    .login-brand{flex-direction:column;align-items:flex-start}
    .login-brand img{width:100px}
}
