:root {
    --sc-green: #15733f;
    --sc-green-dark: #0b4f2b;
    --sc-green-soft: #e8f6ee;
    --sc-mint: #f4fbf7;
    --sc-line: #d8e6dd;
    --sc-text: #1f2933;
    --sc-muted: #667085;
    --sc-danger: #b42318;
    --sc-warning: #b54708;
    --sc-white: #ffffff;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: #f7faf8;
    color: var(--sc-text);
    font-family: "Noto Sans Thai", Tahoma, sans-serif;
    font-size: 15px;
}

.sc-app * {
    box-sizing: border-box;
}

.sc-app a {
    color: var(--sc-green);
    text-decoration: none;
}

.sc-header {
    background: linear-gradient(120deg, var(--sc-green-dark), var(--sc-green));
    color: #fff;
    padding: 16px clamp(14px, 3vw, 32px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.sc-header h1 {
    margin: 4px 0 0;
    font-size: clamp(20px, 2.4vw, 28px);
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: 0;
}

.sc-kicker {
    display: inline-flex;
    color: #dff7e9;
    font-weight: 700;
    font-size: 14px;
}

.sc-header nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sc-header nav a {
    color: #fff;
    border: 1px solid rgba(255,255,255,.35);
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    font-weight: 600;
}

.sc-shell {
    width: min(1040px, calc(100% - 24px));
    margin: 16px auto 28px;
}

.sc-panel, .sc-card {
    background: var(--sc-white);
    border: 1px solid var(--sc-line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(16, 74, 42, .08);
}

.sc-panel {
    padding: clamp(14px, 2vw, 22px);
}

.sc-panel h2, .sc-panel h3 {
    margin: 0 0 14px;
    line-height: 1.3;
}

.sc-lead {
    color: var(--sc-muted);
    margin: 0 0 18px;
}

.sc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.sc-card {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sc-card h3 {
    margin: 0;
    font-size: 18px;
}

.sc-card p {
    margin: 0;
    color: var(--sc-muted);
}

.sc-app .sc-btn, .sc-app button.sc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 0;
    background: var(--sc-green);
    color: #fff !important;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}

.sc-app .sc-btn.secondary {
    background: var(--sc-green-soft);
    color: var(--sc-green-dark) !important;
}

.sc-form {
    display: grid;
    gap: 16px;
}

.sc-section {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--sc-line);
    border-radius: 8px;
    background: #fff;
}

.sc-section-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--sc-green-dark);
}

.sc-confidential {
    background: #fbfefc;
}

.sc-confidential p {
    margin: 0;
    line-height: 1.75;
}

.sc-conditions {
    margin: 0;
    padding-left: 1.5rem;
}

.sc-conditions li {
    margin: 6px 0;
    line-height: 1.7;
}

.sc-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.sc-field.full {
    grid-column: 1 / -1;
}

.sc-field label {
    display: block;
    font-weight: 700;
    margin: 0 0 6px;
}

.sc-field input, .sc-field select, .sc-field textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid #cfdcd4;
    border-radius: 8px;
    padding: 9px 11px;
    font: inherit;
    background: #fff;
}

.sc-field textarea {
    min-height: 88px;
    resize: vertical;
}

.sc-choice {
    display: grid;
    gap: 8px;
}

.sc-choice label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid var(--sc-line);
    border-radius: 8px;
    background: var(--sc-mint);
    font-weight: 500;
}

.sc-choice input[type="radio"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    min-height: 18px;
}

.sc-map-tools {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.sc-map-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.sc-map-results {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.sc-map-result {
    width: 100%;
    border: 1px solid var(--sc-line);
    background: var(--sc-mint);
    color: var(--sc-text);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.sc-map-canvas {
    width: 100%;
    height: 260px;
    border: 1px solid var(--sc-line);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 8px;
    background: var(--sc-mint);
}

.sc-other-field {
    transition: opacity .15s ease;
}

.sc-guide {
    display: grid;
    gap: 14px;
}

.sc-guide h3 {
    color: var(--sc-green-dark);
    margin: 10px 0 0;
}

.sc-guide ol {
    margin: 0;
    padding-left: 1.6rem;
}

.sc-guide li {
    margin: 6px 0;
}

.sc-request-result {
    border: 1px solid var(--sc-line);
    border-radius: 8px;
    padding: 14px;
    margin-top: 14px;
    background: #fff;
}

.sc-attachment-preview {
    display: block;
    max-width: min(420px, 100%);
    max-height: 280px;
    object-fit: contain;
    border: 1px solid var(--sc-line);
    border-radius: 8px;
    margin-top: 8px;
    background: #fff;
}

.flatpickr-calendar {
    font-family: "Noto Sans Thai", Tahoma, sans-serif;
}

.sc-help {
    margin-top: 6px;
    color: var(--sc-muted);
    font-size: 14px;
}

.sc-alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin: 12px 0;
    border: 1px solid var(--sc-line);
    background: var(--sc-mint);
}

.sc-alert.success {
    border-color: #9bd5b2;
    background: #ecfdf3;
}

.sc-alert.danger {
    border-color: #fecdca;
    background: #fff1f0;
    color: var(--sc-danger);
}

.sc-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--sc-line);
    border-radius: 8px;
}

.sc-table-wrap.compact {
    overflow-x: visible;
}

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

.sc-admin-table {
    table-layout: fixed;
    min-width: 0;
}

.sc-admin-table th:nth-child(1),
.sc-admin-table td:nth-child(1) {
    width: 16%;
}

.sc-admin-table th:nth-child(2),
.sc-admin-table td:nth-child(2) {
    width: 20%;
}

.sc-admin-table th:nth-child(3),
.sc-admin-table td:nth-child(3) {
    width: 18%;
}

.sc-admin-table th:nth-child(4),
.sc-admin-table td:nth-child(4) {
    width: 13%;
}

.sc-admin-table th:nth-child(5),
.sc-admin-table td:nth-child(5) {
    width: 33%;
}

.sc-table th, .sc-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--sc-line);
    text-align: left;
    vertical-align: top;
}

.sc-table th {
    background: var(--sc-green-soft);
    color: var(--sc-green-dark);
    font-weight: 700;
}

.sc-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    background: var(--sc-green-soft);
    color: var(--sc-green-dark);
    font-weight: 700;
    white-space: nowrap;
}

.sc-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
    margin: 0 0 16px;
}

.sc-toolbar .sc-field {
    min-width: 180px;
}

.sc-admin-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 12px;
}

.sc-admin-filter label {
    font-weight: 700;
    color: var(--sc-green-dark);
}

.sc-admin-filter select {
    min-width: 240px;
    min-height: 38px;
    border: 1px solid #cfdcd4;
    border-radius: 8px;
    padding: 7px 9px;
    font: inherit;
}

.sc-muted-line {
    color: var(--sc-muted);
    font-size: 13px;
    line-height: 1.45;
    margin-top: 3px;
}

.sc-inline-action {
    display: grid;
    grid-template-columns: minmax(126px, .9fr) minmax(130px, 1fr) auto;
    gap: 6px;
    margin-top: 8px;
    min-width: 0;
}

.sc-inline-action select,
.sc-inline-action input {
    width: 100%;
    min-height: 36px;
    border: 1px solid #cfdcd4;
    border-radius: 8px;
    padding: 7px 9px;
    font: inherit;
}

.dt-container .dt-search input,
.dt-container .dt-length select {
    border: 1px solid #cfdcd4;
    border-radius: 8px;
    padding: 6px 9px;
    font: inherit;
}

.dt-container .dt-paging .dt-paging-button {
    border-radius: 8px !important;
}

.sc-footer {
    color: var(--sc-muted);
    text-align: center;
    padding: 20px;
}

@media (max-width: 760px) {
    .sc-header {
        display: block;
    }

    .sc-header nav {
        justify-content: flex-start;
        margin-top: 14px;
    }

    .sc-fields {
        grid-template-columns: 1fr;
    }

    .sc-shell {
        width: min(100% - 14px, 1040px);
        margin-top: 12px;
    }

    .sc-panel {
        padding: 14px;
    }

    .sc-map-search {
        grid-template-columns: 1fr;
    }

    .sc-header nav a {
        padding: 7px 10px;
        font-size: 14px;
    }

    .sc-inline-action {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .sc-admin-table,
    .sc-admin-table thead,
    .sc-admin-table tbody,
    .sc-admin-table th,
    .sc-admin-table td,
    .sc-admin-table tr {
        display: block;
        width: 100% !important;
    }

    .sc-admin-table thead {
        display: none;
    }

    .sc-admin-table tr {
        border-bottom: 1px solid var(--sc-line);
        padding: 10px;
    }

    .sc-admin-table td {
        border-bottom: 0;
        padding: 6px 0;
    }
}
