html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    height: 100%;
    margin: 0;
}

a, .btn-link { color: #006bb7; }
.btn-primary { color: #fff; background-color: #1b6ec2; border-color: #1861ac; }
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f5f5f5;
}

.login-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    margin-bottom: 0.25rem;
    text-align: center;
}

.login-card p {
    color: #666;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-card .text-muted {
    font-size: 0.85rem;
    color: #999;
}

.vault-layout {
    display: flex;
    height: 100vh;
}

.vault-layout.importing .vault-sidebar,
.vault-layout.importing .vault-sidebar-footer button {
    pointer-events: none;
    opacity: 0.6;
}

.vault-sidebar {
    width: 360px;
    min-width: 360px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vault-sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.vault-sidebar-header h5 {
    margin: 0;
    margin-right: auto;
}

.vault-search {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #eee;
}

.search-row {
    display: flex;
    gap: 0.25rem;
}

.search-row input {
    flex: 1;
}

.search-row button {
    flex-shrink: 0;
}

.vault-tree {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tree-content {
    flex: 1;
    min-height: 0;
}

.tree-root-zone {
    flex-shrink: 0;
    text-align: center;
    padding: 0.75rem;
    color: #28a745;
    font-weight: 500;
    font-size: 0.85rem;
    border-top: 2px dashed #28a745;
    background: #f8fff8;
    margin: 0 0.5rem;
    border-radius: 4px;
    cursor: default;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, background 0.15s, outline 0.15s;
}

.tree-root-zone.active {
    opacity: 1;
    pointer-events: auto;
}

.tree-root-zone.active.drag-over {
    background: #f0f7ff;
    outline: 2px dashed #6ea8fe;
    outline-offset: -2px;
    border-top-color: #6ea8fe;
}

.tree-group {
    margin-bottom: 2px;
}

.tree-group-header {
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.tree-group-header .group-rename-input {
    cursor: text;
}

.tree-group-header:hover {
    background: #e9ecef;
}

.tree-group-header span:first-child {
    font-size: 0.75rem;
    width: 12px;
}

.group-name {
    cursor: pointer;
    flex: 1;
}

.group-name:hover {
    text-decoration: underline;
}

.group-rename-input {
    flex: 1;
    min-width: 0;
}

.tree-children {
    padding-left: 1.5rem;
    min-height: 4px;
}

.tree-group.drag-over {
    background: #e2f0ff;
    border-radius: 4px;
    outline: 2px dashed #6ea8fe;
    outline-offset: -2px;
}

.tree-record {
    padding: 0.4rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    min-width: 0;
}

.tree-record:hover {
    background: #e9ecef;
}

.tree-record.selected {
    background: #d0e2ff;
    font-weight: 500;
}

.tree-drag-active {
    background: #f8fff8;
    outline: 2px dashed #28a745;
    outline-offset: -2px;
    border-radius: 4px;
    transition: background 0.15s, outline 0.15s;
}

.tree-drag-active.hide-records .tree-record {
    display: none;
}

.tree-empty {
    padding: 0.5rem 1rem;
    color: #999;
    font-style: italic;
    font-size: 0.85rem;
}

.tree-empty-clickable {
    cursor: pointer;
    color: #28a745;
    font-style: normal;
    font-weight: 500;
}

.tree-empty-clickable:hover {
    text-decoration: underline;
}

.vault-sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.import-btn {
    cursor: pointer;
    margin: 0;
}

.import-status {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

.pwd-bar-bg {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    margin-top: 4px;
    overflow: hidden;
}

.pwd-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.15s ease, background 0.15s ease;
}

.pwd-label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 2px;
}

.pwd-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin-top: 3px;
}

.pwd-suggestion {
    font-size: 0.7rem;
    color: #888;
}

.vault-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-resizer {
    width: 6px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.sidebar-resizer:hover {
    background: #6ea8fe;
}

.results-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.results-card > .import-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

.vault-placeholder {
    color: #999;
    text-align: center;
    margin-top: 3rem;
    font-style: italic;
}

.record-details {
    width: 100%;
}

.record-details td {
    padding: 0.4rem 0.5rem;
    vertical-align: top;
}

.record-details td.label {
    font-weight: 600;
    width: 100px;
    color: #555;
}

.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 9999;
    animation: toast-in 0.3s ease;
}

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

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.confirm-dialog {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    padding: 1.5rem;
    min-width: 300px;
    max-width: 400px;
}

.confirm-body {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.confirm-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.not-authenticated {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
    text-align: center;
    color: #666;
}

.not-authenticated h2 {
    margin-bottom: 0.5rem;
}

.not-authenticated a {
    font-weight: 600;
}

.vault-content textarea {
    min-height: calc(1.5em * 2 + 12px);
    box-sizing: border-box;
    overflow: hidden;
}

.vault-content textarea.notes-hidden {
    color: transparent;
}

.notes-wrapper {
    position: relative;
}

.notes-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-start;
    padding: 0.375rem 0.75rem;
    color: #6c757d;
    cursor: pointer;
    border-radius: 0.375rem;
    background: #f8f9fa;
    font-size: 0.9rem;
    z-index: 1;
}

.notes-overlay:hover {
    background: #e9ecef;
}

.form-label.required::after {
    content: " *";
    color: #dc3545;
}

.toast-notification.error {
    background: #dc3545;
}

.import-log {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

.results-card > .import-log {
    max-height: none;
    border: none;
    border-radius: 0;
}

.import-entry {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}

.import-entry:hover {
    background: #e9ecef;
}

.import-entry:last-child {
    border-bottom: none;
}

.import-success {
    background: #f0fff4;
}

.import-error {
    background: #fff5f5;
}

.import-warn-char {
    border-left: 3px solid #ffc107;
}

.import-status-icon {
    font-weight: bold;
    flex-shrink: 0;
}

.import-success .import-status-icon {
    color: #28a745;
}

.import-error .import-status-icon {
    color: #dc3545;
}

.import-title {
    font-weight: 500;
}

.import-group {
    font-size: 0.8rem;
}

.import-char-warn {
    cursor: help;
    margin-left: auto;
}

.import-right {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

.import-error-msg {
    color: #dc3545;
    font-size: 0.8rem;
}

.import-date {
    font-size: 0.8rem;
    white-space: nowrap;
}

.pwd-check {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}

.pwd-check-warn {
    color: #856404;
    background: #fff3cd;
}

.pwd-check-ok {
    color: #155724;
    background: #d4edda;
}

.record-compromised {
    cursor: help;
    font-size: 0.85rem;
    color: #dc3545;
}

@media (max-width: 767px) {
    .vault-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .vault-sidebar {
        width: 100% !important;
        min-width: 0 !important;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        max-height: 50vh;
    }

    .vault-sidebar-footer {
        display: none;
    }
}

.user-info {
    padding: 0.25rem 0;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-badge {
    font-weight: 600;
}

.user-role {
    color: #6c757d;
    font-style: italic;
    text-align: center;
}

.admin-section {
    margin-bottom: 0.25rem;
}

.admin-header {
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.admin-header:hover {
    background: #e9ecef;
}

.admin-body {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.admin-user-form {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    background: #f8f9fa;
    margin-bottom: 1rem;
}

.perm-table {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
    font-size: 0.9rem;
}

.perm-table-head {
    display: grid;
    grid-template-columns: 1fr 90px 90px 100px;
    background: #e9ecef;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #de2e6;
    align-items: center;
}

.perm-table-row {
    display: grid;
    grid-template-columns: 1fr 90px 90px 100px;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}

.perm-table-row:last-child {
    border-bottom: none;
}

.perm-table-row:hover {
    background: #e9ecef;
}

.perm-col-group {
    font-weight: 500;
}

.perm-col-check {
    text-align: center;
}

.perm-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.perm-select-all-label input[type=checkbox] {
    margin-top: -2px;
}

.admin-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.admin-user-row:last-child {
    border-bottom: none;
}

.sub-user-list {
    max-height: 200px;
    overflow-y: auto;
}

.sub-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.15rem 0;
    font-size: 0.8rem;
}

.sub-user-name {
    font-weight: 500;
}
