/*
   Kushal Insurance POSP - Unified light UI
   Aligns all application pages with POSPStatus.aspx and POSPAdminApproval.aspx.
*/
:root {
    --ui-bg: #f4f7fb;
    --ui-card: #ffffff;
    --ui-card-soft: #fbfdff;
    --ui-border: #e4eaf2;
    --ui-border-strong: #d7e0eb;
    --ui-heading: #111827;
    --ui-text: #344054;
    --ui-muted: #667085;
    --ui-faint: #8792a5;
    --ui-primary: #2563eb;
    --ui-primary-soft: #eaf1ff;
    --ui-success: #159447;
    --ui-success-soft: #ecf9f0;
    --ui-warning: #d97706;
    --ui-warning-soft: #fff8e7;
    --ui-danger: #c4322b;
    --ui-danger-soft: #fff1f0;
    --ui-violet: #6d28d9;
    --ui-violet-soft: #f5f0ff;
    --ui-shadow: 0 8px 24px rgba(15, 23, 42, .055);
    --ui-shadow-hover: 0 12px 30px rgba(15, 23, 42, .085);
    --ui-radius-lg: 18px;
    --ui-radius-md: 16px;
    --ui-radius-sm: 11px;
}

html:not(.theme-dark) body {
    background: var(--ui-bg);
}

.page-content,
.guest-content {
    color: var(--ui-text);
}

/* ---------- Shared POSP pages ---------- */
.posp-page {
    min-height: auto;
    padding: 0;
    color: var(--ui-text);
    background: transparent;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.guest-content .posp-page {
    min-height: calc(100vh - 64px);
    padding: 20px;
    background: var(--ui-bg);
}

.posp-app {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.posp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    margin-bottom: 18px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-lg);
    color: var(--ui-text);
    background: var(--ui-card);
    box-shadow: var(--ui-shadow);
}

.posp-header > div:first-child { min-width: 0; }

.posp-header h1 {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 0;
    color: var(--ui-heading);
    font-size: clamp(21px, 2vw, 27px);
    font-weight: 760;
    letter-spacing: -.025em;
}

.posp-header h1 > i {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 13px;
    color: var(--ui-primary);
    background: var(--ui-primary-soft);
    font-size: 18px;
}

.posp-header p {
    margin: 5px 0 0 57px;
    color: var(--ui-muted);
    font-size: 13px;
    line-height: 1.55;
}

.posp-content { padding: 0; }

.posp-card,
.posp-question,
.posp-section-card,
.posp-education-row,
.posp-viewer,
.posp-stat {
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-md);
    color: var(--ui-text);
    background: var(--ui-card);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .035);
}

.posp-card { padding: 20px; }
.posp-card h2,
.posp-card h3 {
    margin: 0 0 7px;
    color: var(--ui-heading);
    font-weight: 750;
    letter-spacing: -.018em;
}
.posp-card h2 { font-size: 20px; }
.posp-card h3 { font-size: 16px; }
.posp-muted { color: var(--ui-muted); font-size: 13px; line-height: 1.6; }

.posp-layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; }
.posp-module-layout { grid-template-columns: 350px minmax(0, 1fr); gap: 18px; }
.posp-admin-layout { grid-template-columns: 360px minmax(0, 1fr); gap: 18px; }
.posp-grid-2 { gap: 16px; }
.posp-grid-3 { gap: 14px; }

.posp-field { gap: 7px; margin-bottom: 15px; }
.posp-field label {
    color: var(--ui-heading);
    font-size: 12px;
    font-weight: 700;
}

.posp-input,
.posp-select,
.posp-textarea,
.posp-field input[type=text],
.posp-field input[type=tel],
.posp-field input[type=date],
.posp-field input[type=password],
.posp-field input[type=email],
.posp-field input[type=number],
.posp-field select,
.posp-field textarea {
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #d6deea;
    border-radius: var(--ui-radius-sm);
    color: var(--ui-heading);
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.posp-field textarea,
.posp-textarea { min-height: 86px; resize: vertical; }

.posp-input:focus,
.posp-field input:focus,
.posp-field select:focus,
.posp-field textarea:focus {
    border-color: #77a2f8;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .11);
}

.posp-upload {
    min-height: 100%;
    padding: 15px;
    border: 1.5px dashed #bdcadb;
    border-radius: 14px;
    background: #f9fbfe;
    transition: border-color .16s ease, background .16s ease;
}
.posp-upload:hover { border-color: #8eace2; background: #f5f9ff; }
.posp-upload input[type=file] { width: 100%; color: var(--ui-muted); font-size: 12px; }
.posp-upload input[type=file]::file-selector-button {
    margin-right: 10px;
    padding: 8px 11px;
    border: 1px solid #cfd9e7;
    border-radius: 9px;
    color: #344054;
    background: #fff;
    font: 700 11px Inter, sans-serif;
    cursor: pointer;
}

.posp-btn,
.btn,
.row-btn {
    min-height: 40px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: var(--ui-radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none !important;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.posp-btn:hover,
.btn:hover,
.row-btn:hover { transform: translateY(-1px); }
.posp-btn:focus-visible,
.btn:focus-visible,
.row-btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .18);
    outline-offset: 2px;
}
.posp-btn-primary,
.btn-primary { color: #fff; background: var(--ui-primary); box-shadow: 0 7px 16px rgba(37, 99, 235, .18); }
.posp-btn-success,
.btn-success { color: #fff; background: var(--ui-success); box-shadow: 0 7px 16px rgba(21, 148, 71, .16); }
.posp-btn-danger,
.btn-danger { color: #fff; background: var(--ui-danger); box-shadow: 0 7px 16px rgba(196, 50, 43, .15); }
.posp-btn-warning,
.btn-warning { color: #fff; background: var(--ui-warning); box-shadow: 0 7px 16px rgba(217, 119, 6, .15); }
.posp-btn-light,
.btn-light {
    color: #344054;
    border-color: #dce3ec;
    background: #fff;
    box-shadow: none;
}
.posp-btn-light:hover,
.btn-light:hover { border-color: #bfd0e5; background: #f8fbff; }

.posp-actions { align-items: center; margin-top: 18px; }

.posp-stepper {
    gap: 8px;
    padding: 10px;
    margin-bottom: 13px;
    border: 1px solid var(--ui-border);
    border-radius: 15px;
    background: var(--ui-card);
    box-shadow: 0 5px 16px rgba(15, 23, 42, .03);
}
.posp-step {
    min-height: 42px;
    display: grid;
    place-items: center;
    padding: 8px 7px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--ui-muted);
    background: #f7f9fc;
    font-size: 10.5px;
    font-weight: 650;
}
.posp-step.active {
    color: #2459b8;
    border-color: #c5d7fb;
    background: #edf4ff;
}
.posp-step.done {
    color: #137a3d;
    border-color: #bfe5cc;
    background: var(--ui-success-soft);
}

.posp-progress {
    height: 8px;
    margin-bottom: 18px;
    border-radius: 999px;
    background: #e8edf4;
}
.posp-progress > div { background: linear-gradient(90deg, #2563eb, #4f7fe5); }

.posp-review { gap: 12px; top: 84px; }
.posp-review > h3 { margin: 0 0 2px; color: var(--ui-heading); font-size: 16px; }
.posp-review-item {
    padding: 12px;
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    color: var(--ui-text);
    background: var(--ui-card-soft);
}
.posp-review-item strong {
    margin-bottom: 5px;
    color: var(--ui-faint);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
}
.posp-review-item span,
.posp-review-item label { color: var(--ui-heading); font-size: 12.5px; font-weight: 600; }

.posp-notice {
    padding: 11px 13px;
    border: 1px solid #c9d9f7;
    border-radius: 12px;
    color: #2459b8;
    background: #edf4ff;
    font-size: 12px;
    line-height: 1.55;
}
.posp-notice.success { border-color: #bfe5cc; color: #137a3d; background: var(--ui-success-soft); }
.posp-notice.error { border-color: #f2c4c0; color: #b42318; background: var(--ui-danger-soft); }
.posp-notice.warning { border-color: #f6d890; color: #a15c07; background: var(--ui-warning-soft); }

.posp-badge {
    min-height: 28px;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
}
.posp-badge.pending { color: #a15c07; border-color: #f6d890; background: var(--ui-warning-soft); }
.posp-badge.approved,
.posp-badge.done { color: #137a3d; border-color: #bfe5cc; background: var(--ui-success-soft); }
.posp-badge.rejected { color: #b42318; border-color: #f2c4c0; background: var(--ui-danger-soft); }
.posp-badge.partial { color: #2459b8; border-color: #c5d7fb; background: #edf4ff; }

.posp-preview-grid { gap: 10px; }
.posp-preview-card {
    overflow: hidden;
    padding: 7px;
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .035);
}
.posp-preview-card img { height: 105px; border-radius: 8px; }

.posp-stats { gap: 14px; margin-bottom: 18px; }
.posp-stat {
    position: relative;
    overflow: hidden;
    min-height: 108px;
    padding: 17px;
}
.posp-stat:before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
}
.posp-stat strong {
    margin-top: 8px;
    color: var(--ui-heading);
    font: 750 25px/1 "JetBrains Mono", Consolas, monospace;
}
.posp-stat span {
    color: var(--ui-faint);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.posp-module-item,
.posp-list-item {
    padding: 14px 15px;
    border-bottom: 1px solid var(--ui-border);
    color: var(--ui-text);
    background: #fff;
    transition: background .16s ease, color .16s ease;
}
.posp-module-item.active,
.posp-module-item:hover,
.posp-list-item.active,
.posp-list-item:hover { color: #2459b8; background: #edf4ff; }

.posp-viewer {
    min-height: 360px;
    padding: 24px;
    background: linear-gradient(145deg, #fbfdff, #f4f8ff);
}

.posp-question {
    padding: 18px;
    margin-bottom: 14px;
}
.posp-question > strong { color: var(--ui-heading); font-size: 14px; line-height: 1.55; }
.posp-question label {
    display: flex !important;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 11px;
    margin: 8px 0 !important;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    color: var(--ui-text);
    background: var(--ui-card-soft);
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.posp-question label:hover { border-color: #b9cff4; background: #f3f7ff; }
.posp-question input[type=radio] { margin-top: 2px; accent-color: var(--ui-primary); }

.posp-certificate {
    position: relative;
    overflow: hidden;
    max-width: 1050px;
    margin: 0 auto;
    padding: 48px;
    border: 1px solid #cdd8e6;
    border-radius: 18px;
    color: var(--ui-heading);
    background: #fff;
    box-shadow: var(--ui-shadow);
}
.posp-certificate:before,
.posp-certificate:after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(37, 99, 235, .055);
}
.posp-certificate:before { top: -120px; left: -90px; }
.posp-certificate:after { right: -90px; bottom: -120px; }
.posp-certificate > * { position: relative; z-index: 1; }

/* ---------- Secure staff pages ---------- */
.module-wrap,
.dashboard-wrap { gap: 18px; }

.module-hero,
.command-header {
    padding: 22px 24px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-lg);
    color: var(--ui-text);
    background: var(--ui-card);
    box-shadow: var(--ui-shadow);
}

.module-hero h2,
.command-header h2 {
    margin: 0;
    color: var(--ui-heading);
    font-size: clamp(21px, 2vw, 27px);
    font-weight: 760;
    letter-spacing: -.025em;
}
.module-hero p,
.command-header p { margin-top: 5px; color: var(--ui-muted); font-size: 13px; line-height: 1.55; }
.module-hero-icon,
.command-badge-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 13px;
    color: var(--ui-primary);
    background: var(--ui-primary-soft);
    font-size: 18px;
}
.command-eyebrow { margin-bottom: 6px; font-size: 9px; }
.command-badge {
    min-width: 190px;
    padding: 11px 13px;
    border-color: #d7e4fa;
    border-radius: 12px;
    background: #f8fbff;
}
.command-badge strong { font-size: 11px; }
.command-badge span { font-size: 9px; }

.summary-grid,
.stats-grid { gap: 14px; }
.summary-card,
.stat-card {
    min-height: 118px;
    padding: 17px;
    border-color: var(--ui-border);
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .035);
}
.summary-label,
.stat-card span { font-size: 9px; }
.summary-value,
.stat-card strong { font-size: 27px; }
.summary-meta { font-size: 9.5px; }
.summary-icon,
.stat-icon { width: 40px; height: 40px; flex-basis: 40px; border-radius: 11px; font-size: 15px; }

.glass-panel,
.panel-card {
    border-color: var(--ui-border);
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .035);
}
.panel-head {
    padding: 16px 18px;
    border-color: var(--ui-border);
    background: var(--ui-card-soft);
}
.panel-head h3,
.panel-title { font-size: 14px; }
.panel-kicker { font-size: 8.5px; }
.panel-body { padding: 18px; }

.quick-link { min-height: 60px; padding: 14px; border-color: var(--ui-border); border-radius: 12px; }
.quick-link strong { font-size: 12px; }
.quick-link span { font-size: 9.5px; }
.progress-meta { font-size: 11px; }
.progress-meta strong { font-size: 11px; }
.workflow-copy h3 { font-size: 14px; }
.workflow-copy p { font-size: 10.5px; }
.workflow-cell span { font-size: 8px; }
.workflow-cell strong { font-size: 14px; }

.form-field label { color: var(--ui-heading); font-size: 12px; font-weight: 700; }
.app-input,
.app-select,
.app-textarea {
    min-height: 42px;
    padding: 10px 12px;
    border-color: #d6deea;
    border-radius: 11px;
    color: var(--ui-heading);
    background: #fff;
    font-size: 13px;
}
.app-input:focus,
.app-select:focus,
.app-textarea:focus { border-color: #77a2f8; box-shadow: 0 0 0 3px rgba(37, 99, 235, .11); }
.search-row { gap: 10px; }
.app-alert { border-radius: 11px; font-size: 12px; line-height: 1.55; }
.app-actions { gap: 10px; }

.app-table { font-size: 12px; }
.app-table th {
    padding: 11px 12px;
    color: var(--ui-faint);
    background: #f8fafc;
    font-size: 9px;
    letter-spacing: .08em;
}
.app-table td { padding: 12px; color: var(--ui-text); }
.badge { min-height: 25px; padding: 5px 9px; font-size: 9.5px; }

.modal-card-app { border-radius: 17px; box-shadow: 0 25px 70px rgba(15,23,42,.22); }
.modal-head-app { padding: 16px 18px; border-color: var(--ui-border); }
.modal-head-app h3 { font-size: 16px; }
.modal-body-app { padding: 18px; }

/* ---------- Dark theme remains optional ---------- */
.theme-dark {
    --ui-bg: #07101f;
    --ui-card: #0c1729;
    --ui-card-soft: #101d31;
    --ui-border: #23324a;
    --ui-border-strong: #30415c;
    --ui-heading: #f4f7fb;
    --ui-text: #d6deea;
    --ui-muted: #a7b3c5;
    --ui-faint: #8190a6;
    --ui-primary-soft: rgba(37, 99, 235, .20);
    --ui-success-soft: rgba(21, 148, 71, .18);
    --ui-warning-soft: rgba(217, 119, 6, .16);
    --ui-danger-soft: rgba(196, 50, 43, .16);
}
.theme-dark .posp-header,
.theme-dark .posp-card,
.theme-dark .posp-question,
.theme-dark .posp-section-card,
.theme-dark .posp-education-row,
.theme-dark .posp-stat,
.theme-dark .posp-review-item,
.theme-dark .posp-preview-card,
.theme-dark .posp-stepper,
.theme-dark .posp-certificate,
.theme-dark .module-hero,
.theme-dark .command-header,
.theme-dark .panel-card,
.theme-dark .glass-panel { background: var(--ui-card); border-color: var(--ui-border); }
.theme-dark .posp-step,
.theme-dark .posp-upload,
.theme-dark .posp-viewer,
.theme-dark .posp-question label,
.theme-dark .panel-head { background: var(--ui-card-soft); border-color: var(--ui-border); }
.theme-dark .posp-input,
.theme-dark .posp-select,
.theme-dark .posp-textarea,
.theme-dark .posp-field input,
.theme-dark .posp-field select,
.theme-dark .posp-field textarea,
.theme-dark .app-input,
.theme-dark .app-select,
.theme-dark .app-textarea {
    color: var(--ui-heading);
    border-color: var(--ui-border-strong);
    background: #0a1424;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .posp-layout,
    .posp-module-layout,
    .posp-admin-layout { grid-template-columns: 1fr; }
    .posp-review { position: static; }
}

@media (max-width: 760px) {
    .guest-content .posp-page { padding: 14px; }
    .posp-header,
    .module-hero,
    .command-header { align-items: flex-start; padding: 18px; }
    .posp-header { flex-direction: column; }
    .posp-header p { margin-left: 0; }
    .posp-header h1 { font-size: 21px; }
    .posp-header h1 > i { width: 39px; height: 39px; flex-basis: 39px; border-radius: 11px; font-size: 16px; }
    .posp-card { padding: 16px; }
    .posp-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .posp-grid-2,
    .posp-grid-3,
    .posp-stats,
    .summary-grid,
    .stats-grid,
    .quick-grid { grid-template-columns: 1fr; }
    .posp-certificate { padding: 28px 18px; }
    .dashboard-main-grid { grid-template-columns: 1fr; }
}

@media print {
    .posp-page,
    .guest-content .posp-page { padding: 0; background: #fff; }
    .posp-app { max-width: none; }
    .posp-certificate { border: 2px solid #111; box-shadow: none; }
}
