/* Index Credit Manager - Professional UI Theme */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --icm-primary: #1e3a5f;
    --icm-primary-light: #2d5a87;
    --icm-accent: #0d9488;
    --icm-accent-hover: #0f766e;
    --icm-sidebar-bg: #0f172a;
    --icm-sidebar-hover: rgba(255, 255, 255, 0.08);
    --icm-sidebar-active: rgba(13, 148, 136, 0.25);
    --icm-card-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.06);
    --icm-radius: 0.5rem;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.app-sidebar {
    background: var(--icm-sidebar-bg) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.app-sidebar .brand-link {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 1.25rem;
}

.app-sidebar .brand-text {
    font-weight: 600 !important;
    font-size: 1.1rem;
    color: #fff !important;
    letter-spacing: -0.02em;
}

.app-sidebar .nav-header {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4) !important;
    padding: 1.25rem 1rem 0.5rem;
}

.app-sidebar .nav-link {
    border-radius: var(--icm-radius);
    margin: 2px 0.75rem;
    padding: 0.65rem 1rem;
    color: rgba(255, 255, 255, 0.75) !important;
    transition: all 0.15s ease;
}

.app-sidebar .nav-link:hover {
    background: var(--icm-sidebar-hover);
    color: #fff !important;
}

.app-sidebar .nav-link.active {
    background: var(--icm-sidebar-active) !important;
    color: #5eead4 !important;
    font-weight: 500;
}

.app-sidebar .nav-icon {
    width: 1.25rem;
    margin-right: 0.75rem;
    opacity: 0.85;
}

.app-sidebar .nav-link p {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    flex: 1;
}

.app-sidebar .nav-arrow {
    font-size: 0.7rem;
    opacity: 0.55;
    transition: transform 0.2s ease;
    margin-left: 0.5rem;
}

.app-sidebar .nav-item.menu-open > .nav-link .nav-arrow {
    transform: rotate(90deg);
}

.app-sidebar .nav-treeview {
    display: none;
    padding-left: 0.25rem;
}

.app-sidebar .nav-item.menu-open > .nav-treeview {
    display: block;
}

.app-sidebar .nav-treeview .nav-link {
    padding: 0.45rem 1rem 0.45rem 2.25rem;
    font-size: 0.875rem;
    margin: 1px 0.75rem;
}

.app-sidebar .nav-treeview .nav-icon-sub {
    font-size: 0.35rem;
    width: 0.5rem;
    margin-right: 0.65rem;
    opacity: 0.45;
}

.app-sidebar .sidebar-wrapper {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 4.5rem);
    padding-bottom: 1rem;
}

.app-sidebar .sidebar-menu > .nav-item {
    margin-bottom: 0.15rem;
}

/* Header */
.app-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.app-content-header h3 {
    font-weight: 600;
    font-size: 1.5rem;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: var(--icm-accent);
    text-decoration: none;
}

/* Cards */
.card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--icm-radius);
    box-shadow: var(--icm-card-shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

.card-outline {
    border-top: 3px solid var(--icm-primary);
}

.card-primary.card-outline {
    border-top-color: var(--icm-primary);
}

.card-success.card-outline {
    border-top-color: #059669;
}

.card-warning.card-outline {
    border-top-color: #d97706;
}

.card-info.card-outline {
    border-top-color: var(--icm-accent);
}

/* Small boxes / KPI cards */
.small-box {
    border-radius: var(--icm-radius);
    box-shadow: var(--icm-card-shadow);
    overflow: hidden;
    position: relative;
}

.small-box .inner {
    padding: 1.25rem 1.25rem 1rem;
}

.small-box .inner h3 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.small-box .inner p {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0;
}

.small-box .icon {
    font-size: 4rem;
    opacity: 0.15;
    top: 0.5rem;
}

.small-box-footer {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.text-bg-primary { background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%) !important; }
.text-bg-success { background: linear-gradient(135deg, #047857 0%, #059669 100%) !important; }
.text-bg-warning { background: linear-gradient(135deg, #b45309 0%, #d97706 100%) !important; }
.text-bg-danger { background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%) !important; }
.text-bg-info { background: linear-gradient(135deg, #0e7490 0%, #0d9488 100%) !important; }

/* Tables */
.table-responsive {
    border-radius: var(--icm-radius);
}

.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-color: #f1f5f9;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    --bs-table-bg-type: #fafbfc;
}

/* Forms */
.app-main input[type="text"],
.app-main input[type="email"],
.app-main input[type="password"],
.app-main input[type="number"],
.app-main input[type="date"],
.app-main input[type="tel"],
.app-main input[type="url"],
.app-main select,
.app-main textarea {
    border-radius: 0.375rem;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.app-main input:focus,
.app-main select:focus,
.app-main textarea:focus {
    border-color: var(--icm-accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
    outline: none;
}

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: #334155;
    margin-bottom: 0.375rem;
}

.form-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.form-section-title:first-child {
    margin-top: 0;
}

/* Buttons */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
}

.btn-primary {
    background: var(--icm-primary);
    border-color: var(--icm-primary);
}

.btn-primary:hover {
    background: var(--icm-primary-light);
    border-color: var(--icm-primary-light);
}

.btn-success {
    background: #059669;
    border-color: #059669;
}

.btn-outline-primary {
    color: var(--icm-primary);
    border-color: var(--icm-primary);
}

.btn-outline-primary:hover {
    background: var(--icm-primary);
    border-color: var(--icm-primary);
}

/* Badges */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
}

.badge-status-draft { background: #e2e8f0; color: #475569; }
.badge-status-pending_approval { background: #fef3c7; color: #92400e; }
.badge-status-approved { background: #d1fae5; color: #065f46; }
.badge-status-disbursed { background: #dbeafe; color: #1e40af; }
.badge-status-rejected { background: #fee2e2; color: #991b1b; }
.badge-status-active { background: #d1fae5; color: #065f46; }
.badge-status-closed { background: #e2e8f0; color: #475569; }

/* Detail info rows */
.info-row {
    display: flex;
    padding: 0.625rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    flex: 0 0 40%;
    font-size: 0.8125rem;
    color: #64748b;
    font-weight: 500;
}

.info-value {
    flex: 1;
    font-size: 0.875rem;
    color: #0f172a;
}

/* Profile page */
.profile-hero .profile-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--icm-primary);
    background: rgba(30, 58, 95, 0.1);
    border: 3px solid rgba(30, 58, 95, 0.12);
}

/* Login */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0d9488 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-box {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.login-card-header {
    text-align: center;
    padding: 2rem 2rem 1rem;
    background: #fff;
}

.login-card-header img {
    max-height: 56px;
    margin-bottom: 1rem;
}

.login-card-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.login-card-header p {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0.5rem 0 0;
}

.login-card-body {
    padding: 1.5rem 2rem 2rem;
}

.login-card-body .form-control {
    padding: 0.625rem 0.875rem;
}

.login-card-body .btn-primary {
    padding: 0.625rem;
    font-weight: 600;
}

/* Search bar */
.search-toolbar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--icm-radius);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Action panel */
.action-panel .card-header {
    background: #f8fafc;
}

.action-panel .btn {
    margin-bottom: 0.5rem;
}

/* Stats list */
.stats-list .list-group-item {
    border-color: #f1f5f9;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
}

.stats-list .stat-value {
    font-weight: 600;
    color: var(--icm-primary);
}

/* Pagination */
.pagination .page-link {
    font-size: 0.875rem;
    border-radius: 0.375rem !important;
    margin: 0 2px;
}

/* Alerts */
.alert {
    border-radius: var(--icm-radius);
    border: none;
    font-size: 0.875rem;
}

/* User menu */
.user-menu .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
}

.tenant-badge {
    font-size: 0.75rem;
    background: #ecfdf5;
    color: #047857;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-weight: 500;
}

/* Progress bars for PAR */
.par-bar .progress {
    height: 8px;
    border-radius: 4px;
}

/* Footer */
.app-footer {
    font-size: 0.8125rem;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
}

/* Forms */
.icm-form .card {
    box-shadow: var(--icm-card-shadow);
}

.icm-form .card-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.875rem 1.25rem;
}

.icm-form .card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.icm-form .card-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.icm-form-field {
    display: flex;
    flex-direction: column;
}

.icm-form .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
    letter-spacing: 0.01em;
}

.icm-form .form-control,
.icm-form .form-select {
    font-size: 0.875rem;
    padding: 0.5625rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    background-color: #fff;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.icm-form .form-control:focus,
.icm-form .form-select:focus {
    border-color: var(--icm-accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.icm-form .form-control::placeholder {
    color: #94a3b8;
}

.icm-form textarea.form-control {
    min-height: 88px;
    resize: vertical;
}

.icm-form .input-group-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
}

.icm-form .input-group .form-control {
    border-left: 0;
}

.icm-form .input-group:focus-within .input-group-text {
    border-color: var(--icm-accent);
    color: var(--icm-accent);
}

.icm-form .input-group:focus-within .form-control {
    border-color: var(--icm-accent);
}

.icm-form .form-text {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.icm-form .form-check-input:checked {
    background-color: var(--icm-accent);
    border-color: var(--icm-accent);
}

.icm-form .btn-primary {
    background: var(--icm-primary);
    border-color: var(--icm-primary);
}

.icm-form .btn-primary:hover {
    background: var(--icm-primary-light);
    border-color: var(--icm-primary-light);
}

/* Platform admin toolbar */
.platform-toolbar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--icm-radius);
    padding: 0.75rem 1rem;
}

.platform-toolbar .btn-group .btn {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Help center */
.help-card {
    box-shadow: var(--icm-card-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.help-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.help-card-icon {
    font-size: 2rem;
    line-height: 1;
}

.help-topic-list {
    padding-left: 1.25rem;
    margin-bottom: 0;
}

.help-tip {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--icm-radius);
    padding: 1rem;
    height: 100%;
}

.help-content-card {
    box-shadow: var(--icm-card-shadow);
}

.help-content-card .card-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.help-content p:last-child,
.help-content .help-workflow-steps:last-child {
    margin-bottom: 0;
}

.help-workflow-steps {
    padding-left: 1.25rem;
}

.help-workflow-steps li {
    margin-bottom: 0.625rem;
}

.help-workflow-steps li:last-child {
    margin-bottom: 0;
}

.help-architecture .help-arch-layer {
    padding: 0.875rem 0;
    border-bottom: 1px dashed #e2e8f0;
}

.help-architecture .help-arch-layer:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.help-arch-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--icm-accent);
    margin-bottom: 0.25rem;
}

.help-table th {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    vertical-align: top;
}

.help-module-list .list-group-item {
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
}

.help-nav-card {
    box-shadow: var(--icm-card-shadow);
}

.help-page-nav .list-group-item {
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
    border-left: 3px solid transparent;
}

.help-page-nav .list-group-item:hover,
.help-page-nav .list-group-item:focus {
    border-left-color: var(--icm-accent);
    color: var(--icm-accent);
}

.help-section .card-body h5 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-top: 1.25rem;
}

.help-section .card-body h5:first-child {
    margin-top: 0;
}
