/* =====================================================================
   Lead HRMS — components on top of the shared Lead design system (app.css)
   ===================================================================== */

/* ---------- kanban board ---------- */
.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(276px, 1fr);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 12px;
    align-items: start;
    scrollbar-width: thin;
}
.kanban-col {
    background: var(--surface-2);
    border-radius: 16px;
    padding: 10px;
    min-height: 220px;
    border: 1.5px dashed transparent;
    transition: border-color .15s, background .15s;
}
.kanban-col.drop-target { border-color: var(--brand); background: var(--brand-soft); }
.kanban-head {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 6px 10px;
    font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
}
.kanban-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kanban-head .kanban-count {
    margin-left: auto; background: var(--surface); color: var(--ink-soft);
    border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 700;
}
.kanban-sum { padding: 0 6px 8px; font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.kanban-card {
    background: var(--surface); border-radius: 13px;
    box-shadow: var(--shadow); padding: 12px 13px; margin-bottom: 9px;
    cursor: grab; border-left: 3px solid transparent;
    transition: transform .12s, box-shadow .12s;
}
.kanban-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; }
.kanban-card.won { border-left-color: var(--success); }
.kanban-card.lost { border-left-color: var(--danger); }
.kanban-card.hot { border-left-color: #f97316; }
.kanban-card.rotting { border-left-color: var(--warning); }
.kanban-title { font-weight: 700; font-size: 13.8px; line-height: 1.35; margin-bottom: 3px; }
.kanban-meta { font-size: 11.8px; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kanban-value { font-weight: 800; font-size: 13.5px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.kanban-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.kanban-foot .spacer { flex: 1; }
.kanban-empty { text-align: center; color: var(--ink-faint); font-size: 12.5px; padding: 20px 8px; }

/* ---------- stage bar (deal detail) ---------- */
.stagebar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; }
.stagebar button {
    position: relative; flex: 1 1 110px; min-width: 96px;
    padding: 10px 12px 10px 20px;
    border: none; cursor: pointer; font-family: inherit;
    font-size: 12.8px; font-weight: 700; color: var(--ink-soft);
    background: var(--surface-2);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
    transition: background .15s, color .15s;
}
.stagebar button:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 10px 0 0 10px; }
.stagebar button:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 10px 10px 0; }
.stagebar button:hover { background: var(--brand-soft); color: var(--brand); }
.stagebar button.done { background: #c7d2fe; color: #3730a3; }
.stagebar button.on { background: var(--brand); color: #fff; }
.stagebar button.on.win { background: var(--success); }
.stagebar button.on.loss { background: var(--danger); }
:root[data-theme="dark"] .stagebar button.done { background: #312e81; color: #c7d2fe; }

/* ---------- score ring ---------- */
.score-ring { position: relative; width: 60px; height: 60px; flex: none; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .val {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums;
}

/* ---------- funnel ---------- */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: flex; align-items: center; gap: 12px; }
.funnel-row .f-name { width: 108px; font-size: 13px; font-weight: 600; flex: none; }
.funnel-row .f-bar { flex: 1; height: 26px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.funnel-row .f-fill {
    height: 100%; border-radius: 8px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    display: flex; align-items: center; justify-content: flex-end;
    padding-right: 9px; color: #fff; font-size: 11.5px; font-weight: 700;
    transition: width .5s ease;
}
.funnel-row .f-end { width: 108px; text-align: right; font-size: 13px; font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }

/* ---------- calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border-radius: 14px; overflow: hidden; }
.cal-dow { background: var(--surface-2); padding: 9px 6px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.cal-cell { background: var(--surface); min-height: 108px; padding: 6px 7px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell.dim { background: var(--surface-2); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-date { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.cal-cell.today .cal-date { color: var(--brand); }
.cal-ev {
    font-size: 11.2px; padding: 3px 7px; border-radius: 7px; cursor: pointer;
    background: var(--brand-soft); color: var(--brand); font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-ev.done { background: var(--success-soft); color: var(--success); text-decoration: line-through; }
.cal-ev.over { background: var(--danger-soft); color: var(--danger); }
.cal-ev.meet { background: var(--warning-soft); color: var(--warning); }

/* ---------- timeline (richer than the base) ---------- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; padding: 0 0 16px; position: relative; }
.tl-item::before {
    content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-ico {
    width: 36px; height: 36px; border-radius: 11px; flex: none;
    display: inline-flex; align-items: center; justify-content: center; z-index: 1;
}
.tl-body { flex: 1; min-width: 0; padding-top: 2px; }
.tl-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tl-title { font-weight: 650; font-size: 14px; }
.tl-when { font-size: 11.5px; color: var(--ink-faint); margin-left: auto; white-space: nowrap; }
.tl-text { font-size: 13.3px; color: var(--ink-soft); margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.tl-text.clip { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- composer ---------- */
.composer { border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.composer-tabs { display: flex; gap: 2px; padding: 6px 6px 0; background: var(--surface-2); }
.composer-tabs button {
    border: none; background: transparent; padding: 8px 14px; border-radius: 10px 10px 0 0;
    font: 600 13px Inter, system-ui; color: var(--ink-soft); cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
}
.composer-tabs button.on { background: var(--surface); color: var(--brand); }
.composer-body { padding: 12px 14px; }
.composer-foot { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.composer textarea { min-height: 110px; resize: vertical; }

/* token chips in the template editor */
.tokens { display: flex; flex-wrap: wrap; gap: 5px; }
.token {
    font: 600 11.5px ui-monospace, SFMono-Regular, Menlo, monospace;
    padding: 3px 8px; border-radius: 7px; cursor: pointer;
    background: var(--surface-2); color: var(--brand); border: 1px solid var(--line);
}
.token:hover { background: var(--brand-soft); border-color: var(--brand); }

/* email preview frame */
.mail-preview {
    border: 1.5px solid var(--line); border-radius: 12px; padding: 18px 20px;
    background: #fff; color: #1e2235; max-height: 460px; overflow: auto;
}
:root[data-theme="dark"] .mail-preview { background: #f8f9fe; }
.wa-preview {
    background: #e5ddd5; border-radius: 12px; padding: 16px; max-height: 460px; overflow: auto;
}
.wa-bubble {
    background: #dcf8c6; color: #111; border-radius: 10px 10px 2px 10px;
    padding: 9px 12px; font-size: 13.5px; max-width: 82%; margin-left: auto;
    white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.12); line-height: 1.5;
}

/* ---------- tag pills ---------- */
.tagbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-pill {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--brand-soft); color: var(--brand);
    border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 11.5px; font-weight: 700;
}
.tag-pill button { border: none; background: none; cursor: pointer; color: inherit; font-size: 13px; line-height: 1; padding: 0 2px; opacity: .7; }
.tag-pill button:hover { opacity: 1; }

/* ---------- split detail layout ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.split.wide-side { grid-template-columns: minmax(0, 1fr) 420px; }
@media (max-width: 1100px) { .split, .split.wide-side { grid-template-columns: 1fr; } }

/* ---------- record header ---------- */
.rec-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.rec-head .rec-main { flex: 1; min-width: 220px; }
.rec-head h1 { font-size: 22px; line-height: 1.2; }
.rec-sub { color: var(--ink-soft); font-size: 13.2px; margin-top: 5px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- compact stat strip ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--line); border-radius: 14px; overflow: hidden; }
.strip > div { background: var(--surface); padding: 13px 15px; }
.strip .s-k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; }
.strip .s-v { font-size: 18px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- notification bell ---------- */
.bell-dot {
    position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.notif-pop { position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; width: 360px; max-width: calc(100vw - 32px);
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
    max-height: min(520px, calc(100vh - 90px)); overflow-y: auto; animation: slideup .16s ease; }
.notif-row { display: flex; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-row:hover { background: var(--hover); }
.notif-row.unread { background: var(--brand-soft); }
.notif-row .n-t { font-weight: 650; font-size: 13.5px; }
.notif-row .n-b { font-size: 12.3px; color: var(--ink-faint); }

/* ---------- quotation print ---------- */
.quote-sheet { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 34px; }
.quote-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid var(--line); padding-bottom: 16px; }
.quote-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
@media print {
    .quote-sheet { box-shadow: none; padding: 0; }
    .kanban, .composer, .tabbar { display: none !important; }
}

.tint-gray { background: var(--surface-2); color: var(--ink-soft); }
.tint-orange { background: #fff1e6; color: #ea580c; }
:root[data-theme="dark"] .tint-orange { background: #3a2312; }

/* ---------- toast stack ---------- */
.toast-stack {
    position: fixed; bottom: 26px; right: 26px; z-index: 120;
    display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast-stack .toast { position: static; cursor: pointer; }
@media (max-width: 560px) { .toast-stack { left: 14px; right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); align-items: stretch; } }

/* ---------- misc ---------- */
.hint { font-size: 12.3px; color: var(--ink-faint); margin-top: 6px; line-height: 1.5; }
.key-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 20px; }
.key-list b { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; }
.key-list > div { font-size: 13.8px; }
.dot-sep::before { content: "·"; margin: 0 6px; color: var(--ink-faint); }
.list-scroll { max-height: 420px; overflow-y: auto; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.secret-set { color: var(--success); font-size: 12px; font-weight: 700; }
.w-100 { width: 100%; }
.gap-8 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gap-12 { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.mt-0 { margin-top: 0; }
.mt-12 { margin-top: 12px; }
.mt-18 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.flex-1 { flex: 1; min-width: 0; }

/* ---------- HRMS extras ---------- */
.att-grid { display: grid; grid-template-columns: 220px repeat(31, minmax(30px, 1fr)); gap: 2px; font-size: 11.5px; min-width: 1100px; }
.att-grid .att-name { min-width: 0; }
.att-grid .att-name { position: sticky; left: 0; background: var(--surface); padding: 6px 8px; font-weight: 600; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-grid .att-head { text-align: center; color: var(--ink-faint); font-weight: 700; padding: 4px 0; }
.att-grid .att-head.off { color: var(--danger); }
.att-cell { height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 700; font-size: 11px; border: 1px solid transparent; background: var(--surface-2); color: var(--ink-faint); user-select: none; }
.att-cell:hover { border-color: var(--brand); }
.att-cell.P { background: var(--success-soft); color: var(--success); }
.att-cell.H { background: var(--warning-soft); color: var(--warning); }
.att-cell.A { background: var(--danger-soft); color: var(--danger); }
.att-cell.L { background: var(--brand-soft); color: var(--brand); }
.att-cell.U { background: #ffe4e6; color: #be123c; }
.att-cell.W, .att-cell.HO { background: var(--surface-2); color: var(--ink-faint); }
.att-cell.WFH, .att-cell.OD { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="dark"] .att-cell.U { background: #3f1d2a; }
.punch-btn { width: 150px; height: 150px; border-radius: 50%; border: none; cursor: pointer; font: 800 18px Inter, system-ui; color: #fff; box-shadow: 0 14px 34px rgba(79,70,229,.32); background: linear-gradient(135deg, var(--brand), var(--brand-2)); transition: transform .12s; }
.punch-btn.out { background: linear-gradient(135deg, #dc2626, #f97316); box-shadow: 0 14px 34px rgba(220,38,38,.3); }
.punch-btn:active { transform: scale(.96); }
.punch-btn:disabled { opacity: .6; cursor: wait; }
.org-node { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.org-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 14px; min-width: 150px; text-align: center; border-top: 3px solid var(--brand); }
.org-card .o-name { font-weight: 700; font-size: 13.5px; }
.org-card .o-sub { font-size: 11.5px; color: var(--ink-faint); }
.org-children { display: flex; gap: 14px; justify-content: center; padding-top: 18px; position: relative; flex-wrap: wrap; }
.org-children::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 18px; background: var(--line); }
.payslip-sheet { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 32px; max-width: 900px; margin: 0 auto; }
.payslip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .payslip-cols { grid-template-columns: 1fr; } }
.leave-bal { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.leave-bal .lb { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.leave-bal .lb .n { font-size: 11.5px; color: var(--ink-faint); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.leave-bal .lb .v { font-size: 22px; font-weight: 800; }
.leave-bal .lb .s { font-size: 11.5px; color: var(--ink-faint); }
.candidate-card { border-left: 3px solid var(--brand); }
@media print { .payslip-sheet { box-shadow: none; padding: 0; max-width: none; } }

/* Blazor reconnect/error bar: hidden until the framework shows it (it sets display:block on an unhandled error) */
#blazor-error-ui { display: none; position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 2000;
    width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 12px; background: #1f2937; color: #fff; font-size: 13.5px; line-height: 1.4;
    box-shadow: 0 10px 30px rgba(0,0,0,.25); }
#blazor-error-ui .reload { color: #a5b4fc; font-weight: 600; margin-left: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; margin-left: 10px; opacity: .7; }
#blazor-error-ui .dismiss:hover { opacity: 1; }
