/* ── Base ────────────────────────────────────────────────────────── */

html {
    font-size: 16px;
}

@media (min-width: 768px) {
    html {
        font-size: 17px;
    }
}

body {
    background-color: #eef0f3;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

html {
    height: 100%;
}

body {
    min-height: 100%;
}

/* ── Navbar ──────────────────────────────────────────────────────── */

header > .navbar {
    background-color: #2C3E50 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    min-height: 46px;
    padding-top: .35rem;
    padding-bottom: .35rem;
}

.navbar-brand {
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .02em;
}

/* ── Layout ──────────────────────────────────────────────────────── */

.layout-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.layout-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

main[role="main"] {
    flex: 1 1 auto;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */

.sidebar {
    width: 215px;
    min-width: 215px;
    background-color: #2C3E50;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 2px 0 8px rgba(0,0,0,.12);
}

.sidebar-link {
    display: block;
    padding: .38rem 1rem .38rem 1.1rem;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: .85rem;
    border-left: 3px solid transparent;
    transition: background-color .13s ease, color .13s ease, border-left-color .13s ease;
    line-height: 1.35;
}

.sidebar-link:hover {
    background-color: rgba(255,255,255,.09);
    color: rgba(255,255,255,.95);
}

.sidebar-link.active {
    background-color: rgba(24,188,156,.15);
    color: #fff;
    font-weight: 600;
    border-left-color: #18BC9C;
}

.sidebar-section-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: .5rem 1rem .25rem;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: rgba(255,255,255,.38);
    background: none;
    border: none;
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: .3rem;
    cursor: pointer;
    line-height: 1.2;
    transition: color .13s ease;
}

.sidebar-section-btn:first-child {
    border-top: none;
    margin-top: 0;
}

.sidebar-section-btn:hover {
    color: rgba(255,255,255,.65);
}

.sidebar-chevron {
    font-size: .6rem;
    transition: transform .18s ease;
    display: inline-block;
    flex-shrink: 0;
    opacity: .6;
}

.sidebar-section-btn.collapsed .sidebar-chevron {
    transform: rotate(-90deg);
}

/* Secondary "X List" links — indented, smaller, dimmer */
.sidebar-link-sub {
    padding-left: 1.8rem;
    font-size: .78rem;
    color: rgba(255,255,255,.5);
    margin-bottom: .1rem;
}

.sidebar-link-sub:hover {
    color: rgba(255,255,255,.8);
}

.sidebar-link-sub.active {
    color: #fff;
    border-left-color: #18BC9C;
}

/* ── Footer ──────────────────────────────────────────────────────── */

footer.border-top {
    font-size: .72rem;
    color: #8a9099;
    border-top-color: #d6dade !important;
    background-color: #f4f5f7;
}

/* ── Cards ───────────────────────────────────────────────────────── */

.card {
    box-shadow: 0 1px 5px rgba(0,0,0,.07);
    border-color: #d6dade;
    border-radius: .4rem;
    overflow: hidden;
}

.card > .card-header {
    background-color: #4a565c;
    color: #fff;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .025em;
    border-bottom: none;
    padding: .48rem .8rem;
}

.card > .card-header,
.card > .card-header * {
    color: #fff;
}

.card > .card-header[data-bs-toggle="collapse"] {
    cursor: pointer;
    user-select: none;
    transition: filter .13s ease;
}

.card > .card-header[data-bs-toggle="collapse"]:hover {
    filter: brightness(1.1);
}

/* Danger zone */
.card.border-danger > .card-header {
    background-color: transparent;
    color: #E74C3C !important;
}
.card.border-danger > .card-header * {
    color: #E74C3C !important;
}

.card > .card-footer {
    background-color: #f4f5f6;
    border-top-color: #d6dade;
    font-size: .8rem;
}

/* ── Chevron icons ───────────────────────────────────────────────── */

.chevron-icon {
    display: inline-block;
    transition: transform .18s ease;
    font-size: 1rem;
    line-height: 1;
    color: rgba(255,255,255,.65);
    font-style: normal;
}

[data-bs-toggle="collapse"][aria-expanded="false"] .chevron-icon {
    transform: rotate(90deg);
}

/* ── Tables ──────────────────────────────────────────────────────── */

.table {
    border-color: #e4e8ec;
    font-size: .88rem;
}

.table thead th {
    background-color: #f0f2f5;
    color: #4a565c;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 2px solid #d6dade;
    padding: .45rem .6rem;
    white-space: nowrap;
}

.table > tbody > tr > td {
    vertical-align: middle;
    border-color: #e8ebee;
}

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

.table-sm > :not(caption) > * > * {
    padding: .28rem .5rem;
}

.table-bordered {
    border-color: #e4e8ec;
}

/* ── Table action buttons — never wrap ───────────────────────────── */

td .btn {
    white-space: nowrap;
}

/* ── Buttons ─────────────────────────────────────────────────────── */

.btn {
    transition: all .14s ease;
    font-size: .8rem;
    font-weight: 500;
}

.btn-sm {
    font-size: .75rem;
    padding: .22rem .55rem;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus {
    box-shadow: 0 0 0 0.18rem rgba(69,130,236,.35);
}

/* ── Form controls ───────────────────────────────────────────────── */

.form-control,
.form-select {
    transition: border-color .15s ease, box-shadow .15s ease;
    border-color: #cdd2d8;
    font-size: .88rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #4582EC;
    box-shadow: 0 0 0 0.18rem rgba(69,130,236,.18);
}

.form-control-sm,
.form-select-sm,
.form-control-plaintext.form-control-sm {
    font-size: .92rem;
    padding: .28rem .55rem;
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.18rem rgba(69,130,236,.3);
}

.form-label,
.col-form-label {
    font-weight: 600;
    color: #3d454a;
    font-size: .88rem;
}

.form-label-sm,
.col-form-label-sm {
    font-size: .92rem;
}

/* ── Warning row tint (table-warning / list-group-item-warning) ── */

.table-warning {
    --bs-table-color:         #212529;
    --bs-table-striped-color: #212529;
    --bs-table-active-color:  #212529;
    --bs-table-hover-color:   #212529;
    --bs-table-bg:            #fdf8ed;
    --bs-table-striped-bg:    #f8f2e2;
    --bs-table-hover-bg:      #f3ecda;
    --bs-table-active-bg:     #f3ecda;
    --bs-table-border-color:  #ece3c8;
    color: #212529;
}

.list-group-item-warning {
    background-color: #fdf8ed !important;
    color: #212529 !important;
    border-color: #ece3c8 !important;
}

/* ── Alerts ──────────────────────────────────────────────────────── */

.alert {
    border-radius: .35rem;
    font-size: .82rem;
    border-left-width: 4px;
}

.alert-success  { border-left-color: #18BC9C; }
.alert-danger   { border-left-color: #E74C3C; }
.alert-warning  { border-left-color: #F39C12; }
.alert-info     { border-left-color: #3498DB; }

/* ── Badges ──────────────────────────────────────────────────────── */

.badge {
    font-weight: 600;
    letter-spacing: .03em;
    font-size: .7em;
    padding: .32em .55em;
    border-radius: .25rem;
}

/* ── Tom Select polish ───────────────────────────────────────────── */

.ts-wrapper.single .ts-control::after {
    display: none !important;
}

.ts-control {
    font-size: .78rem !important;
    border-color: #cdd2d8 !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
}

.ts-wrapper.focus .ts-control {
    border-color: #4582EC !important;
    box-shadow: 0 0 0 0.18rem rgba(69,130,236,.18) !important;
}

.ts-dropdown {
    font-size: .78rem !important;
    border-color: #cdd2d8 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.1) !important;
}

.ts-dropdown .option.active,
.ts-dropdown .option:hover {
    background-color: #4582EC !important;
    color: #fff !important;
}

/* ── Modals ──────────────────────────────────────────────────────── */

.modal-header {
    background-color: #4a565c;
    color: #fff;
    padding: .55rem .85rem;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-header .modal-title {
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
}

.modal-body {
    font-size: .88rem;
}

.modal-footer {
    padding: .5rem .85rem;
    background-color: #f8f9fa;
}

/* ── Page headings ───────────────────────────────────────────────── */

h4, h5 {
    font-weight: 700;
    color: #2C3E50;
    letter-spacing: -.01em;
}

h5 { font-size: 1rem; }
h4 { font-size: 1.1rem; }

/* ── Breadcrumb ──────────────────────────────────────────────────── */

.breadcrumb {
    font-size: .78rem;
    margin-bottom: .6rem;
}

/* ── Pagination ──────────────────────────────────────────────────── */

.pagination .page-link {
    font-size: .78rem;
    padding: .28rem .6rem;
}

/* ── Utility tweaks ──────────────────────────────────────────────── */

.small, small {
    font-size: .82rem;
}

.text-muted {
    color: #7a8490 !important;
}
