:root {
    color-scheme: light;
    --ink: #000000;
    --muted: #666666;
    --line: #e7ddd4;
    --surface: #ffffff;
    --page: #fff7f1;
    --accent: #e35205;
    --accent-dark: #b74004;
    --accent-soft: #fff1e8;
    --accent-line: #f3c5aa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: calc(100vh - 58px);
    background: var(--page);
    color: var(--ink);
    font-family: "Kanit", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(135deg, rgb(227 82 5 / 7%), transparent 36%),
        linear-gradient(315deg, rgb(102 102 102 / 5%), transparent 34%);
    content: "";
}

a {
    color: var(--accent-dark);
    font-weight: 500;
}

.shell {
    display: grid;
    min-height: calc(100vh - 58px);
    place-items: center;
    padding: 24px;
}

.status-panel {
    width: min(760px, 100%);
    border: 1px solid var(--line);
    border-top: 5px solid var(--accent);
    border-radius: 8px;
    background: var(--surface);
    padding: 32px;
    box-shadow: 0 12px 32px rgb(0 0 0 / 8%);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    color: var(--ink);
    font-size: 30px;
    font-weight: 600;
    line-height: 1.25;
}

.lede {
    margin: 16px 0 0;
    color: var(--muted);
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 28px 0 0;
}

.status-grid.family-show-summary .status-row-full {
    grid-column: 1 / -1;
}
.status-grid div {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 16px;
}

dt {
    color: var(--muted);
    font-size: 13px;
}

dd {
    margin: 4px 0 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

@media (max-width: 680px) {
    .status-panel {
        padding: 24px;
    }

    h1 {
        font-size: 24px;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }
}

.auth-panel {
    max-width: 520px;
}

.form-stack {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.form-stack label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
}

.form-stack input,
.form-stack textarea,
.form-stack select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--ink);
    font: inherit;
}

.form-stack input:focus,
.form-stack textarea:focus,
.form-stack select:focus {
    border-color: var(--accent);
    outline: 3px solid rgb(227 82 5 / 16%);
}

.form-stack button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-weight: 500;
    padding: 10px 16px;
    text-decoration: none;
    cursor: pointer;
}

.form-stack button:hover,
.button-link:hover {
    background: var(--accent-dark);
}

.form-stack button.button-secondary:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.button-disabled {
    cursor: not-allowed;
    opacity: 0.72;
    box-shadow: none;
}

.button-disabled:hover {
    background: var(--surface);
    transform: none;
    box-shadow: none;
}

.alert {
    margin: 20px 0 0;
    border-radius: 8px;
    padding: 12px 14px;
}

.alert-error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.alert-warning {
    border: 1px solid #f3c5aa;
    background: var(--accent-soft);
    color: #8a3203;
}

.topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

@media (max-width: 680px) {
    .topline {
        display: grid;
    }
}

.shell-wide {
    place-items: start center;
}

.panel-wide {
    width: min(1160px, 100%);
}

.admin-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
}

.admin-menu a,
.button-secondary {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--accent-dark);
}

.admin-menu a {
    display: flex;
    align-items: center;
    min-height: 52px;
    border-radius: 8px;
    padding: 12px 14px;
    text-decoration: none;
    font-weight: 500;
}

.admin-menu a:hover,
.button-secondary:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.button-secondary.button-disabled:hover {
    border-color: var(--line);
    background: #ffffff;
    color: var(--accent-dark);
}

.form-stack textarea {
    resize: vertical;
}

.check-row {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 10px !important;
    color: var(--ink) !important;
}

.check-row input {
    width: auto;
}

.table-wrap {
    margin-top: 24px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.matrix-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: #ffffff;
}

.matrix-table th,
.matrix-table td {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 12px;
    text-align: center;
    vertical-align: middle;
}

.matrix-table th:first-child {
    width: 260px;
    text-align: left;
}

.matrix-table tr:last-child th,
.matrix-table tr:last-child td {
    border-bottom: 0;
}

.matrix-table th:last-child,
.matrix-table td:last-child {
    border-right: 0;
}

.matrix-table thead th {
    background: var(--accent-soft);
    color: #3a1702;
    font-size: 14px;
    font-weight: 600;
}

.matrix-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.action-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.alert-success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

@media (max-width: 820px) {
    .admin-menu {
        grid-template-columns: 1fr;
    }
}

.form-card-list {
    display: grid;
    gap: 14px;
    margin-top: 28px;
}

.form-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 18px;
}

.form-card h2,
.form-workflow h2,
.panel-wide > h2 {
    margin: 0;
    color: var(--ink);
    font-size: 20px;
    font-weight: 600;
}

.form-card h2 {
    margin-top: 2px;
}

.muted {
    margin: 8px 0 0;
    color: var(--muted);
}

.muted.relationship-eligibility {
    color: #008a22;
    font-size: 1.12rem;
    font-weight: 700;
}

.form-workflow h2,
.panel-wide > h2 {
    margin-top: 28px;
}

.form-grid,
.readonly-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.readonly-grid div {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 14px;
}

.span-2 {
    grid-column: span 2;
}

.beneficiary-table input {
    width: 100%;
    min-width: 140px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
}

.beneficiary-table input:focus {
    border-color: var(--accent);
    outline: 3px solid rgb(227 82 5 / 16%);
}

.action-row-gap {
    gap: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 4px 10px;
    font-weight: 600;
}

@media (max-width: 900px) {
    .form-grid,
    .readonly-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .form-card {
        align-items: stretch;
        flex-direction: column;
    }
}


.login-page {
    min-height: calc(100vh - 58px);
    background:
        linear-gradient(rgb(227 82 5 / 7%) 1px, transparent 1px),
        linear-gradient(90deg, rgb(227 82 5 / 7%) 1px, transparent 1px),
        radial-gradient(circle at 50% 34%, #ffffff 0 28rem, rgb(255 244 236 / 76%) 44rem, transparent 58rem),
        linear-gradient(180deg, #fffdfb 0%, #fff7f1 58%, #fdeee4 100%);
    background-size: 128px 128px, 128px 128px, auto, auto;
}

.login-page::before {
    display: none;
}

.login-shell {
    display: grid;
    min-height: calc(100vh - 58px);
    place-items: center;
    padding: 38px 24px;
}

.login-card {
    display: grid;
    grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 1fr);
    gap: 46px;
    width: min(1120px, 100%);
    min-height: 630px;
    border: 1px solid rgb(227 82 5 / 12%);
    border-radius: 28px;
    background: rgb(255 255 255 / 92%);
    padding: 26px;
    box-shadow: 0 24px 58px rgb(138 50 3 / 12%);
    backdrop-filter: blur(10px);
}

.login-visual {
    position: relative;
    display: flex;
    min-height: 578px;
    overflow: hidden;
    border: 1px solid rgb(227 82 5 / 14%);
    border-radius: 24px;
    background: #ffffff;
    isolation: isolate;
}

.login-visual-image {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.login-visual::after {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgb(58 23 2 / 44%) 0%, rgb(255 247 241 / 16%) 42%, rgb(255 255 255 / 8%) 100%);
    content: "";
}

.login-visual-copy {
    position: relative;
    z-index: 3;
    align-self: flex-start;
    width: 100%;
    padding: 34px 38px;
    color: #ffffff;
}

.login-visual-copy h2 {
    margin: 0;
    color: #ffffff;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.28;
    text-shadow: 0 2px 14px rgb(0 0 0 / 32%);
}


.login-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 34px 48px 34px 0;
    text-align: center;
}

.login-form-panel .eyebrow {
    align-self: center;
}

.login-form-panel h1 {
    font-size: 38px;
    line-height: 1.18;
}

.login-form-panel .lede {
    margin-top: 12px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--line);
}

.login-form {
    gap: 18px;
    margin-top: 28px;
    text-align: left;
}

.login-form input,
.login-form textarea,
.login-form select {
    min-height: 52px;
    border-color: #eadbd0;
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 80%);
}

.login-form button {
    min-height: 56px;
    margin-top: 10px;
    font-size: 18px;
    box-shadow: 0 12px 24px rgb(227 82 5 / 20%);
}

.login-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.login-form-scroll {
    max-height: 46vh;
    overflow-y: auto;
    padding-right: 8px;
}

.login-footnote {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.brand-logo {
    display: block;
    width: min(320px, 100%);
    height: auto;
    margin: 0 auto 26px;
    object-fit: contain;
}

.login-form-panel .brand-logo + h1 {
    margin-top: 0;
}

@media (max-width: 980px) {
    .login-card {
        grid-template-columns: 1fr;
        gap: 26px;
        min-height: auto;
        padding: 20px;
    }

    .login-visual {
        min-height: 260px;
    }

    .login-visual-copy {
        padding: 32px;
    }

    .login-visual-copy h2 {
        font-size: 30px;
    }

    .login-form-panel {
        padding: 8px 18px 24px;
    }

    .login-form-scroll {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }
}

@media (max-width: 620px) {
    .login-shell {
        align-items: stretch;
        padding: 12px;
    }

    .login-card {
        border-radius: 20px;
        padding: 12px;
    }

    .login-visual {
        min-height: 190px;
        border-radius: 16px;
    }

    .login-visual-copy {
        padding: 20px;
    }

    .login-visual-copy h2 {
        font-size: 22px;
    }

    .login-form-panel h1 {
        font-size: 26px;
    }

    .login-form-panel {
        padding: 8px 8px 18px;
    }

    .login-form-grid {
        grid-template-columns: 1fr;
    }

    .brand-logo {
        width: min(250px, 100%);
        margin-bottom: 18px;
    }
}

.site-footer {
    padding: 18px 24px 22px;
    color: var(--muted);
    font-size: 15px;
    text-align: center;
}

.login-page .site-footer {
    background: transparent;
}


.profile-summary dd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-avatar {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: var(--accent-soft);
    object-fit: cover;
    box-shadow: 0 6px 16px rgb(138 50 3 / 14%);
}

.profile-avatar-large {
    width: 72px;
    height: 72px;
}

.section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
}

.section-heading-row h2 {
    margin-top: 0;
}

.form-heading-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 620px) {
    .profile-summary dd,
    .section-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-heading-actions {
        align-items: flex-start;
        justify-content: flex-start;
    }
}


.login-sso-button {
    width: 100%;
    margin-top: 10px;
}


.topline-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 680px) {
    .topline-actions {
        justify-content: flex-start;
    }
}


.admin-dashboard-page {
    min-height: 100vh;
    background: #ededeb;
}

.admin-dashboard-page::before {
    background: linear-gradient(135deg, rgb(227 82 5 / 9%), transparent 34%), linear-gradient(315deg, rgb(0 0 0 / 4%), transparent 32%);
}

.admin-app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 0;
    width: min(1180px, calc(100% - 48px));
    min-height: calc(100vh - 104px);
    margin: 48px auto 0;
    overflow: hidden;
    border: 1px solid rgb(0 0 0 / 5%);
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 26px 70px rgb(0 0 0 / 14%);
}

.admin-sidebar {
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    gap: 24px;
    border-right: 1px solid #f0e8e2;
    background: #fffdfb;
    padding: 28px 20px 18px;
}

.admin-brand {
    display: grid;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.admin-brand img {
    width: 126px;
    max-width: 100%;
}

.admin-brand span {
    font-size: 18px;
    font-weight: 600;
}

.admin-side-nav {
    display: grid;
    align-content: start;
    gap: 8px;
}

.admin-side-nav a,
.admin-logout-link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 42px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 12px;
    text-decoration: none;
}

.admin-side-nav a:hover,
.admin-side-nav a.is-active {
    background: var(--accent-soft);
    color: var(--ink);
}

.admin-side-nav a.is-active::before {
    position: absolute;
    left: -20px;
    width: 4px;
    height: 28px;
    border-radius: 0 8px 8px 0;
    background: var(--accent);
    content: "";
}

.admin-sidebar-card {
    border-radius: 8px;
    background: linear-gradient(135deg, #4b1602, #8a3203);
    color: #ffffff;
    padding: 18px;
}

.admin-sidebar-card span,
.admin-sidebar-card p {
    color: rgb(255 255 255 / 78%);
    font-size: 13px;
}

.admin-sidebar-card strong {
    display: block;
    margin-top: 4px;
    font-size: 22px;
}

.admin-sidebar-card p {
    margin: 8px 0 0;
}

.admin-logout-link {
    color: #b91c1c;
}

.admin-main-panel {
    min-width: 0;
    background: #fffaf6;
    padding: 28px;
}

.admin-topbar,
.admin-dashboard-head,
.widget-heading,
.form-bar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-topbar {
    margin-bottom: 28px;
}

.admin-search {
    width: min(420px, 100%);
    border: 1px solid #f0e3d9;
    border-radius: 8px;
    background: #ffffff;
    color: #9a8f86;
    font-size: 14px;
    padding: 12px 16px;
    box-shadow: 0 10px 24px rgb(138 50 3 / 6%);
}

.admin-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #f0e3d9;
    border-radius: 999px;
    background: #ffffff;
    padding: 7px 12px;
}

.admin-user-pill span {
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
}

.admin-user-pill strong {
    max-width: 180px;
    overflow: hidden;
    color: var(--ink);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-dashboard-head {
    align-items: flex-start;
    margin-bottom: 22px;
}

.admin-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.admin-metric-card,
.admin-widget {
    border: 1px solid #f0e3d9;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 14px 30px rgb(138 50 3 / 7%);
}

.admin-metric-card {
    min-height: 132px;
    padding: 18px;
}

.metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 16px;
    font-weight: 700;
}

.admin-metric-card p {
    margin: 12px 0 4px;
    color: var(--ink);
    font-weight: 500;
}

.admin-metric-card strong {
    display: block;
    color: var(--ink);
    font-size: 30px;
    line-height: 1.2;
}

.admin-metric-card small {
    color: #0f7a3b;
    font-size: 12px;
}

.admin-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 16px;
}

.admin-widget {
    min-width: 0;
    padding: 18px;
}

.admin-widget-wide {
    grid-row: span 2;
}

.widget-heading {
    align-items: flex-start;
    margin-bottom: 14px;
}

.widget-heading h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

.widget-heading span {
    border: 1px solid #f0e3d9;
    border-radius: 999px;
    background: #fffaf6;
    color: var(--muted);
    font-size: 13px;
    padding: 6px 10px;
}


.admin-form {
    display: grid;
    max-width: 620px;
    gap: 16px;
}

.admin-form label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.admin-form select {
    min-height: 46px;
    border: 1px solid #ead7c9;
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    padding: 0 14px;
}

.admin-form button {
    width: fit-content;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 12px 18px;
}

.admin-form button:hover {
    background: var(--accent-dark);
    color: #ffffff;
}

.admin-form-bars,
.admin-list {
    display: grid;
    gap: 12px;
}

.form-bar-row {
    align-items: center;
    border-top: 1px solid #f4ebe4;
    padding-top: 12px;
}

.form-bar-row div:first-child {
    min-width: 0;
    width: 42%;
}

.form-bar-row strong,
.admin-list strong {
    color: var(--ink);
}

.form-bar-row span,
.admin-list span,
.recent-list small {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-bar-track {
    flex: 1;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #f7eee7;
}

.form-bar-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #ff7a1a);
}

.form-bar-row em {
    min-width: 36px;
    color: var(--accent-dark);
    font-style: normal;
    font-weight: 600;
    text-align: right;
}

.admin-list div {
    position: relative;
    border-top: 1px solid #f4ebe4;
    padding-top: 12px;
}

.admin-list div:first-child,
.form-bar-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.admin-list strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
}

@media (max-width: 980px) {
    .admin-app-shell {
        grid-template-columns: 1fr;
        width: min(720px, calc(100% - 28px));
        margin-top: 20px;
    }

    .admin-sidebar {
        grid-template-rows: auto auto auto;
        border-right: 0;
        border-bottom: 1px solid #f0e8e2;
    }

    .admin-side-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-metric-grid,
    .admin-dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-widget-wide {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .admin-app-shell {
        width: min(100% - 16px, 520px);
        border-radius: 16px;
    }

    .admin-main-panel,
    .admin-sidebar {
        padding: 20px;
    }

    .admin-topbar,
    .admin-dashboard-head,
    .form-bar-row {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-side-nav,
    .admin-metric-grid,
    .admin-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .admin-widget-wide {
        grid-column: auto;
    }

    .form-bar-row div:first-child,
    .admin-search {
        width: 100%;
    }
}

.admin-user-form {
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
    align-items: end;
}

.admin-user-table-wrap {
    margin-top: 28px;
    overflow-x: auto;
}

.admin-user-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.admin-user-table th,
.admin-user-table td {
    border-bottom: 1px solid var(--line);
    padding: 14px 12px;
    text-align: left;
    vertical-align: middle;
}

.admin-user-table th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.inline-admin-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.inline-admin-form select {
    min-width: 128px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    padding: 8px 10px;
}

.inline-admin-form button {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-weight: 500;
    padding: 7px 12px;
    cursor: pointer;
}

.inline-admin-form button:hover {
    background: var(--accent-dark);
}

.inline-admin-form .button-secondary {
    border-color: var(--line);
    background: #ffffff;
    color: var(--accent-dark);
}

.admin-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
}

.admin-status-badge.is-active {
    background: #dcfce7;
    color: #166534;
}

.admin-status-badge.is-muted {
    background: #f3f4f6;
    color: #6b7280;
}

@media screen and (max-width: 760px) {
    .admin-user-form {
        grid-template-columns: 1fr;
    }
}
.editable-panel {
    margin-top: 14px;
    border: 1px solid #86efac;
    border-radius: 8px;
    background: #f0fdf4;
    padding: 16px;
}

.editable-panel h2 {
    margin-top: 0;
}


.section-heading-compact {
    align-items: flex-start;
    gap: 12px;
}

.checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    color: var(--text);
    font-weight: 500;
}

.checkbox-line input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.checkbox-line span {
    line-height: 1.45;
}
.editable-field input,
.editable-field select,
.beneficiary-table input {
    background: #ffffff;
}

.editable-field input:required:invalid,
.editable-field select:required:invalid,
.beneficiary-table input:required:invalid {
    border-color: #dc2626;
    background: #fff7f7;
}

.editable-field input:required:invalid:focus,
.editable-field select:required:invalid:focus,
.beneficiary-table input:required:invalid:focus {
    outline-color: rgb(220 38 38 / 18%);
}


.document-grid {
    grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(110px, 0.7fr) minmax(180px, 1fr);
    align-items: end;
}

.document-lifetime {
    align-self: end;
}

.beneficiary-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px 12px;
    margin-top: 10px;
}

.beneficiary-name {
    grid-column: span 6;
}

.beneficiary-relation,
.beneficiary-percent {
    grid-column: span 3;
}

.beneficiary-grid-head {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.beneficiary-field {
    display: grid;
    gap: 6px;
}

.beneficiary-field span {
    display: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.beneficiary-field input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    padding: 10px 12px;
}

.beneficiary-total {
    margin-top: 12px;
}

.beneficiary-total-error {
    margin-top: 10px;
}

@media screen and (max-width: 760px) {
    .beneficiary-grid {
        grid-template-columns: 1fr;
    }

    .beneficiary-name,
    .beneficiary-relation,
    .beneficiary-percent {
        grid-column: auto;
    }

    .beneficiary-grid-head {
        display: none;
    }

    .beneficiary-field span {
        display: block;
    }
}
.span-3 {
    grid-column: span 3;
}

@media (max-width: 1100px) {
    .document-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .span-2,
    .span-3 {
        grid-column: auto;
    }
}

@media (max-width: 680px) {
    .document-grid {
        grid-template-columns: 1fr;
    }
}
.print-body {
    background: #f7f2ec;
    font-family: "Sarabun", "Kanit", system-ui, sans-serif;
}

.print-page {
    max-width: 940px;
    margin: 24px auto;
    padding: 0 16px;
}

.print-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 14px;
}

.print-actions button,
.print-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--accent-dark);
    font: inherit;
    font-weight: 600;
    padding: 8px 14px;
    text-decoration: none;
    cursor: pointer;
}

.print-actions button {
    border-color: transparent;
    background: var(--accent);
    color: #ffffff;
}

.print-document {
    min-height: 1120px;
    border: 1px solid #eadfd4;
    border-radius: 8px;
    background: #ffffff;
    color: #111111;
    padding: 34px 42px;
    box-shadow: 0 18px 40px rgb(68 42 20 / 12%);
}

.print-header {
    text-align: center;
    border-bottom: 2px solid #111111;
    margin-bottom: 16px;
    padding-bottom: 14px;
}

.print-header p {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 600;
}

.print-header h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.45;
}

.print-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 15px;
}

.print-document h2 {
    margin: 18px 0 8px;
    font-size: 18px;
    border-bottom: 1px solid #d6d3d1;
    padding-bottom: 4px;
}

.print-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    margin: 0;
}

.print-grid div {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 8px;
    border-bottom: 1px dotted #b6aea6;
    padding: 4px 0;
}

.print-grid dt {
    color: #44403c;
    font-weight: 600;
}

.print-grid dd {
    margin: 0;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.print-table th,
.print-table td {
    border: 1px solid #78716c;
    padding: 7px 8px;
    text-align: left;
    vertical-align: top;
}

.print-table th {
    background: #f5f5f4;
    font-weight: 700;
}

.print-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 52px;
    text-align: center;
    font-size: 16px;
}

.print-signatures span {
    display: inline-block;
    margin-top: 8px;
}

@media print {
    @page {
        size: A4;
        margin: 8mm;
    }

    body.print-body {
        background: #ffffff;
    }

    .print-page {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .print-actions,
    .site-footer {
        display: none !important;
    }

    .print-document {
        min-height: auto;
        border: 1px solid #eadfd4;
        border-radius: 8px;
        padding: 22px 28px;
        box-shadow: none;
    }
}

@media screen and (max-width: 760px) {
    .print-document {
        padding: 24px 18px;
    }

    .print-meta,
    .print-signatures {
        grid-template-columns: 1fr;
        display: grid;
    }

    .print-grid {
        grid-template-columns: 1fr;
    }

    .print-grid div {
        grid-template-columns: 1fr;
    }
}
.readonly-panel .form-grid > div,
.beneficiary-readonly-cell {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 12px 14px;
}

.beneficiary-readonly-cell span {
    display: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.beneficiary-readonly-cell strong {
    display: block;
    margin-top: 2px;
    color: var(--ink);
    font-weight: 500;
    overflow-wrap: anywhere;
}

@media screen and (max-width: 760px) {
    .beneficiary-readonly-cell span {
        display: block;
    }
}

.beneficiary-empty {
    grid-column: 1 / -1;
}

.consent-panel {
    margin-top: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(227, 82, 5, 0.22);
    border-radius: 8px;
    background: rgba(255, 248, 244, 0.92);
    color: var(--text);
}

.consent-panel h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: var(--accent-dark);
}

.consent-panel p {
    margin: 0;
    line-height: 1.8;
    color: var(--muted-text);
}

.print-consent {
    margin-top: 16px;
    page-break-inside: avoid;
}
.print-template-document {
    font-size: 14px;
    line-height: 1.5;
    padding: 22px 28px;
}

.print-template-header {
    text-align: center;
    margin-bottom: 10px;
}

.print-template-header-inner {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(180px, 0.55fr);
    align-items: start;
    gap: 16px;
    margin-bottom: 8px;
}

.print-header-left {
    text-align: left;
}

.print-header-right {
    text-align: right;
    font-weight: 600;
    line-height: 1.45;
    padding-top: 3px;
}

.print-header-right p {
    margin: 0;
}

.print-header-right p + p {
    font-weight: 500;
}

.print-kmitl-logo {
    display: block;
    width: min(100%, 370px);
    height: auto;
    margin: 0;
}

.print-template-header h1,
.print-template-header h2 {
    margin: 0;
    color: #000;
    font-weight: 700;
    line-height: 1.35;
}

.print-template-header h1 {
    font-size: 17px;
}

.print-template-header h2 {
    font-size: 16px;
}

.print-template-section {
    margin-top: 8px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.print-form-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 5px 0;
    min-width: 0;
}

.print-full-line {
    flex-wrap: wrap;
}

.print-personal-line,
.print-three-line,
.print-two-line,
.print-address-line {
    flex-wrap: wrap;
}

.print-line-no,
.print-line-label,
.print-inline-label,
.print-suffix {
    font-weight: 500;
    white-space: nowrap;
}

.print-checkbox-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
}

.print-checkbox-item {
    white-space: nowrap;
}

.print-checkbox {
    font-family: "Sarabun", sans-serif;
    font-weight: 600;
}

.print-inline-field {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    flex: 1 1 150px;
    min-width: 0;
}

.print-personal-line {
    display: grid;
    grid-template-columns: auto minmax(96px, 0.62fr) minmax(146px, 0.86fr) minmax(132px, 0.76fr) minmax(132px, 0.76fr);
    align-items: baseline;
    column-gap: 5px;
}

.print-personal-line .print-inline-field {
    flex: none;
    min-width: 0;
    justify-self: start;
}

.print-personal-line .print-body-measure-field {
    justify-self: start;
}

.print-age-field,
.print-birth-field {
    white-space: nowrap;
}

.print-age-field .print-fill {
    min-width: 34px;
    max-width: 46px;
    flex: 0 0 34px;
    text-align: center;
}

.print-birth-field {
    gap: 4px;
}

.print-birth-field .print-fill {
    min-width: 92px;
    max-width: 108px;
    flex: 0 0 96px;
    padding-left: 4px;
    padding-right: 4px;
}

.print-body-measure-field {
    gap: 3px;
    white-space: nowrap;
}


.print-body-measure-field .print-inline-label,
.print-body-measure-field .print-suffix {
    font-size: 0.94em;
    white-space: nowrap;
}


.print-body-measure-field .print-fill {
    min-width: 48px;
    max-width: 58px;
    flex: 0 0 52px;
    padding-left: 3px;
    padding-right: 3px;
    text-align: center;
    white-space: nowrap;
    overflow: visible;
}


.print-fill {
    display: inline-block;
    min-width: 72px;
    flex: 1 1 auto;
    border-bottom: 1px dotted #444;
    padding: 0 6px 1px;
    min-height: 20px;
    overflow-wrap: anywhere;
}

.print-fill-lg {
    min-width: 220px;
}

.print-fill-xl {
    min-width: 300px;
}

.print-address-block {
    margin-top: 3px;
}

.print-address-line-indent {
    padding-left: 22px;
}

.print-section-title {
    margin: 0 0 4px;
    font-weight: 600;
}

.print-template-table {
    font-size: 13.5px;
}

.print-template-table th,
.print-template-table td {
    border: 1px solid #333;
    padding: 5px 7px;
    height: 28px;
    vertical-align: middle;
}

.print-template-table th {
    background: #fff;
    color: #000;
    text-align: center;
}

.print-template-table th:nth-child(1),
.print-template-table td:nth-child(1) {
    width: 58%;
}

.print-template-table th:nth-child(2),
.print-template-table td:nth-child(2) {
    width: 24%;
}

.print-percent-cell,
.print-template-table th:nth-child(3) {
    width: 18%;
    text-align: center;
}

.print-consent-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 6px;
}
.print-consent-text p {
    margin: 0;
    text-align: justify;
    text-indent: 24px;
    line-height: 1.45;
}

.print-consent-text span,
.print-consent-title {
    font-weight: 600;
}

.print-template-signatures {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 28px;
    text-align: center;
}

.print-template-signatures-family {
    grid-template-columns: 1fr 1fr;
}

.print-template-signatures span {
    display: inline-block;
    margin-top: 5px;
}

.print-template-signatures strong {
    display: inline-block;
    margin-top: 4px;
    font-weight: 500;
}


html[lang="en"] .print-template-document {
    font-size: 13px;
}

html[lang="en"] .print-template-header h1 {
    font-size: 16px;
}

html[lang="en"] .print-template-header h2 {
    font-size: 15px;
}

html[lang="en"] .print-personal-line {
    column-gap: 4px;
}

html[lang="en"] .print-line-label,
html[lang="en"] .print-inline-label,
html[lang="en"] .print-suffix {
    font-size: 0.95em;
}

@media print {
    .print-template-document {
        font-size: 14px;
        line-height: 1.5;
        padding: 22px 28px;
    }

    .print-template-header-inner {
        grid-template-columns: minmax(280px, 1fr) minmax(180px, 0.55fr);
        gap: 16px;
    }

    .print-kmitl-logo {
        width: min(100%, 370px);
        max-height: none;
        object-fit: contain;
    }

    .print-personal-line {
        grid-template-columns: auto minmax(96px, 0.62fr) minmax(146px, 0.86fr) minmax(132px, 0.76fr) minmax(132px, 0.76fr);
        column-gap: 5px;
    }

    .print-template-section {
        margin-top: 8px;
    }

    .print-form-line {
        margin: 5px 0;
    }

    .print-template-table th,
    .print-template-table td {
        padding: 5px 7px;
        height: 28px;
    }

    .print-template-signatures {
        margin-top: 28px;
    }
}

@media screen and (max-width: 760px) {
    .print-template-document {
        padding: 20px 16px;
    }

    .print-template-header-inner,
    .print-personal-line {
        grid-template-columns: 1fr;
    }

    .print-header-left,
    .print-header-right {
        text-align: center;
    }

    .print-kmitl-logo {
        width: 100%;
        margin: 0 auto;
    }
    .print-fill,
    .print-fill-lg,
    .print-fill-xl {
        min-width: 120px;
    }

    .print-template-signatures-family {
        grid-template-columns: 1fr;
    }
}

.admin-detail-grid {
    grid-template-columns: 1fr;
}

.admin-detail-grid .admin-metric-card {
    min-height: 118px;
}

.admin-detail-grid .admin-metric-card strong {
    font-size: 24px;
}

.admin-detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.admin-detail-list div {
    min-width: 0;
    border: 1px solid #f4ebe4;
    border-radius: 8px;
    background: #fffaf7;
    padding: 10px 12px;
}

.admin-detail-list span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.admin-detail-list strong {
    display: block;
    margin-top: 3px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.admin-unlock-form textarea {
    width: 100%;
    min-height: 132px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    font: inherit;
}

.admin-unlock-form textarea:focus {
    border-color: var(--accent);
    outline: 3px solid rgb(227 82 5 / 16%);
}

@media (max-width: 920px) {
    .admin-detail-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .admin-detail-grid {
        grid-template-columns: 1fr;
    }
}
.admin-topline-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .admin-topline-actions {
        justify-content: stretch;
    }

    .admin-topline-actions .button-link {
        width: 100%;
        justify-content: center;
    }
}
.admin-search-form {
    display: flex;
    align-items: end;
    gap: 10px;
    width: min(720px, 100%);
    flex-wrap: wrap;
}

.admin-search-form label {
    flex: 1 1 280px;
}

.admin-search-form label span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
}

.admin-search-form input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #f0e3d9;
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}

.admin-search-form button,
.admin-search-form .button-secondary {
    min-height: 44px;
    border-radius: 8px;
    padding: 10px 16px;
    font: inherit;
    text-decoration: none;
}

.admin-search-form button {
    border: 1px solid transparent;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

.admin-submission-table {
    font-size: 13px;
}

.admin-submission-table th,
.admin-submission-table td {
    padding: 10px 8px;
}

.admin-submission-table small {
    font-size: 12px;
}

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 13px;
}

.admin-pagination div {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .admin-search-form,
    .admin-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-search-form button,
    .admin-search-form .button-secondary,
    .admin-pagination .button-secondary {
        justify-content: center;
        text-align: center;
    }
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #f0e3d9;
    border-radius: 999px;
    background: #fffaf7;
    padding: 4px;
    width: fit-content;
}

.language-switch-link {
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 8px 10px;
    text-decoration: none;
}

.language-switch-link:hover,
.language-switch-link.is-active {
    background: var(--accent);
    color: #fff;
}

.topline-actions .language-switch {
    margin-right: 2px;
}

@media (max-width: 640px) {
    .language-switch {
        align-self: flex-start;
    }
}