* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f4f6f8;
    color: #1a1a1a;
    margin: 0;
    padding: 0;
}

.login-container,
.upload-container {
    max-width: 640px;
    margin: 60px auto;
    background: #ffffff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

h1 {
    margin-top: 0;
    font-size: 24px;
    color: #1a2b3c;
}

.subtitle {
    color: #667;
    margin-bottom: 24px;
}

label {
    display: block;
    font-weight: 600;
    margin-top: 18px;
    margin-bottom: 6px;
    font-size: 14px;
}

input[type="text"],
input[type="password"],
select,
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccd2d9;
    border-radius: 6px;
    font-size: 15px;
}

button {
    margin-top: 24px;
    width: 100%;
    padding: 12px;
    background: #1a5fb4;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: #164a8f;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 14px;
}

.alert-error {
    background: #fdecea;
    color: #a12822;
    border: 1px solid #f5c2be;
}

.alert-success {
    background: #eef8ee;
    color: #1c6b1c;
    border: 1px solid #bfe3bf;
}

.path-row {
    display: flex;
    gap: 8px;
}

.path-row input {
    flex: 1;
}

.browse-btn {
    margin-top: 0;
    width: auto;
    padding: 10px 14px;
    font-size: 14px;
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.small-btn {
    margin-top: 0;
    width: auto;
    padding: 5px 10px;
    font-size: 13px;
}

.link-btn {
    display: inline-block;
    background: #1a5fb4;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    margin-right: 4px;
}

.link-btn:hover {
    background: #164a8f;
}

.danger-btn {
    background: #c01c28;
}

.danger-btn:hover {
    background: #9a161f;
}

.path-cell {
    font-size: 12px;
    word-break: break-all;
}

#browser-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1100;
    justify-content: center;
    align-items: center;
}

.browser-box {
    background: #fff;
    border-radius: 10px;
    width: 90%;
    max-width: 560px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e8ec;
}

.browser-path {
    padding: 8px 18px;
    font-size: 12px;
    color: #556;
    background: #f6f8fa;
    word-break: break-all;
}

.browser-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    overflow-y: auto;
    flex: 1;
}

.browser-list li {
    padding: 9px 18px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f2f4f6;
}

.browser-list li:hover {
    background: #eef4fb;
}

.browser-list li.browser-empty,
.browser-list li.browser-loading {
    color: #99a;
    cursor: default;
}

.browser-list li.browser-error {
    color: #a12822;
    cursor: default;
}

.browser-footer {
    padding: 12px 18px;
    border-top: 1px solid #e5e8ec;
    text-align: right;
}

.table-filter {
    margin-top: 10px;
    margin-bottom: 2px;
    max-width: 340px;
    display: block;
}

.upload-container.admin-container {
    max-width: 1100px;
}

.hint {
    font-size: 12px;
    color: #778;
    margin-top: 12px;
}

.hint-inline {
    display: block;
    font-weight: normal;
    font-size: 12px;
    color: #778;
    margin-top: 2px;
    margin-left: 24px;
}

.radio-group {
    margin-top: 6px;
}

.radio-label {
    font-weight: normal;
    margin-top: 10px;
}

.top-bar {
    max-width: 640px;
    margin: 20px auto 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    font-size: 14px;
}

.top-bar a {
    color: #1a5fb4;
    text-decoration: none;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 14px;
}

.results-table th,
.results-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #eaecee;
}

.row-success {
    background: #f1f9f1;
}

.row-warning {
    background: #fff8e1;
}

.row-error {
    background: #fdf2f1;
}

.hint-danger {
    color: #c01c28;
    font-weight: 600;
}

.checkbox-row {
    margin-top: 20px;
    padding: 10px 14px;
    background: #fff8e1;
    border: 1px solid #f0e0b0;
    border-radius: 6px;
}

.fallback-fieldset {
    margin-top: 24px;
    border: 1px solid #e0e4e8;
    border-radius: 6px;
    padding: 12px 16px 16px 16px;
}

.fallback-fieldset legend {
    font-size: 12px;
    color: #667;
    padding: 0 6px;
}

.fallback-row {
    display: flex;
    gap: 16px;
}

.fallback-row > div {
    flex: 1;
}

.fallback-row label {
    margin-top: 4px;
}

#loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.loading-box {
    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 32px 40px;
    text-align: center;
    max-width: 420px;
}

.loading-box p {
    margin: 8px 0;
    font-size: 14px;
    color: #445;
}

.spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto 16px auto;
    border: 4px solid #dbe4f0;
    border-top-color: #1a5fb4;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

code {
    background: #f1f3f5;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}
