* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Tahoma, Arial, sans-serif;
    color: #17211b;
    background:
        linear-gradient(135deg, rgba(36, 112, 79, 0.08), rgba(196, 139, 46, 0.06)),
        #f7f6f2;
}

.page-shell,
.admin-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0;
}

.page-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.form-panel,
.admin-panel {
    width: 100%;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(210, 200, 184, 0.85);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(54, 45, 30, 0.11);
}

.form-panel {
    max-width: 860px;
    padding: 0;
    overflow: hidden;
}

.admin-panel {
    padding: 0;
    overflow: hidden;
}

.page-header,
.admin-heading {
    margin-bottom: 26px;
}

.application-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 0;
    padding: 32px;
    background: linear-gradient(135deg, #173f2d, #276348);
    color: #ffffff;
}

.admin-heading {
    padding: 28px;
    background: linear-gradient(135deg, #163d2b, #235c43);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.page-header p,
.admin-heading p {
    margin: 0 0 8px;
    color: #6f5a2d;
    font-size: 15px;
    font-weight: 700;
}

.application-hero p {
    color: rgba(255, 255, 255, 0.78);
}

.admin-heading p {
    color: rgba(255, 255, 255, 0.78);
}

h1 {
    margin: 0;
    color: #1e3b2d;
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.25;
}

.application-hero h1 {
    color: #ffffff;
}

.application-hero span {
    display: block;
    max-width: 520px;
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 16px;
    line-height: 1.8;
}

.application-form {
    padding: 30px 32px 34px;
}

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

.admin-heading h1 {
    color: #ffffff;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

form {
    display: grid;
    gap: 18px;
}

label,
legend {
    color: #243329;
    font-size: 15px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    margin-top: 8px;
    border: 1px solid #cfc4b2;
    border-radius: 6px;
    background: #ffffff;
    color: #17211b;
    font: inherit;
}

input,
select {
    min-height: 46px;
    padding: 10px 12px;
}

textarea {
    padding: 12px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(36, 112, 79, 0.18);
    border-color: #24704f;
}

fieldset {
    margin: 0;
    padding: 16px;
    border: 1px solid #d9cfbd;
    border-radius: 8px;
}

.application-type-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
    background: #fbfaf6;
}

.application-type-group legend {
    padding: 0 6px;
}

.radio-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0 22px;
    font-weight: 600;
}

.choice-card {
    width: 100%;
    min-height: 96px;
    margin: 8px 0 0;
    padding: 14px;
    border: 1px solid #d9cfbd;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.choice-card:hover {
    border-color: #24704f;
    box-shadow: 0 12px 26px rgba(54, 45, 30, 0.08);
    transform: translateY(-1px);
}

.choice-card:has(input:checked) {
    border-color: #24704f;
    background: #eef8f3;
    box-shadow: inset 0 0 0 1px #24704f;
}

.choice-card span {
    display: grid;
    gap: 6px;
}

.choice-card strong {
    color: #183d2c;
    font-size: 16px;
}

.choice-card small {
    color: #6a756f;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
}

.radio-row input {
    width: 18px;
    min-height: 18px;
    margin: 0;
}

button,
.logout,
.view-link,
.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 18px;
    border: 0;
    border-radius: 6px;
    background: #24704f;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

button:hover,
.logout:hover,
.view-link:hover,
.submit-button:hover {
    background: #1b5a3f;
}

.secondary-link {
    background: #ffffff;
    color: #254133;
    border: 1px solid rgba(216, 203, 184, 0.9);
}

.secondary-link:hover {
    background: #f4f0e8;
}

.application-hero .secondary-link {
    color: #183d2c;
    white-space: nowrap;
}

.submit-button {
    min-height: 52px;
    font-size: 16px;
}

.alert,
.empty-state,
.stats-row {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 8px;
    font-weight: 700;
}

.admin-panel > .alert,
.admin-panel > .stats-row,
.admin-panel > .empty-state,
.admin-panel > .table-wrap,
.admin-panel > .detail-actions,
.admin-panel > .application-detail,
.admin-panel > .login-form {
    margin-right: 28px;
    margin-left: 28px;
}

.alert p {
    margin: 0 0 6px;
}

.alert p:last-child {
    margin-bottom: 0;
}

.success {
    background: #e7f5ed;
    color: #135736;
    border: 1px solid #a9d7bc;
}

.error {
    background: #fff0eb;
    color: #92351f;
    border: 1px solid #efb6a4;
}

.login-form {
    max-width: 420px;
    margin-bottom: 28px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 12px;
    padding: 0;
    background: transparent;
    color: #1c6042;
}

.stats-row span {
    display: grid;
    gap: 5px;
    min-height: 76px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #e0d6c5;
    border-radius: 6px;
    box-shadow: 0 10px 24px rgba(54, 45, 30, 0.06);
}

.stats-row strong {
    color: #183d2c;
    font-size: 26px;
    line-height: 1;
}

.empty-state {
    background: #f7efe0;
    color: #6d562a;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #ddd2bf;
    border-radius: 8px;
    margin-bottom: 28px;
    background: #ffffff;
}

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

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid #eadfce;
    text-align: right;
    vertical-align: top;
    font-size: 14px;
}

th {
    position: sticky;
    top: 0;
    background: #f4efe6;
    color: #2f3d34;
    font-weight: 800;
    white-space: nowrap;
}

tbody tr:hover {
    background: #fbfaf6;
}

tr:last-child td {
    border-bottom: 0;
}

.long-text {
    min-width: 210px;
    max-width: 280px;
    line-height: 1.7;
}

.status-form {
    min-width: 150px;
}

.status-form select {
    margin-top: 0;
}

.detail-actions {
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.application-detail {
    min-height: calc(100vh - 190px);
    padding: 26px;
    border: 1px solid #ddd2bf;
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 28px;
}

.detail-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eadfce;
}

.detail-title span {
    color: #6f5a2d;
    font-weight: 800;
}

.detail-title h2 {
    margin: 8px 0 0;
    color: #1e3b2d;
    font-size: clamp(24px, 4vw, 34px);
    line-height: 1.25;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #eef5f1;
    color: #1c6042 !important;
    white-space: nowrap;
}

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

.detail-grid section,
.detail-block,
.detail-status-form {
    padding: 18px;
    border: 1px solid #eadfce;
    border-radius: 8px;
    background: #fffdf8;
}

.detail-grid h3,
.detail-block h3 {
    margin: 0 0 14px;
    color: #1e3b2d;
    font-size: 18px;
}

dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

dt {
    color: #6f5a2d;
    font-weight: 800;
}

dd {
    margin: 0;
    color: #17211b;
    line-height: 1.7;
}

.detail-block {
    margin-top: 18px;
}

.detail-block p {
    margin: 0;
    line-height: 1.9;
    white-space: normal;
}

.detail-status-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
    gap: 14px;
    margin-top: 18px;
}

.view-link {
    min-height: 38px;
    padding: 8px 12px;
    white-space: nowrap;
}

.actions-cell {
    min-width: 190px;
}

.inline-delete-form {
    display: inline-flex;
    margin: 0 8px 0 0;
    gap: 0;
}

.danger-button {
    background: #b33b30;
}

.danger-button:hover {
    background: #912e25;
}

.small-button {
    min-height: 38px;
    padding: 8px 12px;
}

.delete-detail-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #eadfce;
}

@media (max-width: 700px) {
    .page-shell,
    .admin-shell {
        width: min(100% - 20px, 1120px);
        padding: 18px 0;
    }

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

    .form-panel {
        padding: 0;
    }

    .application-hero {
        flex-direction: column;
        padding: 22px;
    }

    .application-hero .secondary-link,
    .submit-button {
        width: 100%;
    }

    .application-form {
        padding: 22px;
    }

    .form-grid,
    .application-type-group {
        grid-template-columns: 1fr;
    }

    .admin-panel {
        padding: 0;
    }

    .admin-heading,
    .admin-panel > .alert,
    .admin-panel > .stats-row,
    .admin-panel > .empty-state,
    .admin-panel > .table-wrap,
    .admin-panel > .detail-actions,
    .admin-panel > .application-detail,
    .admin-panel > .login-form {
        margin-right: 0;
        margin-left: 0;
    }

    .admin-heading {
        padding: 20px;
    }

    .admin-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-title,
    .detail-status-form {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }

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

    .stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .application-detail {
        padding: 18px;
    }

    .admin-toolbar,
    .delete-detail-form {
        width: 100%;
    }

    .admin-toolbar a,
    .delete-detail-form button {
        width: 100%;
    }
}
