/* Global reset */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    background-color: #f4f4f4;
    color: #1f2933;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

img,
iframe {
    max-width: 100%;
    height: auto;
}

.site-header,
header,
.site-footer,
footer {
    width: 100%;
    padding: 10px 16px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.site-header,
header {
    background-color: #0f5ef0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-footer,
footer {
    background-color: #1e293b;
    margin-top: auto;
    font-size: 14px;
    position: sticky;
    bottom: 0;
    z-index: 1000;
}

.site-header h1,
.site-header h2,
header h1,
header h2 {
    font-size: 18px;
    margin: 0;
}

.header-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.site-header nav,
header nav {
    margin-left: auto;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    margin-left: auto;
}

.nav-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.nav-toggle__bar {
    width: 24px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 1px;
    display: block;
}

main,
.page-container,
.centered,
section {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
}

main:empty {
    padding: 0;
}

nav {
    background-color: #333333;
    color: #ffffff;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
    padding: 0;
}

nav li {
    margin: 4px 8px;
}

nav a {
    color: inherit;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: inline-block;
}

nav a:hover,
nav a:focus {
    background-color: #555555;
}

h1,
h2,
h3,
h4 {
    margin: 0 0 16px;
    line-height: 1.3;
}

p {
    margin: 0 0 12px;
}

form {
    background-color: #ffffff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    width: 100%;
    max-width: 680px;
    margin: 16px auto;
}

form.form-wide {
    max-width: 100%;
}

form > *:not(:last-child) {
    margin-bottom: 16px;
}

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

.form-grid__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
}

.button-group .button-link {
    flex: 1 1 200px;
    text-align: center;
}

.button-group .inline-form {
    flex: 1 1 200px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    background-color: #ffffff;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: 8px;
}

input[type="submit"],
button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

input[type="submit"],
.button-success {
    background-color: #5cb85c;
    color: #ffffff;
}

input[type="submit"]:hover,
.button-success:hover {
    background-color: #4cae4c;
}

button,
.button-primary {
    background-color: #007bff;
    color: #ffffff;
}

button:hover,
.button-primary:hover {
    background-color: #0064d6;
}

small {
    color: #475569;
}

a {
    color: #0f5ef0;
}

a:hover,
a:focus {
    text-decoration: none;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    margin: 16px auto;
    padding: 0;
}

.table-container table {
    margin: 0;
    width: 100%;
}

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

th,
td {
    border: 1px solid #e2e8f0;
    padding: 10px;
    text-align: left;
}

.table-total-row {
    background-color: #f9fafb;
    font-weight: 600;
}

th {
    background-color: #f1f5f9;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #f9fbfd;
}

.notice,
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px auto;
    max-width: 680px;
}

.notice {
    background-color: #ecfdf5;
    color: #047857;
}

.alert {
    background-color: #fef2f2;
    color: #b91c1c;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-start;
    margin: 16px 0;
}

.actions > * {
    flex: 1 1 200px;
}

form.inline-form {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0;
    max-width: none;
    display: flex;
    align-items: stretch;
}

form.inline-form > *:not(:last-child) {
    margin-bottom: 0;
}

form.inline-form input[type="submit"],
form.inline-form button {
    width: 100%;
}

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

legend {
    font-weight: 600;
    padding: 0 8px;
}

@media (max-width: 768px) {
    body {
        padding: 0 0 32px;
    }

    header,
    footer {
        padding: 12px;
    }

    form {
        padding: 20px;
        margin: 12px auto;
    }

    .nav-toggle {
        display: flex;
    }

    .site-nav {
        width: 100%;
        display: none;
        background-color: rgba(15, 23, 42, 0.18);
        border-radius: 8px;
        margin-top: 8px;
        padding: 8px 0;
    }

    .site-header.nav-open .site-nav {
        display: block;
    }

    .site-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .site-nav li {
        margin: 0;
    }

    .site-nav a {
        width: 100%;
        padding: 12px 16px;
        border-radius: 0;
    }

    .header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
        margin-top: 8px;
    }

    .header-actions .button-link {
        flex: 1 1 140px;
        justify-content: center;
    }

    th,
    td {
        padding: 8px;
        font-size: 14px;
    }

    .actions {
        flex-direction: column;
    }

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

    .button-group {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    nav ul {
        flex-direction: column;
        align-items: stretch;
    }

    nav li {
        margin: 0;
    }

    nav a {
        text-align: center;
    }

    form {
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .table-container {
        border-radius: 0;
        box-shadow: none;
    }

    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
}
