.master-table {
    font-size: 12px;
}

.master-table th {
    padding: 8px 10px;
    font-size: 11px;
    white-space: nowrap;
}

.master-table td {
    padding: 8px 10px;
    line-height: 1.4;
    vertical-align: middle;
}

.master-table td b {
    font-size: 12px;
    font-weight: 500;
}

.master-table td small {
    font-size: 10px;
    line-height: 1.35;
}

.master-table .badge {
    padding: 2px 8px;
    font-size: 10px;
}

.master-table .row-edit summary {
    font-size: 11px;
}

.master-table td:nth-child(1),
.master-table td:nth-child(3),
.master-table td:nth-child(5),
.master-table td:nth-child(6) {
    white-space: nowrap;
}

/* Unified Container Widths for proposal-page and dashboard-page */
.proposal-page,
.dashboard-page {
    width: min(1180px, 92%) !important;
    max-width: 1180px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.proposal-page .section-head {
    margin-bottom: 14px;
}

/* Global Unified Section Header Format & Sizes */
.section-head {
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    text-align: left !important;
}

.section-head>div {
    text-align: left !important;
}

.section-head .eyebrow {
    font-size: 10px !important;
    font-weight: 600 !important;
    letter-spacing: 0.6px !important;
    color: #164f8f !important;
    text-transform: uppercase !important;
    margin-bottom: 3px !important;
    display: block !important;
    line-height: 1.2 !important;
    text-align: left !important;
}

.section-head h1,
.section-head h2 {
    font-size: 13pt !important;
    font-weight: 600 !important;
    color: #0b2b55 !important;
    line-height: 1.3 !important;
    margin: 2px 0 3px 0 !important;
    text-align: left !important;
}

.section-head p {
    font-size: 11pt !important;
    font-weight: 400 !important;
    color: #64748b !important;
    margin: 0 !important;
    line-height: 1.35 !important;
    text-align: left !important;
}

.proposal-page .section-head h1,
.dashboard-page .section-head h1,
.report-page .section-head h1,
.report-form-page .section-head h1,
.projects-page .section-head h1,
.master-page .section-head h1 {
    font-size: 13pt !important;
    font-weight: 600 !important;
    color: #0b2b55 !important;
    line-height: 1.3 !important;
    margin: 2px 0 3px 0 !important;
    text-align: left !important;
}

.proposal-page .section-head p,
.dashboard-page .section-head p,
.report-page .section-head p,
.report-form-page .section-head p,
.projects-page .section-head p {
    font-size: 11pt !important;
    font-weight: 400 !important;
    color: #64748b !important;
    margin: 0 !important;
    line-height: 1.35 !important;
    text-align: left !important;
}

.master-page {
    padding-top: 10px !important;
}

.master-page .section-head {
    margin-top: 0 !important;
    margin-bottom: 12px !important;
}

.master-page .section-head .eyebrow {
    font-size: 9pt !important;
    font-weight: 600 !important;
    letter-spacing: 0.6px !important;
    color: #164f8f !important;
    text-transform: uppercase !important;
    margin-bottom: 2px !important;
    display: block !important;
    line-height: 1.2 !important;
}

.master-page .section-head p {
    font-size: 9pt !important;
    font-weight: 400 !important;
    color: #64748b !important;
    margin: 0 !important;
    line-height: 1.35 !important;
    text-align: left !important;
}

@media (max-width: 640px) {
    .section-head {
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        text-align: left !important;
        gap: 6px !important;
        margin-bottom: 12px !important;
        width: 100% !important;
    }

    .section-head>div {
        width: 100% !important;
        text-align: left !important;
        align-items: flex-start !important;
        display: flex !important;
        flex-direction: column !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .section-head .eyebrow,
    .section-head h1,
    .section-head h2,
    .section-head p {
        text-align: left !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }

    .section-head .head-actions {
        width: 100% !important;
        display: flex !important;
        justify-content: flex-start !important;
        margin-top: 4px !important;
    }
}

.proposal-page .eyebrow,
.proposal-page .form-required {
    font-size: 10.5px;
}

.proposal-page .form-section {
    margin-bottom: 14px;
    border-radius: 14px;
}

.proposal-page .form-section-head {
    gap: 11px;
    padding: 11px 16px;
}

.proposal-page .form-section-head>span {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 11px;
}

.proposal-page .form-section-head h2 {
    font-size: 15px;
}

.proposal-page .form-section-head p {
    font-size: 10px;
}

.proposal-page .form-section-body {
    padding: 15px 16px;
}

.proposal-page .field {
    margin-bottom: 11px;
}

.proposal-page .field label {
    margin-bottom: 4px;
    font-size: 12px;
}

.proposal-page .field small {
    font-size: 10px;
}

.proposal-page .input,
.proposal-page select,
.proposal-page textarea {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
}

.proposal-page textarea {
    min-height: 76px;
}

.proposal-page .choice-group,
.proposal-page .plan-options {
    gap: 7px;
}

.proposal-page .choice-group span,
.proposal-page .plan-options span {
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 11px;
}

.proposal-page .plan-options b {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    font-size: 10px;
}

.proposal-page .repeat-head,
.proposal-page .repeat-row {
    padding: 6px;
    gap: 6px;
}

.proposal-page .repeat-head,
.proposal-page .repeat-row .input,
.proposal-page .repeat-row select,
.proposal-page .repeat-row output {
    font-size: 11px;
}

.proposal-page .add-row {
    margin-top: 8px;
    padding: 5px 10px;
    font-size: 11px;
}

.proposal-page .remove-row {
    width: 25px;
    height: 25px;
    font-size: 15px;
}

.proposal-page .form-submit-bar {
    padding: 10px 13px;
    border-radius: 12px;
}

.proposal-page .form-submit-bar .btn {
    padding: 8px 13px;
    font-size: 12px;
}

.proposal-page .form-grid {
    gap: 0 12px;
}

.proposal-page .form-section-body {
    padding: 12px 14px;
}

.proposal-page .field {
    margin-bottom: 9px;
}

.proposal-page .field label {
    margin-bottom: 2px;
    font-size: 11px;
    line-height: 1.35;
}

.proposal-page .input,
.proposal-page select,
.proposal-page textarea {
    min-height: 35px;
    padding: 7px 9px;
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.35;
}

.proposal-page textarea {
    min-height: 68px;
}

.proposal-page .choice-group span,
.proposal-page .plan-options span {
    padding: 5px 8px;
    font-size: 10px;
    line-height: 1.35;
}

.proposal-page .quarter-group,
.proposal-page .plan-options {
    gap: 5px 7px;
}

.proposal-page .money-input span {
    top: 6px;
    right: 32px;
    font-size: 10px;
}

.proposal-page .money-input input {
    padding-right: 68px;
}

.proposal-page .repeat-row .input,
.proposal-page .repeat-row select {
    min-height: 31px;
    padding: 5px 7px;
    font-size: 11px;
}

.proposal-page .section-head h1 {
    font-size: 13pt !important;
    font-weight: 600 !important;
}

.proposal-page .section-head p {
    font-size: 11pt !important;
    font-weight: 400 !important;
}

.proposal-page .eyebrow,
.proposal-page .form-required {
    font-size: 10px;
}

.proposal-page .form-section-head h2 {
    font-size: 18px;
}

.proposal-page .form-section-head p {
    font-size: 12px;
}

.proposal-page .field label {
    font-size: 13px;
}

.proposal-page .field small {
    font-size: 12px;
}

.proposal-page .input,
.proposal-page select,
.proposal-page textarea {
    font-size: 14px;
}

.proposal-page .choice-group span,
.proposal-page .plan-options span {
    font-size: 12px;
}

.proposal-page .repeat-head,
.proposal-page .repeat-row .input,
.proposal-page .repeat-row select,
.proposal-page .repeat-row output {
    font-size: 13px;
}

.proposal-page .teacher-count {
    display: inline-flex;
    margin-left: 5px;
    padding: 1px 7px;
    border-radius: 20px;
    background: #e5edf7;
    color: #164f8f;
    font-size: 10px;
    font-weight: 600;
}

.proposal-page .supervisor-field {
    margin-top: 5px;
    padding-top: 11px;
    border-top: 1px dashed var(--line);
}

.proposal-page .step-method {
    min-height: 58px;
    resize: vertical;
    line-height: 1.45;
}

.proposal-page .expense-grid {
    grid-template-columns: 30px 1.8fr 80px 90px 100px 95px 1fr 34px
}

.proposal-page .expense-order {
    text-align: center;
    font-weight: 600;
    color: var(--muted)
}

/* Preserve Thai vowel and tone marks in the compact proposal form. */
.proposal-page,
.proposal-page button,
.proposal-page input,
.proposal-page select,
.proposal-page textarea,
.proposal-page option,
.proposal-page optgroup {
    font-family: 'Sarabun', Tahoma, sans-serif;
}

.proposal-page .section-head h1,
.proposal-page .form-section-head h2,
.proposal-page .form-section-head p,
.proposal-page .field label,
.proposal-page .field small,
.proposal-page .repeat-head,
.proposal-page .choice-group span,
.proposal-page .plan-options span {
    line-height: 1.6;
    overflow: visible;
}

.proposal-page .input,
.proposal-page input.input,
.proposal-page select,
.proposal-page textarea {
    line-height: 1.65;
    min-height: 42px;
    padding-top: 7px;
    padding-bottom: 7px;
}

.proposal-page textarea {
    min-height: 84px;
    overflow-y: auto;
}

.proposal-page .repeat-row .input,
.proposal-page .repeat-row select {
    min-height: 38px;
    line-height: 1.6;
    padding-top: 6px;
    padding-bottom: 6px;
}

.proposal-page .repeat-row textarea.step-method {
    min-height: 68px;
    line-height: 1.65;
}

/* ========================================================
   MODERN REFINED NAVIGATION & MENU BAR
   ======================================================== */

.topbar {
    height: 72px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid rgba(217, 227, 238, 0.85);
    box-shadow: 0 2px 16px rgba(11, 43, 85, 0.04);
}

.brand {
    gap: 13px;
}

.brand .logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(11, 43, 85, 0.18);
    transition: transform .2s ease;
}

.brand:hover .logo {
    transform: scale(1.03);
}

.brand b {
    font-size: 15px;
    font-weight: 700;
    color: #0b2b55;
    letter-spacing: -0.01em;
}

.brand small {
    font-size: 12px;
    font-weight: 500;
    color: #62778f;
    letter-spacing: 0.02em;
}

/* Mobile Nav Toggle */
.nav-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(212, 224, 237, 0.9);
    background: #f0f4f9;
    color: #0b2b55;
    display: none;
    place-items: center;
    cursor: pointer;
    transition: all 0.18s ease;
    padding: 0;
}

.nav-toggle:hover {
    background: #e2ecf7;
}

/* Nav Links Pill Container */
.nav-links {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 5px;
    background: rgba(238, 243, 249, 0.85);
    border: 1px solid rgba(212, 224, 237, 0.9);
    border-radius: 13px;
    box-shadow: inset 0 1px 2px rgba(11, 43, 85, 0.03);
}

/* Standard Nav Link */
.nav-links>a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 500;
    color: #3b5066;
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links>a:hover {
    background: rgba(255, 255, 255, 0.7);
    color: #0b2b55;
    border-color: rgba(212, 224, 237, 0.5);
    transform: translateY(-1px);
}

.nav-links>a.active {
    background: #ffffff;
    color: #0b2b55;
    font-weight: 600;
    border-color: rgba(200, 215, 232, 0.85);
    box-shadow: 0 2px 7px rgba(11, 43, 85, 0.09), 0 1px 2px rgba(11, 43, 85, 0.04);
}

/* Nav Icon inside main links */
.nav-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke-width: 1.8;
    color: currentColor;
    opacity: 0.75;
    transition: opacity 0.18s ease;
}

.nav-links>a:hover .nav-icon,
.nav-links>a.active .nav-icon,
.nav-dropdown:hover .nav-icon,
.nav-dropdown.active .nav-icon {
    opacity: 1;
}

/* Dropdown Container */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 500;
    color: #3b5066;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-dropdown summary::-webkit-details-marker,
.nav-dropdown summary::marker {
    display: none;
}

.nav-dropdown summary:hover,
.nav-dropdown[open] summary {
    background: rgba(255, 255, 255, 0.7);
    color: #0b2b55;
    border-color: rgba(212, 224, 237, 0.5);
}

.nav-dropdown.active summary {
    background: #ffffff;
    color: #0b2b55;
    font-weight: 600;
    border-color: rgba(200, 215, 232, 0.85);
    box-shadow: 0 2px 7px rgba(11, 43, 85, 0.09), 0 1px 2px rgba(11, 43, 85, 0.04);
}

/* Animated Chevron */
.chevron-svg {
    width: 11px;
    height: 11px;
    margin-left: 1px;
    opacity: 0.6;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.nav-dropdown summary:hover .chevron-svg,
.nav-dropdown[open] summary .chevron-svg,
.profile-menu summary:hover .chevron-svg,
.profile-menu[open] summary .chevron-svg {
    opacity: 1;
}

.nav-dropdown[open] summary .chevron-svg,
.nav-dropdown:hover summary .chevron-svg,
.profile-menu[open] summary .chevron-svg {
    transform: rotate(180deg);
}

/* Dropdown Menu Popover Card */
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 275px;
    padding: 7px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(215, 226, 238, 0.95);
    border-radius: 16px;
    box-shadow: 0 18px 45px -8px rgba(11, 43, 85, 0.16), 0 4px 12px rgba(11, 43, 85, 0.05);
    z-index: 70;
    flex-direction: column;
    gap: 3px;
    transform-origin: top left;
    animation: dropdownPop 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dropdownPop {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.nav-dropdown[open]>.nav-dropdown-menu {
    display: flex;
}

@media (min-width: 851px) {
    .nav-dropdown:hover>.nav-dropdown-menu {
        display: flex;
    }
}

/* Modern Submenu Card Item */
.nav-sub-item {
    display: flex !important;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border-radius: 11px;
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.nav-sub-item:hover {
    background: #f2f7fc;
    border-color: rgba(200, 218, 238, 0.5);
    transform: translateX(2px);
}

.nav-sub-item.active {
    background: #ebf3fb;
    border-color: rgba(185, 209, 234, 0.85);
}

/* Icon badge inside submenu */
.sub-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #edf3fa;
    color: #164f8f;
    transition: all 0.18s ease;
}

.sub-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
}

.nav-sub-item:hover .sub-icon {
    background: #164f8f;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(22, 79, 143, 0.28);
}

.nav-sub-item.active .sub-icon {
    background: #0b2b55;
    color: #ffffff;
}

/* Submenu item text */
.sub-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.sub-title {
    font-size: 13px;
    font-weight: 600;
    color: #14283f;
    line-height: 1.35;
    white-space: nowrap;
}

.nav-sub-item.active .sub-title {
    color: #0b2b55;
}

.sub-desc {
    font-size: 11px;
    color: #6d8095;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Arrow indicator on hover */
.sub-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0;
    color: #164f8f;
    transform: translateX(-4px);
    transition: all 0.18s ease;
}

.sub-arrow svg {
    width: 100%;
    height: 100%;
}

.nav-sub-item:hover .sub-arrow {
    opacity: 1;
    transform: translateX(0);
}

.nav-sub-item.active .sub-arrow {
    opacity: 0.8;
    transform: translateX(0);
}

/* Profile menu modern upgrade */
.profile-menu summary {
    border-radius: 12px;
    border: 1px solid rgba(215, 226, 238, 0.9);
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(11, 43, 85, 0.05);
}

.profile-menu summary:hover,
.profile-menu[open] summary {
    border-color: #a7c2df;
    background: #f7fafe;
}

.profile-dropdown {
    border-radius: 16px;
    border: 1px solid rgba(215, 226, 238, 0.95);
    box-shadow: 0 18px 45px -8px rgba(11, 43, 85, 0.16);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 240px;
}

.profile-icon {
    overflow: hidden;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    border-radius: inherit;
    display: block;
}

.profile-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 0;
}

.profile-user-avatar {
    width: 44px;
    height: 55px;
    aspect-ratio: 4 / 5;
    border-radius: 8px;
    object-fit: cover;
    object-position: top center;
    flex-shrink: 0;
    border: 1.5px solid rgba(215, 226, 238, 0.9);
    box-shadow: 0 2px 8px rgba(11, 43, 85, 0.08);
}

.profile-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-user-meta b {
    font-size: 13.5px;
    line-height: 1.35;
    color: #0b2b55;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-user-meta small {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 2px;
}

.profile-dept-badge {
    font-size: 10.5px;
    color: #164f8f;
    background: #eef4fb;
    padding: 2px 7px;
    border-radius: 6px;
    margin-top: 5px;
    display: inline-block;
    width: fit-content;
    max-width: 155px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(167, 194, 223, 0.4);
}

.brand {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

.brand span:last-child {
    white-space: nowrap !important;
}

.brand b,
.brand small {
    white-space: nowrap !important;
}

@media (max-width: 1180px) {
    .nav-toggle {
        display: grid;
    }

    .nav {
        border-radius: 0 0 18px 18px;
        border-bottom: 1px solid var(--line);
        box-shadow: 0 12px 30px rgba(11, 43, 85, 0.1);
    }

    .nav-links {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        gap: 6px;
    }

    .nav-links>a {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 11px;
    }

    .nav-dropdown {
        width: 100%;
        display: block;
    }

    .nav-dropdown summary {
        padding: 10px 14px;
        width: 100%;
        justify-content: space-between;
        font-size: 14px;
        border-radius: 11px;
    }

    .nav-dropdown-menu {
        position: static;
        width: 100%;
        margin-top: 4px;
        border: 1px solid rgba(215, 226, 238, 0.6);
        background: #f5f9fd;
        box-shadow: none;
        padding: 6px;
        border-radius: 12px;
        animation: none;
    }

    .nav-dropdown-menu::before {
        display: none;
    }

    .nav-sub-item {
        padding: 9px 11px;
    }
}

/* Modern & Compact Global Button Refinements */
.btn {
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    transition: all 0.15s ease;
}

.btn.small {
    height: 30px;
    padding: 0 11px;
    font-size: 11.5px;
    border-radius: 7px;
    gap: 5px;
}

.btn.outline {
    background: #ffffff;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    box-shadow: 0 1px 2px rgba(11, 43, 85, 0.04);
}

.btn.outline:hover {
    background: #f8fafc;
    border-color: #94a3b8 !important;
    color: #0b2b55 !important;
    transform: translateY(-1px);
}