html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, sans-serif;
    margin: 0 auto;
    padding: 20px;
    max-width: 1100px;
    box-sizing: border-box;
    color: #243028;
    background: #f7faf7;
}

#startupSplash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    box-sizing: border-box;
    background: linear-gradient(180deg, #f4f8f4 0%, #eef5ef 100%);
    color: #2f5d31;
    text-align: center;
    z-index: 9980;
}

#startupSplashSpinner {
    width: 34px;
    height: 34px;
    border: 4px solid #b7d9bb;
    border-top-color: #2f7d32;
    border-radius: 50%;
    animation: splashSpin 0.9s linear infinite;
}

#startupSplash.failed #startupSplashSpinner {
    display: none;
}

#startupSplashTitle {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: #1e4a22;
}

#startupSplashMessage {
    font-size: 16px;
    max-width: 520px;
    line-height: 1.45;
    color: #3d5f40;
}

@keyframes splashSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

body.appInitialized #startupSplash {
    display: none;
}

.banner {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-width: 0;
    object-fit: contain;
    box-sizing: border-box;
    margin: 0 auto 18px;
    background: white;
    border-radius: 10px;
}

#startupSplash .banner {
    width: 100%;
    max-width: 100%;
    flex: 0 1 auto;
    margin: 0 0 8px;
}

h1 {
    margin: 0 0 6px;
    font-size: 28px;
    color: #1e4a22;
}

.lede {
    margin: 0 0 18px;
    color: #3d5f40;
    line-height: 1.45;
}

.nav {
    display: flex;
    gap: 16px;
    margin: 0 0 18px;
}

.nav a {
    color: #1e4a22;
    font-weight: 700;
}

#welcomeMessage,
#credentialNote,
#blockMessage {
    white-space: pre-wrap;
}

textarea {
    min-height: 96px;
    resize: vertical;
    font-family: inherit;
}

.panel {
    background: white;
    border: 1px solid #d5e3d6;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

form label {
    margin-top: 14px;
}

#turnstileWidget {
    margin-top: 14px;
}

form label:first-of-type {
    margin-top: 0;
}

input[type="email"],
input[type="text"],
input[type="date"],
textarea {
    width: 100%;
    box-sizing: border-box;
    border: 2px solid #4CAF50;
    border-radius: 6px;
    padding: 12px;
    font-size: 18px;
    background: white;
}

input[type="email"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus {
    border-color: #66bb6a;
    box-shadow: 0 0 8px rgba(102, 187, 106, 0.7);
    outline: none;
}

button {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
}

button:hover {
    background-color: #45a049;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

button.secondary {
    background-color: #777;
}

button.danger {
    background-color: #c62828;
}

button.compact {
    padding: 4px 10px;
    font-size: 14px;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

#manualAssignDialog:not([open]) {
    display: none;
}

.stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 14px;
}

.stat {
    background: white;
    border: 1px solid #d5e3d6;
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 140px;
}

.stat span {
    display: block;
    color: #5d7260;
    font-size: 13px;
}

.stat strong {
    font-size: 22px;
    color: #1e4a22;
    word-break: break-word;
}

#formMessage,
#poolMessage,
#manualAssignMessage {
    min-height: 1.2em;
    margin: 10px 0 0;
    font-weight: 700;
}

#manualAssignDialog {
    border: none;
    border-radius: 10px;
    padding: 0;
    max-width: 460px;
    width: calc(100% - 32px);
    box-shadow: 0 12px 40px rgba(30, 74, 34, 0.25);
}

#manualAssignDialog::backdrop {
    background: rgba(36, 48, 40, 0.45);
}

#manualAssignDialog form {
    margin: 0;
    padding: 18px;
}

#manualAssignDialog h2 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #1e4a22;
}

.error {
    color: #c62828;
}

.ok {
    color: #1b5e20;
}

#credentialCard {
    display: none;
    margin-top: 16px;
    border: 1px solid #b7d9bb;
    background: #f3faf3;
    border-radius: 8px;
    padding: 14px;
}

#credentialCard h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.credential-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 6px 10px;
    margin-bottom: 12px;
}

.credential-grid dt {
    font-weight: 700;
}

.credential-grid dd {
    margin: 0;
    font-family: Consolas, "Courier New", monospace;
    word-break: break-all;
}

.hint {
    color: #5d7260;
    line-height: 1.45;
}

#welcomeMessage,
#blockMessage,
#credentialNote {
    white-space: pre-wrap;
}

#welcomeMessage a,
#blockMessage a,
#credentialNote a {
    color: #1e4a22;
}

#poolTableWrap {
    width: 100%;
    overflow-x: auto;
    margin-top: 14px;
    border: 1px solid #ddd;
    background: white;
    padding: 8px;
}

#poolTableWrap .dt-container {
    font-size: 14px;
}

#poolTableWrap .dt-layout-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    align-items: center;
    margin: 8px 0;
}

#poolTableWrap .dt-search input,
#poolTableWrap .dt-length select {
    font: inherit;
    padding: 4px 6px;
}

#poolTableWrap table.dataTable thead th {
    background: #eef5ef;
}

body[data-page="start"] {
    max-width: none;
}

body[data-page="start"] #poolTableWrap {
    overflow-x: visible;
}

body[data-page="start"] #poolTableWrap table {
    table-layout: fixed;
    width: 100%;
}

body[data-page="start"] #poolTableWrap th,
body[data-page="start"] #poolTableWrap td {
    white-space: normal;
    overflow-wrap: anywhere;
}

body[data-page="start"] #poolTableWrap th:nth-child(1),
body[data-page="start"] #poolTableWrap td:nth-child(1) {
    width: 4%;
}

body[data-page="start"] #poolTableWrap th:nth-child(5),
body[data-page="start"] #poolTableWrap td:nth-child(5) {
    width: 14%;
}

body[data-page="start"] #poolTableWrap th:nth-child(6),
body[data-page="start"] #poolTableWrap td:nth-child(6) {
    width: 22%;
}

body[data-page="start"] #poolTableWrap th:nth-child(8),
body[data-page="start"] #poolTableWrap td:nth-child(8) {
    width: 7%;
}

body[data-page="start"] #poolTableWrap th:nth-child(9),
body[data-page="start"] #poolTableWrap td:nth-child(9) {
    width: 8%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    border-bottom: 1px solid #e4e4e4;
    padding: 8px;
    text-align: left;
    white-space: nowrap;
}

th {
    position: sticky;
    top: 0;
    background: #eef5ef;
}

tr.assigned td {
    color: #666;
    background: #fafafa;
}

.muted {
    color: #888;
}

@media (max-width: 600px) {
    .credential-grid {
        grid-template-columns: 1fr;
    }

    .row button,
    #registerButton {
        width: 100%;
    }
}
