:root {
    --brand-olive: #7d7300;
    --brand-olive-dark: #514c0a;
    --brand-green: #667000;
    --brand-yellow: #efe513;
    --brand-yellow-soft: #faf8cf;
    --surface: #ffffff;
    --surface-muted: #f6f7f2;
    --border: #e4e7dc;
    --text: #252822;
    --text-muted: #6d7268;
    --shadow-sm: 0 2px 10px rgba(37, 40, 34, .06);
    --shadow-md: 0 12px 32px rgba(37, 40, 34, .1);
    --radius: 14px;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    background: var(--surface-muted);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding-right: 32px;
    padding-left: 32px;
}

/* Navigation */
.app-navbar {
    min-height: 64px;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, .98);
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    margin-right: 42px;
    padding: 8px 0;
}

.navbar-brand img {
    width: 145px;
    height: 50px;
    object-fit: contain;
}

.brand-section {
    margin-left: 15px;
    padding-left: 15px;
    border-left: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    line-height: 1.2;
    text-transform: uppercase;
}

.app-navbar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 64px;
    padding: 0 18px !important;
    color: var(--text-muted) !important;
    font-size: .96rem;
    font-weight: 600;
    transition: color .2s ease, background-color .2s ease;
}

.app-navbar .nav-link i {
    width: 20px;
    margin-right: 8px;
    color: var(--brand-olive);
    text-align: center;
}

.app-navbar .app-navigation .nav-link::after {
    position: absolute;
    right: 18px;
    bottom: 0;
    left: 18px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--brand-yellow);
    content: "";
    opacity: 0;
    transform: scaleX(.4);
    transition: opacity .2s ease, transform .2s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-item.active .nav-link {
    color: var(--text) !important;
}

.app-navbar .app-navigation .nav-link:hover::after,
.app-navbar .app-navigation .nav-item.active .nav-link::after {
    opacity: 1;
    transform: scaleX(1);
}

.user-navigation {
    align-items: center;
    margin-left: auto !important;
}

.user-navigation .user-name .nav-link {
    font-weight: 600;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-right: 9px;
    border-radius: 50%;
    background: var(--brand-yellow-soft);
}

.user-avatar i {
    width: auto !important;
    margin: 0 !important;
    color: var(--brand-olive-dark) !important;
}

.app-navbar .logout-link {
    min-height: auto;
    margin-left: 4px;
    padding: 10px 13px !important;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.app-navbar .logout-link:hover {
    border-color: #d4d8c9;
    background: var(--surface-muted);
}

.navbar-toggler {
    padding: 7px 9px;
    border-color: var(--border) !important;
    border-radius: 9px;
}

/* Main layout */
.app-main {
    flex: 1 0 auto;
    padding: 20px 0 36px;
}

.page-header {
    margin-bottom: 14px;
}

.section-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--brand-olive);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.page-header h1,
.login-heading h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    font-weight: 750;
    letter-spacing: -.035em;
}

.login-heading p {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 1rem;
}

/* Filters */
.filter-card,
.data-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.filter-card {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 14px;
    padding: 14px 18px;
}

.filter-form {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: repeat(2, minmax(220px, 340px));
    gap: 14px;
}

.filter-clear {
    flex: 0 0 auto;
    margin-left: auto;
    white-space: nowrap;
}

.filter-field label,
.form-label {
    display: block;
    margin-bottom: 4px;
    color: #4c5148;
    font-size: .82rem;
    font-weight: 700;
}

.input-with-icon {
    position: relative;
}

.input-with-icon > i {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 2;
    color: #92978c;
    transform: translateY(-50%);
    pointer-events: none;
}

.input-with-icon .form-control {
    padding-left: 42px;
}

.form-control {
    height: 42px;
    border: 1px solid #d9ddd2;
    border-radius: 9px;
    background: #fbfcf9;
    color: var(--text);
    font-size: .95rem;
    transition: border-color .2s ease, box-shadow .2s ease,
        background-color .2s ease;
}

.form-control::placeholder {
    color: #9ba095;
}

.form-control:hover {
    border-color: #c6cbbd;
}

.form-control:focus {
    border-color: var(--brand-green);
    background: var(--surface);
    box-shadow: 0 0 0 .2rem rgba(102, 112, 0, .13);
}

.btn {
    border-radius: 9px;
    font-weight: 700;
}

.btn-brand {
    border-color: var(--brand-green);
    background: var(--brand-green);
    color: #fff;
    box-shadow: 0 5px 14px rgba(102, 112, 0, .2);
}

.btn-brand:hover,
.btn-brand:focus {
    border-color: var(--brand-olive-dark);
    background: var(--brand-olive-dark);
    color: #fff;
}

.btn-brand i {
    margin-left: 8px;
}

.btn-ghost {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
}

.btn-ghost:hover,
.btn-ghost:focus {
    border-color: #d2d6ca;
    background: var(--surface-muted);
    color: var(--text);
}

.btn-ghost i {
    margin-right: 5px;
}

/* Data tables */
.data-card {
    overflow: hidden;
}

.data-card .table-responsive {
    margin: 0;
}

.responsive-table {
    margin: 0;
    color: var(--text);
}

.responsive-table thead th {
    padding: 11px 18px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: #f9faf6;
    color: #70756b;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    white-space: nowrap;
}

.responsive-table tbody td {
    padding: 12px 18px;
    border-top: 1px solid #eceee7;
    vertical-align: middle;
    font-size: .93rem;
}

.responsive-table tbody tr:first-child td {
    border-top: 0;
}

.responsive-table tbody tr:not(.empty-row):not(.loading-row) {
    transition: background-color .18s ease;
}

.responsive-table tbody tr:not(.empty-row):not(.loading-row):hover {
    background: #fafbf7;
}

.record-code {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 7px;
    background: #f0f1eb;
    color: #555b50;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: .8rem;
    font-weight: 700;
}

.location-value,
.date-value {
    display: inline-flex;
    align-items: baseline;
    color: #555b50;
}

.location-value i,
.date-value i {
    width: 16px;
    margin-right: 7px;
    color: #9a9f94;
    text-align: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid #dfe2ad;
    border-radius: 999px;
    background: var(--brand-yellow-soft);
    color: var(--brand-olive-dark);
    font-size: .78rem;
    font-weight: 750;
    line-height: 1;
}

.status-badge::before {
    width: 6px;
    height: 6px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--brand-green);
    content: "";
}

.status-confirmed,
.status-processing,
.status-done {
    border-color: #c9e3d2;
    background: #eaf6ee;
    color: #27623c;
}

.status-confirmed::before,
.status-processing::before,
.status-done::before {
    background: #388b53;
}

.status-cancelled {
    border-color: #efcdcd;
    background: #fbecec;
    color: #943d3d;
}

.status-cancelled::before {
    background: #b84a4a;
}

.loading-row td {
    padding: 16px !important;
    color: var(--text-muted);
    font-size: .86rem !important;
}

.loading-row .spinner-border {
    margin-right: 7px;
    color: var(--brand-olive);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 52px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state > i {
    margin-bottom: 14px;
    color: #b9bda8;
    font-size: 2rem;
}

.empty-state strong {
    margin-bottom: 4px;
    color: var(--text);
    font-size: 1rem;
}

.empty-state span {
    font-size: .88rem;
}

/* Flash messages */
.noty_theme__relax.noty_bar {
    margin: 8px 0;
    overflow: hidden;
    border: 1px solid #d9ddd2;
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    color: var(--text);
    font-weight: 600;
}

.noty_theme__relax .noty_body {
    padding: 13px 38px 13px 16px;
}

.noty_theme__relax.noty_type__success {
    border-color: #b9ddc4;
    background: #eaf6ee;
    color: #27623c;
}

.noty_theme__relax.noty_type__error {
    border-color: #efcdcd;
    background: #fbecec;
    color: #943d3d;
}

.noty_theme__relax.noty_type__warning {
    border-color: #eadb9b;
    background: #fff8dd;
    color: #765d00;
}

.noty_theme__relax.noty_type__info,
.noty_theme__relax.noty_type__notification,
.noty_theme__relax.noty_type__alert {
    border-color: #cbdce9;
    background: #edf6fb;
    color: #285a78;
}

.noty_theme__relax .noty_close_button {
    top: 8px;
    right: 8px;
    background: transparent;
    color: currentColor;
    font-size: 1.1rem;
    line-height: 18px;
}

.noty_theme__relax .noty_close_button:hover {
    background: rgba(0, 0, 0, .08);
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 230px);
    padding: 20px 0;
}

.login-card {
    width: 100%;
    max-width: 450px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.login-brand {
    display: flex;
    justify-content: center;
    padding: 24px;
    background: var(--brand-olive);
}

.login-brand img {
    width: 210px;
    max-width: 100%;
    height: 74px;
    object-fit: contain;
}

.login-heading,
.form-signin {
    padding-right: 36px;
    padding-left: 36px;
}

.login-heading {
    padding-top: 30px;
}

.login-heading h1 {
    font-size: 1.75rem;
}

.login-heading p {
    font-size: .92rem;
}

.form-signin {
    padding-top: 23px;
    padding-bottom: 36px;
}

.form-signin .form-group {
    margin-bottom: 18px;
}

.form-signin .btn {
    margin-top: 25px;
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: .98rem;
}

.form-error {
    display: block;
    margin-top: 5px;
    color: #b13a3a;
}

/* Footer */
.app-footer {
    flex-shrink: 0;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 600;
}

.app-footer .app-container {
    display: flex;
    align-items: center;
}

.footer-separator {
    width: 4px;
    height: 4px;
    margin: 0 10px;
    border-radius: 50%;
    background: var(--brand-yellow);
}

@media (max-width: 991.98px) {
    .app-navbar {
        min-height: 60px;
        padding: 0 20px;
    }

    .navbar-brand img {
        width: 135px;
        height: 46px;
    }

    .brand-section {
        display: none;
    }

    .app-navbar .navbar-collapse {
        margin: 0 -20px;
        padding: 8px 20px 17px;
        border-top: 1px solid var(--border);
        background: var(--surface);
    }

    .app-navbar .nav-link {
        min-height: 46px;
        padding: 0 10px !important;
        border-radius: 8px;
    }

    .app-navbar .app-navigation .nav-link::after {
        top: 8px;
        right: auto;
        bottom: 8px;
        left: 0;
        width: 3px;
        height: auto;
    }

    .app-navbar .nav-item.active .nav-link {
        background: var(--brand-yellow-soft);
    }

    .user-navigation {
        align-items: stretch;
        margin-top: 7px;
        padding-top: 7px;
        border-top: 1px solid var(--border);
    }

    .app-navbar .logout-link {
        margin: 2px 0 0;
        border: 0;
    }

}

@media (max-width: 767.98px) {
    .app-container {
        padding-right: 16px;
        padding-left: 16px;
    }

    .app-main {
        padding: 16px 0 28px;
    }

    .page-header {
        margin-bottom: 12px;
    }

    .filter-card {
        gap: 12px;
        padding: 14px;
    }

    .filter-form {
        grid-template-columns: 1fr;
        gap: 13px;
    }

    .data-card {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .data-card .table-responsive {
        overflow: visible;
    }

    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody {
        display: grid;
        gap: 12px;
    }

    .responsive-table tbody tr {
        overflow: hidden;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: var(--shadow-sm);
    }

    .responsive-table tbody td {
        display: grid;
        grid-template-columns: minmax(92px, 34%) 1fr;
        align-items: baseline;
        padding: 13px 16px;
        border-top: 1px solid #eceee7;
        text-align: right;
    }

    .responsive-table tbody td:first-child {
        border-top: 0;
    }

    .responsive-table tbody td::before {
        padding-right: 10px;
        color: #858a80;
        content: attr(data-label);
        font-size: .68rem;
        font-weight: 800;
        letter-spacing: .05em;
        text-align: left;
        text-transform: uppercase;
    }

    .responsive-table tbody td > * {
        justify-self: end;
    }

    .responsive-table .empty-row td,
    .responsive-table .loading-row td {
        display: block;
        text-align: center;
    }

    .responsive-table .empty-row td::before,
    .responsive-table .loading-row td::before {
        display: none;
    }

    .empty-state {
        padding: 38px 15px;
    }

    .login-page {
        min-height: auto;
        padding: 6px 0 20px;
    }

    .login-heading,
    .form-signin {
        padding-right: 24px;
        padding-left: 24px;
    }

    .login-heading {
        padding-top: 25px;
    }

    .form-signin {
        padding-bottom: 28px;
    }
}

@media (max-width: 399.98px) {
    .app-navbar {
        padding: 0 14px;
    }

    .navbar-brand img {
        width: 130px;
    }

}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
