:root {
    color-scheme: light;
    --ink: #171717;
    --muted: #666;
    --line: #c9c9c9;
    --soft: #f6f7f8;
    --accent: #146c43;
    --danger: #a52834;
    --warn: #8a5a00;
    --blue: #0b5ed7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: #eceff1;
    background-image:
        linear-gradient(rgba(236, 239, 241, 0.78), rgba(236, 239, 241, 0.78)),
        url("/assets/images/trust_emblem.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: min(78vw, 680px) auto;
    background-attachment: fixed;
    color: var(--ink);
    font-family: Arial, "Noto Nastaliq Urdu", "Noto Naskh Arabic", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--blue);
    text-decoration: none;
}

.page-shell {
    position: relative;
    isolation: isolate;
    width: min(1120px, calc(100% - 24px));
    margin: 24px auto;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid #d7d7d7;
    padding: clamp(16px, 3vw, 32px);
}

.page-shell::before {
    content: "";
    position: absolute;
    inset: 110px 24px 24px;
    z-index: 0;
    background: url("/assets/images/trust_emblem.png") center top / min(76vw, 700px) auto no-repeat;
    opacity: 0.34;
    pointer-events: none;
}

.page-shell > * {
    position: relative;
    z-index: 1;
}

.masthead {
    display: grid;
    grid-template-columns: 84px 1fr 84px;
    gap: 16px;
    align-items: center;
    text-align: center;
    border-bottom: 4px double #111;
    padding-bottom: 14px;
    margin-bottom: 22px;
}

.masthead h1 {
    margin: 0;
    font-size: clamp(28px, 5vw, 54px);
    font-weight: 800;
    letter-spacing: 0;
}

.masthead h2 {
    margin: 6px 0 0;
    font-size: clamp(20px, 3vw, 32px);
}

.form-number {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 800;
}

.form-number strong {
    border: 1px solid #111;
    border-radius: 6px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.78);
    letter-spacing: 0;
}

.trust-no {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 14px;
}

.brand-mark {
    display: block;
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid #a3cfbb;
    background: #d1e7dd;
    color: #0f5132;
}

.alert.error {
    border-color: #f1aeb5;
    background: #f8d7da;
    color: #842029;
}

.request-form,
.admin-card {
    display: grid;
    gap: 18px;
}

.form-panel,
.admin-card {
    border: 1px dashed #999;
    border-radius: 8px;
    padding: 18px;
    background: transparent;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    font-weight: 800;
    font-size: 18px;
}

.grid {
    display: grid;
    gap: 14px;
}

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

.grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

label span {
    color: #222;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    font: inherit;
    background: #fff;
}

fieldset {
    margin: 0;
    border: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

legend {
    padding: 0;
    margin-bottom: 8px;
    font-weight: 700;
}

.choice-group {
    display: grid;
    gap: 10px;
}

.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.radio-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.78);
    font-weight: 700;
}

.radio-option input {
    width: auto;
    min-height: auto;
}

.conditional-options {
    display: grid;
    gap: 8px;
}

.utility-grid {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.utility-option {
    display: grid;
    grid-template-columns: minmax(180px, max-content) minmax(220px, 1fr);
    gap: 10px;
    align-items: start;
}

.fixed-option {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    font-weight: 800;
}

.electricity-charge-row {
    grid-template-columns: 140px minmax(180px, 360px);
    align-items: end;
}

textarea {
    resize: vertical;
}

small {
    color: var(--danger);
}

.form-actions,
.admin-actions,
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

button,
.button {
    border: 0;
    border-radius: 6px;
    margin-top: 10px;
    padding: 10px 14px;
    min-height: 42px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button.secondary,
button.secondary {
    background: #4b5563;
}

.button.danger,
button.danger {
    background: var(--danger);
}

.button.warn,
button.warn {
    background: var(--warn);
}

.button.blue,
button.blue {
    background: var(--blue);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
    margin-bottom: 18px;
}

.admin-header h1 {
    margin: 0;
    font-size: clamp(24px, 3vw, 34px);
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 12px;
    align-items: end;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
}

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

th,
td {
    border-bottom: 1px solid #e4e4e4;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--soft);
    font-size: 13px;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 800;
    background: #e9ecef;
}

.badge.approved {
    background: #d1e7dd;
    color: #0f5132;
}

.badge.rejected {
    background: #f8d7da;
    color: #842029;
}

.badge.pending {
    background: #fff3cd;
    color: #664d03;
}

.inline-form {
    display: inline-flex;
    margin: 0 4px 6px 0;
}

.inline-link {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 13px;
    margin: 0 4px 6px 0;
}

.inline-form button {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 13px;
}

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

.login-card {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    padding: 24px;
}

.login-stack {
    width: min(920px, 100%);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.login-stack.single {
    width: min(520px, 100%);
    grid-template-columns: 1fr;
}

.login-toggle {
    justify-self: center;
    font-size: 14px;
}

.login-card h1 {
    margin: 0 0 18px;
}

.user-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

@media (max-width: 860px) {
    .masthead {
        grid-template-columns: 60px 1fr 60px;
    }

    .grid.two,
    .grid.four,
    .filter-form,
    .user-form {
        grid-template-columns: 1fr;
    }

    .utility-option {
        grid-template-columns: 1fr;
    }

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

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

@media (max-width: 560px) {
    .page-shell {
        width: 100%;
        margin: 0;
        border: 0;
        padding: 14px;
    }

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

    .brand-mark {
        width: 64px;
        height: 64px;
        justify-self: center;
    }

    .panel-title {
        flex-direction: column;
        gap: 2px;
    }
}
