@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --cp-blue: #086bdc;
    --cp-blue-dark: #0757b2;
    --cp-ink: #152a48;
    --cp-muted: #6f829c;
    --cp-line: #dfe9f5;
    --cp-surface: #ffffff;
    --cp-canvas: #f3f7fc;
    --cp-layout-gutter: clamp(14px, 1.75vw, 32px);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

html, body { min-height: 100%; background: var(--cp-canvas); color: var(--cp-ink); }
body { margin: 0; font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
.cp-app-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--cp-canvas); }
.cp-topbar { min-height: 70px; padding: 0 var(--cp-layout-gutter); display: flex; align-items: center; gap: 22px; background: #fff; border-bottom: 1px solid var(--cp-line); position: sticky; top: 0; z-index: 1000; }
.cp-brand { display: inline-flex; align-items: baseline; color: var(--cp-blue); font-size: 22px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.cp-brand-logo { display: block; width: 150px; height: auto; object-fit: contain; }
.cp-brand-logo-white { width: 164px; }
.cp-brand strong { color: var(--cp-ink); font-weight: 800; }
.cp-brand small { margin-left: 7px; padding: 4px 6px; border-radius: 4px; background: #e4f0ff; color: var(--cp-blue); font-size: 9px; font-weight: 800; }
.cp-topbar-spacer { flex: 1; }
.cp-environment { padding: 7px 10px; border: 1px solid #d7e5f5; border-radius: 6px; color: #56708f; font-size: 11px; font-weight: 700; }
.cp-user { display: flex; align-items: center; gap: 9px; }
.cp-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--cp-blue); color: #fff; font-size: 11px; font-weight: 800; }
.cp-user-copy { display: flex; flex-direction: column; line-height: 1.25; }
.cp-user-copy strong { font-size: 12px; color: var(--cp-ink); }
.cp-user-copy small { color: #8595aa; font-size: 10px; }
.cp-logout, .cp-icon-button { border: 1px solid #d7e5f5; background: #fff; color: #405c7b; border-radius: 7px; }
.cp-logout { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; font-size: 11px; font-weight: 700; }
.cp-logout:hover, .cp-icon-button:hover { border-color: var(--cp-blue); color: var(--cp-blue); }
.cp-menu { background: #fff; border-bottom: 1px solid var(--cp-line); position: sticky; top: 70px; z-index: 999; }
.cp-menu-inner { width: 100%; min-width: 0; min-height: 52px; padding: 0 var(--cp-layout-gutter); display: flex; align-items: stretch; gap: 3px; overflow: visible; box-sizing: border-box; }
.cp-menu-link { min-height: 52px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border: 0; background: transparent; color: #60758f; text-decoration: none; white-space: nowrap; font-size: 12px; font-weight: 650; }
.cp-menu-link:hover, .cp-menu-link.active { background: #eaf3ff; color: var(--cp-blue); text-decoration: none; }
.cp-menu-home { font-size: 17px; line-height: 1; }
.cp-menu-group { position: relative; display: flex; }
.cp-menu-toggle { cursor: pointer; }
.cp-chevron { font-size: 9px; }
.cp-submenu { position: absolute; left: 0; top: calc(100% + 5px); min-width: 230px; padding: 7px; border: 1px solid var(--cp-line); border-radius: 7px; background: #fff; box-shadow: 0 15px 35px rgba(23, 52, 95, .14); }
.cp-submenu-link { display: block; padding: 10px 11px; border-radius: 5px; color: #536b87; text-decoration: none; font-size: 12px; font-weight: 600; }
.cp-submenu-link:hover, .cp-submenu-link.active { background: #edf5ff; color: var(--cp-blue); text-decoration: none; }
.cp-content { width: 100%; max-width: none; min-width: 0; margin: 0; padding: 30px var(--cp-layout-gutter); flex: 1; box-sizing: border-box; }
.cp-page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.cp-breadcrumb { margin-bottom: 8px; color: #8494a9; font-size: 11px; }
.cp-page-head h1 { margin: 0; color: var(--cp-ink); font-size: 27px; font-weight: 800; letter-spacing: 0; }
.cp-icon-button { width: 38px; height: 38px; font-size: 20px; }
.cp-page-body { width: 100%; max-width: none; min-width: 0; }
.cp-page-body > .container-fluid, .cp-page-body > .page-content.container-fluid { width: 100%; max-width: none; padding-left: 0; padding-right: 0; }
.cp-page-body > .panel, .cp-page-body .dashboard-panel, .cp-page-body .dashboard-card { border-color: var(--cp-line) !important; box-shadow: 0 4px 18px rgba(22, 70, 123, .035) !important; }
.cp-footer { width: 100%; max-width: none; min-width: 0; margin: 0; padding: 20px var(--cp-layout-gutter) 28px; display: flex; justify-content: space-between; color: #8798ad; font-size: 11px; box-sizing: border-box; }

.cp-auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(440px, .85fr); background: #fff; }
.cp-auth-story { min-height: 100vh; padding: 38px 52px; display: flex; flex-direction: column; position: relative; overflow: hidden; background: #0b66ce; color: #fff; }
.cp-auth-story::before { content: ""; position: absolute; inset: 0; background: linear-gradient(145deg, rgba(0, 27, 73, .15), transparent 58%), repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 90px); pointer-events: none; }
.cp-auth-brand { position: relative; color: #fff; z-index: 1; }
.cp-auth-brand strong { color: #fff; }
.cp-auth-brand small { background: rgba(255,255,255,.16); color: #fff; }
.cp-auth-story-content { position: relative; z-index: 1; max-width: 650px; margin: auto 0; padding: 70px 0; }
.cp-auth-kicker { color: #8bc6ff; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cp-auth-story h1 { max-width: 620px; margin: 18px 0; color: #fff; font-size: clamp(38px, 4.5vw, 66px); line-height: 1.07; font-weight: 800; letter-spacing: 0; }
.cp-auth-story p { max-width: 570px; margin: 0; color: #d7eaff; font-size: 15px; line-height: 1.75; }
.cp-auth-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 45px; padding-top: 25px; border-top: 1px solid rgba(255,255,255,.22); }
.cp-auth-metrics div { display: flex; flex-direction: column; gap: 5px; }
.cp-auth-metrics strong { font-size: 16px; }
.cp-auth-metrics span, .cp-auth-year { color: #b8d9fc; font-size: 10px; }
.cp-auth-year { position: relative; z-index: 1; }
.cp-auth-main { display: grid; place-items: center; padding: 50px clamp(32px, 6vw, 90px); background: #fff; }
.cp-auth-panel { width: 100%; max-width: 440px; }
.cp-login-heading { margin-bottom: 32px; }
.cp-login-heading h2, .cp-auth-loading h2 { margin: 10px 0 8px; color: var(--cp-ink); font-size: 31px; font-weight: 800; letter-spacing: 0; }
.cp-login-heading p, .cp-auth-loading p { color: var(--cp-muted); font-size: 13px; }
.cp-login-form { display: grid; gap: 19px; }
.cp-field { display: grid; gap: 8px; }
.cp-field label { color: #334e70; font-size: 12px; font-weight: 700; }
.cp-field input { width: 100%; height: 49px; padding: 0 14px; border: 1px solid #d5e2f0; border-radius: 7px; outline: none; color: var(--cp-ink); background: #fbfdff; }
.cp-field input:focus { border-color: var(--cp-blue); box-shadow: 0 0 0 3px rgba(8, 107, 220, .1); background: #fff; }
.cp-login-options { display: flex; align-items: center; justify-content: space-between; gap: 15px; color: #687d96; font-size: 11px; }
.cp-login-options a { color: var(--cp-blue); font-weight: 700; }
.cp-check { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.cp-check input { accent-color: var(--cp-blue); }
.cp-login-submit { min-height: 49px; border: 0; border-radius: 7px; background: var(--cp-blue); color: #fff; font-weight: 800; font-size: 12px; }
.cp-login-submit:hover { background: var(--cp-blue-dark); }
.cp-login-submit:disabled { cursor: wait; opacity: .7; }
.cp-login-error { padding: 12px 14px; border-left: 3px solid #cc3a45; border-radius: 4px; background: #fff0f1; color: #9f2630; font-size: 12px; }
.cp-login-help { margin-top: 25px; text-align: center; color: #93a1b3; font-size: 10px; }
.cp-auth-loading { text-align: center; }

/* Shared loading state - aligned with the SIMS spinner system */
.cp-spinner-wrap { min-height: 120px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; color: var(--cp-muted); font-weight: 600; }
.cp-spinner-wrap.is-inline { min-height: auto; display: inline-flex; flex-direction: row; color: inherit; }
.cp-spinner { width: 38px; height: 38px; display: inline-block; flex: 0 0 auto; border: 3px solid #dbeafe; border-top-color: var(--cp-blue); border-radius: 50%; animation: cp-spin .75s linear infinite; }
.cp-spinner.is-small { width: 18px; height: 18px; border-width: 2px; }
.cp-spinner-text { line-height: 1.35; }
@keyframes cp-spin { to { transform: rotate(360deg); } }
.btn > .cp-spinner-wrap.is-inline { margin-right: .5rem; vertical-align: middle; }
.loading-overlay { position: absolute; inset: 0; z-index: 20; min-height: 160px; display: grid; place-items: center; padding: 24px; border-radius: 12px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(1px); }
.loading-overlay .cp-spinner-wrap { min-height: auto; padding: 24px; }

/* Data tables */
.cp-data-surface, .cp-page-body .card, .cp-page-body .panel { padding: 20px; border: 1px solid var(--cp-line); border-radius: 7px; background: var(--cp-surface); box-shadow: 0 4px 18px rgba(22, 70, 123, .04); }
.cp-page-body .table-responsive { width: 100%; margin-top: 12px; border: 1px solid var(--cp-line); border-radius: 6px; background: #fff; overflow-x: auto; }
.cp-page-body .table { width: 100%; margin: 0; color: #334e70; font-size: 12px; vertical-align: middle; }
.cp-page-body .table > :not(caption) > * > * { padding: 12px 14px; border-color: #e6edf6; }
.cp-page-body .table thead th { border-bottom-width: 1px; background: #edf5ff; color: #284a72; font-size: 11px; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.cp-page-body .table tbody tr:nth-of-type(even) > * { background: #f9fbfe; }
.cp-page-body .table tbody tr:hover > * { background: #f0f6fd; }
.cp-page-body .table td { max-width: 360px; overflow-wrap: anywhere; }
.cp-page-body .table td:last-child { white-space: nowrap; }

/* Forms and actions */
.cp-page-body label, .modal label { margin-bottom: 6px; color: #3c5675; font-size: 11px; font-weight: 750; }
.cp-page-body .form-control, .cp-page-body .form-select, .modal .form-control, .modal .form-select { min-height: 40px; border: 1px solid #d5e2f0; border-radius: 6px; background-color: #fbfdff; color: var(--cp-ink); font-size: 12px; box-shadow: none; }
.cp-page-body textarea.form-control, .modal textarea.form-control { min-height: 100px; }
.cp-page-body .form-control:focus, .cp-page-body .form-select:focus, .modal .form-control:focus, .modal .form-select:focus { border-color: var(--cp-blue); background-color: #fff; box-shadow: 0 0 0 3px rgba(8, 107, 220, .1); }
.cp-page-body .btn, .modal .btn { min-height: 38px; padding: 8px 13px; border-radius: 6px; font-size: 11px; font-weight: 750; box-shadow: none; }
.cp-page-body .btn-sm, .modal .btn-sm { min-height: 32px; padding: 5px 9px; }
.btn-primary { border-color: var(--cp-blue); background: var(--cp-blue); }
.btn-primary:hover, .btn-primary:focus { border-color: var(--cp-blue-dark); background: var(--cp-blue-dark); }
.btn-outline-primary { border-color: #a9c9ed; color: var(--cp-blue); }
.btn-outline-primary:hover { border-color: var(--cp-blue); background: #eaf3ff; color: var(--cp-blue-dark); }
.btn:disabled { cursor: not-allowed; opacity: .55; }

/* Modals */
.modal.show.d-block { overflow-y: auto; padding: 24px 12px; background: rgba(18, 38, 65, .56) !important; }
.modal-dialog { margin-top: 3vh; margin-bottom: 3vh; }
.modal-content { overflow: hidden; border: 0; border-radius: 8px; box-shadow: 0 22px 58px rgba(15, 41, 74, .24); }
.modal-header { min-height: 62px; padding: 16px 20px; border-bottom: 1px solid var(--cp-line); background: #f7faff; }
.modal-title { color: var(--cp-ink); font-size: 16px; font-weight: 800; }
.modal-body { padding: 22px 20px; color: #47617e; font-size: 12px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--cp-line); background: #fbfdff; }
.btn-close { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border: 1px solid #d5e2f0; border-radius: 6px; background: #fff; color: #60758f; opacity: 1; }
.btn-close::before { content: "\00d7"; font-size: 22px; font-weight: 400; line-height: 1; }
.btn-close:hover { border-color: #b9cce1; background: #edf5ff; color: var(--cp-blue); }

/* Alerts and notifications */
.alert { padding: 12px 14px; border-width: 0 0 0 4px; border-radius: 5px; font-size: 12px; }
.alert-info { border-color: #2f80d8; background: #edf6ff; color: #225f9d; }
.alert-success { border-color: #2d9668; background: #edf9f3; color: #257455; }
.alert-warning { border-color: #d48a24; background: #fff7e8; color: #805015; }
.alert-danger, .alert-error { border-color: #c64752; background: #fff0f1; color: #982f39; }
.cp-notification-stack { position: fixed; top: 86px; right: 22px; z-index: 2100; display: grid; gap: 10px; width: min(390px, calc(100vw - 28px)); pointer-events: none; }
.cp-notification { display: grid; grid-template-columns: 34px minmax(0, 1fr) 28px; align-items: start; gap: 10px; padding: 13px 12px; border: 1px solid; border-left-width: 4px; border-radius: 7px; background: #fff; box-shadow: 0 14px 34px rgba(22, 55, 94, .16); pointer-events: auto; }
.cp-notification-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; }
.cp-notification-content { min-width: 0; display: grid; gap: 2px; }
.cp-notification-content strong { color: var(--cp-ink); font-size: 12px; }
.cp-notification-content span { color: #60758f; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.cp-notification-close { width: 28px; height: 28px; border: 0; background: transparent; color: #7c8da3; font-size: 20px; line-height: 1; }
.cp-notification-info { border-color: #b8d8f8; border-left-color: #2f80d8; } .cp-notification-info .cp-notification-icon { background: #e8f4ff; color: #2f80d8; }
.cp-notification-success { border-color: #bde4d1; border-left-color: #2d9668; } .cp-notification-success .cp-notification-icon { background: #e8f7ef; color: #2d9668; }
.cp-notification-warning { border-color: #efd8b2; border-left-color: #d48a24; } .cp-notification-warning .cp-notification-icon { background: #fff3de; color: #a56413; }
.cp-notification-error { border-color: #efc4c8; border-left-color: #c64752; } .cp-notification-error .cp-notification-icon { background: #ffedef; color: #c64752; }
.cp-mobile-menu-toggle { display: none; }

@media (max-width: 980px) {
    .cp-auth-shell { grid-template-columns: 1fr; }
    .cp-auth-story { min-height: 320px; padding: 28px 32px; }
    .cp-auth-story-content { padding: 55px 0 25px; margin: 0; }
    .cp-auth-story h1 { font-size: 38px; }
    .cp-auth-year, .cp-auth-metrics { display: none; }
    .cp-auth-main { padding: 45px 25px; }
    .cp-user-copy, .cp-environment { display: none; }
}

@media (max-width: 700px) {
    .cp-topbar { min-height: 62px; padding: 0 14px; gap: 10px; }
    .cp-menu { top: 62px; overflow: visible; }
    .cp-mobile-menu-toggle { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 15px; border: 0; border-bottom: 1px solid var(--cp-line); background: #fff; color: #405c7b; font-size: 12px; font-weight: 800; text-align: left; }
    .cp-menu-bars { width: 20px; display: grid; gap: 4px; }
    .cp-menu-bars i { height: 2px; display: block; border-radius: 2px; background: var(--cp-blue); }
    .cp-menu-inner { min-width: 0; max-height: 0; padding: 0 var(--cp-layout-gutter); display: block; overflow: hidden; opacity: 0; transition: max-height .22s ease, opacity .18s ease, padding .22s ease; }
    .cp-menu-inner.is-open { max-height: calc(100vh - 110px); padding-top: 8px; padding-bottom: 10px; overflow-y: auto; opacity: 1; }
    .cp-menu-link { width: 100%; min-height: 44px; justify-content: space-between; padding: 0 10px; border-radius: 5px; }
    .cp-menu-group { display: block; }
    .cp-submenu { position: static; min-width: 0; margin: 0 0 7px 14px; padding: 4px; border: 0; border-left: 2px solid #d7e7f8; border-radius: 0; box-shadow: none; }
    .cp-submenu-link { min-height: 40px; display: flex; align-items: center; }
    .cp-content { padding: 24px 14px; }
    .cp-footer { padding: 18px 14px 24px; }
    .cp-logout span:last-child { display: none; }
    .cp-auth-story { min-height: 280px; padding: 24px; }
    .cp-auth-story h1 { font-size: 31px; }
    .cp-page-head { align-items: flex-start; }
    .cp-page-head h1 { font-size: 23px; }
    .cp-data-surface, .cp-page-body .card, .cp-page-body .panel { padding: 14px; }
    .cp-page-body .table > :not(caption) > * > * { padding: 10px; }
    .cp-notification-stack { top: 72px; right: 14px; }
    .modal.show.d-block { padding: 10px; }
    .modal-dialog { margin: 2vh auto; }
}
