:root {
    --primary-color: #4a69bd;
    --primary-hover: #6082d6;
    --background-light: #eef2f7;
    --foreground-light: #ffffff;
    --text-color-light: #1e293b;
    --border-color-light: #d1d9e6;
    --input-bg-light: #f8fafc;

    --background-dark: #0f172a;
    --foreground-dark: #1e293b;
    --text-color-dark: #e2e8f0;
    --border-color-dark: #334155;
    --input-bg-dark: #293649;

    --danger-color: #e53e3e;
    --danger-hover: #c53030;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-light);
    color: var(--text-color-light);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-color: var(--background-dark);
    color: var(--text-color-dark);
}

.container {
    background-color: transparent;
    width: 100%;
    max-width: 680px;
    text-align: center;
}

.card {
    background-color: var(--foreground-light);
    padding: 2rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    width: 100%;
    text-align: center;
    transition: background-color 0.3s;
    position: relative;
    margin-top: 20px;
}

body.dark-mode .card {
    background-color: var(--foreground-dark);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Agent Card Styles */
.agent-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s;
    text-align: left;
    position: relative;
}

.agent-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.agent-card.active {
    background-color: #d4f4dd;
    border-left: 4px solid #48bb78;
}

.agent-card.inactive {
    background-color: #ffd4d4;
    border-left: 4px solid #f56565;
    cursor: default;
}

.agent-card.inactive:hover {
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.dark-mode .agent-card.active {
    background-color: #1a3a27;
    border-left: 4px solid #48bb78;
}

body.dark-mode .agent-card.inactive {
    background-color: #3a1a1a;
    border-left: 4px solid #f56565;
    cursor: default;
}

body.dark-mode .agent-card.inactive:hover {
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

body.dark-mode .agent-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.agent-hostname {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: inherit;
}

.agent-status,
.agent-host-os,
.agent-remote-ip {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: inherit;
    opacity: 0.9;
    display: flex;
}

.agent-status .label,
.agent-host-os .label,
.agent-remote-ip .label {
    min-width: 75px;
    font-weight: 500;
}

.agent-status .value,
.agent-host-os .value,
.agent-remote-ip .value {
    flex: 1;
}

.agent-last-connected {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    color: inherit;
    opacity: 0.75;
    font-style: italic;
}

/* Agent Reset Button Styles */
.agent-reset-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2d7a4a;
    background-color: rgba(72, 187, 120, 0.15);
    border: 1px solid rgba(72, 187, 120, 0.4);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.agent-reset-btn:hover:not(:disabled) {
    background-color: rgba(72, 187, 120, 0.25);
    border-color: rgba(72, 187, 120, 0.6);
}

.agent-reset-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

body.dark-mode .agent-reset-btn {
    color: #68d391;
    background-color: rgba(72, 187, 120, 0.2);
    border-color: rgba(72, 187, 120, 0.5);
}

body.dark-mode .agent-reset-btn:hover:not(:disabled) {
    background-color: rgba(72, 187, 120, 0.3);
    border-color: rgba(72, 187, 120, 0.7);
}

/* Agent Three-Dot Menu Styles */
.agent-menu-container {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.agent-menu-btn {
    padding: 0.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.agent-menu-btn:hover {
    opacity: 0.7;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.agent-menu-btn:focus {
    outline: none !important;
    box-shadow: none !important;
    background: none !important;
}

.agent-menu-btn:active {
    outline: none !important;
    box-shadow: none !important;
    background: none !important;
}

.agent-menu-btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.agent-menu-btn.active {
    color: #2d7a4a;
}

.agent-menu-btn.inactive {
    color: #c53030;
}

.agent-menu-icon {
    display: block;
    transform: rotate(0deg);
}

/* Dark mode menu button */
body.dark-mode .agent-menu-btn.active {
    color: #68d391;
}

body.dark-mode .agent-menu-btn.inactive {
    color: #fc8181;
}

/* Agent Menu Dropdown */
.agent-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    background-color: var(--foreground-light);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 100;
    border-radius: 6px;
}

.agent-menu-dropdown button {
    width: 100%;
    color: var(--text-color-light);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
}

.agent-menu-dropdown button:hover {
    background-color: var(--background-light);
}

/* Dark mode dropdown */
body.dark-mode .agent-menu-dropdown {
    background-color: var(--foreground-dark);
}

body.dark-mode .agent-menu-dropdown button {
    color: var(--text-color-dark);
}

body.dark-mode .agent-menu-dropdown button:hover {
    background-color: var(--background-dark);
}

/* Show class for dropdown */
.agent-menu-dropdown.show {
    display: block;
}

/* Contingency Plan Execution Status Styles */
.agent-plan-status {
    font-size: 0.9rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: rgba(72, 187, 120, 0.1);
    border-left: 3px solid #48bb78;
    border-radius: 4px;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    line-height: 1.5;
}

.agent-plan-message {
    flex: 1;
}

body.dark-mode .agent-plan-status {
    background-color: rgba(72, 187, 120, 0.15);
}

.agent-plan-status .spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
    margin-right: 0;
    flex-shrink: 0;
}

/* Agent Detail View Styles */
.agent-card-wrapper {
    margin-bottom: 0;
}

.agent-detail-view {
    background-color: var(--foreground-light);
    border-radius: 0 0 12px 12px;
    padding: 1.5rem 2.5rem 2rem 2.5rem;
    margin-top: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.dark-mode .agent-detail-view {
    background-color: var(--foreground-dark);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.agent-detail-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.agent-targets-section,
.agent-browser-section {
    text-align: left;
}

/* Section header with action button */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.section-header h3 {
    margin: 0;
}

.agent-targets-section h3,
.agent-browser-section h3 {
    font-size: 1.1rem;
    color: inherit;
    font-weight: 600;
}

/* Clear All button */
.clear-all-btn {
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.clear-all-btn:hover {
    background-color: #f56565;
    color: #ffffff;
    border-color: #f56565;
}

.clear-all-btn:active {
    transform: scale(0.97);
}

body.dark-mode .clear-all-btn {
    color: #999;
    border-color: #555;
}

body.dark-mode .clear-all-btn:hover {
    background-color: #f56565;
    color: #ffffff;
    border-color: #f56565;
}

.agent-targets-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color-light);
    border-radius: 6px;
    padding: 0.75rem;
    background-color: var(--input-bg-light);
}

body.dark-mode .agent-targets-list {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}

.target-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color-light);
}

body.dark-mode .target-item {
    border-bottom-color: var(--border-color-dark);
}

.target-item:last-child {
    border-bottom: none;
}

.target-item-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.target-item-content .item-icon {
    margin-right: 0.5rem;
}

.target-path {
    font-family: monospace;
    font-size: 0.9rem;
    color: inherit;
}

.remove-target-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background-color: var(--danger-color);
}

.remove-target-btn:hover {
    background-color: var(--danger-hover);
}

.current-path-display {
    font-family: monospace;
    font-size: 0.95rem;
    padding: 0.6rem 0.8rem;
    background-color: var(--input-bg-light);
    border: 1px solid var(--border-color-light);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    color: inherit;
}

body.dark-mode .current-path-display {
    background-color: var(--input-bg-dark);
    border-color: var(--border-color-dark);
}

.directory-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color-light);
    border-radius: 6px;
    padding: 0.5rem;
    background-color: var(--input-bg-light);
}

body.dark-mode .directory-list {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}

.directory-item,
.file-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

/* Browse items with add button */
.browse-item {
    justify-content: space-between;
}

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

.directory-item {
    cursor: pointer;
}

.directory-item:hover {
    background-color: rgba(74, 105, 189, 0.1);
}

body.dark-mode .directory-item:hover {
    background-color: rgba(74, 105, 189, 0.2);
}

.parent-directory-item {
    font-weight: 500;
    border-bottom: 1px solid var(--border-color-light);
    margin-bottom: 0.25rem;
    padding-bottom: 0.6rem;
}

body.dark-mode .parent-directory-item {
    border-bottom-color: var(--border-color-dark);
}

.parent-directory-item:hover {
    background-color: rgba(74, 105, 189, 0.15);
}

body.dark-mode .parent-directory-item:hover {
    background-color: rgba(74, 105, 189, 0.25);
}

.file-item {
    cursor: default;
    opacity: 0.8;
}

.item-icon {
    font-size: 1.2rem;
    margin-right: 0.6rem;
    line-height: 1;
}

.item-name {
    font-family: monospace;
    font-size: 0.9rem;
    color: inherit;
}

.loading-text,
.placeholder-text {
    color: inherit;
    opacity: 0.6;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

h2 {
    color: inherit;
    margin-bottom: 1.5rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

input[type="text"],
input[type="password"],
textarea,
select {
    padding: 0.8rem;
    border: 1px solid var(--border-color-light);
    background-color: var(--input-bg-light);
    color: inherit;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s, background-color 0.3s;
    text-align: left;
}

body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode textarea,
body.dark-mode select {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}

input[type="file"] {
    padding: 0.8rem;
    border: 1px solid var(--border-color-light);
    background-color: var(--input-bg-light);
    color: inherit;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s, background-color 0.3s;
    width: 100%;
}

body.dark-mode input[type="file"] {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}

/* File Upload Styling */
.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-input-hidden {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

.file-upload-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    display: inline-block;
    text-align: center;
}

.file-upload-btn:hover {
    background-color: var(--primary-hover);
}

.file-upload-name {
    color: inherit;
    opacity: 0.7;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.2);
}

button, .button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    display: inline-block;
    text-align: center;
    margin: 0;
}

button:hover, .button:hover {
    background-color: var(--primary-hover);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button:disabled:hover {
    background-color: var(--primary-color); /* Prevent hover effect when disabled */
}

.spinner {
    width: 16px;
    height: 16px; 
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.button-danger {
    background-color: var(--danger-color);
}
.button-danger:hover {
    background-color: var(--danger-hover);
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.message-box {
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-weight: 500;
    display: none; /* Hidden by default */
    white-space: pre-wrap; /* Allow newlines to display as line breaks */
}

.message-box.error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    display: block;
}

.message-box.success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    display: block;
}

.message-box.warning {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    display: block;
}

/* Browser message box spacing */
[id^="browser-message-"] {
    margin-bottom: 1rem;
}

/* Message box with action button layout */
.message-box-with-action {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.75rem;
}

/* Error action button */
.error-action-btn {
    background-color: #ffffff;
    color: #721c24;
    border: 1.5px solid #721c24;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.error-action-btn:hover {
    background-color: #721c24;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(114, 28, 36, 0.2);
}

.error-action-btn:active {
    transform: translateY(0);
}

/* Action icon buttons (add/remove) */
.action-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.action-icon {
    font-size: 1.1rem;
    line-height: 1;
    display: block;
}

.action-icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.action-icon-btn:active {
    transform: scale(0.95);
}

body.dark-mode .action-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Specific button styles */
.add-btn:hover {
    background-color: rgba(72, 187, 120, 0.15);
}

body.dark-mode .add-btn:hover {
    background-color: rgba(72, 187, 120, 0.25);
}

.remove-btn:hover {
    background-color: rgba(245, 101, 101, 0.15);
}

body.dark-mode .remove-btn:hover {
    background-color: rgba(245, 101, 101, 0.25);
}

.data-display {
    background-color: var(--background-light);
    border: 1px solid var(--border-color-light);
    padding: 1rem;
    border-radius: 6px;
    text-align: left;
    margin-top: 1rem;
}

body.dark-mode .data-display {
    background-color: var(--input-bg-dark);
    border-color: var(--border-color-dark);
}

.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color-light);
}

body.dark-mode .data-item {
    border-bottom-color: var(--border-color-dark);
}

.data-item:last-child {
    border-bottom: none;
}

.data-item.expanded {
    background-color: rgba(0, 0, 0, 0.03);
}

body.dark-mode .data-item.expanded {
    background-color: rgba(255, 255, 255, 0.05);
}

.data-item-recommended {
    background-color: #d4f4dd;
    border-left: 4px solid #48bb78;
}

body.dark-mode .data-item-recommended {
    background-color: #1a3a27;
    border-left: 4px solid #48bb78;
}

.data-item-recommended button {
    background-color: #48bb78;
}

.data-item-recommended button:hover {
    background-color: #38a169;
}

.recommended-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: #276749;
    background-color: #c6f6d5;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    margin-left: 0.5rem;
    white-space: nowrap;
}

body.dark-mode .recommended-badge {
    color: #9ae6b4;
    background-color: #1c4532;
}

.data-key {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    margin-right: 10px;
}

.data-value {
    font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

.data-item input[type="text"] {
    flex-grow: 1;
    margin-right: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color-light);
    background-color: var(--input-bg-light);
    color: inherit;
}

#mfaSection .data-item select,
#mfaSection .data-item input[type="text"] {
    text-align: left;
    padding: 0.5rem;
    border: 1px solid var(--border-color-light);
    background-color: var(--input-bg-light);
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    margin: 0 !important;
}

body.dark-mode #mfaSection .data-item select,
body.dark-mode #mfaSection .data-item input[type="text"] {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}

/* Phone input container for unified country+phone field */
.phone-input-container {
    display: flex;
    width: 300px;
    border: 1px solid var(--border-color-light);
    border-radius: 4px;
    overflow: hidden;
    background-color: var(--input-bg-light);
}

/* Full-width phone input container for change phone page */
.phone-input-container-full {
    display: flex;
    width: 100%;
    border: 1px solid var(--border-color-light);
    border-radius: 4px;
    overflow: hidden;
    background-color: var(--input-bg-light);
}

#mfaSection .phone-input-container select {
    border: none !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    background: transparent !important;
    color: inherit;
    font-size: 1rem;
    outline: none;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    flex-shrink: 0;
    text-align: left !important;
}

#mfaSection .phone-input-container select option {
    color: var(--text-color-light);
    background-color: var(--foreground-light);
}

body.dark-mode #mfaSection .phone-input-container select option {
    color: var(--text-color-dark);
    background-color: var(--foreground-dark);
}

#mfaSection .phone-input-container input[type="text"] {
    border: none !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    background: transparent !important;
    color: inherit;
    font-size: 1rem;
    outline: none;
    flex: 1;
    text-align: left !important;
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
}

.phone-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 105, 189, 0.2);
}

body.dark-mode .phone-input-container {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}

/* Full-width phone container styling */
.phone-input-container-full select {
    border: none !important;
    margin: 0 !important;
    padding: 0.8rem !important;
    background: transparent !important;
    color: inherit;
    font-size: 1rem;
    outline: none;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    flex-shrink: 0;
    text-align: left !important;
}

.phone-input-container-full select option {
    color: var(--text-color-light);
    background-color: var(--foreground-light);
}

body.dark-mode .phone-input-container-full select option {
    color: var(--text-color-dark);
    background-color: var(--foreground-dark);
}

.phone-input-container-full input[type="text"] {
    border: none !important;
    margin: 0 !important;
    padding: 0.8rem !important;
    background: transparent !important;
    color: inherit;
    font-size: 1rem;
    outline: none;
    flex: 1;
    text-align: left !important;
    min-width: 0;
}

.phone-input-container-full:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.2);
}

body.dark-mode .phone-input-container-full {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}


.phone-validation-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

body.dark-mode .data-item input[type="text"] {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}

.data-item button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.card > button,
.collapsible-content > button {
    margin-top: 1rem;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color-light);
    margin-bottom: 0.75rem;
}

body.dark-mode .collapsible-header {
    border-bottom-color: var(--border-color-dark);
}

.collapsible-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.collapsible-icon {
    transition: transform 0.2s ease-in-out;
    font-size: 1.2rem;
}

.collapsible-icon.collapsed {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 1000px; /* Arbitrarily large value for expansion */
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    margin-bottom: 1.5rem;
    width: 100%;
    padding: 0 2.5rem;
}

.dashboard-header h2 {
    margin: 0;
}

.dashboard-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.dashboard-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.dashboard-actions button {
    width: 165px;
}

/* MFA Section */
.mfa-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color-light);
}

body.dark-mode .mfa-section {
    border-top-color: var(--border-color-dark);
}

.mfa-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color-light);
}

body.dark-mode .mfa-section {
    border-top-color: var(--border-color-dark);
}

/* The switch - the box around the slider */
.switch {
    position: relative;
    display: flex;
    align-items: center;
    width: 40px;
    height: 24px;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    -webkit-transform: translateX(16px);
    -ms-transform: translateX(16px);
    transform: translateX(16px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* User Menu */
.user-menu-container {
    position: relative;
    display: inline-block;
}

.user-icon {
    width: 40px;
    height: 40px;
    cursor: pointer;
    border-radius: 50%;
    background-color: var(--primary-color);
    position: relative;
}

.user-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background-color: var(--background-light);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z'/%3E%3C/svg%3E") no-repeat center;
}

body.dark-mode .user-icon::before {
    background-color: var(--background-dark);
}

body.dark-mode .user-icon {
    background-color: var(--primary-color);
}

.dashboard-icon {
    width: 40px;
    height: 40px;
    cursor: pointer;
    border-radius: 50%;
    background-color: var(--primary-color);
    position: relative;
}

.dashboard-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background-color: var(--background-light);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z'/%3E%3C/svg%3E") no-repeat center;
}

body.dark-mode .dashboard-icon::before {
    background-color: var(--background-dark);
}

body.dark-mode .dashboard-icon {
    background-color: var(--primary-color);
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--foreground-light);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 6px;
}

.user-dropdown a {
    color: var(--text-color-light);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.user-dropdown a:hover {
    background-color: var(--background-light);
}

body.dark-mode .user-dropdown {
    background-color: var(--foreground-dark);
}

body.dark-mode .user-dropdown a {
    color: var(--text-color-dark);
}

body.dark-mode .user-dropdown a:hover {
    background-color: var(--background-dark);
}

.show {
    display: block;
}


.page-header {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

#header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-switch-wrapper {
    position: relative;
    top: 0;
    right: 0;
}

.home-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.home-image {
    max-width: 50%;
    height: auto;
    margin-bottom: 0;
}

.home-text {
    margin-top: 0;
}

.page-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.page-actions p {
    margin: 0;
}

.resend-code, .return-to-login {
    color: var(--primary-color);
    cursor: pointer;
}

.resend-code:hover, .return-to-login:hover {
    text-decoration: underline;
}

/* MFA Section */
.mfa-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color-light);
}

body.dark-mode .mfa-section {
    border-top-color: var(--border-color-dark);
}

/* Modify button for edit actions */
.data-item .modify-btn {
    width: 28px;
    height: 22px;
    padding: 0;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    vertical-align: baseline;
    border-radius: 4px;
    min-width: auto;
    min-height: auto;
    line-height: 1;
}

/* Button container for grouped edit/delete buttons */
.data-buttons {
    display: inline-flex;
    gap: 6px;
    margin-left: 8px;
}

.data-buttons .modify-btn {
    margin-left: 0;
}

.orphan-warning {
    width: 28px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: #e6a700;
    color: #333;
    font-weight: bold;
    font-size: 14px;
    cursor: default;
}

.invisible-btn {
    visibility: hidden;
}

#pencil-icon-align {
    position: relative;
    left: 1px; /* optical alignment for pencil icon */
}

/* Profile Page Specific Styles */
.data-value input[type="text"],
.data-value select {
    margin-left: auto;
    max-width: 250px;
}

.checkbox-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-left: auto;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
}

.profile-actions {
    margin-top: 1.5rem;
}

.profile-actions button {
    width: 100%;
}

/* Custom checkbox styling */
.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    border: 2px solid var(--border-color-light);
    border-radius: 4px;
    background-color: var(--input-bg-light);
    position: relative;
    transition: all 0.2s ease-in-out;
}

.checkbox-label input[type="checkbox"]:hover {
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.2);
}

.checkbox-label input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Dark mode adjustments for checkboxes */
body.dark-mode .checkbox-label input[type="checkbox"] {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}

body.dark-mode .checkbox-label input[type="checkbox"]:hover {
    border-color: var(--primary-color);
}

body.dark-mode .checkbox-label input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-group select {
    cursor: pointer;
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.2);
}

/* --- Resend Link Cooldown Styles --- */
.resend-disabled {
    color: #999 !important;
    cursor: default !important;
    pointer-events: none;
    text-decoration: none !important;
}

body.dark-mode .resend-disabled {
    color: #666 !important;
}

/* Dark mode - Message boxes */
body.dark-mode .message-box.error {
    color: #f8d7da;
    background-color: #5a1f1f;
    border: 1px solid #7a2e2e;
}

body.dark-mode .message-box.success {
    color: #d4edda;
    background-color: #1f4a2e;
    border: 1px solid #2e5a3e;
}

body.dark-mode .message-box.warning {
    color: #fff3cd;
    background-color: #5a4a1f;
    border: 1px solid #7a6a2e;
}

/* Dark mode - Error action button */
body.dark-mode .error-action-btn {
    background-color: #3a0f0f;
    color: #f8d7da;
    border: 1.5px solid #f8d7da;
}

body.dark-mode .error-action-btn:hover {
    background-color: #f8d7da;
    color: #3a0f0f;
    box-shadow: 0 2px 4px rgba(248, 215, 218, 0.3);
}

/* Ensure normal resend links have proper cursor and color */
.resend-code {
    cursor: pointer;
}

/* --- Tab Navigation Styles --- */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color-light);
    padding-bottom: 0;
}

body.dark-mode .tab-navigation {
    border-bottom-color: var(--border-color-dark);
}

.tab-button {
    flex: 1;
    text-align: center;
    background-color: transparent;
    color: inherit;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: -2px;
    border-radius: 0;
}

.tab-button:hover {
    background-color: rgba(74, 105, 189, 0.1);
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: transparent;
}

body.dark-mode .tab-button:hover {
    background-color: rgba(74, 105, 189, 0.15);
}

/* --- Tab Panes --- */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Form Sections --- */
.form-section {
    margin-bottom: 2rem;
    text-align: left;
}

.form-section h3 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: inherit;
}

.form-section h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    margin-top: 1.25rem;
    color: inherit;
    font-weight: 600;
}

.form-subsection {
    margin-top: 1.5rem;
    padding-left: 0;
}

/* --- Radio Button Styles --- */
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    margin-right: 0.5rem;
    cursor: pointer;
    border: 2px solid var(--border-color-light);
    border-radius: 50%;
    background-color: var(--input-bg-light);
    position: relative;
    transition: all 0.2s ease-in-out;
    vertical-align: middle;
}

input[type="radio"]:hover {
    border-color: var(--primary-color);
}

input[type="radio"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.2);
}

input[type="radio"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
}

body.dark-mode input[type="radio"] {
    border-color: var(--border-color-dark);
    background-color: var(--input-bg-dark);
}

body.dark-mode input[type="radio"]:hover {
    border-color: var(--primary-color);
}

body.dark-mode input[type="radio"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* --- Contingency Note Styling --- */
.contingency-note {
    margin-top: 2rem;
    padding: 1rem;
    background-color: rgba(74, 105, 189, 0.1);
    border-radius: 6px;
    border: 1px solid var(--border-color-light);
    color: var(--text-color-light);
}

body.dark-mode .contingency-note {
    background-color: rgba(74, 105, 189, 0.2);
    border-color: var(--border-color-dark);
    color: var(--text-color-dark);
}

/* --- Vault Access Secret Rows --- */
.vault-access-item {
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.vault-access-item:hover {
    background-color: rgba(74, 105, 189, 0.07);
}
body.dark-mode .vault-access-item:hover {
    background-color: rgba(74, 105, 189, 0.12);
}

/* --- Secret Reveal Modal --- */
.secret-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.secret-modal-box {
    background-color: var(--foreground-light);
    color: var(--text-color-light);
    padding: 1.75rem 2rem;
    border-radius: 12px;
    max-width: 620px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
body.dark-mode .secret-modal-box {
    background-color: var(--foreground-dark);
    color: var(--text-color-dark);
}
.secret-modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}
.secret-modal-close {
    margin-left: auto;
}
.secret-modal-content {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: monospace;
    font-size: 0.9rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.dark-mode .secret-modal-content {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}
.styled-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(128,128,128,0.35) transparent;
}
.styled-scroll::-webkit-scrollbar {
    width: 6px;
}
.styled-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.styled-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(128,128,128,0.35);
    border-radius: 3px;
}
.styled-scroll::-webkit-scrollbar-thumb:hover {
    background-color: rgba(128,128,128,0.6);
}