/* Funeral Home Portal — branding layer on top of the Telerik Ocean Blue theme. */

:root {
    --fp-navy: #1f3a5f;
    --fp-navy-deep: #15293f;
    --fp-navy-soft: #2c4a72;
    --fp-gold: #b08d57;
    --fp-gold-soft: #c9a979;
    --fp-ink: #1c2530;
    --fp-muted: #6b7785;
    --fp-line: #e4e8ee;
    --fp-bg: #f4f6f9;
    --fp-card: #ffffff;
    --fp-shadow: 0 10px 30px rgba(21, 41, 63, .12);
    --fp-shadow-sm: 0 2px 10px rgba(21, 41, 63, .08);
}

/* ---------- Login ---------- */
.fp-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 15% -10%, rgba(176, 141, 87, .18), transparent 60%),
        radial-gradient(1000px 700px at 110% 110%, rgba(44, 74, 114, .35), transparent 55%),
        linear-gradient(160deg, var(--fp-navy-deep), var(--fp-navy) 55%, #0f1f30);
}

.fp-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--fp-card);
    border-radius: 18px;
    box-shadow: var(--fp-shadow);
    padding: 40px 36px 32px;
    border: 1px solid rgba(255, 255, 255, .6);
}

.fp-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 26px;
}

.fp-brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(150deg, var(--fp-navy-soft), var(--fp-navy-deep));
    box-shadow: var(--fp-shadow-sm);
    margin-bottom: 14px;
}

.fp-brand-mark .k-svg-icon { width: 28px; height: 28px; }

.fp-brand h1 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.5rem;
    letter-spacing: .2px;
    color: var(--fp-ink);
    margin: 0;
}

.fp-brand .fp-sub {
    color: var(--fp-muted);
    font-size: .9rem;
    margin-top: 4px;
}

.fp-brand .fp-rule {
    width: 46px;
    height: 3px;
    border-radius: 3px;
    background: var(--fp-gold);
    margin-top: 14px;
}

.fp-field { margin-bottom: 16px; }
.fp-field label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--fp-ink);
    margin-bottom: 6px;
}
.fp-field .k-input, .fp-field .k-textbox { width: 100%; }

.fp-login .fp-submit { width: 100%; margin-top: 6px; }

.fp-error {
    background: #fdecec;
    color: #a4262c;
    border: 1px solid #f3c0c2;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: .86rem;
    margin-bottom: 16px;
}

.fp-login-foot {
    text-align: center;
    color: var(--fp-muted);
    font-size: .78rem;
    margin-top: 22px;
}

/* ---------- App shell: fixed sidebar + main column ---------- */
.fp-app { display: flex; min-height: 100vh; background: var(--fp-bg); }

/* Sidebar (SalasMaster-style dark rail, dynamic menu) */
.fp-side {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--fp-navy-deep), #0f2236);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.fp-side-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.fp-side-logo {
    width: 38px; height: 38px; border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    display: grid; place-items: center; color: var(--fp-gold-soft);
    flex-shrink: 0;
}
.fp-side-title { font-family: Georgia, 'Times New Roman', serif; font-size: 1.05rem; font-weight: 600; line-height: 1.1; }
.fp-side-sub { font-size: .72rem; color: rgba(255, 255, 255, .5); margin-top: 2px; }

.fp-side-nav { flex: 1; overflow-y: auto; padding: 10px 12px 18px; }

/* Collapsible group header (clickable, with chevron) */
.fp-side-group {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: transparent; border: none; cursor: pointer; text-align: left;
    color: rgba(255, 255, 255, .55);
    padding: 10px 12px 6px;
    font-size: .68rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
}
.fp-side-group:hover { color: #fff; }
.fp-side-group.lvl1 {
    text-transform: none; letter-spacing: normal; font-size: .82rem; font-weight: 600;
    color: rgba(255, 255, 255, .7); padding: 8px 12px;
}
.fp-side-chev { width: 14px; height: 14px; display: grid; place-items: center; transition: transform .15s; }
.fp-side-chev svg { width: 14px; height: 14px; }
.fp-side-chev.open { transform: rotate(90deg); }
.fp-side-grouplabel { flex: 1; }
.fp-side-children { display: flex; flex-direction: column; }
.fp-side-item.lvl1 { padding-left: 22px; }
.fp-side-item.lvl2 { padding-left: 34px; font-size: .86rem; }
.fp-side-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; margin: 1px 0;
    border-radius: 9px;
    color: rgba(255, 255, 255, .78);
    text-decoration: none; font-size: .9rem; font-weight: 500;
    cursor: pointer;
}
.fp-side-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.fp-side-item.active {
    background: rgba(255, 255, 255, .12);
    color: #fff; font-weight: 600;
    box-shadow: inset 3px 0 0 var(--fp-gold);
}
.fp-side-item.disabled { color: rgba(255, 255, 255, .34); cursor: default; }
.fp-side-item.disabled:hover { background: transparent; color: rgba(255, 255, 255, .34); }
.fp-side-ico { width: 20px; height: 20px; display: grid; place-items: center; flex-shrink: 0; }
.fp-side-ico svg { width: 20px; height: 20px; }
.fp-side-label { flex: 1; }
.fp-side-soon {
    font-size: .6rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
    background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .55);
    padding: 1px 6px; border-radius: 6px;
}
.fp-side-foot {
    padding: 14px 20px; font-size: .72rem; color: rgba(255, 255, 255, .4);
    border-top: 1px solid rgba(255, 255, 255, .08);
}

/* Main column */
.fp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fp-appbar {
    height: 62px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    background: var(--fp-card);
    border-bottom: 1px solid var(--fp-line);
}
.fp-appbar-title { font-weight: 600; color: var(--fp-ink); font-size: 1rem; }
.fp-appbar-user { display: flex; align-items: center; gap: 12px; }
.fp-appbar-meta { text-align: right; line-height: 1.2; }
.fp-appbar-name { font-size: .85rem; font-weight: 600; color: var(--fp-ink); }
.fp-appbar-role { font-size: .72rem; color: var(--fp-muted); }
.fp-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--fp-gold); color: var(--fp-navy-deep);
    display: grid; place-items: center; font-weight: 700; font-size: .82rem;
}

.fp-content { padding: 28px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* Collapse the sidebar to a top strip on narrow screens (phones) */
@media (max-width: 640px) {
    .fp-app { flex-direction: column; }
    .fp-side { width: 100%; height: auto; position: static; flex-direction: column; }
    .fp-side-nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .fp-side-grouphead { width: 100%; padding: 8px 12px 2px; }
}

.fp-page-head { margin-bottom: 20px; }
.fp-head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.fp-src { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.fp-src::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.fp-src-coroner { background: #e8f1fb; color: #1f6fb2; }
.fp-src-manual { background: #f2eef9; color: #6b4bb0; }
.fp-page-head h2 {
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--fp-ink);
    margin: 0 0 2px;
}
.fp-page-head p { color: var(--fp-muted); margin: 0; font-size: .9rem; }

/* ---------- KPI cards ---------- */
.fp-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.fp-kpi {
    background: var(--fp-card);
    border: 1px solid var(--fp-line);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--fp-shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}
.fp-kpi .fp-kpi-icon {
    width: 46px; height: 46px; border-radius: 12px;
    display: grid; place-items: center; color: #fff;
}
.fp-kpi .fp-kpi-icon .k-svg-icon { width: 24px; height: 24px; }
.fp-kpi-total .fp-kpi-icon { background: var(--fp-navy-soft); }
.fp-kpi-ready .fp-kpi-icon { background: #2f8f6b; }
.fp-kpi-hold .fp-kpi-icon  { background: #c08a2e; }
.fp-kpi .fp-kpi-value { font-size: 1.7rem; font-weight: 700; color: var(--fp-ink); line-height: 1; }
.fp-kpi .fp-kpi-label { color: var(--fp-muted); font-size: .82rem; margin-top: 4px; }

/* ---------- Grid card + status badges ---------- */
.fp-grid-card {
    background: var(--fp-card);
    border: 1px solid var(--fp-line);
    border-radius: 14px;
    box-shadow: var(--fp-shadow-sm);
    overflow: hidden;
}

.fp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.4;
}
.fp-badge::before {
    content: "";
    width: 7px; height: 7px; border-radius: 50%;
    background: currentColor;
}
.fp-badge-new       { background: #eef2f7; color: #4a5b70; }
.fp-badge-active    { background: #e8f1fb; color: #1f6fb2; }
.fp-badge-ready     { background: #e7f5ee; color: #1f8a5b; }
.fp-badge-hold      { background: #fdeede; color: #b3791a; }
.fp-badge-released  { background: #eee9f7; color: #6b4bb0; }
.fp-badge-completed { background: #eef0f2; color: #5a6675; }
.fp-badge-closed    { background: #eef0f2; color: #8893a1; }

.fp-hold-flag { color: #b3791a; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .82rem; }
.fp-hold-no { color: var(--fp-muted); font-size: .82rem; }

/* clickable grid rows */
.fp-grid-card .k-grid tr.k-master-row { cursor: pointer; }

/* Document thumbnails stay bounded so long file metadata does not inflate grid rows. */
.fp-doc-thumb {
    display: block;
    width: 64px;
    height: 64px;
    max-width: 64px;
    max-height: 64px;
    object-fit: contain;
}
.fp-doc-thumb-button {
    min-width: 64px !important;
    min-height: 64px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}
.fp-doc-thumb-file {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    border-radius: 4px;
    background: #f1f3f5;
    color: var(--fp-muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
}
.fp-doc-thumb-file .k-svg-icon { width: 25px; height: 25px; }
.fp-doc-thumb-file.pdf { color: #b42318; background: #fff0ee; }
.fp-doc-thumb-file.doc { color: #2456a6; background: #edf3ff; }
.fp-doc-thumb-file.xls { color: #23734f; background: #edf8f1; }
.fp-doc-preview-window { position: fixed !important; right: 0 !important; left: auto !important; top: 0 !important; height: 100vh !important; max-height: 100vh !important; }
.fp-doc-preview-window .k-window-content { display: flex; flex-direction: column; min-height: 0; padding: 0; }
.fp-doc-preview-window .k-window-footer { padding: 10px 14px; }
.fp-doc-preview-title { display: block; max-width: min(560px, 70vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-doc-preview-content { display: flex; flex: 1 1 auto; min-height: 0; align-items: center; justify-content: center; overflow: auto; background: #20242a; }
.fp-doc-preview-image { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.fp-doc-preview-frame { width: 100%; height: 100%; min-height: 0; border: 0; background: #fff; }
.fp-doc-preview-message { padding: 24px; color: #fff; text-align: center; }
.fp-doc-preview-message.fp-error { color: #ffd4d4; }
.fp-doc-preview-actions { display: flex; align-items: center; gap: 8px; width: 100%; }
.fp-doc-preview-count { color: var(--fp-muted); font-size: .82rem; white-space: nowrap; }
.fp-doc-preview-spacer { flex: 1 1 auto; }
@media (max-width: 640px) {
    .fp-doc-preview-window { width: 100vw !important; }
    .fp-doc-preview-actions { gap: 4px; }
}

/* date+time grid cell (date big, time smaller below) */
.fp-dt { line-height: 1.25; }
.fp-dt-date { font-size: .88rem; color: var(--fp-ink); font-weight: 500; }
.fp-dt-time { font-size: .72rem; color: var(--fp-muted); }
.fp-dt-empty { color: #aab3bf; }

/* ---------- Cases filter bar ---------- */
.fp-filters {
    background: var(--fp-card); border: 1px solid var(--fp-line); border-radius: 14px;
    box-shadow: var(--fp-shadow-sm); padding: 16px 18px; margin-bottom: 16px;
}
.fp-filters-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px 16px; align-items: end;
}
.fp-filters-grid label { display: block; font-size: .78rem; font-weight: 600; color: var(--fp-ink); margin-bottom: 4px; }
.fp-filters-actions { display: flex; gap: 8px; margin-top: 14px; }
.fp-period-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-top: 12px; }
.fp-period-row > div > label { display: block; font-size: .78rem; font-weight: 600; color: var(--fp-ink); margin-bottom: 4px; }
.fp-period-err { align-self: center; color: #a4262c; font-size: .82rem; font-weight: 600; }

/* ---------- Case detail ---------- */
.fp-back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--fp-navy-soft); font-size: .85rem; font-weight: 600;
    text-decoration: none; margin-bottom: 14px;
}
.fp-back:hover { color: var(--fp-navy-deep); }

.fp-detail-head {
    background: var(--fp-card);
    border: 1px solid var(--fp-line);
    border-radius: 14px;
    box-shadow: var(--fp-shadow-sm);
    padding: 22px 24px;
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.fp-detail-head h2 {
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--fp-ink);
    margin: 0 0 4px;
}
.fp-detail-head .fp-sub2 { color: var(--fp-muted); font-size: .88rem; }
.fp-detail-head .fp-headmeta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.fp-chip {
    background: #eef2f7; color: #4a5b70;
    padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600;
}

.fp-card {
    background: var(--fp-card);
    border: 1px solid var(--fp-line);
    border-radius: 14px;
    box-shadow: var(--fp-shadow-sm);
    padding: 20px 24px;
    margin-bottom: 18px;
}
.fp-card h3 {
    font-size: .95rem; color: var(--fp-ink); margin: 0 0 16px;
    text-transform: uppercase; letter-spacing: .4px;
}
.fp-card h3 .fp-accent { color: var(--fp-gold); }

.fp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.fp-form-grid .full { grid-column: 1 / -1; }
.fp-form-grid label { display: block; font-size: .8rem; font-weight: 600; color: var(--fp-ink); margin-bottom: 5px; }

/* logo / photo upload */
.fp-media-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.fp-media-thumb {
    width: 96px; height: 96px; border-radius: 12px; border: 1px solid var(--fp-line);
    background: #f6f8fa; display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
}
.fp-media-thumb img { width: 100%; height: 100%; object-fit: contain; }
.fp-media-empty { color: var(--fp-muted); font-size: .8rem; }
.fp-media-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fp-media-busy { color: var(--fp-muted); font-size: .82rem; }
.fp-upload-btn {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    background: var(--fp-navy); color: #fff; font-size: .85rem; font-weight: 600;
    padding: 8px 16px; border-radius: 8px; position: relative; overflow: hidden;
}
.fp-upload-btn:hover { background: var(--fp-navy-deep); }
.fp-upload-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* modern drag-and-drop zone */
.fp-dropzone {
    position: relative; border: 2px dashed #cdd6e0; border-radius: 12px; background: #f6f8fa;
    transition: border-color .15s, background .15s; overflow: hidden;
}
.fp-dropzone:hover { border-color: var(--fp-navy-soft); background: #eef2f7; }
.fp-dropzone.dragover { border-color: var(--fp-navy); background: #e6eef8; }
.fp-dropzone.busy { opacity: .65; }
.fp-dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.fp-dropzone-inner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; pointer-events: none; }
.fp-dropzone-ico { width: 34px; height: 34px; color: var(--fp-navy-soft); flex-shrink: 0; }
.fp-dropzone-ico svg { width: 34px; height: 34px; }
.fp-dropzone-text strong { display: block; color: var(--fp-ink); font-size: .9rem; }
.fp-dropzone-text span { color: var(--fp-muted); font-size: .8rem; }
.fp-modal-foot { display: flex; justify-content: flex-end; gap: 8px; }
.fp-modal-hint { margin-top: 14px; font-size: .76rem; color: var(--fp-muted); text-align: right; }
.fp-modal-hint kbd {
    font-family: inherit; font-size: .72rem; font-weight: 600; color: var(--fp-ink);
    background: #f1f4f8; border: 1px solid var(--fp-line); border-bottom-width: 2px;
    border-radius: 5px; padding: 1px 6px;
}
.fp-saved { background: #e7f5ee; color: #1f8a5b; border: 1px solid #cdeadd; border-radius: 10px; padding: 12px 14px; font-size: .86rem; margin-bottom: 16px; }

.fp-detail-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}
.fp-kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; }
.fp-kv dt { color: var(--fp-muted); font-size: .82rem; }
.fp-kv dd { color: var(--fp-ink); font-size: .9rem; margin: 0; font-weight: 500; }
.fp-kv dd.empty { color: #aab3bf; font-weight: 400; }

.fp-step-meta { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.fp-step-pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 12px; border-radius: 10px; font-size: .8rem; font-weight: 600;
    border: 1px solid var(--fp-line);
}
.fp-step-pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.fp-step-done .dot { background: #2f8f6b; }
.fp-step-current .dot { background: #1f6fb2; }
.fp-step-pending .dot { background: #c3ccd6; }
.fp-step-done { color: #1f8a5b; background: #e7f5ee; border-color: #cdeadd; }
.fp-step-current { color: #1f6fb2; background: #e8f1fb; border-color: #cfe2f6; }
.fp-step-pending { color: #8893a1; background: #f6f8fa; }

/* ---------- Roles & permissions (friendly switch editor) ---------- */
.fp-perm-layout { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.fp-roles-col { padding: 18px 16px; }
.fp-roles-list { display: flex; flex-direction: column; gap: 4px; }
.fp-role-item {
    text-align: left; border: 1px solid transparent; background: transparent; cursor: pointer;
    padding: 10px 12px; border-radius: 9px; font-size: .9rem; font-weight: 600; color: var(--fp-ink);
}
.fp-role-item:hover { background: var(--fp-bg); }
.fp-role-item.active { background: #e8f1fb; color: #1f6fb2; border-color: #cfe2f6; }

.fp-perm-col { padding: 20px 22px; }
.fp-perm-hint { color: var(--fp-muted); font-size: .82rem; margin: 0 0 12px; }
.fp-saved-inline { color: #1f8a5b; font-weight: 600; font-size: .85rem; }

.fp-perm-group {
    font-size: .72rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
    color: var(--fp-muted); margin: 18px 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--fp-line);
}
.fp-perm-group:first-of-type { margin-top: 4px; }
.fp-perm-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 10px 4px; border-bottom: 1px solid #f1f4f8; flex-wrap: wrap;
}
.fp-perm-name { display: flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 500; color: var(--fp-ink); }
.fp-perm-ico { width: 18px; height: 18px; color: var(--fp-navy-soft); display: grid; place-items: center; }
.fp-perm-ico svg { width: 18px; height: 18px; }
.fp-perm-switches { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.fp-step-num {
    display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    background: var(--fp-navy-soft); color: #fff; font-size: .72rem; font-weight: 700; flex-shrink: 0;
}
.fp-step-num-off { display: inline-grid; place-items: center; width: 22px; height: 22px; color: #c3ccd6; flex-shrink: 0; }
.fp-trigger { color: var(--fp-gold); font-size: .9rem; }
.fp-tree { background: #0f2236; color: #d7e2ee; border-radius: 10px; padding: 14px 16px; font-size: .82rem; line-height: 1.6; overflow-x: auto; margin: 0; }

/* ---------- Workflow steps maintenance (drag-and-drop list) ---------- */
.fp-steps-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.fp-step-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--fp-card); border: 1px solid var(--fp-line); border-radius: 12px;
    padding: 12px 14px; box-shadow: var(--fp-shadow-sm); cursor: default;
}
.fp-step-card.dragging { opacity: .5; border-style: dashed; border-color: var(--fp-navy-soft); }
.fp-step-handle { cursor: grab; color: #aab3bf; font-size: 1.2rem; line-height: 1; user-select: none; }
.fp-step-handle:active { cursor: grabbing; }
.fp-step-order {
    width: 26px; height: 26px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%;
    background: var(--fp-navy-soft); color: #fff; font-size: .8rem; font-weight: 700;
}
.fp-step-main { flex: 1; min-width: 0; }
.fp-step-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--fp-ink); }
.fp-step-codeline { font-size: .76rem; color: var(--fp-muted); margin-top: 2px; }
.fp-step-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ---------- Case hub: persistent timeline + tab bar ---------- */
.fp-timeline-card { position: sticky; top: 0; z-index: 5; }
.fp-tabs {
    display: flex; gap: 4px; flex-wrap: wrap;
    border-bottom: 1px solid var(--fp-line); margin: 4px 0 18px;
}
.fp-tab {
    display: inline-flex; align-items: center; gap: 8px;
    background: transparent; border: none; cursor: pointer;
    padding: 10px 16px; border-radius: 10px 10px 0 0;
    color: var(--fp-muted); font-size: .9rem; font-weight: 600;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.fp-tab:hover { background: #eef2f7; color: var(--fp-ink); }
.fp-tab.active { color: var(--fp-navy); border-bottom-color: var(--fp-gold); background: #fff; }
.fp-tab-ico { width: 18px; height: 18px; display: grid; place-items: center; }
.fp-tab-ico svg { width: 18px; height: 18px; }
.fp-tab-body { min-height: 200px; }

/* ---------- Documents ---------- */
.fp-doc-case { color: var(--fp-navy-soft); cursor: pointer; font-weight: 600; text-decoration: none; }
.fp-doc-case:hover { text-decoration: underline; }
.fp-doc-caseno { font-size: .74rem; color: var(--fp-muted); margin-top: 2px; }

/* ---------- Messages thread + compose ---------- */
.fp-msg-thread { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; padding: 8px 4px; margin-bottom: 12px; }
.fp-msg-row { display: flex; }
.fp-msg-row.out { justify-content: flex-end; }
.fp-msg-row.in { justify-content: flex-start; }
.fp-msg-bubble { max-width: 72%; padding: 8px 12px; border-radius: 12px; border: 1px solid #e2e8f0; }
.fp-msg-bubble.out { background: #eff6ff; border-color: #bfdbfe; }
.fp-msg-bubble.in { background: #f8fafc; }
.fp-msg-meta { font-size: .72rem; color: #64748b; margin-bottom: 2px; }
.fp-msg-text { white-space: pre-wrap; word-break: break-word; }
.fp-msg-compose { display: flex; gap: 8px; align-items: flex-end; }
.fp-msg-compose .k-textarea { flex: 1; }

/* ---------- Family billing ---------- */
.fp-billing-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.fp-billing-tabs .fp-role-item { width: auto; padding: 8px 18px; }
.fp-line-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px; }
.fp-line-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.fp-line-table th, .fp-line-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid #eef0f2; }
.fp-line-table tfoot td { border-bottom: none; }

/* ---------- Reports KPIs + chart grid (renamed to avoid clashing with dashboard .fp-kpi) ---------- */
.fp-rep-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.fp-rep-kpi { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.fp-rep-kpi-num { font-size: 32px; font-weight: 700; line-height: 1; color: var(--fp-ink); }
.fp-rep-kpi-label { font-size: 13px; color: var(--fp-muted); }
.fp-report-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.fp-report-grid h3 { margin: 0 0 10px; }
@media (max-width: 900px) { .fp-rep-kpi-row { grid-template-columns: repeat(2, 1fr); } .fp-report-grid { grid-template-columns: 1fr; } }
.fp-sw { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--fp-muted); font-weight: 600; }
.fp-perm-save { margin-top: 20px; }

@media (max-width: 760px) {
    .fp-perm-layout { grid-template-columns: 1fr; }
    .fp-roles-list { flex-direction: row; flex-wrap: wrap; }
}

/* AR aging strip */
.fp-aging { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.fp-aging-cell { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; text-align: center; }
.fp-aging-amt { font-size: 1.15rem; font-weight: 700; color: #111827; }
.fp-aging-lab { font-size: .78rem; color: #6b7280; margin-top: 2px; }
.fp-aging-bad { background: #fef2f2; border-color: #fecaca; }
.fp-aging-bad .fp-aging-amt { color: #b91c1c; }
@media (max-width: 760px) { .fp-aging { grid-template-columns: repeat(2, 1fr); } }

/* Owed KPI accent */
.fp-kpi-owed .fp-kpi-icon { color: #b45309; background: #fffbeb; }

/* Interactive timeline steps */
.fp-step-click { cursor: pointer; user-select: none; }
.fp-step-click:hover { filter: brightness(0.95); box-shadow: 0 0 0 2px #e5e7eb; }
.fp-step-pill.sel { box-shadow: 0 0 0 2px #2563eb; }
.fp-step-panel { margin-top: 12px; border-top: 1px solid #e5e7eb; padding-top: 12px; }

/* Custom fields: section titles + designer preview */
.fp-cf-section { font-weight: 700; font-size: .92rem; color: #374151; border-bottom: 1px dashed #d1d5db; padding-bottom: 4px; margin-top: 6px; }
.fp-step-card.fp-cf-title { background: #f0fdf4; border-color: #bbf7d0; }
.fp-cf-preview { border: 1px dashed #d1d5db; border-radius: 8px; padding: 12px; background: #fafafa; }
.fp-cf-preview-title { font-weight: 700; color: #374151; border-bottom: 1px dashed #d1d5db; padding-bottom: 4px; }
.fp-cf-preview-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.fp-cf-preview-label { font-size: .8rem; color: #6b7280; margin-bottom: 3px; }
.fp-cf-preview-input { border: 1px solid #d1d5db; border-radius: 6px; background: #fff; height: 30px; padding: 4px 8px; font-size: .82rem; color: #9ca3af; }

/* Custom fields: 6-unit layout grid (Third=2, Half=3, Full=6) */
.fp-cf-grid6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px 18px; }
.fp-cf-grid6 label { display: block; font-size: .8rem; font-weight: 600; color: var(--fp-ink); margin-bottom: 5px; }
@media (max-width: 700px) { .fp-cf-grid6 { grid-template-columns: 1fr; } .fp-cf-grid6 > div { grid-column: 1 / -1 !important; } }

/* Drawn signature pad */
.fp-sigpad { border: 1px dashed #9ca3af; border-radius: 8px; background: #fff; overflow: hidden; }
.fp-sigpad canvas { display: block; background: #fff; cursor: crosshair; }
.fp-sigpad-foot { display: flex; justify-content: space-between; align-items: center; padding: 2px 8px; border-top: 1px solid #e5e7eb; background: #f9fafb; }
.fp-sigpad-hint { font-size: .75rem; color: #9ca3af; }
