:root {
    --va-bg: #f4f7fb;
    --va-surface: #ffffff;
    --va-text: #172033;
    --va-muted: #64748b;
    --va-border: #e2e8f0;
    --va-primary: #3457d5;
    --va-primary-hover: #2946b8;
    --va-radius: 12px;
}

html,
body {
    background: var(--va-bg);
    color: var(--va-text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
}

body {
    min-height: 100vh;
}

a {
    color: var(--va-primary);
    text-decoration: none;
}

a:hover {
    color: var(--va-primary-hover);
    text-decoration: none;
}

/* Top navigation */
.navbar {
    background: var(--va-surface) !important;
    border-bottom: 1px solid var(--va-border) !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.035);
    padding-top: 10px;
    padding-bottom: 10px;
}

.navbar .container,
.navbar .container-fluid {
    margin-top: 0;
    margin-bottom: 0;
}

.navbar-brand {
    color: var(--va-text) !important;
    font-weight: 750;
    letter-spacing: -0.025em;
}

.navbar-nav .nav-link,
.navbar-nav > li > a {
    border-radius: 8px;
    color: #475569 !important;
    font-weight: 550;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav > li > a:hover {
    background: #eef2ff;
    color: var(--va-primary) !important;
}

/* Main page width and headings */
.container {
    max-width: 1320px;
    margin-top: 24px;
    margin-bottom: 30px;
}

.navbar .container {
    margin-top: 0;
    margin-bottom: 0;
}

h1,
h2,
h3,
h4,
h5 {
    color: var(--va-text);
    font-weight: 700;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 1.8rem;
}

h2 {
    font-size: 1.45rem;
}

h3 {
    font-size: 1.2rem;
}

/* Panels, cards and content sections */
.card,
.panel,
.well {
    background: var(--va-surface);
    border: 1px solid var(--va-border);
    border-radius: var(--va-radius);
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.035);
    overflow: hidden;
}

.card-header,
.panel-heading {
    background: #f8fafc;
    border-bottom: 1px solid var(--va-border);
    color: var(--va-text);
    font-weight: 650;
}

.list-group-item {
    border-color: var(--va-border);
    padding: 13px 16px;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 8px 13px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
    background: var(--va-primary);
    border-color: var(--va-primary);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--va-primary-hover);
    border-color: var(--va-primary-hover);
    color: #fff;
}

.btn-default,
.btn-secondary,
.btn-light {
    background: #fff;
    border-color: #d7deea;
    color: #334155;
}

.btn-default:hover,
.btn-secondary:hover,
.btn-light:hover {
    background: #f8fafc;
    border-color: #b9c5d8;
    color: var(--va-text);
}

.btn-success,
.btn-danger,
.btn-warning {
    border-radius: 8px;
    font-weight: 600;
}

/* Inputs and form controls */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    border: 1px solid #d5ddea;
    border-radius: 8px;
    color: var(--va-text);
    min-height: 40px;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: #8096ee;
    box-shadow: 0 0 0 3px rgba(52, 87, 213, 0.12);
    outline: none;
}

label,
.form-label {
    color: #334155;
    font-weight: 600;
}

/* Tables and lists */
.table {
    --bs-table-border-color: var(--va-border);
    color: var(--va-text);
    vertical-align: middle;
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--va-border);
    padding: 12px 14px;
}

.table thead th,
.table > thead > tr > th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.table tbody tr:hover > * {
    background-color: #f8faff;
}

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

/* Notifications and page footer */
.alert {
    border-radius: 10px;
    border: 1px solid var(--va-border);
}

footer,
.footer {
    color: var(--va-muted);
    font-size: 0.85rem;
}

hr {
    border-color: var(--va-border);
    opacity: 1;
}

/* Small screens */
@media (max-width: 768px) {
    .container {
        margin-top: 16px;
        padding-left: 14px;
        padding-right: 14px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .table-responsive {
        overflow-x: auto;
    }
}

/* Vistaran dashboard redesign */
#main_menu.panel {
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
}

#main_menu > section {
    background: var(--va-surface);
    border: 1px solid var(--va-border);
    border-radius: 16px;
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.04);
    margin-bottom: 22px;
    padding: 22px;
}

#main_menu > section h2 {
    color: var(--va-text);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 16px;
}

#main_menu > section h3 {
    font-size: 1rem;
    margin-top: 18px;
}

/* Search area */
#main_menu > section:first-of-type form {
    max-width: 100%;
}

#main_menu > section:first-of-type .input-group {
    display: flex;
    width: 100%;
}

#main_menu > section:first-of-type .form-control {
    min-width: 0;
    height: 44px;
}

/* Dashboard action cards */
#main_menu > section:nth-of-type(2) > table.table {
    display: block;
    width: 100%;
    margin: 0;
    border: 0;
}

#main_menu > section:nth-of-type(2) > table.table > tbody {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

#main_menu > section:nth-of-type(2) > table.table > tbody > tr {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--va-border);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease,
                transform 0.18s ease;
}

#main_menu > section:nth-of-type(2) > table.table > tbody > tr:hover {
    border-color: #c7d2fe;
    box-shadow: 0 8px 22px rgba(52, 87, 213, 0.08);
    transform: translateY(-2px);
}

#main_menu > section:nth-of-type(2) > table.table > tbody > tr > td {
    display: block;
    width: 100%;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    white-space: normal !important;
    vertical-align: top;
}

#main_menu > section:nth-of-type(2) > table.table > tbody > tr > td:first-child a {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px !important;
    border-radius: 9px;
    text-align: left !important;
    white-space: normal;
}

#main_menu > section:nth-of-type(2) > table.table > tbody > tr > td:nth-child(2) {
    color: var(--va-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

/* Make logout feel like a utility action */
#main_menu > section:nth-of-type(2) > table.table > tbody > tr:last-child {
    background: #f8fafc;
}

/* Tablet */
@media (max-width: 1000px) {
    #main_menu > section:nth-of-type(2) > table.table > tbody {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile */
@media (max-width: 640px) {
    #main_menu > section {
        padding: 16px;
    }

    #main_menu > section:nth-of-type(2) > table.table > tbody {
        grid-template-columns: 1fr;
    }
}

/* Final dashboard polish */
#main_menu > section:nth-of-type(2) > table.table > tbody > tr:last-child {
    display: none;
}

#main_menu > section:first-of-type form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#main_menu > section:first-of-type .input-group {
    display: flex;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#main_menu > section:first-of-type .input-group > .form-control {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
    box-sizing: border-box;
}

#main_menu > section:first-of-type .input-group > .btn {
    flex: 0 0 auto;
}
