:root {
    --ink: #1c2834;
    --muted: #667586;
    --line: #e4ebf1;
    --bg: #f4f6f8;
    --card: #ffffff;
    --navy: #1b2430;
    --blue: #1d4f91;
    --blue-dark: #163e73;
    --shadow: 0 10px 28px rgba(27, 36, 48, 0.06);
}

body.app-shell,
body.app-login {
    background: var(--bg) !important;
    color: var(--ink);
    font-family: "Source Sans Pro", "Segoe UI", sans-serif;
}

body.app-shell .wrapper {
    background: transparent;
}

.app-nav {
    background: var(--navy);
}

.app-nav-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    min-height: 68px;
    margin: 0 auto;
    padding: 0 28px;
}

.app-brand {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    padding: 4px 8px;
    line-height: 0;
}

.app-brand img {
    height: 36px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.app-menu {
    display: none;
    margin-left: auto;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.app-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
}

.app-links a {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
}

.app-links a:hover,
.app-links a.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.app-nav-end {
    margin-left: auto;
}

.app-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: #fff;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.app-logout:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.app-page {
    width: min(1560px, calc(100% - 48px));
    margin: 20px auto 40px;
    padding: 0;
}

.app-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin: 8px 0 16px;
}

.app-heading h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.app-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.app-clock {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.app-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
}

.app-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 220px;
    width: 220px;
    max-width: 260px;
}

.app-field label,
.app-page .form-label,
.app-login label {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #526273;
}

.app-field input,
.app-field select,
.app-page .form-control,
.app-login .form-control {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    padding: 0 12px;
    border: 1px solid #d5dee6;
    border-radius: 10px;
    background-color: #fff;
    color: var(--ink);
    box-shadow: none;
    font-size: 14px;
    line-height: 40px;
}

.app-field select {
    padding-right: 34px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23526273' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.app-field input[type="date"] {
    min-width: 190px;
    padding-right: 8px;
    font-family: inherit;
    color-scheme: light;
}

.app-field input[type="date"]::-webkit-datetime-edit {
    padding: 0;
}

.app-field input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    margin-left: 4px;
}

.app-field input:focus,
.app-field select:focus,
.app-page .form-control:focus,
.app-login .form-control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(29, 79, 145, 0.15);
}

.date-picker {
    position: relative;
}

.date-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d5dee6;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.date-picker-btn i {
    color: var(--blue);
}

.date-picker-text.is-placeholder {
    color: #8b9aab;
    font-weight: 600;
}

.date-picker-btn:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(29, 79, 145, 0.15);
    outline: none;
}

.date-picker-pop {
    position: absolute;
    z-index: 80;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(27, 36, 48, 0.18);
}

.date-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.date-picker-jumps {
    display: flex;
    gap: 6px;
}

.date-picker-jump-btn {
    height: 32px;
    min-width: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7fafb;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.date-picker-jump-btn.is-open,
.date-picker-jump-btn:hover {
    background: #e7eef6;
    border-color: #b7c6d6;
}

.date-picker-grid.is-choices {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.date-picker-grid.is-choices button {
    height: 40px;
}

.date-picker-nav,
.date-picker-today,
.date-picker-foot button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

.date-picker-nav {
    width: 32px;
    height: 32px;
    font-size: 18px;
    line-height: 1;
}

.date-picker-weekdays,
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.date-picker-weekdays span {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8b9aab;
    padding-bottom: 4px;
}

.date-picker-grid button {
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.date-picker-grid button:hover {
    background: #e7eef6;
}

.date-picker-grid button.is-today {
    box-shadow: inset 0 0 0 1px #b7c6d6;
}

.date-picker-grid button.is-selected,
.date-picker-grid button.is-selected:hover {
    background: var(--navy);
    color: #fff;
    box-shadow: none;
}

.date-picker-today,
.date-picker-foot button {
    height: 34px;
    font-size: 13px;
}

.date-picker-today {
    width: 100%;
    margin-top: 10px;
}

.date-picker-foot {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.date-picker-foot button {
    flex: 1;
}

.month-picker {
    position: relative;
}

.month-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d5dee6;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.month-picker-btn i {
    color: var(--blue);
}

.month-picker-btn:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(29, 79, 145, 0.15);
    outline: none;
}

.month-picker-pop {
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    left: 0;
    width: 280px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(27, 36, 48, 0.16);
}

.month-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.month-picker-head strong {
    font-size: 15px;
}

.month-picker-nav,
.month-picker-today {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    cursor: pointer;
}

.month-picker-nav {
    width: 32px;
    height: 32px;
    font-size: 18px;
    line-height: 1;
}

.month-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.month-picker-grid button {
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: #f4f7fa;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.month-picker-grid button:hover {
    background: #e7eef6;
}

.month-picker-grid button.is-selected {
    background: var(--blue);
    color: #fff;
}

.month-picker-today {
    width: 100%;
    height: 34px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
}

.app-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
    width: auto;
}

.app-btn,
.app-page .btn-info,
.app-page .btn-primary,
.app-page .btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--blue);
    background: var(--blue);
    color: #fff !important;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none !important;
    cursor: pointer;
}

.app-btn:hover,
.app-page .btn-info:hover,
.app-page .btn-primary:hover,
.app-page .btn-success:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
    color: #fff !important;
}

.app-btn-ghost {
    background: #fff;
    color: var(--navy) !important;
    border-color: #d5dee6;
}

.app-btn-ghost:hover {
    background: #f7fafb;
    color: var(--navy) !important;
}

.app-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.app-stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 18px 18px 16px;
    min-height: 132px;
}

.app-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-stat-label {
    font-size: 14px;
    font-weight: 700;
    color: #3d4d5c;
}

.app-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #e8f0fa;
    color: var(--blue);
}

.app-stat-value {
    margin-top: 18px;
    font-size: 36px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.app-stat-meta {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.app-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 18px;
    margin-top: 16px;
}

.app-panel h2 {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 700;
}

.app-table-wrap,
body.app-shell .dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
}

body.app-shell table.dataTable,
.app-page table.table {
    width: max-content !important;
    min-width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate !important;
    border-spacing: 0;
}

body.app-shell table.dataTable thead th,
body.app-shell table.dataTable tbody td,
.app-page table.table thead th,
.app-page table.table tbody td {
    width: auto !important;
    min-width: 0;
    max-width: none !important;
    white-space: nowrap !important;
    vertical-align: middle;
}

body.app-shell table.dataTable thead th,
.app-page table.table thead th {
    background: #f7fafb;
    color: #3c4c5a;
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line) !important;
    padding: 12px 16px !important;
}

body.app-shell table.dataTable tbody td,
.app-page table.table tbody td {
    padding: 12px 16px !important;
    border-bottom: 1px solid #eef3f6 !important;
    color: #243240;
    font-size: 14px;
}

body.app-shell table.dataTable tbody tr:hover td {
    background: #f8fbfc;
}

body.app-shell table.dataTable.no-footer {
    border-bottom: 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
}

.status-pill.is-pass {
    background: #e8f7ee;
    color: #157a3d;
}

.status-pill.is-reject {
    background: #fdecea;
    color: #b42318;
}

.status-pill.is-neutral {
    background: #eef2f5;
    color: #526273;
}

.app-dt-top,
.app-dt-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 8px 0;
}

body.app-shell .dataTables_filter label,
body.app-shell .dataTables_info {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
}

body.app-shell .dataTables_filter input {
    margin-left: 8px;
    height: 38px;
    border: 1px solid #d5dee6;
    border-radius: 10px;
    padding: 0 12px;
}

body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    background: transparent !important;
    background-image: none !important;
    color: #3c4c5a !important;
    box-shadow: none !important;
}

body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button:hover,
body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button:active {
    background: #e8eef5 !important;
    background-image: none !important;
    color: #1b2430 !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
}

body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button.current,
body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button.current:active {
    background: var(--navy) !important;
    background-image: none !important;
    color: #fff !important;
    border-color: var(--navy) !important;
}

body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
    background: transparent !important;
    background-image: none !important;
    color: #9aa8b5 !important;
    cursor: default;
}

.app-page .card {
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 18px;
}

.app-page .card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    text-align: left;
    margin: 0;
    padding: 18px 20px 0;
}

.app-page .card-header,
.app-page .card.card-primary > .card-header {
    background: #fff !important;
    color: var(--ink) !important;
    border-bottom: 1px solid var(--line);
    padding: 16px 20px;
}

.app-page .card-header .card-title,
.app-page .card-header h3 {
    padding: 0 !important;
    color: var(--ink) !important;
}

.app-page .smtp-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.app-page .smtp-fields .mb-3 {
    margin-bottom: 0 !important;
}

.app-page .smtp-fields .btn {
    grid-column: 1 / -1;
    justify-self: start;
    width: auto;
}

.app-page .input-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

.app-page .input-group > .form-control {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 10px 0 0 10px;
}

.app-page .input-group > .btn {
    width: auto;
    flex: 0 0 auto;
    height: 42px;
    margin: 0;
    border-radius: 0 10px 10px 0;
    white-space: nowrap;
}

.app-page .email-list + .btn {
    margin-top: 8px;
}

.app-page td .btn {
    width: auto;
    height: 34px;
    padding: 0 12px;
}

.app-page .form-container,
.app-page .card-body {
    padding: 8px 20px 20px;
}

.app-page #submitButton {
    width: auto;
    min-width: 140px;
    max-width: none;
}

.app-page .nav-tabs {
    border-bottom: 1px solid var(--line);
    gap: 6px;
}

.app-page .nav-tabs .nav-link {
    border: 0;
    border-radius: 8px 8px 0 0;
    color: #526273;
    font-weight: 700;
}

.app-page .nav-tabs .nav-link.active {
    color: var(--blue);
    background: #f3f7fc;
}

.app-page .btn-danger {
    border-radius: 8px;
}

body.app-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(900px 420px at 50% -10%, rgba(29, 79, 145, 0.16), transparent 60%),
        var(--bg) !important;
}

body.app-login .login-box {
    width: min(420px, calc(100% - 32px));
    margin: 32px auto;
}

body.app-login .login-logo {
    margin-bottom: 18px;
    text-align: center;
}

body.app-login .login-logo a {
    color: var(--ink);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

body.app-login .login-logo img {
    height: 52px;
    width: auto;
    object-fit: contain;
    margin-bottom: 8px;
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px;
}

body.app-login .card {
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

body.app-login .login-card-body {
    padding: 26px 26px 22px;
}

body.app-login .login-box-msg {
    color: var(--muted);
    margin-bottom: 18px;
    padding: 0;
    text-align: left;
}

body.app-login .input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

body.app-login .input-group > .form-control {
    width: 1%;
    flex: 1 1 auto;
    min-width: 0;
    border-right: 0;
    border-radius: 10px 0 0 10px;
}

body.app-login .input-group-append {
    display: flex;
    flex: 0 0 auto;
    margin-left: 0;
}

body.app-login .input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 14px;
    background: #f7fafb;
    border: 1px solid #d5dee6;
    border-left: 0;
    border-radius: 0 10px 10px 0;
    color: #6b7c8c;
}

body.app-login .input-group .invalid-feedback {
    flex: 1 0 100%;
}

body.app-login .app-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 16px;
    font-size: 14px;
    font-weight: 600;
    color: #3c4c5a;
    text-transform: none;
    letter-spacing: 0;
}

body.app-login .app-btn {
    width: 100%;
}

body.app-error {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(900px 420px at 50% -10%, rgba(29, 79, 145, 0.16), transparent 60%),
        var(--bg);
    color: var(--ink);
    font-family: "Source Sans Pro", "Segoe UI", sans-serif;
}

.app-error-card {
    width: min(460px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 32px 28px 26px;
    text-align: center;
}

.app-error-card img {
    height: 48px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
}

.app-error-code {
    margin: 18px 0 0;
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.app-error-card h1 {
    margin: 6px 0 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
}

.app-error-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.5;
}

.app-error-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

@media (max-width: 1100px) {
    .app-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .app-menu {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .app-nav-bar {
        flex-wrap: wrap;
    }

    .app-nav-end {
        margin-left: 0;
    }

    .app-links {
        display: none;
        flex: 1 1 100%;
        order: 3;
        width: 100%;
        margin: 0;
        padding: 4px 0 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .app-nav.is-open .app-links {
        display: flex;
    }

    .app-links a {
        padding: 12px;
    }

    .app-nav-bar {
        width: 100%;
        padding: 0 16px;
    }
}

@media (max-width: 720px) {
    .app-page {
        width: calc(100% - 20px);
    }

    .app-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-heading h1 {
        font-size: 24px;
    }

    .app-field {
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
    }

    .app-actions {
        width: 100%;
    }

    .app-page .smtp-fields {
        grid-template-columns: 1fr;
    }

    .app-stats {
        grid-template-columns: 1fr;
    }

    .month-picker-pop {
        width: min(280px, calc(100vw - 48px));
    }

    .app-panel {
        padding: 12px;
    }

    body.app-shell .dataTables_filter,
    body.app-shell .dataTables_filter label,
    body.app-shell .dataTables_filter input {
        width: 100%;
        margin-left: 0;
    }

    body.app-shell .dataTables_filter label {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
}
