/* =====================================================================
   SPMS — Sales Progress Monitoring System
   Professional blue / white / gray theme
   ===================================================================== */
:root {
    --brand:        #1d4ed8;   /* primary blue */
    --brand-dark:   #1e3a8a;
    --brand-light:  #eff4ff;
    --sidebar-bg:   #0f1b3d;
    --sidebar-bg2:  #16245a;
    --ink:          #1f2937;
    --muted:        #6b7280;
    --line:         #e5e7eb;
    --bg:           #f4f6fb;
    --card:         #ffffff;
    --radius:       14px;
    --shadow:       0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
    --shadow-md:    0 4px 16px rgba(16,24,40,.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
}

/* ---- Layout shell --------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg2));
    color: #cdd6f4;
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    transition: transform .25s ease;
}
.main { flex: 1; margin-left: 250px; min-width: 0; display: flex; flex-direction: column; }

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 22px; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 26px; color: #60a5fa; }
.sidebar-brand .brand-title { font-weight: 700; font-size: 19px; display: block; line-height: 1; }
.sidebar-brand small { color: #93a4d4; font-size: 11px; }

.sidebar-nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 12px;
    color: #c7d0ee; padding: 10px 14px; border-radius: 10px;
    font-weight: 500; margin-bottom: 3px; text-decoration: none;
    transition: background .15s, color .15s;
}
.sidebar-nav .nav-link i { font-size: 17px; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(29,78,216,.4); }
.nav-section {
    text-transform: uppercase; font-size: 10.5px; letter-spacing: .08em;
    color: #6f7fb3; margin: 16px 14px 6px; font-weight: 700;
}
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot a {
    display: flex; align-items: center; gap: 8px; color: #93a4d4;
    font-size: 12.5px; padding: 5px 0; text-decoration: none;
}
.sidebar-foot a:hover { color: #fff; }

/* ---- Topbar --------------------------------------------------------- */
.topbar {
    height: 64px; background: var(--card);
    display: flex; align-items: center; gap: 14px;
    padding: 0 24px; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 1030;
}
.page-title { font-size: 18px; font-weight: 700; margin: 0; flex: 1; }
.btn-toggle { display: none; background: none; border: 0; font-size: 22px; color: var(--ink); }
.user-chip {
    display: flex; align-items: center; gap: 10px; background: none; border: 0;
    padding: 5px 8px; border-radius: 10px;
}
.user-chip:hover { background: var(--brand-light); }
.user-chip::after { margin-left: 4px; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--brand); color: #fff; font-weight: 700;
    display: grid; place-items: center;
}
.user-meta { text-align: left; line-height: 1.15; }
.user-meta strong { display: block; font-size: 13px; }
.user-meta small { color: var(--muted); font-size: 11px; }

/* ---- Content -------------------------------------------------------- */
.content { padding: 26px; flex: 1; }

/* ---- Cards ---------------------------------------------------------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-title { font-weight: 700; }
.section-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---- Stat cards ----------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.stat {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat .stat-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .stat-value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat .stat-icon {
    position: absolute; right: 14px; top: 14px; width: 40px; height: 40px;
    border-radius: 11px; display: grid; place-items: center; font-size: 19px;
    background: var(--brand-light); color: var(--brand);
}
.stat.stat-accent { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; }
.stat.stat-accent .stat-label, .stat.stat-accent .stat-value { color: #fff; }
.stat.stat-accent .stat-icon { background: rgba(255,255,255,.18); color: #fff; }

/* ---- Status / priority badges (soft style) ------------------------- */
.badge-status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
    line-height: 1.4; white-space: nowrap;
}
.s-secondary { background: #eef0f3; color: #4b5563; }
.s-info      { background: #e0f2fe; color: #0369a1; }
.s-primary   { background: #e0e7ff; color: #3730a3; }
.s-success   { background: #dcfce7; color: #15803d; }
.s-danger    { background: #fee2e2; color: #b91c1c; }
.s-warning   { background: #fef3c7; color: #b45309; }
.s-teal      { background: #ccfbf1; color: #0f766e; }
.s-dark      { background: #e2e3e7; color: #1f2937; }

/* ---- Kanban --------------------------------------------------------- */
.kanban {
    display: flex; gap: 16px; overflow-x: auto; padding-bottom: 14px;
    align-items: flex-start;
}
.kanban-col {
    flex: 0 0 290px; background: #eef1f7; border-radius: var(--radius);
    border: 1px solid var(--line);
}
.kanban-col-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; font-weight: 700; border-bottom: 2px solid var(--line);
}
.kanban-col-head .count { background: #fff; border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.kanban-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; max-height: 72vh; overflow-y: auto; }
.kanban-card {
    background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand);
    border-radius: 10px; padding: 12px; box-shadow: var(--shadow); text-decoration: none; color: inherit;
    display: block; transition: box-shadow .15s, transform .15s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kanban-card.prio-urgent { border-left-color: #dc2626; }
.kanban-card.prio-high   { border-left-color: #f59e0b; }
.kanban-card.prio-medium { border-left-color: #0ea5e9; }
.kanban-card.prio-low    { border-left-color: #9ca3af; }
.kc-code { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kc-title { font-weight: 700; margin: 2px 0 6px; font-size: 13.5px; }
.kc-meta { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.kc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 6px; flex-wrap: wrap; }
.kc-int { display: flex; gap: 5px; }
.int-dot { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; }
.int-completed { background: #dcfce7; color: #15803d; }
.int-on_progress { background: #e0e7ff; color: #3730a3; }
.int-need_revision { background: #fee2e2; color: #b91c1c; }
.int-not_started { background: #eef0f3; color: #9ca3af; }

/* ---- Timeline ------------------------------------------------------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before {
    content: ''; position: absolute; left: -23px; top: 3px; width: 14px; height: 14px;
    border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--brand-light);
}
.tl-action { font-weight: 700; font-size: 13.5px; }
.tl-meta { color: var(--muted); font-size: 12px; }
.tl-note { background: var(--brand-light); border-radius: 8px; padding: 7px 10px; margin-top: 5px; font-size: 12.5px; }

/* ---- Integration panel --------------------------------------------- */
.int-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.int-card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--brand-light); }
.int-card-head i { font-size: 22px; color: var(--brand); }

/* ---- Comments ------------------------------------------------------- */
.comment { display: flex; gap: 10px; margin-bottom: 14px; }
.comment .avatar { width: 34px; height: 34px; font-size: 13px; flex-shrink: 0; }
.comment-body { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; flex: 1; }
.comment-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }

/* ---- Tables --------------------------------------------------------- */
.table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--line); }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--brand-light); }

/* ---- Buttons / misc ------------------------------------------------- */
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
a { color: var(--brand); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.muted { color: var(--muted); }
.aging-warn { color: #b45309; font-weight: 600; }
.aging-danger { color: #b91c1c; font-weight: 700; }

/* ---- Auth screen ---------------------------------------------------- */
.auth-body { background: linear-gradient(135deg, var(--sidebar-bg), var(--brand)); min-height: 100vh; display: grid; place-items: center; }
.auth-wrap { width: 100%; max-width: 410px; padding: 20px; }
.auth-card { background: #fff; border-radius: 18px; padding: 34px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo i { font-size: 42px; color: var(--brand); }
.auth-logo h1 { font-size: 21px; font-weight: 800; margin: 8px 0 2px; }
.auth-logo p { color: var(--muted); font-size: 13px; margin: 0; }
.demo-creds { font-size: 12px; color: var(--muted); background: var(--brand-light); border-radius: 10px; padding: 10px 12px; margin-top: 18px; }

/* ---- Responsive ----------------------------------------------------- */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .btn-toggle { display: block; }
    .user-meta { display: none; }
}
