/* InsuranceHub design system — compact, card based (same approach as Salon), InsuranceHub's own blue/purple palette. */
:root {
    --ih-bg: #f4f6fb;
    --ih-surface: #ffffff;
    --ih-border: #e1e6f0;
    --ih-hover: #eef2fa;
    --ih-ink: #1b2333;
    --ih-muted: #667085;
    --ih-primary: #1f5fbf;
    --ih-primary-dark: #184c99;
    --ih-primary-soft: #e8f0fc;
    --ih-danger: #b42318;
    --ih-success: #157f3b;
    --ih-warn: #b45309;
    --ih-radius: 10px;

    --bs-body-font-size: 0.875rem;
    --bs-body-line-height: 1.45;
    --bs-body-bg: var(--ih-bg);
    --bs-body-color: var(--ih-ink);
    --bs-link-color: var(--ih-primary);
    --bs-link-hover-color: var(--ih-primary-dark);
    --bs-primary: var(--ih-primary);
    --bs-primary-rgb: 31, 95, 191;
    --bs-border-color: var(--ih-border);
}

html, body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    /* Syncfusion's filter/dropdown popups render outside .content (appended to
       body), so .content's own overflow-x:auto can't contain them — a popup
       opened near a wide, unscrolled grid can force the whole document to scroll
       horizontally, which drags the sticky sidebar off-screen to the left (sticky
       only pins vertically). `clip` (not `hidden`) prevents that without turning
       html/body into a scroll container — `hidden`/`auto` do, and that breaks
       position:sticky by giving it the wrong scrolling ancestor. */
    overflow-x: clip;
}

a, .btn-link {
    color: var(--ih-primary);
}

/* ---------- headings ---------- */
h1, h2, h3, h4, h5 { font-weight: 600; line-height: 1.25; color: var(--ih-ink); }
h1 { font-size: 1.45rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1.1rem 0 0.5rem; }
h4, h5 { font-size: 0.95rem; margin: 0.9rem 0 0.4rem; }
h1:focus { outline: none; }
p { margin-bottom: 0.6rem; }
.text-muted, .form-text { color: var(--ih-muted) !important; }

.content { padding-top: 1rem; }

/* ---------- page structure ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.page-header h1 { margin: 0; }

.ih-card {
    background: var(--ih-surface);
    border: 1px solid var(--ih-border);
    border-radius: var(--ih-radius);
    padding: 0.9rem 1rem;
    margin-bottom: 0.9rem;
}

.ih-card > h2:first-child, .ih-card > h3:first-child, .ih-card-title {
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.ih-card.danger { border-color: #f3c6c2; }

/* label / value pairs in two compact columns */
.kv {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    gap: 0.35rem 1rem;
    align-items: center;
    margin: 0;
}

.kv dt { color: var(--ih-muted); font-weight: 500; font-size: 0.8rem; }
.kv dd { margin: 0; }

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.6rem 0.9rem;
}

.field-grid label, .form-label { font-size: 0.78rem; color: var(--ih-muted); margin-bottom: 0.15rem; font-weight: 500; }

.ih-pill {
    display: inline-block;
    padding: 0.1rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ---------- buttons ---------- */
.btn {
    --bs-btn-padding-y: 0.3rem;
    --bs-btn-padding-x: 0.75rem;
    --bs-btn-font-size: 0.85rem;
    --bs-btn-border-radius: 8px;
}

.btn-sm {
    --bs-btn-padding-y: 0.2rem;
    --bs-btn-padding-x: 0.55rem;
    --bs-btn-font-size: 0.8rem;
}

.btn-primary {
    --bs-btn-bg: var(--ih-primary);
    --bs-btn-border-color: var(--ih-primary);
    --bs-btn-hover-bg: var(--ih-primary-dark);
    --bs-btn-hover-border-color: var(--ih-primary-dark);
    --bs-btn-active-bg: var(--ih-primary-dark);
    --bs-btn-active-border-color: var(--ih-primary-dark);
    --bs-btn-disabled-bg: var(--ih-primary);
    --bs-btn-disabled-border-color: var(--ih-primary);
    color: #fff;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(31, 95, 191, 0.22);
}

/* ---------- forms ---------- */
.form-control, .form-select {
    font-size: 0.875rem;
    padding: 0.32rem 0.6rem;
    border-radius: 8px;
    border-color: var(--ih-border);
}

/* --bs-body-bg is now the grey page background: inputs stay white. */
.form-control, .form-select { background-color: var(--ih-surface); }
.form-control:disabled, .form-select:disabled { background-color: var(--ih-hover); }
.form-select { padding-right: 2rem; }
.form-control-sm, .form-select-sm { padding: 0.2rem 0.5rem; font-size: 0.8rem; }

.form-floating > .form-control, .form-floating > .form-select {
    height: calc(2.9rem + 2px);
    min-height: calc(2.9rem + 2px);
    padding: 1.35rem 0.6rem 0.3rem;
    line-height: 1.25;
}

.form-floating > label { padding: 0.75rem 0.6rem; font-size: 0.85rem; }

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    transform: scale(0.8) translateY(-0.55rem) translateX(0.15rem);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.mb-3 { margin-bottom: 0.7rem !important; }

/* ---------- tables ---------- */
.table {
    --bs-table-bg: transparent;
    --bs-table-cell-padding-y: 0.4rem;
    --bs-table-cell-padding-x: 0.65rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.table > thead > tr > th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ih-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--ih-border);
    background: transparent;
}

.table > :not(caption) > * > * { border-bottom-color: var(--ih-border); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--ih-hover); }

.table-wrap {
    background: var(--ih-surface);
    border: 1px solid var(--ih-border);
    border-radius: var(--ih-radius);
    overflow-x: auto;
}

.table-wrap > .table { margin: 0; }

/* Bootstrap components that took the (now grey) page background as their own */
.list-group { --bs-list-group-bg: var(--ih-surface); }
.card { --bs-card-bg: var(--ih-surface); }
.modal-content { --bs-modal-bg: var(--ih-surface); }
.dropdown-menu { --bs-dropdown-bg: var(--ih-surface); }
.kv dd { min-width: 0; }
.kv .form-select { max-width: 100%; }

/* ---------- alerts ---------- */
.alert { padding: 0.55rem 0.8rem; border-radius: 8px; font-size: 0.85rem; margin-bottom: 0.75rem; }
.alert p:last-child { margin-bottom: 0; }

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg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
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* "Προβολή επιχείρησης": the admin sees an insurer's application */
.imp-banner { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; background: #b45309; color: #fff; padding: 0.45rem 1rem; font-size: 0.88rem; }
.imp-banner strong { letter-spacing: 0.04em; }
.imp-banner form { margin-left: auto; }

/* ---- detail views (policy dialog, customer page): summary header, cards, label/value rows */
.pd-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 1040; }
.pd-modal {
    position: fixed; top: 5vh; left: 50%; transform: translateX(-50%);
    width: min(920px, 94vw); max-height: 90vh; overflow-y: auto;
    background: var(--ih-surface); border-radius: 14px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28); z-index: 1050;
}
.pd-header { display: flex; justify-content: space-between; align-items: center; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--ih-border); }
.pd-header h4 { margin: 0; font-size: 1.05rem; }
.pd-summary { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.25rem 0.25rem; }
.pd-summary-main { min-width: 0; }
.pd-eyebrow { font-size: 0.8rem; color: var(--ih-muted); }
.pd-title { font-size: 1.2rem; font-weight: 600; margin: 0.1rem 0 0.5rem; }
.pd-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pd-pill { font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.65rem; border-radius: 999px; white-space: nowrap; }
.pd-ok { background: #e6f4ea; color: var(--ih-success); }
.pd-bad { background: #fdecea; color: var(--ih-danger); }
.pd-warn { background: #fff4e5; color: var(--ih-warn); }
.pd-info { background: var(--ih-primary-soft); color: var(--ih-primary-dark); }
.pd-neutral { background: var(--ih-bg); color: var(--ih-muted); border: 1px solid var(--ih-border); }
.pd-amount { text-align: right; display: flex; flex-direction: column; }
.pd-amount span { font-size: 0.8rem; color: var(--ih-muted); }
.pd-amount strong { font-size: 1.6rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pd-body { padding: 0 1.25rem 1.25rem; }
.pd-card { background: var(--ih-bg); border-radius: 10px; padding: 0.75rem 0.9rem; min-width: 0; }
.pd-card h5 { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ih-muted); margin: 0 0 0.5rem; }
.pd-timeline-card { margin: 1rem 0 0.75rem; }
.pd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.75rem; }
.pd-row { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.875rem; padding: 0.2rem 0; }
.pd-row > span:first-child { color: var(--ih-muted); white-space: nowrap; }
.pd-row > :last-child { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.pd-row > .pd-blank { color: #b0b7c3; font-weight: 400; }
/* long codes (RF payment code): label above, the value whole on its own line */
.pd-row-stack { font-size: 0.875rem; padding: 0.2rem 0; }
.pd-row-stack > span { color: var(--ih-muted); }
.pd-code { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.pd-code > span { font-weight: 600; font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pd-text-ok { color: var(--ih-success); }
.pd-text-bad { color: var(--ih-danger); }
.pd-timeline { display: grid; grid-template-columns: repeat(4, 1fr); position: relative; }
.pd-timeline::before { content: ""; position: absolute; left: 12.5%; right: 12.5%; top: 6px; height: 2px; background: var(--ih-border); }
.pd-step { text-align: center; position: relative; display: flex; flex-direction: column; align-items: center; }
.pd-step strong { font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pd-step small { font-size: 0.75rem; color: var(--ih-muted); }
.pd-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ih-surface); border: 2px solid #9aa5b8; margin-bottom: 0.3rem; }
.pd-dot-on { background: var(--ih-primary); border-color: var(--ih-primary); }
.pd-empty { margin-top: 1rem; padding: 2rem 1rem; text-align: center; border: 1px dashed var(--ih-border); border-radius: 10px; display: flex; flex-direction: column; gap: 0.25rem; }
.pd-empty span { color: var(--ih-muted); font-size: 0.875rem; }
.pd-person { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0 0.75rem; }
.pd-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--ih-primary-soft); color: var(--ih-primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.pd-person-name { font-size: 1.05rem; font-weight: 600; }
@media (max-width: 560px) {
    .pd-code > span { white-space: normal; } /* phones: wraps between the groups of 4 */
    .pd-amount { text-align: left; }
    .pd-timeline { grid-template-columns: repeat(2, 1fr); row-gap: 0.75rem; }
    .pd-timeline::before { display: none; }
}

/* ---- actions (Ενέργειες) */
.act-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.act-filter { border: 1px solid var(--ih-border); background: var(--ih-surface); border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.875rem; color: var(--ih-ink); }
.act-filter:hover { border-color: var(--ih-primary); }
.act-filter-on { background: var(--ih-primary); border-color: var(--ih-primary); color: #fff; }
.act-filter-count { margin-left: 0.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-row { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.6rem 0.25rem; border-bottom: 1px solid var(--ih-border); }
.act-row:last-child { border-bottom: 0; }
.act-urgent { border-left: 3px solid var(--ih-danger); padding-left: 0.5rem; }
.act-check { flex-shrink: 0; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%; border: 2px solid #9aa5b8; background: var(--ih-surface); color: #fff; font-size: 0.75rem; line-height: 1; padding: 0; }
.act-check:hover:not(:disabled) { border-color: var(--ih-success); }
.act-done .act-check { background: var(--ih-success); border-color: var(--ih-success); }
.act-main { flex: 1; min-width: 0; cursor: pointer; }
.act-title { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; overflow-wrap: anywhere; }
.act-done .act-title > span:last-child { text-decoration: line-through; color: var(--ih-muted); font-weight: 400; }
.act-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; font-size: 0.8rem; color: var(--ih-muted); margin-top: 0.15rem; }
.act-overdue { color: var(--ih-danger); font-weight: 600; }
.act-empty { color: var(--ih-muted); padding: 0.75rem 0.25rem; }
.act-modal { width: min(640px, 94vw); z-index: 1070; }
.act-backdrop { z-index: 1060; } /* above a policy dialog it may be opened from */
.act-form-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.75rem; align-items: end; }
.act-urgent-toggle { padding-bottom: 0.45rem; }
.act-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.act-comments-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ih-muted); margin: 1.25rem 0 0.5rem; }
.act-comments { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.5rem; }
.act-comments li { background: var(--ih-bg); border-radius: 10px; padding: 0.5rem 0.75rem; }
.act-comment-head { font-size: 0.8rem; color: var(--ih-muted); }
.act-comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.act-comment-new { display: flex; gap: 0.5rem; align-items: flex-end; }
.act-comment-new textarea { flex: 1; }
@media (max-width: 560px) {
    .act-form-grid { grid-template-columns: 1fr; }
}

/* ---- customer picker */
.cp { position: relative; }
.cp-chosen { display: flex; align-items: center; gap: 0.75rem; padding: 0.4rem 0.75rem; border: 1px solid var(--ih-border); border-radius: 8px; background: var(--ih-bg); font-weight: 600; }
.cp-results { position: absolute; z-index: 5; left: 0; right: 0; margin-top: 2px; background: var(--ih-surface); border: 1px solid var(--ih-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12); max-height: 260px; overflow-y: auto; }
.cp-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; padding: 0.45rem 0.75rem; text-align: left; }
.cp-item:hover { background: var(--ih-hover); }
.cp-item span { font-size: 0.8rem; color: var(--ih-muted); }

/* ---- home: actions + birthdays */
.home-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; margin: 1rem 0 1.25rem; }
.home-panels > section { min-width: 0; margin-bottom: 0; }
.home-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.home-panel-head h2 { font-size: 1rem; margin: 0; }
.bd-list { list-style: none; margin: 0; padding: 0; }
.bd-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--ih-border); }
.bd-row:last-child { border-bottom: 0; }
.bd-day { flex-shrink: 0; width: 46px; text-align: center; border-radius: 8px; background: var(--ih-bg); padding: 0.2rem 0; line-height: 1.15; }
.bd-day strong { display: block; font-size: 1.05rem; }
.bd-day span { font-size: 0.7rem; color: var(--ih-muted); text-transform: uppercase; }
.bd-today .bd-day { background: #fff4e5; color: var(--ih-warn); }
.bd-main { flex: 1; min-width: 0; }
.bd-main a { font-weight: 600; }
.bd-sub { font-size: 0.8rem; color: var(--ih-muted); }
.bd-sms { margin-top: 0.4rem; display: grid; gap: 0.4rem; }

/* ---- pager under short lists (home panels) */
.ih-pager { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; margin-top: 0.6rem; font-size: 0.8rem; color: var(--ih-muted); }
.ih-pager span { margin-right: auto; }
