* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f2f3f7;
    min-height: 100vh;
}

button,
input,
textarea {
    font: inherit;
}

.login-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

.password-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-container input[type="password"],
.password-container input[type="text"] {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.toggle-btn {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: opacity 0.3s ease;
}

.toggle-btn:hover {
    opacity: 0.7;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #28a745;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-size: 16px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast.error {
    background: #dc3545;
}

.logged-in-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f3f6ff 0%, #eef2f9 100%);
}

.app-shell {
    width: min(1100px, 100%);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(124, 143, 214, 0.15);
    border-radius: 24px;
    box-shadow: 0 18px 45px rgba(133, 142, 186, 0.12);
    padding: 30px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e7ebf3;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #6f7ca2;
    margin-bottom: 8px;
}

.app-header h1 {
    font-size: clamp(28px, 3vw, 40px);
    color: #1d2433;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eef2ff;
    border: 1px solid #dde4ff;
    color: #36425f;
    border-radius: 999px;
    padding: 10px 14px;
    max-width: 320px;
    word-break: break-word;
}

.user-avatar-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5868ff 0%, #5d9cff 100%);
    color: white;
    font-weight: 700;
    font-size: 12px;
}

.logout-btn {
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    background: linear-gradient(135deg, #ff6b7a, #d94262);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.secondary-btn {
    border: 1px solid #dfe6ff;
    border-radius: 10px;
    padding: 11px 16px;
    background: #f4f7ff;
    color: #2e3e72;
    font-weight: 600;
    cursor: pointer;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(220px, 0.8fr);
    gap: 24px;
    margin-top: 24px;
}

.panel {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ebeff9;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(112, 122, 168, 0.06);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.panel-header h2,
.side-panel h3 {
    color: #1d2433;
}

.count-badge {
    min-width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef3ff;
    color: #3f4fcb;
    font-weight: 700;
}

.note-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 110px;
    border: 1px solid #dfe5f5;
    border-radius: 12px;
    background: #f9faff;
    padding: 14px 16px;
    font-size: 14px;
    color: #252d3c;
}

.note-form textarea:focus {
    outline: none;
    border-color: #7b8cff;
    box-shadow: 0 0 0 3px rgba(123, 140, 255, 0.12);
}

.note-form-actions {
    display: flex;
    gap: 10px;
}

.save-note-btn,
.cancel-edit-btn,
.edit-note,
.delete-note {
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
}

.save-note-btn {
    background: linear-gradient(135deg, #5e6ef5 0%, #4f8dfc 100%);
    color: white;
}

.cancel-edit-btn {
    background: #edf1f8;
    color: #48546d;
}

.notes-list {
    list-style: none;
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #f9faff;
    border: 1px solid #edf1fa;
    border-radius: 12px;
    padding: 14px 16px;
}

.note-text {
    color: #2a3142;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
}

.note-actions {
    display: flex;
    gap: 8px;
}

.edit-note {
    background: #edf3ff;
    color: #3558d0;
}

.delete-note {
    background: #ffe8eb;
    color: #c63a52;
}

.empty-state {
    padding: 18px;
    border-radius: 12px;
    text-align: center;
    color: #60708f;
    background: #f9faff;
    border: 1px dashed #d9e0f2;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f6f8ff;
    border: 1px solid #edf1fb;
    border-radius: 12px;
    padding: 16px;
}

.stat-label {
    color: #6f7ca2;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-card strong {
    color: #1d2433;
    font-size: 15px;
    word-break: break-word;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
    position: relative;
    width: min(520px, calc(100% - 32px));
    background: white;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(28, 39, 68, 0.2);
    padding: 24px;
    z-index: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-header h3 {
    color: #1d2433;
    font-size: 24px;
}

.close-modal {
    border: none;
    background: transparent;
    font-size: 30px;
    line-height: 1;
    color: #64708a;
    cursor: pointer;
}

.password-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-form-group {
    margin-bottom: 8px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}

@media (max-width: 800px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .app-shell {
        padding: 20px 16px;
    }

    .user-badge {
        max-width: 100%;
    }

    .note-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .note-actions {
        width: 100%;
    }

    .edit-note,
    .delete-note {
        flex: 1;
    }
}
