/* assets/css/style.css */

html,
body {
    margin: 0;
    padding: 0;
}

html {
    background: #0f4a3c;
}

body {
    font-family: 'Sarabun', sans-serif;
    color: #163047;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.84), transparent 20%),
        linear-gradient(180deg, #eef5f1 0%, #f7fafc 100%);
}

.app-shell {
    position: relative;
    align-items: stretch;
}

.app-sidebar-backdrop {
    position: fixed;
    inset: 76px 0 0 0;
    background: rgba(10, 27, 23, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 1035;
}

.sidebar {
    min-height: 100vh;
}

.nav-link {
    color: #25435c;
    border-radius: 14px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 0.95rem;
    font-weight: 600;
}

.nav-link:hover {
    background: #e8f0f6;
}

.nav-link.active {
    background: linear-gradient(135deg, #0d6e5f 0%, #12836f 100%);
    color: #fff !important;
    box-shadow: 0 12px 24px rgba(18, 131, 111, 0.18);
}

.nav-link-icon {
    width: 1.4rem;
    text-align: center;
    flex: 0 0 auto;
}

.content {
    min-height: 100vh;
    background: transparent;
}

.card {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(18, 39, 63, 0.08);
}

.table,
table.dataTable {
    --bs-table-bg: #ffffff;
}

.table thead th,
.table > thead > tr > th,
.table > :not(caption) > thead > tr > th,
table.dataTable thead th,
table.dataTable thead td,
table.dataTable.table thead th,
table.dataTable.table thead td {
    background: #5c6475 !important;
    color: #ffffff !important;
    border-color: #d7dde5 !important;
    vertical-align: middle;
}

.table.ledger-table thead th,
.table.ledger-table > thead > tr > th,
.table.ledger-table > :not(caption) > thead > tr > th {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    color: #000000 !important;
}

.table thead th.sorting,
.table thead th.sorting_asc,
.table thead th.sorting_desc,
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    color: #ffffff !important;
}

.table tbody td,
table.dataTable tbody td {
    vertical-align: top;
}

.app-navbar {
    position: relative;
    background: linear-gradient(90deg, #0f4a3c 0%, #116357 45%, #1e7a68 100%);
    border-top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0;
    box-shadow: none !important;
}

.app-navbar::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #0f4a3c;
}

.app-navbar-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-navbar-start {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.app-sidebar-toggle {
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.app-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
}

.app-sidebar-toggle:focus {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15);
}

.app-sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #ffffff;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #fff;
}

.app-brand:hover {
    color: #fff;
}

.app-brand-logo {
    width: 58px;
    height: 58px;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: none;
}

.app-brand-logo img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.app-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.app-brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.app-brand-subtitle {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.82);
}

.app-navbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
}

.app-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 0.55rem 0.95rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.app-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.app-user-avatar svg {
    width: 22px;
    height: 22px;
    fill: #ffffff;
}

.app-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.12;
}

.app-user-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.98rem;
}

.app-user-role {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.app-logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 52px;
    padding: 0.8rem 1rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #fff3be 0%, #ffd978 100%);
    color: #21433b;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(12, 43, 35, 0.16);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.app-logout-link:hover {
    color: #163047;
    transform: translateY(-1px);
    filter: brightness(1.02);
    box-shadow: 0 16px 28px rgba(12, 43, 35, 0.2);
}

.app-sidebar {
    width: 290px;
    min-height: calc(100vh - 76px);
    background: linear-gradient(180deg, #f8fcfa 0%, #eff7f3 100%);
    flex: 0 0 290px;
    transition: width 0.25s ease, flex-basis 0.25s ease, margin-left 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
    overflow: hidden;
}

.app-sidebar-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 1.15rem 1.25rem 0.75rem;
    border-bottom: 1px solid #dce9e3;
}

.app-sidebar-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.app-sidebar-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #17473b;
}

.app-sidebar-subtitle {
    font-size: 0.74rem;
    color: #648174;
    line-height: 1.3;
}

.app-content {
    width: 100%;
    min-width: 0;
    transition: padding 0.25s ease;
}

body.sidebar-collapsed .app-sidebar {
    width: 0;
    flex-basis: 0;
    margin-left: -1px;
    opacity: 0;
}

body.sidebar-collapsed .app-sidebar-header,
body.sidebar-collapsed .app-sidebar .nav {
    opacity: 0;
    pointer-events: none;
}

body.sidebar-collapsed .app-sidebar-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.sidebar-collapsed .app-sidebar-toggle span:nth-child(2) {
    opacity: 0;
}

body.sidebar-collapsed .app-sidebar-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.dashboard-shell {
    display: grid;
    gap: 1.5rem;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.9fr);
    gap: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f3fbf6 100%);
    border: 1px solid #d9e7df;
    border-radius: 28px;
    padding: 2rem;
    box-shadow: 0 20px 55px rgba(16, 58, 44, 0.08);
}

.dashboard-kicker {
    display: inline-block;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: #e4f2ea;
    color: #1a6b57;
    font-weight: 700;
    margin-bottom: 1rem;
}

.dashboard-hero h1 {
    font-size: clamp(2rem, 4vw, 3.1rem);
    font-weight: 800;
    color: #16453a;
    margin-bottom: 0.9rem;
}

.dashboard-hero p {
    color: #526d61;
    font-size: 1.05rem;
    max-width: 720px;
}

.dashboard-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.35rem;
}

.dashboard-pill {
    padding: 0.62rem 0.9rem;
    border-radius: 999px;
    background: #f2f8f5;
    border: 1px solid #d7e5de;
    color: #264d42;
    font-weight: 600;
}

.dashboard-hero-media {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-logo-card {
    width: 100%;
    max-width: 340px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
    border: 1px solid #dbeae2;
    border-radius: 24px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 20px 45px rgba(17, 74, 59, 0.09);
}

.dashboard-logo-card img {
    width: min(100%, 220px);
    height: auto;
    object-fit: contain;
}

.dashboard-logo-text {
    display: grid;
    gap: 0.25rem;
    margin-top: 1rem;
    color: #2d564b;
}

.dashboard-logo-text strong {
    font-size: 0.98rem;
}

.dashboard-logo-text span {
    font-size: 0.86rem;
    color: #688477;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.dashboard-card {
    background: #fff;
    border: 1px solid #dbe7df;
    border-radius: 22px;
    padding: 1.5rem;
    box-shadow: 0 12px 28px rgba(17, 74, 59, 0.06);
}

.dashboard-card-icon {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    background: linear-gradient(135deg, #eef8f2 0%, #dbefe4 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.dashboard-card-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.dashboard-card h3 {
    font-size: 1.08rem;
    font-weight: 700;
    color: #17453a;
    margin-bottom: 0.6rem;
}

.dashboard-card p {
    color: #61796d;
    margin: 0;
}

.login-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.30), transparent 28%),
        linear-gradient(135deg, #0d3b2f 0%, #116357 45%, #1f7d69 100%);
    color: #102336;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.login-panel {
    width: 100%;
    max-width: 1140px;
    border-radius: 30px;
    overflow: hidden;
    background: rgba(255,255,255,0.97);
    box-shadow: 0 28px 80px rgba(8, 28, 22, 0.34);
}

.login-hero {
    background: linear-gradient(180deg, #0f4b3d 0%, #156655 100%);
    color: #fff;
    padding: 44px 40px;
    position: relative;
}

.login-hero::after {
    content: '';
    position: absolute;
    inset: auto -95px -95px auto;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.login-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    font-size: 0.95rem;
    font-weight: 700;
}

.login-badge img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.login-seal-wrap {
    margin: 1.5rem 0 1rem;
}

.login-seal-main {
    width: min(100%, 220px);
    background: #fff;
    border-radius: 24px;
    padding: 0.75rem;
    box-shadow: 0 22px 45px rgba(7, 32, 24, 0.18);
}

.login-hero h1 {
    font-size: clamp(1.85rem, 3vw, 3rem);
    line-height: 1.15;
    margin: 0 0 14px;
    font-weight: 800;
}

.login-hero p {
    max-width: 520px;
    margin: 0;
    color: rgba(255,255,255,0.85);
    font-size: 1.02rem;
}

.login-points {
    margin-top: 28px;
    display: grid;
    gap: 14px;
}

.login-point {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.88);
}

.login-point .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffd166;
    box-shadow: 0 0 0 6px rgba(255, 209, 102, 0.18);
    flex: 0 0 auto;
}

.login-form-wrap {
    padding: 48px 40px;
    background: linear-gradient(180deg, #fbfdff 0%, #f2f7fb 100%);
}

.login-form-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 1rem;
}

.login-form-brand img {
    width: 62px;
    height: 62px;
    object-fit: contain;
}

.login-card-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #153d33;
    margin-bottom: 4px;
}

.login-card-subtitle {
    color: #5c7287;
}

.login-label {
    font-weight: 700;
    color: #244862;
    margin-bottom: 8px;
}

.login-input {
    height: 52px;
    border-radius: 16px;
    border: 1px solid #d7e2ea;
    padding: 0 16px;
    background: #fff;
}

.login-input:focus {
    border-color: #1f7a8c;
    box-shadow: 0 0 0 4px rgba(31, 122, 140, 0.14);
}

.btn-login {
    height: 54px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f8a73 0%, #1f7d69 100%);
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 12px 28px rgba(18, 114, 163, 0.22);
}

.login-note {
    font-size: 0.92rem;
    color: #70879a;
    margin-top: 18px;
}

@media (max-width: 1199.98px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: 250px;
        flex-basis: 250px;
    }

    .login-hero,
    .login-form-wrap {
        padding: 32px 24px;
    }

    .app-brand-subtitle {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .app-shell {
        display: block !important;
    }

    .app-sidebar {
        position: fixed;
        top: 76px;
        left: 0;
        bottom: 0;
        z-index: 1040;
        width: min(300px, calc(100vw - 24px));
        flex-basis: auto;
        box-shadow: 0 24px 50px rgba(12, 43, 35, 0.18);
    }

    body.mobile-sidebar-open .app-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    body.mobile-sidebar-open {
        overflow: hidden;
    }

    body.sidebar-collapsed .app-sidebar {
        margin-left: 0;
        transform: translateX(-100%);
        opacity: 1;
    }

    .app-navbar {
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .app-navbar-inner {
        min-height: auto;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        align-items: stretch;
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .app-navbar-start {
        width: 100%;
        gap: 0.7rem;
    }

    .app-sidebar-toggle {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        flex: 0 0 44px;
    }

    .app-brand {
        gap: 10px;
        min-width: 0;
        flex: 1 1 auto;
    }

    .app-brand-logo {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    .app-brand-logo img {
        width: 42px;
        height: 42px;
    }

    .app-brand-text {
        min-width: 0;
    }

    .app-brand-subtitle {
        display: none;
    }

    .app-navbar-user {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.6rem;
        align-items: stretch;
    }

    .app-user-chip {
        min-width: 0;
        min-height: 46px;
        padding: 0.45rem 0.75rem;
        border-radius: 16px;
    }

    .app-user-avatar {
        width: 40px;
        height: 40px;
    }

    .app-user-avatar svg {
        width: 20px;
        height: 20px;
    }

    .app-user-name {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-user-role {
        font-size: 0.7rem;
        letter-spacing: 0.05em;
    }

    .app-logout-link {
        min-height: 46px;
        padding: 0.72rem 0.9rem;
        border-radius: 14px;
        white-space: nowrap;
    }

    .content {
        padding: 1rem !important;
    }

    .app-brand-title {
        font-size: 1rem;
    }
}


.app-logout-link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex: 0 0 auto;
}
