* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

h1 {
    margin: 0 0 8px;
}

.subtitle {
    margin: 0 0 16px;
    color: #4b5563;
}

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

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

.check-row {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.check-row input {
    min-width: auto;
    margin: 0;
}

input {
    flex: 1;
    min-width: 200px;
}

input,
button {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}

select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    background: #ffffff;
    color: #1f2937;
    min-width: 260px;
}

button {
    cursor: pointer;
    background: #111827;
    border-color: #111827;
    color: #ffffff;
}

button:hover {
    opacity: 0.9;
}

.secondary {
    background: #374151;
    border-color: #374151;
}

.secondary-link {
    display: inline-block;
    text-decoration: none;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    background: #374151;
    color: #ffffff;
}

.danger {
    background: #b91c1c;
    border-color: #b91c1c;
}

.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.table-actions h2 {
    margin: 0;
}

.db-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.db-nav a {
    text-decoration: none;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    color: #111827;
    background: #ffffff;
}

.db-nav a.active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-form input {
    min-width: 120px;
}

textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}

.search-select {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 14px;
    background: #fafafa;
}

.search-select-input {
    width: 100%;
    margin-bottom: 8px;
}

.search-select-top {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.search-select-modal-btn {
    background: #4b5563;
    border-color: #4b5563;
    color: #ffffff;
    white-space: nowrap;
}

.search-select-picked {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.search-select-chip {
    border: 1px solid #1f2937;
    background: #1f2937;
    color: #ffffff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
}

.search-select-empty {
    color: #6b7280;
    font-size: 13px;
}

.search-select-options {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.search-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    margin-bottom: 6px;
}

.search-select-option input {
    min-width: auto;
    margin: 0;
}

.search-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.search-modal.hidden {
    display: none;
}

.search-modal-content {
    width: min(880px, 92vw);
    max-height: 82vh;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.search-modal-title {
    font-size: 18px;
    font-weight: 700;
}

.search-modal-list {
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    max-height: 60vh;
}

.search-modal-item {
    display: block;
    overflow: auto;
    margin-bottom: 6px;
}

.search-modal-item input {
    float: left;
    min-width: auto;
    margin: 2px 0 0;
}

.search-modal-text {
    float: left;
    width: calc(100% - 28px);
    margin-left: 8px;
    text-align: left;
}

.info-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.info-modal.hidden {
    display: none;
}

.info-modal-content {
    width: min(720px, 92vw);
    max-height: 82vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 16px;
}

.info-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.info-modal-header h2 {
    margin: 0;
}

.info-circle-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid #9ca3af;
    background: #ffffff;
    color: #1f2937;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.info-circle-btn:hover {
    background: #f3f4f6;
}

.insurance-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin: 0;
    vertical-align: middle;
}

.insurance-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    min-width: 0;
}

.insurance-switch-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #d1d5db;
    border-radius: 999px;
    transition: background-color 0.2s ease;
}

.insurance-switch-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.insurance-switch input:checked + .insurance-switch-slider {
    background: #10b981;
}

.insurance-switch input:checked + .insurance-switch-slider::before {
    transform: translateX(20px);
}

.insurance-switch input:focus-visible + .insurance-switch-slider {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

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

.payout-summary {
    margin-top: 12px;
    margin-bottom: 0;
    font-weight: 700;
    color: #1f2937;
}

.site-footer {
    background: #111827;
    color: #e5e7eb;
    border: 1px solid #111827;
    border-radius: 0;
    padding: 20px 16px;
    margin: 0;
    width: 100%;
}

.site-footer-line {
    margin: 0 0 10px;
    color: #d1d5db;
}

.site-footer-line:last-child {
    margin-bottom: 0;
}

.site-footer a {
    color: #93c5fd;
    text-decoration: none;
}

.site-footer a:hover {
    color: #bfdbfe;
    text-decoration: underline;
}

.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    background: #111827;
    color: #e5e7eb;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 14px;
    z-index: 10050;
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.cookie-banner.hidden {
    display: none;
}

.cookie-banner-text {
    font-size: 14px;
    line-height: 1.4;
}

.cookie-banner-text a {
    color: #93c5fd;
}

.cookie-banner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cookie-btn {
    white-space: nowrap;
}

.cookie-settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10060;
}

.cookie-settings-modal.hidden {
    display: none;
}

.cookie-settings-content {
    width: min(640px, 92vw);
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 16px;
}

.cookie-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.cookie-settings-header h2 {
    margin: 0;
}

.cookie-settings-check {
    margin-top: 12px;
}

.cookie-settings-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cookie-manage-floating-btn {
    display: none;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10040;
    border: 1px solid #1f2937;
    background: #1f2937;
    color: #ffffff;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
}

.cookie-manage-floating-btn.visible {
    display: inline-block;
}

.table-edit-input {
    width: 100%;
    min-width: 180px;
}

details > summary {
    cursor: pointer;
    font-size: 13px;
    color: #374151;
}

details[open] > summary {
    margin-bottom: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    background: #f9fafb;
}

tfoot td {
    font-weight: 700;
    background: #f9fafb;
}

.small-list {
    margin: 0;
    padding-left: 16px;
}

.small-list li {
    margin-bottom: 2px;
}

.remove-row {
    background: #ef4444;
    border-color: #ef4444;
}

.auth-card {
    max-width: 460px;
    margin: 40px auto;
}

.auth-form label {
    margin-top: 10px;
}

.auth-form button {
    width: 100%;
    margin-top: 14px;
}

.alert {
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.alert.error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

@media (max-width: 768px) {
    .input-row {
        flex-direction: column;
    }

    .cookie-banner {
        flex-direction: column;
        align-items: flex-start;
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .cookie-manage-floating-btn {
        right: 10px;
        bottom: 10px;
    }
}
