body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: linear-gradient(135deg, #0a192f 0%, #1e3a5f 50%, #172a45 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: #e4e4e7;
}

.login-container {
    width: 340px;
    margin: 100px auto;
    padding: 32px;
    background: rgba(30, 30, 46, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

input[type='email'],
input[type='text'] {
    width: 100%;
    padding: 12px 16px;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e4e4e7;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

input[type='email']:focus,
input[type='text']:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type='email']::placeholder,
input[type='text']::placeholder {
    color: rgba(228, 228, 231, 0.4);
}

button {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    margin: 12px 0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover,
button:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    gap: 12px;
}

/* Card styles */
.card {
    background: rgba(30, 30, 46, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    max-width: 800px;
    margin: 80px auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.card-slim {
    background: rgba(30, 30, 46, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    max-width: 800px;
    margin: 40px auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.card-content {
    overflow-y: auto;
    width: 100%;
    text-align: left;
}

/* The Modal (background) */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* Modal Content */
.modal-content {
    background: rgba(30, 30, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 10% auto;
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    color: #e4e4e7;
}

/* The Close Button */
.close {
    color: rgba(228, 228, 231, 0.6);
    float: right;
    font-size: 32px;
    font-weight: 300;
    line-height: 1;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: #e4e4e7;
    text-decoration: none;
    cursor: pointer;
}

/* Sign in with Google - Dark theme adaptation */
.gsi-material-button {
    user-select: none;
    background-color: rgba(255, 255, 255, 0.05);
    background-image: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    box-sizing: border-box;
    color: #e4e4e7;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 14px;
    height: 48px;
    letter-spacing: 0.25px;
    outline: none;
    overflow: hidden;
    padding: 0 16px;
    position: relative;
    text-align: center;
    transition: all 0.3s ease;
    vertical-align: middle;
    white-space: nowrap;
    width: auto;
    max-width: 400px;
    min-width: min-content;
}

.gsi-material-button .gsi-material-button-icon {
    height: 20px;
    margin-right: 12px;
    min-width: 20px;
    width: 20px;
    filter: brightness(1.2);
}

.gsi-material-button .gsi-material-button-content-wrapper {
    align-items: center;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    height: 100%;
    justify-content: space-between;
    position: relative;
    width: 100%;
}

.gsi-material-button .gsi-material-button-contents {
    flex-grow: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.gsi-material-button .gsi-material-button-state {
    transition: opacity 0.3s;
    bottom: 0;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.gsi-material-button:disabled {
    cursor: default;
    background-color: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
}

.gsi-material-button:disabled .gsi-material-button-contents {
    opacity: 0.38;
}

.gsi-material-button:disabled .gsi-material-button-icon {
    opacity: 0.38;
}

.gsi-material-button:not(:disabled):active .gsi-material-button-state,
.gsi-material-button:not(:disabled):focus .gsi-material-button-state {
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.gsi-material-button:not(:disabled):hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gsi-material-button:not(:disabled):hover .gsi-material-button-state {
    background-color: rgba(255, 255, 255, 0.05);
    opacity: 1;
}



.org-list {
    list-style: none;
    margin: 20px 0 0 0;
    padding: 0;
    width: 100%;
    max-width: 480px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.org-list li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.org-list li:last-child {
    border-bottom: none;
}

.org-link {
    display: block;
    padding: 16px 24px;
    color: #e4e4e7;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.org-link:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}


.btn-switch {
    color: #60a5fa;
    cursor: pointer;
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 15px;
}


.btn-switch:hover {
    color: #93c5fd;
}

.btn-logout {
    color: #f87171;
    cursor: pointer;
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
}

.btn-logout:hover {
    color: #fca5a5;
}

.btn-table {
    width: 70%;
    border-collapse: collapse;
    margin-top: 8px;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.info-table td {
    padding: 10px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
}

.info-table tr:last-child td {
    border-bottom: none;
}

.info-table td:first-child {
    color: rgba(228, 228, 231, 0.5);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    width: 200px;
    white-space: nowrap;
}

.info-table td:last-child {
    color: #e4e4e7;
}

.info-section {
    width: 100%;
    margin-bottom: 8px;
}

.info-section h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(228, 228, 231, 0.4);
    margin: 0 0 4px 0;
    padding: 0 16px;
}

.info-section h2 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(228, 228, 231, 0.4);
    margin: 0 0 4px 0;
    padding: 0 16px;
}

.info-section table {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

#modalOverlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
}
#modalBox {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 8px;
    padding: 2rem;
    width: 360px;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
    z-index: 10000;
}
#modalBox h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }
#modalBox p  { margin: 0 0 1.5rem; color: #555; }
#modalBox button { cursor: pointer; padding: 0.4rem 1.2rem; }
#modalIcon { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* ===== Page containers ===== */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.container-lg {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.container h1,
.container-lg h1 {
    font-size: 1.875rem;
    font-weight: bold;
    color: #e4e4e7;
    margin: 0 0 2rem 0;
}

.container-lg h1 {
    margin: 0;
}

/* ===== Form card (create_org, modify_org) ===== */
.form-card {
    background: rgba(30, 30, 46, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-card label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(228, 228, 231, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.form-card input[type='text'] {
    box-sizing: border-box;
}

.readonly-value {
    font-size: 0.9375rem;
    color: rgba(228, 228, 231, 0.5);
    padding: 0.5rem 0;
}

.divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    margin: 1.5rem 0;
}

.hint {
    font-size: 0.75rem;
    color: rgba(228, 228, 231, 0.4);
    margin-top: 0.35rem;
}

#errorMsg {
    display: none;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* ===== Domain list ===== */
.domain-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.domain-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.domain-row input {
    flex: 1;
    width: 0; /* override global width:100% so flex:1 controls sizing */
    min-width: 0;
    padding: 0.5rem 0.75rem;
    margin: 0;
}

.btn-remove-domain {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin: 0;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    width: 30%;
    flex-shrink: 0;
}

.btn-remove-domain:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-add-domain {
    margin: 0.5rem 0 0 0;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-domain:hover {
    background: rgba(59, 130, 246, 0.25);
}

/* ===== Checkbox groups and role selection ===== */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
}

.checkbox-item input[type='checkbox'] {
    width: 1rem;
    height: 1rem;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: #3b82f6;
    flex-shrink: 0;
}

.checkbox-item input[type='checkbox']:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.checkbox-item label {
    color: #e4e4e7;
    font-size: 0.875rem;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    margin: 0;
}

.checkbox-item.locked label {
    color: rgba(228, 228, 231, 0.5);
    cursor: not-allowed;
}

.role-locked-badge {
    margin-left: 0.5rem;
    font-size: 0.7rem;
    color: rgba(228, 228, 231, 0.4);
    font-style: italic;
}

/* ===== Form actions (cancel / submit row) ===== */
.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    align-items: stretch;
    margin-top: 2rem;
}

.form-actions .btn-cancel,
.form-actions .btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30%;
    padding: 0.625rem 1rem;
    margin: 0;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    box-sizing: border-box;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: #e4e4e7;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: none;
    box-shadow: none;
}

/* ===== Organization members page ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.container-lg input[type='text'] {
    min-width: 250px;
}

.table-container {
    background: rgba(30, 30, 46, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

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

.table-container thead {
    background: rgba(255, 255, 255, 0.03);
}

.table-container th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(228, 228, 231, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-container tbody tr {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease;
}

.table-container tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.table-container td {
    padding: 1rem 1.5rem;
}

.email {
    color: #e4e4e7;
    font-size: 0.875rem;
}

.roles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.role-badge {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.role-admin {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.role-manager {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.role-member {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.role-default {
    background: rgba(156, 163, 175, 0.2);
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.actions {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.btn-edit {
    color: #60a5fa;
    cursor: pointer;
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
}

.btn-edit:hover {
    color: #93c5fd;
}

.btn-remove {
    color: #f87171;
    cursor: pointer;
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
}

.btn-remove:hover {
    color: #fca5a5;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: rgba(228, 228, 231, 0.7);
    font-size: 0.875rem;
}

.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.pagination-buttons a {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e4e4e7;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.pagination-buttons a:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #3b82f6;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: rgba(228, 228, 231, 0.5);
}

.return-link {
    margin-top: 2rem;
    display: inline-block;
}

.return-link a {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.2s ease;
}

.return-link a:hover {
    color: #93c5fd;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    color: #e4e4e7;
}

.modal-content .checkbox-group {
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-buttons .btn-cancel,
.modal-buttons .btn-submit {
    padding: 0.625rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    width: auto;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===== Organization discovery page ===== */
.org-wrapper {
    width: 100%;
    max-width: 560px;
    margin-top: 24px;
}

.org-wrapper a {
    all: unset;
    display: block;
    padding: 14px 20px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #93c5fd;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.org-wrapper a:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: #3b82f6;
    color: #fff;
}

/* ===== Password reset dialog ===== */
dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

dialog {
    border: none;
    border-radius: 8px;
    padding: 2rem;
    min-width: 300px;
    text-align: center;
}

dialog p {
    margin: 0 0 1.5rem;
}

dialog button {
    width: 100%;
}
