html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f6f8;
    color: #1f2933;
}

a {
    color: inherit;
}

.topbar {
    background: #172026;
    color: #fff;
    border-bottom: 4px solid #2f9e44;
}

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 18px;
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-size: 20px;
    font-weight: 800;
    text-decoration: none;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.nav a,
.nav button {
    border: 0;
    border-radius: 6px;
    padding: 9px 11px;
    background: transparent;
    color: #f8fafc;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}

.nav a:hover,
.nav button:hover {
    background: rgba(255, 255, 255, .12);
}

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 18px 44px;
    width: 100%;
    min-width: 0;
}

.page-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.15;
}

.muted {
    color: #607080;
}

.grid {
    display: grid;
    gap: 16px;
    min-width: 0;
}

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

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

.panel,
.card {
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.action-card {
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-decoration: none;
    border-left: 5px solid #2f9e44;
}

.action-card strong {
    font-size: 21px;
    margin-bottom: 6px;
}

.dashboard-grid {
    display: grid;
    gap: 16px;
    max-width: 760px;
}

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

.single-form-shell {
    max-width: 620px;
    width: 100%;
    margin: 0 auto;
    min-width: 0;
    overflow-x: hidden;
}

.single-form-header {
    margin-bottom: 20px;
}

.single-form-panel {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.auth-shell {
    max-width: 440px;
    margin: clamp(20px, 8vh, 88px) auto 0;
}

.auth-header {
    justify-content: center;
    text-align: center;
}

.auth-panel {
    width: 100%;
}

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

.summary-item {
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 8px;
    padding: 16px;
}

.summary-value {
    display: block;
    font-size: 30px;
    font-weight: 800;
}

.completion-card {
    padding: 24px;
}

.completion-lead {
    margin-bottom: 8px;
    font-size: 28px;
    font-weight: 800;
}

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

.completion-item {
    background: #f8fafc;
    border: 1px solid #d9e1e8;
    border-radius: 8px;
    padding: 14px 16px;
}

.completion-item strong {
    display: block;
    margin-top: 6px;
    font-size: 18px;
}

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

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form-row.full {
    grid-column: 1 / -1;
}

.date-field-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid #b8c4d0;
    border-radius: 7px;
    background: #fff;
}

.date-field-wrap:focus-within {
    outline: 3px solid rgba(47, 158, 68, .22);
    border-color: #2f9e44;
}

.filter-stack {
    display: grid;
    gap: 14px;
    max-width: 560px;
}

.filter-actions .button {
    width: 100%;
}

label {
    font-weight: 700;
    color: #344054;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border: 1px solid #b8c4d0;
    border-radius: 7px;
    padding: 10px 12px;
    min-height: 42px;
    font: inherit;
    background: #fff;
}

form {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

textarea {
    min-height: 90px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(47, 158, 68, .22);
    border-color: #2f9e44;
}

input[type="date"] {
    min-width: 0;
    max-width: 100%;
    display: block;
    inline-size: 100%;
    border: 0;
    border-radius: 0;
    outline: 0;
    box-shadow: none;
}

input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
}

input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    margin: 0;
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 7px;
    padding: 10px 14px;
    min-height: 42px;
    background: #2f9e44;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.button.secondary {
    background: #32485a;
}

.button.warning {
    background: #b7791f;
}

.button.danger {
    background: #c92a2a;
}

.button.small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 14px;
}

.button.ghost {
    background: #eef2f6;
    color: #243746;
}

.button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert.success {
    background: #e9f8ee;
    border-color: #b7e4c7;
    color: #1b6b31;
}

.alert.warning {
    background: #fff7e6;
    border-color: #ffd589;
    color: #8a5a00;
}

.alert.danger {
    background: #fff0f0;
    border-color: #ffc9c9;
    color: #9b1c1c;
}

.table-wrap {
    overflow-x: auto;
}

.inline-form {
    margin: 0;
}

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

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

th {
    background: #eef2f6;
    font-size: 13px;
    color: #465a69;
}

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

.badge.ok {
    background: #d8f5df;
    color: #1b6b31;
}

.badge.warn {
    background: #fff0c2;
    color: #8a5a00;
}

.badge.bad {
    background: #ffd8d8;
    color: #9b1c1c;
}

.totals {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.total-box {
    padding: 14px;
    border-radius: 8px;
    background: #eef2f6;
}

.total-box strong {
    display: block;
    font-size: 22px;
    margin-top: 4px;
}

.hidden {
    display: none !important;
}

.pagination {
    margin-top: 16px;
}

@media (max-width: 760px) {
    .page {
        padding: 22px 14px 36px;
        overflow-x: hidden;
    }

    .panel,
    .card {
        padding: 14px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .grid > *,
    .form-grid > *,
    .single-form-shell,
    .single-form-panel,
    .filter-stack {
        min-width: 0;
        max-width: 100%;
    }

    .topbar-inner,
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .grid-2,
    .grid-3,
    .dashboard-grid-2,
    .summary,
    .completion-meta,
    .form-grid,
    .totals {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 24px;
    }

    .nav {
        align-items: stretch;
    }

    .nav a,
    .nav button,
    .button {
        width: 100%;
    }

    input[type="date"] {
        font-size: 16px;
    }
}
